← Blog

Claude MCP skill rate limiting bypass — bulk operations and batch API endpoints — SA-SKL-RATELIMIT14

Rate limiting on bulk and batch endpoints fails in a different way than on single-item endpoints: the unit of rate limiting (the request) is not the same as the unit of work (the item). SA-SKL-RATELIMIT14 covers four bypass patterns that exploit this mismatch in MCP skill registry bulk import, batch audit, and multi-item API endpoints — per-request counting that ignores array size, user-ID-only keys that collapse under free account churn, in-process counters that fragment across a horizontally scaled fleet, and HTTP/2 multiplexing that collapses concurrent streams into a single counter read.

By SkillAudit  |  13 Nov 2026
SA-SKL-RATELIMIT14 findings at a glance
HIGHRATELIMIT14-001 — Bulk skill import endpoint (POST /api/skills/bulk-import) is rate-limited per HTTP request rather than per item in the submitted array; attacker submits requests with arrays of 1000 skills; each 1000-item array counts as one request against the per-minute limit of 10 requests, allowing 10,000 skill imports per minute vs the intended 10; fix: rate-limit per item and enforce a per-request array length cap
HIGHRATELIMIT14-002 — Batch audit request endpoint rate-limits on user ID only; attacker registers 100 free accounts (email+password, no verification required) and distributes batch requests across them; each account's rate limit window resets independently; combined throughput scales linearly with account count; fix: add per-org rate limit as primary key and per-IP rate limit as secondary key independent of authentication
HIGHRATELIMIT14-003 — Rate limit counter is stored in an in-process Map (via express-rate-limit default MemoryStore); a horizontally scaled deployment of 4 registry instances has four independent in-process counters; attacker rotates requests across all four instances in round-robin, filling each counter to 25% of the limit per instance and 100% of the actual work throughput; fix: Redis-backed distributed counter with Lua script atomic increment
MEDIUMRATELIMIT14-004 — HTTP/2 multiplexing allows multiple concurrent streams over a single TCP connection; the per-IP rate limiter reads req.ip (the client IP) from the first stream's metadata and applies one counter increment per stream; however, the Node.js HTTP/2 server processes all concurrent streams from the same connection in the same event loop tick; the limiter's windowMs check is evaluated once and all streams in that tick see the same stale counter value — attacker sends 50 concurrent H2 streams and all 50 are counted as 1 against the IP limiter

Background: bulk API rate limiting semantics

Standard rate limiting operates at the HTTP request boundary: one request = one unit of work. This assumption breaks for batch and bulk endpoints, where one request encapsulates N units of work. If the rate limiter counts requests and the attacker controls request size, the effective limit is requests_per_window × max_items_per_request — which may be orders of magnitude higher than intended. The findings in SA-SKL-RATELIMIT14 represent four independent axes along which bulk endpoint rate limits can be bypassed: item granularity (RATELIMIT14-001), identity multiplicity (RATELIMIT14-002), counter distribution (RATELIMIT14-003), and transport-layer batching (RATELIMIT14-004).

These issues build on the IP-spoofing and account-churn bypasses documented in SA-SKL-RATELIMIT10 and the HTTP request smuggling patterns in SA-SKL-RATELIMIT9. Each finding here requires a different countermeasure, but all share the same underlying principle: the rate limiter's unit of measurement must match the unit of cost that the registry bears.

RATELIMIT14-001 — HIGH — Bulk import rate-limited per request, not per item

The bulk skill import endpoint accepts a JSON array of skill objects and processes each one synchronously in a loop. The rate limiter wraps the entire handler and increments its counter once per HTTP request, regardless of how many items the request contains. An attacker who sets the array size to 1000 and sends 10 requests in the rate limit window (the intended maximum) performs 10,000 skill import operations — 1000× the intended limit. The impact is not just bypassed quotas: bulk import triggers expensive downstream operations (audit queue entries, search index writes, storage allocation) for each item. At 10,000 items per minute, an attacker can consume significant registry compute and storage resources.

The correct fix requires counting each item in the array as one unit of rate limit budget. Use a custom rate limiter that increments the counter by req.body.skills.length rather than by 1. Additionally, enforce a per-request array length cap (e.g., 100 items maximum) to bound the blast radius of a single request slipping through the rate limiter. Apply both controls together.

Vulnerable
// VULNERABLE — RATELIMIT14-001
// routes/bulk-import.js
const rateLimit = require('express-rate-limit');

const bulkImportLimiter = rateLimit({
  windowMs: 60 * 1000,  // 1 minute
  max: 10,              // 10 requests per minute
  keyGenerator: (req) => req.user.id,
  // BUG: counts requests, not items — 10 requests × 1000 items = 10,000 items/min
});

router.post('/api/skills/bulk-import', requireAuth, bulkImportLimiter, async (req, res) => {
  const { skills } = req.body;
  // BUG: no array length cap — attacker can send arrays of arbitrary size
  for (const skill of skills) {
    await importSkill(skill, req.user.orgId);  // expensive: DB write + index + audit queue
  }
  res.json({ imported: skills.length });
});
Fixed
// FIXED — RATELIMIT14-001
// routes/bulk-import.js
const { createClient } = require('redis');
const redisClient = createClient({ url: process.env.REDIS_URL });

const MAX_ITEMS_PER_REQUEST = 100;
const ITEMS_PER_MINUTE_LIMIT = 100;  // actual per-user item throughput budget

async function itemRateLimit(req, res, next) {
  const items = req.body?.skills;

  // Per-request array length cap — applied before rate limit check
  if (!Array.isArray(items) || items.length === 0) {
    return res.status(400).json({ error: 'skills must be a non-empty array' });
  }
  if (items.length > MAX_ITEMS_PER_REQUEST) {
    return res.status(400).json({
      error: `Maximum ${MAX_ITEMS_PER_REQUEST} items per request`,
    });
  }

  const key = `ratelimit:bulk-import:${req.user.id}`;
  const windowSec = 60;

  // Atomic increment by item count using Lua script
  const luaScript = `
    local current = redis.call('INCRBY', KEYS[1], ARGV[1])
    if current == tonumber(ARGV[1]) then
      redis.call('EXPIRE', KEYS[1], ARGV[2])
    end
    return current
  `;
  const current = await redisClient.eval(luaScript, {
    keys: [key],
    arguments: [String(items.length), String(windowSec)],
  });

  if (current > ITEMS_PER_MINUTE_LIMIT) {
    res.setHeader('Retry-After', windowSec);
    return res.status(429).json({ error: 'Item rate limit exceeded' });
  }

  next();
}

router.post('/api/skills/bulk-import', requireAuth, itemRateLimit, async (req, res) => {
  const { skills } = req.body;
  for (const skill of skills) {
    await importSkill(skill, req.user.orgId);
  }
  res.json({ imported: skills.length });
});

RATELIMIT14-001 impact: At 10 requests × 1000 items = 10,000 items/minute, an attacker can saturate the registry's audit queue within seconds. Each item enqueues a background audit job; 10,000 jobs per minute creates approximately 167 jobs per second, which exceeds typical worker capacity and causes job queue buildup, increasing audit latency for all users. SkillAudit detects this by submitting a request with an array of 1000 items and verifying the response is 400 (array cap exceeded) or 429 (rate limit by item count), not 200.

RATELIMIT14-002 — HIGH — Batch audit rate-limited on user ID only — bypassed by account churn

The batch audit endpoint rate-limits on req.user.id, the authenticated user's database ID. Because free account registration requires only an email and password (no email verification, no phone verification), an attacker can programmatically register 100 free accounts in under a minute. Each account has an independent rate limit window keyed to its user ID. By distributing batch audit requests across all 100 accounts in round-robin, the attacker achieves 100× the per-user rate limit. With 100 accounts, a 10-audits-per-minute per-user limit becomes 1000 audits per minute — bypassing the billing controls that restrict free users to 3 audits per month.

The fix requires adding additional rate limit dimensions that are harder to control than the user ID. The primary fix is an organization-level rate limit: even with 100 free accounts, each from a different email, the attacker's requests come from the same IP address or the same email domain. Apply independent limiters keyed on (1) the organization ID (or IP if unauthenticated), and (2) the requesting IP address as a secondary control. When both a user-ID limit and an IP limit are active, an attacker must bypass both simultaneously.

Vulnerable
// VULNERABLE — RATELIMIT14-002
// routes/audits.js

const auditLimiter = rateLimit({
  windowMs: 60 * 1000,
  max: 10,
  // BUG: keyed on user ID only — 100 free accounts × 10 = 1000 audits/min
  keyGenerator: (req) => req.user.id,
  store: redisStore,
});

router.post('/api/audits/batch', requireAuth, auditLimiter, async (req, res) => {
  const { skillUrls } = req.body;
  const audits = await Promise.all(skillUrls.map(url => enqueueAudit(url, req.user)));
  res.json({ queued: audits.length });
});
Fixed
// FIXED — RATELIMIT14-002
// routes/audits.js

// Two independent limiters — attacker must bypass BOTH
const auditUserLimiter = rateLimit({
  windowMs: 60 * 1000,
  max: 10,
  keyGenerator: (req) => `user:${req.user.id}`,
  store: redisStore,
  message: 'Per-user audit rate limit exceeded',
});

const auditIpLimiter = rateLimit({
  windowMs: 60 * 1000,
  max: 50,  // generous IP limit to allow legitimate shared NAT/proxy usage
  keyGenerator: (req) => `ip:${req.ip}`,  // req.ip from trusted proxy config
  store: redisStore,
  message: 'Per-IP audit rate limit exceeded',
});

// Also per-org limit to cap organization-wide throughput regardless of seat count
const auditOrgLimiter = rateLimit({
  windowMs: 60 * 1000,
  max: 100,  // org-wide: 10 users × 10 each
  keyGenerator: (req) => `org:${req.user.orgId}`,
  store: redisStore,
  message: 'Per-org audit rate limit exceeded',
});

router.post(
  '/api/audits/batch',
  requireAuth,
  auditUserLimiter,   // per user
  auditIpLimiter,     // per IP
  auditOrgLimiter,    // per org
  async (req, res) => {
    const { skillUrls } = req.body;
    if (!Array.isArray(skillUrls) || skillUrls.length > 10) {
      return res.status(400).json({ error: 'Maximum 10 URLs per batch request' });
    }
    const audits = await Promise.all(skillUrls.map(url => enqueueAudit(url, req.user)));
    res.json({ queued: audits.length });
  }
);

RATELIMIT14-002 impact: The attack requires the ability to register free accounts without verification — a prerequisite that may itself be a finding (missing email verification). If the registry allows free signups without verification, account churn rate limiting bypass is virtually unconstrained. The combined user+IP+org limiter raises the bar: an attacker with 100 accounts must also control 100 different IP addresses (a botnet) to bypass the IP limit, which significantly increases attack cost. SkillAudit detects user-ID-only rate limiters on batch endpoints by checking whether the limiter key includes at least one non-user-controlled dimension (IP, org, or device fingerprint).

RATELIMIT14-003 — HIGH — In-process rate limit counter on horizontally scaled fleet

The registry uses express-rate-limit with its default MemoryStore, which maintains counters in an in-process JavaScript Map. This works correctly on a single-instance deployment. When the registry is horizontally scaled to multiple instances behind a load balancer, each instance maintains an independent counter for the same user. With 4 instances and round-robin load balancing, an attacker who sends 40 requests will have approximately 10 requests routed to each instance. Each instance sees a counter of 10, which is below a 30-requests-per-minute limit. The combined throughput of 40 requests exceeds the intended limit, but no single instance detects this. The attacker can sustain up to limit × instance_count actual requests while remaining below the limit on every individual instance.

The fix is to replace the MemoryStore with a distributed store backed by Redis. Use an atomic Redis Lua script to increment the counter in a single round-trip, which guarantees that all instances see a consistent counter value regardless of which instance processes the request. The rate-limit-redis package provides a drop-in Redis store for express-rate-limit that uses Lua scripts for atomic increment-and-expire operations.

Vulnerable
// VULNERABLE — RATELIMIT14-003
// app.js

const rateLimit = require('express-rate-limit');

const auditLimiter = rateLimit({
  windowMs: 60 * 1000,
  max: 30,
  // BUG: default MemoryStore — in-process, not shared across instances
  // 4 instances: attacker sends 120 requests (30 × 4 = 120 passes all counters)
  keyGenerator: (req) => req.user.id,
  // No store option = uses MemoryStore
});

app.use('/api/audits', auditLimiter);
Fixed
// FIXED — RATELIMIT14-003
// app.js

const rateLimit = require('express-rate-limit');
const { RedisStore } = require('rate-limit-redis');
const { createClient } = require('redis');

const redisClient = createClient({ url: process.env.REDIS_URL });
await redisClient.connect();

const auditLimiter = rateLimit({
  windowMs: 60 * 1000,
  max: 30,
  keyGenerator: (req) => req.user.id,
  // Redis-backed distributed store — atomic Lua script increment
  // All instances share the same counter per user key
  store: new RedisStore({
    sendCommand: (...args) => redisClient.sendCommand(args),
    prefix: 'rl:audit:',
  }),
  standardHeaders: true,  // include RateLimit-* headers in responses
  legacyHeaders: false,
});

app.use('/api/audits', auditLimiter);

RATELIMIT14-003 operational note: Redis availability becomes a dependency for rate limiting. If Redis is unreachable, the rate limiter must decide whether to fail open (allow all requests) or fail closed (block all requests). For registry audit endpoints, failing open briefly during a Redis outage is acceptable — it allows a short burst of unthrottled requests but preserves availability. Fail closed only for endpoints where unthrottled access would cause irreversible harm (e.g., account deletion, billing changes). Configure the Redis store with a short connection timeout (500ms) and a fallback to MemoryStore during outage periods to minimize impact of Redis downtime on legitimate users.

RATELIMIT14-004 — MEDIUM — HTTP/2 stream count collapse in rate limiter

HTTP/2 multiplexing allows a client to send multiple request streams concurrently over a single TCP connection. Node.js's HTTP/2 server processes incoming streams and creates individual req objects for each, but the rate limiter's window check is evaluated in the same event loop tick for all streams arriving simultaneously. The rate limiter reads the current counter value from its store, checks it against the limit, and increments it. When 50 streams arrive in the same event loop tick, all 50 read the counter before any increment is committed, all 50 see a counter of 0 (or the stale pre-request value), all 50 pass the check, and all 50 increment the counter independently — resulting in a final counter of 50 but only the first read-check-increment cycle being consistent. This is a classic TOCTOU race: the check and the increment are not atomic at the HTTP/2 stream level.

The fix is to enforce rate limiting at the load balancer or ingress layer rather than at the application layer for HTTP/2 traffic. Nginx's limit_req_zone directive operates at the connection level and handles HTTP/2 streams correctly by counting streams, not connections. Alternatively, enforce a per-connection stream count limit in the Node.js HTTP/2 server configuration (maxSessionMemory, settings.maxConcurrentStreams) to bound the number of concurrent streams per connection, limiting the blast radius of this attack.

Vulnerable
// VULNERABLE — RATELIMIT14-004
// In-process rate limiter susceptible to H2 stream count collapse

// 50 concurrent H2 streams arrive in the same event loop tick:
// All 50 call: current = counter.get(userId) → 0
// All 50 check: 0 < 30 → pass
// All 50 call: counter.set(userId, current + 1) → 1 (each overwrites, not increments)
// Final counter: 1 (not 50) — rate limit sees 1, actual work: 50 requests processed

const auditLimiter = rateLimit({
  windowMs: 60 * 1000,
  max: 30,
  keyGenerator: (req) => req.user.id,
  store: redisStore,  // even Redis store can have this race without Lua atomics
  // BUG: if Redis INCR and GET are not in the same Lua script, there's a window
});
Fixed
# FIXED — RATELIMIT14-004
# Nginx rate limiting at ingress — handles HTTP/2 streams correctly at kernel level

# nginx.conf
http {
  # Rate limit zone keyed on binary client IP — handled before proxying to Node
  limit_req_zone $binary_remote_addr zone=audit_per_ip:10m rate=10r/s;
  limit_req_zone $http_x_user_id zone=audit_per_user:10m rate=1r/s;

  server {
    listen 443 ssl http2;

    location /api/audits {
      # Apply at Nginx level — HTTP/2 streams counted correctly at the proxy layer
      limit_req zone=audit_per_ip burst=20 nodelay;
      limit_req zone=audit_per_user burst=5 nodelay;

      proxy_pass http://registry_backend;
    }
  }
}
// In Node.js HTTP/2 server: limit concurrent streams per connection
// This bounds the blast radius even if rate limiting has a gap

const http2 = require('http2');
const server = http2.createSecureServer({
  key: fs.readFileSync('/etc/ssl/server.key'),
  cert: fs.readFileSync('/etc/ssl/server.crt'),
  settings: {
    maxConcurrentStreams: 10,  // limit: 10 concurrent streams per H2 connection
  },
});

RATELIMIT14-004 severity context: This is a medium finding because exploiting the HTTP/2 TOCTOU race requires a Redis store without Lua atomic scripts. The rate-limit-redis store (from RATELIMIT14-003 fix) uses Lua scripts that make the increment-and-check atomic at the Redis server level, which also closes the RATELIMIT14-004 window. The Nginx-level fix is defense-in-depth: even if the application-level rate limiter has a race, the proxy-level limit prevents more than burst requests in the burst window. SkillAudit flags application-level rate limiters on HTTP/2-capable endpoints that do not use atomic Lua scripts at the store level.

Detection with SkillAudit

SkillAudit's rate limit audit module tests all four SA-SKL-RATELIMIT14 patterns. For RATELIMIT14-001, it submits bulk requests with array sizes of 1, 10, and 1000 and verifies the rate limiter decrements the budget proportionally to array size. For RATELIMIT14-002, it submits requests from multiple independent test user IDs and measures whether the combined throughput is bounded. For RATELIMIT14-003, it checks whether the rate limit store configuration uses an in-process MemoryStore and flags it on any deployment with more than one instance. For RATELIMIT14-004, it sends 20 concurrent HTTP/2 streams and verifies the per-IP or per-user counter reflects all 20 streams rather than 1.

FindingSeverityBypass techniqueFix
RATELIMIT14-001HIGHLarge array in bulk request — 1 request = N items of workRate limit per item; cap array length per request
RATELIMIT14-002HIGH100 free accounts — independent user-ID countersAdd per-IP and per-org limiters independent of user ID
RATELIMIT14-003HIGHRotate across instances — in-process counters don't share stateRedis-backed store with Lua atomic increment
RATELIMIT14-004MEDIUM50 concurrent H2 streams read stale counter before any increment commitsNginx limit_req at ingress; maxConcurrentStreams in H2 server config

Related findings: SA-SKL-RATELIMIT10 (IP spoofing and account churn), SA-SKL-RATELIMIT9 (GraphQL alias batching), SA-SKL-AUTH16 (API key authentication bypass).