← Blog

Claude MCP skill privilege escalation — audit result access and report sharing — SA-SKL-PRIVESC8

Audit report access control and sharing features determine who can read proprietary skill vulnerability findings. When access tokens are brute-forceable, access checks are too coarse, bulk export endpoints skip per-resource authorization, or report UI renders user-controlled markdown as live links, an attacker can read private reports they did not run and deliver phishing content through the trusted report domain. SA-SKL-PRIVESC8 covers four privilege escalation patterns in the audit result access and report sharing features of a typical MCP skill registry.

By SkillAudit  |  13 Nov 2026
SA-SKL-PRIVESC8 findings at a glance
HIGHPRIVESC8-001 — Shareable report links are signed with HMAC-MD5 over reportId + ":" + Math.floor(Date.now()/1000); attacker who knows a valid report ID enumerates a ±3600-second window (~7200 tokens) to brute-force a valid share token; at 10 billion MD5 hashes/second the entire space completes in microseconds
CRITICALPRIVESC8-002 — Report access check verifies only report.orgId === req.user.orgId; any org member reads all reports belonging to any other member of the same organization; in multi-client orgs (e.g., consultancies billing multiple clients to one org), this exposes one client's proprietary skill source code findings to another
CRITICALPRIVESC8-003 — Bulk report export POST /api/reports/export accepts {"reportIds":["id1","id2",...]} and returns a ZIP without filtering on userId = req.user.id or orgId = req.user.orgId; attacker submits hundreds of IDs from the public audit feed and receives full content of private reports they do not own
MEDIUMPRIVESC8-004 — Report comment links and skill name fields rendered with Markdown are missing rel="noopener noreferrer" and target="_blank"; skill name [Claim free Pro upgrade](https://phishing.skillaudit.dev/upgrade) renders as a phishing link in shared reports on the trusted skillaudit.dev domain

Background: access control in audit report sharing

Audit reports contain proprietary information: vulnerability findings in skill source code, suggested fixes that reveal implementation details, and security scores that may affect procurement decisions. MCP skill registries typically implement report sharing via three mechanisms: shareable links (for sharing with external stakeholders who are not registry users), organization-level access (for sharing within a team), and bulk export (for compliance and archival). Each mechanism introduces a distinct access control surface. SA-SKL-PRIVESC8 builds on the access control patterns identified in SA-SKL-AUTH16 (authentication bypass in audit history) and extends them to the specific features of report sharing and export.

PRIVESC8-001 is a token strength issue. PRIVESC8-002 and PRIVESC8-003 are authorization logic bugs — missing clauses in the SQL query that enforces ownership. PRIVESC8-004 is a UI injection issue that exploits the trust context of a shared report page. Each requires a different fix layer: cryptographic randomness for tokens, query-level ownership enforcement for access checks, and input sanitization plus CSP headers for the UI.

PRIVESC8-001 — HIGH — Shareable report token is HMAC-MD5 over timestamp — brute-forceable

When a user generates a shareable link for an audit report, the server creates a token by computing hmac_md5(reportId + ":" + Math.floor(Date.now()/1000), process.env.SHARE_SECRET). The token is a 32-character hex-encoded MD5 output (128 bits). The server stores the token in the database alongside the report ID and timestamp, and verifies incoming share tokens by recomputing the HMAC over the stored timestamp. Because the timestamp is stored and the report ID is obtainable from the public audit feed, an attacker who wants to access a known report ID can enumerate all timestamps in a plausible generation window (e.g., the past 7 days = 604,800 seconds) and compute the HMAC for each one. With MD5 running at 10 billion operations per second on commodity hardware, 604,800 candidates complete in under 1 millisecond. Even a narrow ±3600-second window around a guessed creation time completes in microseconds. The attacker does not need to know SHARE_SECRET — they only need to find a timestamp t such that hmac_md5(reportId + ":" + t, secret) === storedToken. Because the token encodes the timestamp, the attacker can derive the secret offline from a single known token.

The fix is to generate share tokens using cryptographically random bytes independent of any report attribute: crypto.randomBytes(32).toString('hex'). Store only the token, its expiry time, and the report ID it grants access to. Never derive any information from report ID or timestamp in the token. Invalidate the token on report deletion and when the owner explicitly revokes it.

Vulnerable
// VULNERABLE — PRIVESC8-001
// routes/reports.js

const crypto = require('crypto');

function generateShareToken(reportId) {
  const timestamp = Math.floor(Date.now() / 1000);
  // BUG: token derived from reportId + timestamp — both are known or guessable
  // MD5 is fast to compute offline — attacker brute-forces timestamp window
  const token = crypto
    .createHmac('md5', process.env.SHARE_SECRET)
    .update(`${reportId}:${timestamp}`)
    .digest('hex');
  return { token, timestamp };
}

router.post('/api/reports/:id/share', requireAuth, async (req, res) => {
  const report = await db.reports.findOne({ id: req.params.id, userId: req.user.id });
  if (!report) return res.status(404).json({ error: 'Not found' });

  const { token, timestamp } = generateShareToken(report.id);
  await db.shareTokens.create({ reportId: report.id, token, timestamp });
  res.json({ shareUrl: `https://skillaudit.dev/reports/shared/${token}` });
});

// Token verification — vulnerable to offline brute-force
router.get('/reports/shared/:token', async (req, res) => {
  const record = await db.shareTokens.findOne({ token: req.params.token });
  if (!record) return res.status(403).send('Invalid or expired link');

  const report = await db.reports.findOne({ id: record.reportId });
  res.json(report);
});
Fixed
// FIXED — PRIVESC8-001
// routes/reports.js

const crypto = require('crypto');

const SHARE_TOKEN_EXPIRY_DAYS = 30;

async function generateShareToken(reportId) {
  // FIXED: cryptographically random token — no information derived from report attributes
  const token = crypto.randomBytes(32).toString('hex');  // 256 bits of entropy

  const expiresAt = new Date(Date.now() + SHARE_TOKEN_EXPIRY_DAYS * 24 * 60 * 60 * 1000);

  await db.shareTokens.create({
    reportId,
    token,       // stored as SHA-256 hash to prevent timing attacks on DB read
    tokenHash: crypto.createHash('sha256').update(token).digest('hex'),
    expiresAt,
    createdAt: new Date(),
  });

  return token;  // return raw token only once — never stored in plaintext
}

router.post('/api/reports/:id/share', requireAuth, async (req, res) => {
  const report = await db.reports.findOne({ id: req.params.id, userId: req.user.id });
  if (!report) return res.status(404).json({ error: 'Not found' });

  const token = await generateShareToken(report.id);
  res.json({ shareUrl: `https://skillaudit.dev/reports/shared/${token}` });
});

// Constant-time token comparison prevents timing oracle
router.get('/reports/shared/:token', async (req, res) => {
  const tokenHash = crypto
    .createHash('sha256')
    .update(req.params.token)
    .digest('hex');

  const record = await db.shareTokens.findOne({
    tokenHash,
    expiresAt: { gt: new Date() },
  });

  if (!record) return res.status(403).send('Invalid or expired link');

  const report = await db.reports.findOne({ id: record.reportId });
  res.json(report);
});

PRIVESC8-001 impact: An attacker who can observe a single valid share token (e.g., from a leaked URL or HTTP referrer header) can recover the HMAC-MD5 key offline via a birthday or meet-in-the-middle attack against the small timestamp space. With the key, they can forge valid tokens for any known report ID. SkillAudit detects PRIVESC8-001 by auditing token generation code for HMAC constructions where any input operand is derived from a database field (report ID, user ID, creation timestamp) rather than a pure random source.

PRIVESC8-002 — CRITICAL — Report access check on orgId only exposes all org reports to any member

The report access control middleware checks whether the requesting user belongs to the same organization as the report owner: report.orgId === req.user.orgId. This check is correct for the common case where an organization represents a single team and all members should have read access to all team reports. However, some organizations in the registry are billing aggregates — a consulting firm may have multiple clients all assigned to the same organization for invoice consolidation. When one client's security engineer runs an audit of their proprietary skill, the report contains detailed vulnerability findings including source code snippets and stack traces. Any other member of the same organization — including engineers from a different client — can read this report. The attacker (a free-tier user added to the same billing org) calls GET /api/reports/:id with any report ID belonging to any other org member and receives the full report content.

The fix is to add an explicit userId or sharedWithOrg condition to the access check query. Introduce a visibility enum (private, org, public) on the report model and enforce it at query time. Default new reports to private. Allow org-sharing only when the report owner explicitly sets visibility = 'org'.

Vulnerable
// VULNERABLE — PRIVESC8-002
// middleware/report-access.js

async function requireReportAccess(req, res, next) {
  const report = await db.reports.findOne({ id: req.params.id });
  if (!report) return res.status(404).json({ error: 'Not found' });

  // BUG: orgId-only check — any org member reads any other member's private report
  // attacker is a free-tier user in the same billing org as the victim
  if (report.orgId !== req.user.orgId) {
    return res.status(403).json({ error: 'Access denied' });
  }

  req.report = report;
  next();
}

// routes/reports.js
router.get('/api/reports/:id', requireAuth, requireReportAccess, async (req, res) => {
  res.json(req.report);  // returns full report to any org member
});
Fixed
// FIXED — PRIVESC8-002
// middleware/report-access.js

// Report visibility enum
const VISIBILITY = {
  PRIVATE: 'private',   // only report owner
  ORG: 'org',          // all org members
  PUBLIC: 'public',    // anyone with the URL
};

async function requireReportAccess(req, res, next) {
  const report = await db.reports.findOne({ id: req.params.id });
  if (!report) return res.status(404).json({ error: 'Not found' });

  const { userId, orgId } = req.user;

  // Three-tier visibility check
  const isOwner = report.userId === userId;
  const isOrgMember = report.orgId === orgId && report.visibility === VISIBILITY.ORG;
  const isPublic = report.visibility === VISIBILITY.PUBLIC;
  const hasShareToken = req.shareTokenReportId === report.id;  // set by share token middleware

  if (!isOwner && !isOrgMember && !isPublic && !hasShareToken) {
    return res.status(403).json({ error: 'Access denied' });
  }

  req.report = report;
  next();
}

// New reports default to private
router.post('/api/reports', requireAuth, async (req, res) => {
  const report = await db.reports.create({
    data: {
      userId: req.user.userId,
      orgId: req.user.orgId,
      visibility: VISIBILITY.PRIVATE,  // default — explicit opt-in to share
      ...reportData,
    },
  });
  res.status(201).json({ id: report.id });
});

PRIVESC8-002 impact: In a consulting firm scenario where multiple clients are assigned to the same billing organization, PRIVESC8-002 constitutes a data breach — one client's proprietary skill vulnerability report is readable by a competitor's engineer in the same org. The report content may include skill source code, internal API URLs, and authentication secrets that were found as vulnerabilities. SkillAudit detects this by identifying report access middleware that queries by orgId without also constraining on userId or an explicit visibility field.

PRIVESC8-003 — CRITICAL — Bulk export endpoint missing userId filter returns private reports

The bulk report export endpoint POST /api/reports/export accepts a JSON body { "reportIds": ["id1", "id2", ...] } and returns a ZIP archive containing all matching reports. The database query fetches reports by ID in a single WHERE reportId IN (?) clause without also requiring userId = req.user.id or orgId = req.user.orgId. The public audit feed endpoint GET /api/audits/public returns the most recent N publicly submitted audits with their report IDs and skill names visible. An attacker calls the public feed endpoint repeatedly to build a list of report IDs (sequential integers make this easier, but the public feed provides UUIDs directly). The attacker then submits a bulk export request with these IDs and receives a ZIP containing the full content of private reports — detailed vulnerability findings, source code snippets, and security grades — for skills they did not audit. With a batch limit of 500 (or no limit), a single request can exfiltrate hundreds of private reports.

The fix is to add a mandatory AND (userId = ? OR (sharedWithOrg = true AND orgId = ?)) clause to the bulk export query. Limit bulk exports to 50 reports per request. Log every bulk export request with the requesting user ID, timestamp, and the full list of report IDs for audit trail. Return an error (not an empty result) if any requested report ID does not belong to the requesting user and is not shared with their org.

Vulnerable
// VULNERABLE — PRIVESC8-003
// routes/reports.js

router.post('/api/reports/export', requireAuth, async (req, res) => {
  const { reportIds } = req.body;

  // BUG: no userId or orgId filter — any report ID returns that report's content
  // attacker submits IDs from public audit feed to get private reports
  const reports = await db.reports.findMany({
    where: {
      id: { in: reportIds },  // missing: AND userId = req.user.id
    },
  });

  const zip = await buildZipArchive(reports);
  res.set('Content-Type', 'application/zip');
  res.set('Content-Disposition', 'attachment; filename="reports-export.zip"');
  res.send(zip);
});
Fixed
// FIXED — PRIVESC8-003
// routes/reports.js

const BULK_EXPORT_LIMIT = 50;

router.post('/api/reports/export', requireAuth, async (req, res) => {
  const { reportIds } = req.body;

  // Input validation
  if (!Array.isArray(reportIds) || reportIds.length === 0) {
    return res.status(400).json({ error: 'reportIds must be a non-empty array' });
  }
  if (reportIds.length > BULK_EXPORT_LIMIT) {
    return res.status(400).json({ error: `Bulk export limited to ${BULK_EXPORT_LIMIT} reports` });
  }

  const { userId, orgId } = req.user;

  // FIXED: ownership filter in query — only return reports the user owns or org-shared reports
  const reports = await db.reports.findMany({
    where: {
      id: { in: reportIds },
      OR: [
        { userId },                                       // owner
        { orgId, sharedWithOrg: true },                  // org-shared
        { visibility: 'public' },                        // public
      ],
    },
  });

  // Check that all requested IDs were returned — reject if any are missing (access denied)
  const returnedIds = new Set(reports.map(r => r.id));
  const deniedIds = reportIds.filter(id => !returnedIds.has(id));
  if (deniedIds.length > 0) {
    // Audit log — potential enumeration attempt
    logger.warn({ userId, deniedIds }, 'bulk export access denied for some report IDs');
    return res.status(403).json({ error: 'Access denied for one or more report IDs' });
  }

  // Audit log every bulk export
  logger.info({ userId, reportIds, count: reports.length }, 'bulk export executed');

  const zip = await buildZipArchive(reports);
  res.set('Content-Type', 'application/zip');
  res.set('Content-Disposition', 'attachment; filename="reports-export.zip"');
  res.send(zip);
});

PRIVESC8-003 impact: A single bulk export request with 50 IDs from the public audit feed returns 50 private audit reports. Without a batch limit, a single request can drain the entire reports table. The public audit feed continuously updates, giving the attacker a fresh supply of report IDs. Combined with PRIVESC8-001 (brute-forceable share tokens), an attacker can first enumerate report IDs from the public feed, then forge share tokens for the private reports they want. SkillAudit detects PRIVESC8-003 by identifying bulk query endpoints where the WHERE IN clause on a resource ID is not accompanied by an ownership filter on userId or orgId.

PRIVESC8-004 — MEDIUM — Markdown links in report comments missing rel attributes enable tabnapping and phishing

Report comment threads allow Markdown with link syntax [text](url). The Markdown renderer produces <a href="url">text</a> without rel="noopener noreferrer" or target="_blank". When a report page is opened from a shareable link (using the token from PRIVESC8-001), the link opens in a new tab that retains a window.opener reference to the sharing tab. Any link in a report comment that opens the shared report causes a minor tabnapping risk. More critically, the same markdown renderer is used to render skill name fields in the report summary. Skill names are not validated to be plain text, so an attacker who names their skill [Claim your free Pro upgrade](https://phishing.skillaudit.dev/upgrade) creates a phishing link in every audit report and shared link that references that skill. The link appears on the trusted skillaudit.dev domain in the report UI. Any recipient of a shared report that includes this skill's section is exposed to the phishing link.

The fix has three parts: (1) strip all markdown link syntax from skill name fields — names should be plain text only, validated against /^[a-zA-Z0-9_\-\. ]{1,100}$/; (2) add rel="noopener noreferrer" and target="_blank" to all rendered report links; (3) add Content-Security-Policy: frame-ancestors 'none' to report pages to prevent clickjacking in iframe contexts.

Vulnerable
// VULNERABLE — PRIVESC8-004
// services/report-renderer.js

const marked = require('marked');

function renderReportSection(report) {
  // BUG: skill name field processed through markdown renderer — allows link injection
  // attacker skill name: "[Claim free Pro upgrade](https://phishing.skillaudit.dev/upgrade)"
  const skillNameHtml = marked.parseInline(report.skill.name);

  // BUG: comment markdown rendered without rel="noopener noreferrer"
  const commentsHtml = report.comments.map(comment => {
    const contentHtml = marked.parse(comment.content);
    // rendered links: <a href="...">text</a> — no rel, no target
    return `<div class="comment">${contentHtml}</div>`;
  }).join('');

  return `
    <div class="report-skill-name">${skillNameHtml}</div>
    <div class="report-comments">${commentsHtml}</div>
  `;
}
Fixed
// FIXED — PRIVESC8-004
// services/report-renderer.js

const marked = require('marked');
const DOMPurify = require('dompurify');
const { JSDOM } = require('jsdom');
const purify = DOMPurify(new JSDOM('').window);

// Custom marked renderer — adds rel and target to all links
const renderer = new marked.Renderer();
renderer.link = (href, title, text) => {
  // Reject non-https links entirely
  try {
    const u = new URL(href);
    if (u.protocol !== 'https:') return escapeHtml(text);
  } catch {
    return escapeHtml(text);
  }
  const titleAttr = title ? ` title="${escapeHtml(title)}"` : '';
  // FIXED: rel="noopener noreferrer" + target="_blank" on all report links
  return `<a href="${escapeHtml(href)}"${titleAttr} rel="noopener noreferrer" target="_blank">${text}</a>`;
};

marked.use({ renderer });

// Skill names are plain text — never rendered as markdown
const SKILL_NAME_RE = /^[a-zA-Z0-9_\-\. ]{1,100}$/;

function renderReportSection(report) {
  const skillName = report.skill.name;

  // Validate skill name is plain text — reject markdown link syntax
  if (!SKILL_NAME_RE.test(skillName)) {
    throw new Error('Invalid skill name in report');
  }

  // Render as escaped plain text — never as markdown
  const skillNameHtml = escapeHtml(skillName);

  const commentsHtml = report.comments.map(comment => {
    const rawHtml = marked.parse(comment.content);
    // Post-process with DOMPurify — defense-in-depth against renderer bypass
    const safeHtml = purify.sanitize(rawHtml, {
      ALLOWED_TAGS: ['p', 'a', 'b', 'i', 'em', 'strong', 'code', 'pre', 'ul', 'ol', 'li'],
      ALLOWED_ATTR: ['href', 'rel', 'target', 'title'],
      FORCE_BODY: true,
    });
    return `<div class="comment">${safeHtml}</div>`;
  }).join('');

  return `
    <div class="report-skill-name">${skillNameHtml}</div>
    <div class="report-comments">${commentsHtml}</div>
  `;
}

// routes/reports.js — CSP header on all report pages (defense-in-depth)
router.use('/reports', (req, res, next) => {
  res.set('Content-Security-Policy', [
    "default-src 'self'",
    "script-src 'self'",
    "frame-ancestors 'none'",    // prevents clickjacking in iframes
  ].join('; '));
  next();
});

PRIVESC8-004 impact: A phishing link on the trusted skillaudit.dev domain is significantly more credible than a link on an unknown domain. Recipients of shared audit reports from consultants, security reviewers, and CI systems will see the link in a professional context and are more likely to click it. The window.opener tabnapping risk is lower severity but can be combined with PRIVESC8-001's shareable link mechanism to manipulate the original share page when the report is opened from an email link. SkillAudit detects PRIVESC8-004 by scanning the report renderer for markdown link processing of skill name fields and for <a> tag generation that omits rel="noopener noreferrer".

Detection with SkillAudit

SkillAudit's SA-SKL-PRIVESC8 scanner covers all four privilege escalation patterns. For PRIVESC8-001, the scanner identifies HMAC token generation where any input to the HMAC function is derived from a database field (report ID, timestamp) rather than a pure random source, and flags MD5 as a fast hash unsuitable for secret tokens. For PRIVESC8-002, the scanner traces report access middleware and identifies WHERE orgId = ? queries without an accompanying AND (userId = ? OR visibility = ?) condition. For PRIVESC8-003, the scanner detects bulk query endpoints where WHERE id IN (?) is not accompanied by an ownership filter. For PRIVESC8-004, the scanner checks markdown rendering pipelines for link output that omits rel="noopener noreferrer" and flags skill name fields processed through a markdown renderer.

FindingSeverityVulnerabilityFix
PRIVESC8-001HIGHHMAC-MD5 share token brute-forceable via timestampcrypto.randomBytes(32) token; no info from report attributes
PRIVESC8-002CRITICALOrgId-only access check exposes all reports to org membersvisibility enum; userId filter; explicit org-sharing opt-in
PRIVESC8-003CRITICALBulk export missing userId filter — IDOR on report ZIPAND userId/orgId filter; 50-report limit; audit log
PRIVESC8-004MEDIUMMarkdown links missing rel — tabnapping + phishing in reportsrel="noopener noreferrer"; plain-text skill names; CSP frame-ancestors

Related findings: SA-SKL-INJECTION14 (template injection in report generation), SA-SKL-AUTH16 (auth bypass in audit history), SA-SKL-SSRF26 (SSRF in badge and preview rendering).

Run SkillAudit against your MCP skill registry to detect all SA-SKL-PRIVESC8 privilege escalation patterns before they expose private audit reports to unauthorized users. SkillAudit performs authorization logic analysis, token strength testing, and UI injection scanning across your report sharing and export features. Get started free