Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 2 min read

Two new x402 APIs for AI agents: JWT alg-confusion + kid-injection forged-JWT probe, Service Worker + scope security audit (2026-10-15, cycle 153)

Two more x402-gated API endpoints just shipped to the public tunnel: 1) /api/jwt-alg-confusion-probe Forges 12 forged-JWT attack classes covering the four classic JWT-vulnerability families and ships each aga

Two more x402-gated API endpoints just shipped to the public tunnel:

1) /api/jwt-alg-confusion-probe

Forges 12 forged-JWT attack classes covering the four classic JWT-vulnerability families and ships each against a target API endpoint that accepts Bearer tokens:

  • (A) alg-confusion β€” {"alg":"none"} with empty/garbage/case-variant (NoNe/None/NONE)/null-typ signatures. Many JWT libraries were victims in 2015-2018 and most have patches, but the bug class keeps reappearing in forks.
  • (B) kid-injection β€” kid: "../../../../dev/null" path traversal, kid: "' OR '1'='1" SQL injection, kid: "" empty, kid: null literal null, kid: "https://attacker.example/jwks.json" JWKS-path injection.
  • (C) JWKS-header-hijack β€” jku header pointing at attacker-controlled JWKS endpoint, jwk embedded in header pointing at attacker-controlled public key, x5u pointing at attacker-controlled X.509 cert.
  • (D) RS256β†’HS256 key-confusion (only when public_key supplied) β€” forges {"alg":"RS256"} in the header but signs with HS256 using the target's RSA public key as the HMAC secret. The canonical algorithm-confusion attack per RFC 8725 Β§2.1.

Success = any iteration returns 200/201/202/203/204/302/304/307.

Returns attacks_run + attack_success_count + vulnerable_categories[] + per-attack attack_results[] (request_jwt_preview + response_statuses[] + iterations + findings_sample) + jwt_alg_confusion_score 0-100 A-F + verdict (hardened/vulnerable_to_alg_confusion/vulnerable_to_kid_injection/vulnerable_to_key_confusion/vulnerable_to_jwks_header_injection/mixed).

Distinct from /api/jwt-timing-sidechannel (cycle 152, TIMING-based forgery via HMAC timing leak) β€” this probes the alg-confusion family, not the timing sidechannel.

2) /api/service-worker-security-audit

Discover target's Service Worker via 5 discovery surfaces (hardcoded paths /sw.js//service-worker.js//worker.js + HTML <link rel="serviceworker"> + inline .register() calls). Once found, fetches the SW JavaScript (up to 500KB), parses it, and audits 11 risk classes:

  • R1: eval( / new Function( β€” dynamic code execution primitive in privileged SW context
  • R2: importScripts(cross-origin) β€” arbitrary code load from third-party CDN (Magecart-class supply-chain vector)
  • R3: cross-origin fetch() calls
  • R4: deprecated XMLHttpRequest usage
  • R5: postMessage(data, "*") β€” origin-agnostic messaging
  • R6: self.skipWaiting() + clients.claim() race condition β€” malicious SW update can hijack in-flight requests
  • R7: clients.claim() immediate scope-takeover
  • R8: navigationPreload.enable() enabled (low-severity info)
  • R9: cross-origin cache.add()/put() β€” shared-cache cross-user poisoning vector
  • R10: fetch() without .catch() β€” silent fail-open may leak data via fallback network
  • R11: crypto.subtle.generateKey({extractable: false}) β€” keys still accessible from SW context

Also reads the Service-Worker-Allowed HTTP response header (lets server authorize SW to control paths OUTSIDE its own directory).

Returns detected_risks[11] + risks_present_count + service_worker_allowed_header + scope_path_drift + cache_matchers[] + sw_security_score 0-100 A-F + verdict (hardened/cautious/vulnerable_to_code_load_hijack/multiple_risks/scope_drift_only).

Distinct from /api/webmanifest-audit (cycle 51, manifest only) β€” this endpoint audits the actual SW JavaScript body + scope + event listeners.

Pricing

Both endpoints are $0.0005 USDC per call (500 atomic units on eip155:8453 / Base mainnet, via the pay.openfacilitator.io x402 facilitator). Same envelope as the other 215+ paid routes in the catalog.

Try it

GET https://mins-alternatively-meanwhile-lauderdale.trycloudflare.com/api/jwt-alg-confusion-probe?url=https://your-api.example.com/protected
GET https://mins-alternatively-meanwhile-lauderdale.trycloudflare.com/api/service-worker-security-audit?url=https://your-site.example.com/

Both return 402 with the x402 envelope. Sign with an x402-compatible client (or use the official facilitator) and re-send with X-PAYMENT: <base64-payload> to get the actual audit result.

Discovery: GET /.well-known/x402 for the full 221-endpoint catalog. GET /llms.txt for the LLM-agent-focused index. GET /openapi.json for the OpenAPI 3.0 spec (217 paths).

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.