Skip to content

Case study · Web3

On-Chain Multi-Asset Markets and Perpetuals Trading Platform

Across 74 sessions, the trading API reflected arbitrary origins across every endpoint and exposed its full OpenAPI 3.1.0 schema, while a verification audit downgraded an unproven high-severity claim before reporting.

Findings · 5
1 Medium2 Low2 Other
FindingVulnerabilitySeverity
3.1Arbitrary CORS origin reflection on the trading API backendCWE-942Sending GET /v1/account with Origin: https://untrusted.example returns Access-Control-Allow-Origin: https://untrusted.example without allowlist validation (CWE-942).Medium
3.2Unauthenticated OpenAPI 3.1.0 specification and interactive docs exposing admin routesCWE-200GET /docs/json returns HTTP 200 with a 50,933-byte OpenAPI 3.1.0 document without authentication, and GET /docs/ renders an interactive API reference UI (CWE-200).Low
3.3Hardcoded local development origin in production Content-Security-PolicyCWE-693GET https://markets.example/ returns a Content-Security-Policy header allowlisting http://localhost:<dev-port> in frame-ancestors and form-action (CWE-693).Low
Standby origin server exposure (standby-origin.markets.example)Returns 502 Bad Gateway with an expired TLS certificate and an older reverse-proxy version flagged for HTTP/2 Rapid Reset (CVE-2023-44487) and a known TLS virtual-host vulnerabilityInfo
Static OAuth redirectors (oauth.markets.example, oauth-origin.markets.example)Thin ~500 B HTML + ~1 KB JS static edge hosts running implicit-flow (id_token) redirects to a custom app scheme (app-scheme://); ACAO: * and client-side-only allowlist checks; 156 paths tested, 0 open redirects confirmedInfo

Executive summary

What we were asked to do

A non-custodial, 24/7 on-chain trading platform offering leveraged perpetual futures across tokenized equities, indices, currencies, commodities, and digital assets commissioned an external black-box assessment of its public web and API estate. Users authenticate via Web3 wallet signatures (EIP-712) to mint bearer API keys or through an embedded wallet-infrastructure proxy and static OAuth redirectors, while all trade settlement executes on a Layer-1 perpetuals blockchain.

The engagement spanned two workstreams and 74 agent sessions across 14 nested host-depth jobs. Its most notable output is a clean map of three verified configuration weaknesses — paired with a disciplined verification audit that caught and downgraded an unproven High finding before it could reach the client as confirmed fact.

Principal findings

The trading API backend reflected arbitrary `Origin` headers (including `null`) in `Access-Control-Allow-Origin` across every tested endpoint — including account, sign-up challenge, documentation, and administrative paths — while publicly exposing its complete 50 KB OpenAPI 3.1.0 specification and interactive API UI without authentication, disclosing all 34 endpoints including seven /admin/v1/* routes sharing the same bearer-authentication scheme. On the primary production frontend, the Content-Security-Policy allowlisted a hardcoded local development origin (`http://localhost:<dev-port>`) in both `frame-ancestors` and `form-action`. Equally important: a claimed high-severity CORS-with-credentials vulnerability on the embedded wallet-API proxy was caught during synthesis verification because the saved evidence files captured HTTP response bodies only and omitted the response headers required to prove reflection; it was downgraded and flagged with an explicit evidence gap rather than reported as confirmed.

What this means in plain terms

Three things leadership should take from this assessment.

  • The trading API accepts cross-origin reads from any website. Even though the platform does not rely on session cookies (which limits classical cookie-riding attacks), reflecting arbitrary origins and null across account and administrative endpoints violates least-privilege browser isolation and creates immediate risk if any frontend stores or forwards bearer API keys.
  • Unauthenticated API documentation maps the entire administrative surface. Any visitor can download the full OpenAPI 3.1.0 schema and enumerate all seven /admin/v1/* routes, which declare the exact same bearer security scheme as ordinary user endpoints — making an authenticated privilege-scope test a high-value follow-up.
  • Verification discipline caught an unproven High before it became a false report. A worker narrative claimed credentialed CORS reflection on the embedded wallet-API proxy, but independent artifact verification inspected the raw capture files and found only error response bodies with no captured Access-Control-Allow-* headers. Reporting that gap honestly protects engineering time.

The five things that need a decision, not a patch

#What is wrongBusiness impactWho decides
1The trading API backend reflects arbitrary Origin headers (including null) across all endpointsCross-origin policy should explicitly allow only production frontend origins, not every website on the internet.Backend engineering
2Full OpenAPI 3.1.0 spec (/docs/json) and interactive UI are publicly accessible without authDiscloses all 34 routes including 7 /admin/v1/* endpoints. Whether API docs should stay public — and whether admin routes belong in the public spec — is a governance call.Platform engineering + product
3Production CSP allowlists a local development origin in frame-ancestors and form-actionDevelopment configuration leaked into production security headers; removing it is trivial once local dev environments are cleanly separated.Frontend engineering
4A standby origin server behind the frontend returns 502 with an expired certificate and an unpatched reverse-proxy versionPassive infrastructure records flagged known HTTP/2 Rapid Reset and TLS virtual-host vulnerabilities on the standby host; decide whether to decommission or patch it.Infrastructure
5All 21 trading API routes, 7 admin routes, and 202 wallet-API routes remain untested with live credentialsEvery authentication gate held anonymously; verifying admin-scope isolation and wallet-API Basic auth requires an operator-supplied test credential.Security leadership

What we did not get

No authentication bypass. No unauthorized trading account access or API key issuance. No subdomain takeover. No XSS, path traversal, or cache poisoning. No leaked secrets or credentials anywhere in passive OSINT, DNS, or historical archives.

All 10 authentication-bypass attempts against the trading API returned 401, all 21 trading endpoints enforced bearer authentication consistently, zero dangling DNS records existed across 10 enumerated subdomains, and the primary frontend issued zero session cookies across 218 captured network requests.

Engagement outcome

An authorized external black-box assessment of an on-chain multi-asset perpetuals trading platform identified three confirmed configuration weaknesses: overly permissive cross-origin headers on the trading API, publicly accessible OpenAPI documentation including administrative routes, and a development origin left in the production Content-Security-Policy. All tested authentication gates on the trading API and wallet-infrastructure boundary rejected unauthenticated and malformed requests, with zero account compromise or subdomain takeover. All confirmed findings, unverified credential-gated hypotheses, and remediation steps were delivered under confidentiality.


1. The engagement in numbers

MetricValue
Root workstreams2 (initial intelligence pass + full host-depth assessment)
Total Swarm Size74
Subdomains enumerated10 (5 resolving, 5 non-resolving)
Production hosts assessed in depth5 (across 14 nested swarm jobs)
Finding artifacts consumed & verified227 (22 worker jails audited)
API operations inventoried34–36 trading API routes + 208 wallet-API operations
Confirmed findings3 (1 medium, 2 low)
Evidence-qualified claims (downgraded)1 (wallet-API credentialed CORS — body-only captures)
Unverified hypotheses (credential/rate gated)7
Rejected candidates8 (cache poisoning, XSS, open redirect, IDOR, etc.)

The 22-jail synthesis-verification audit is central to this engagement's numbers. Every claimed finding was traced back to its raw artifact on disk, which preserved three clean confirmations, downgraded one headerless claim, and documented eight explicit coverage gaps.

Agent topology

RoleSessionsResponsibility
Recon50Estate discovery, per-host depth across 5 hosts, DNS/OSINT, synthesis
Scout13Edge fingerprinting, live crawling, schema extraction, auth mapping, vuln scanning
Research7Platform architecture, business context, settlement and trust modeling
Orchestrator2Workstream coordination across initial intel pass and full host-depth run
Synthesis verify1Independent 22-jail evidence audit and artifact integrity check
Advisor1Post-recon strategy consultation and phase-boundary prioritization
Fig 01 · Agent topology
Fig 01 · Agent topology

2. What held

Even without an active web application firewall on any of the three edge-probed hosts (all 23 canonical payloads passed the edge unfiltered), application-layer authentication and static-host hygiene held across the board.

  • The trading API enforced bearer authentication across every tested route. All 21 /v1/* endpoints required a valid wallet-signed API key, and all 10 authentication-bypass techniques (missing header, empty bearer, prefix-only bearer, empty API-key header, null-byte injection, duplicate headers, lowercase header casing, unprefixed token, X-Forwarded-For spoofing, and cookie-based auth) returned 401 Unauthorized.
  • Path traversal, method tampering, and hidden-endpoint probes failed cleanly. Plain traversal returned 404, URL-encoded and double-encoded traversal were blocked at the authentication gate (401) before path resolution, unsupported HTTP verbs (POST/DELETE/PATCH) on read endpoints returned 404, and root debug/admin paths all returned 404.
  • Zero dangling subdomains and zero leaked credentials. All 10 enumerated subdomains produced zero takeover candidates (all active CNAMEs resolved to live edge platforms), and passive OSINT plus archive checks found zero leaked secrets.
  • Stateless frontend session posture and strict primary-domain CORS. Across 218 captured network requests on the primary trading app, zero Set-Cookie headers were issued (the only edge cookie observed was a non-sensitive redirect flag), HSTS enforced a two-year max-age, and the primary frontend restricted its own Access-Control-Allow-Origin strictly to itself.
  • The wallet-API edge gate rejected invalid application identifiers before reaching handlers. Requests lacking a valid application-ID header died at the edge with 400, and malformed content types died with 415, preventing unauthenticated input-handling probes from reaching backend logic.
Fig 02 · 2. What held
Fig 02 · 2. What held

Verification discipline: downgrading an unproven High

The single highest-value quality-control event in this engagement occurred during synthesis verification rather than initial scanning.

A nested vulnerability worker targeting the embedded wallet-API proxy (wallet-api.markets.example) reported a High finding: arbitrary Origin reflection (including Origin: null) paired with Access-Control-Allow-Credentials: true across account and wallet-authentication endpoints.

When the synthesis-verification agent audited all 22 worker jails against their raw capture files, it discovered that all four saved JSONL evidence files contained only HTTP response bodies (400 invalid application-ID and 405 method-not-allowed error payloads) and zero HTTP response headers proving Access-Control-Allow-Origin or Access-Control-Allow-Credentials. Rather than repeating an unverified narrative as a confirmed High, the audit preserved the exact gap in a dedicated evidence-gap record and downgraded the claim until verbatim header captures are obtained.

Fig 03 · Verification discipline: downgrading an unproven High
Fig 03 · Verification discipline: downgrading an unproven High

3. The findings that mattered

How the estate was mapped

Fig 04 · How the estate was mapped
Fig 04 · How the estate was mapped

3.1 Arbitrary CORS origin reflection on the trading API backendMedium

In plain terms. The platform's PaaS trading API (api-backend.markets.example) echoes whatever Origin header a caller sends directly back into Access-Control-Allow-Origin — including untrusted attacker domains and Origin: null — across account, health, sign-up challenge, documentation, and administrative endpoints.

What. Sending GET /v1/account with Origin: https://untrusted.example returns Access-Control-Allow-Origin: https://untrusted.example without allowlist validation (CWE-942). OPTIONS preflight requests similarly reflect arbitrary origins, while /docs/json returns Access-Control-Allow-Origin: * alongside Access-Control-Allow-Methods: *. Reflection was confirmed with verbatim header-level captures across /v1/account, /healthz, /docs/json, /docs/, /v1/sign-up/challenge, and /admin/v1/accounts. Access-Control-Allow-Credentials is not present.

How we found it. Host-depth reconnaissance discovered that the nominal api.markets.example subdomain does not resolve in DNS, traced live API calls to the PaaS backend host, and verified header-level CORS responses across authenticated, public, and administrative endpoints.

Root cause. Overly permissive backend CORS middleware reflecting arbitrary request Origin headers (or using wildcards) instead of checking against a strict allowlist of first-party origins.

Fig 05 · 3.1 Arbitrary CORS origin reflection on the trading API backend
Fig 05 · 3.1 Arbitrary CORS origin reflection on the trading API backend

Impact. The absence of Access-Control-Allow-Credentials: true and the stateless, cookie-free API design prevent classical credentialed cookie theft — which is why this is rated Medium rather than High. However, reflecting arbitrary origins and null strips browser same-origin protection from the API layer and creates an immediate exfiltration path if any client attaches bearer keys or tokens in a cross-origin browser context.

Fix. Replace dynamic origin reflection with an explicit server-side allowlist restricted to the production trading frontend origins, reject Origin: null, and remove wildcard method headers.


3.2 Unauthenticated OpenAPI 3.1.0 specification and interactive docs exposing admin routesLow

In plain terms. Anyone on the internet can fetch /docs/json on the trading API backend and download a complete 50 KB OpenAPI 3.1.0 schema — or browse an interactive API explorer at /docs/ — listing every endpoint, parameter schema, authentication mechanism, and seven administrative routes under /admin/v1/*.

What. GET /docs/json returns HTTP 200 with a 50,933-byte OpenAPI 3.1.0 document without authentication, and GET /docs/ renders an interactive API reference UI (CWE-200). The schema documents 34 endpoints in total, including seven /admin/v1/* paths, and defines a single shared bearerAuth security scheme for both regular user and administrative endpoints.

How we found it. Crawl and schema-discovery workers enumerated standard documentation paths on the PaaS backend and parsed the returned specification to build the complete endpoint and privilege map.

Root cause. Leaving framework-generated API documentation middleware (@fastify/swagger / interactive reference UI) enabled on the public production deployment without authentication or internal-only filtering of administrative routes.

Fig 06 · 3.2 Unauthenticated OpenAPI 3.1.0 specification and interactive docs exposing admin routes
Fig 06 · 3.2 Unauthenticated OpenAPI 3.1.0 specification and interactive docs exposing admin routes

Impact. Eliminates attacker discovery cost for the entire backend API and reveals administrative routes alongside a potential privilege-separation design flaw (a single bearerAuth scheme declared for both user and admin endpoints, recorded honestly as an unverified hypothesis because no live API key was in scope to test /admin/v1/accounts).

Fix. Restrict /docs/ and /docs/json to authenticated developer contexts or disable them on the public production API host. At minimum, strip all /admin/v1/* routes from any public schema and verify server-side that standard user API keys receive 403 on every administrative route.


3.3 Hardcoded local development origin in production Content-Security-PolicyLow

In plain terms. The production trading site (markets.example) ships a Content-Security-Policy header that explicitly trusts http://localhost:<dev-port> inside both frame-ancestors and form-action. A local development port setting made it into production security headers.

What. GET https://markets.example/ returns a Content-Security-Policy header allowlisting http://localhost:<dev-port> in frame-ancestors and form-action (CWE-693).

How we found it. Edge-header fingerprinting on the primary production host parsed every CSP directive and flagged the non-production localhost origin.

Root cause. Shared or insufficiently environment-gated CSP configuration carrying a local developer tooling origin into the production build.

Fig 07 · 3.3 Hardcoded local development origin in production Content-Security-Policy
Fig 07 · 3.3 Hardcoded local development origin in production Content-Security-Policy

Impact. Requires a user to have a service listening on that specific local port, making real-world exploitation narrow and appropriately rated Low. Still, production security headers on a financial trading application should never trust plaintext http://localhost origins.

Fix. Remove http://localhost:<dev-port> from production CSP frame-ancestors and form-action directives, gating local origins strictly to development builds.


Also confirmed, evidence-qualified, and notable observations

Finding / ObservationClassificationContent
Wallet-API proxy CORS with credentials (wallet-api.markets.example)Evidence gap (claimed High, downgraded)Narrative claimed arbitrary + null origin reflection with ACAC: true; 4 saved JSONL captures contain error bodies only (400/405), lacking HTTP header proof
Standby origin server exposure (standby-origin.markets.example)Informational / InfraReturns 502 Bad Gateway with an expired TLS certificate and an older reverse-proxy version flagged for HTTP/2 Rapid Reset (CVE-2023-44487) and a known TLS virtual-host vulnerability
Static OAuth redirectors (oauth.markets.example, oauth-origin.markets.example)InformationalThin ~500 B HTML + ~1 KB JS static edge hosts running implicit-flow (id_token) redirects to a custom app scheme (app-scheme://); ACAO: * and client-side-only allowlist checks; 156 paths tested, 0 open redirects confirmed
Unverified API hypotheses (H-004 / H-005 / H-006)Unverified20 rapid POST /v1/sign-up/challenge calls returned 201 (5-min nonces, no 429); 404 error messages expose backend framework routing; shared bearerAuth on /admin/v1/* untestable without a valid API key

4. Kill chain summary

Fig 08 · 4. Kill chain summary
Fig 08 · 4. Kill chain summary
ChainReachedTerminated atData obtained
Trading API CORS reflectionStage 4 (exploit proof)No ACAC: true; stateless APIHeader reflection proof
OpenAPI spec -> admin route discoveryStage 5 (collection)All /admin/v1/* return 401 unauth50 KB OpenAPI 3.1 schema
Production CSP localhost leakStage 2 (recon/config)Requires local service on dev portCSP header capture
Wallet-API CORS + credentialsStage 2 (unverified)Downgraded — missing header captureError JSON bodies only
Trading API auth bypass (10 variants)Stage 3 (delivery)401 Unauthorized across all 10None
Wallet-API Basic auth (appSecretAuth)Stage 2 (blocked)Edge 400 invalid app-ID gatePublic OpenAPI schema

5. What the shape of this engagement teaches

Evidence verification is as important as discovery. Auditing the 22 worker jails caught a claimed High finding whose raw capture files contained only response bodies without HTTP headers. Enforcing verbatim header proof prevents false escalations and builds trust in every finding that does clear the bar.

Early-gate short-circuiting blocks deeper layers without proving they are safe. On the embedded wallet-API proxy, the edge rejects invalid application IDs (400) before the HTTP Basic authentication layer ever executes. Treating an unreachable inner gate as "deferred pending valid app credentials" — rather than guessing either way — is the only honest conclusion.

Public OpenAPI specifications should never bundle administrative routes. Publishing developer documentation for a trading API is often intentional, but including seven /admin/v1/* routes under the same bearerAuth declaration gives adversaries an exact blueprint and signals an immediate need to verify server-side role isolation.

Absence of a WAF puts all the weight on application-layer hygiene. Zero of 23 canonical payloads were filtered at the CDN edges across three hosts. The platform's stateless wallet-signature model and strict 401 enforcement carried that load well, but tightening CORS, CSP, and rate limiting removes unnecessary margin for error.

Unauthenticated recon cleanly defines the scope of an authenticated Phase 2. Every unauthenticated control held, leaving a short, surgical list for a credentialed follow-up: verify /admin/v1/* scope separation with a standard user API key, capture verbatim CORS headers on the wallet-API proxy, and test the 34 signature-gated wallet operations with valid app credentials.

PriorityActionWhy firstEffort
1Restrict trading API CORS to an explicit production-origin allowlist and reject nullEliminates arbitrary cross-origin readability across account and admin routesVery low
1Verify server-side role checks on all 7 /admin/v1/* routes and remove them from public specsPrevents user-tier API keys from reaching administrative endpointsLow
2Capture and verify CORS headers on the wallet-API proxy; tighten if ACAC: true reflectsResolves the downgraded High evidence gap with vendor/proxy confirmationLow
2Remove http://localhost:<dev-port> from production CSP frame-ancestors and form-actionEliminates leaked local development trust in production headersVery low
3Require authentication on /docs/ and /docs/json (or disable on production API host)Stops unauthenticated enumeration of the full 34-endpoint API surfaceVery low
3Decommission or patch the 502 standby origin server with expired cert and old proxy versionCloses passive exposure to HTTP/2 Rapid Reset and TLS virtual-host CVEsLow
4Add rate limiting to POST /v1/sign-up/challenge and genericize framework 404 error bodiesPrevents challenge-nonce flooding and framework fingerprintingLow

Notices

Authorization

This was an authorized external black-box assessment conducted under written engagement terms. All testing remained unauthenticated, non-destructive, and confined to in-scope hostnames. No user accounts were created, no trades or wallet signatures were executed, and no authenticated endpoints were accessed.

Redaction

Every hostname, IP address, ASN, backend PaaS URL, API-key prefix, custom URI scheme, OAuth client ID, PGP fingerprint, email address, vendor name, and calendar date in this document has been replaced with a placeholder or generalized.

What was removed:

  • All real domains, subdomains, origin hostnames, and PaaS deployment URLs
  • All IP addresses, ASNs, hosting providers, and co-hosted unrelated domains
  • All organization, team, founder, token, blockchain, oracle, and third-party vendor names
  • All API-key prefixes, OAuth client IDs, mobile app IDs, custom URI schemes, and dev port numbers
  • All email addresses, PGP fingerprints, and security-policy URLs
  • Exact calendar dates and timestamps

What was kept, deliberately: vulnerability classes and CWE identifiers, HTTP status codes and auth-bypass test matrices, endpoint and operation counts as magnitudes, the 22-jail synthesis verification audit that downgraded an unproven High, and the explicit coverage-gap inventory. These are transferable engineering lessons and identify nobody.

Placeholders used throughout:

PlaceholderMeaning
markets.examplePrimary trading platform domain and frontend
api-backend.markets.examplePaaS-hosted trading API backend
wallet-api.markets.exampleEmbedded wallet-infrastructure API proxy
oauth.markets.example / oauth-origin.markets.exampleStatic OAuth callback and redirector hosts
standby-origin.markets.exampleStandby reverse-proxy origin returning 502
app-scheme://Native mobile application custom URI scheme
localhost:<dev-port>Hardcoded local development origin in production CSP
<redacted>Any key, identifier, client ID, or address

Data handling

No customer accounts, wallet addresses, API keys, or private trading records were accessed or reproduced. API schema disclosures are described by endpoint counts and structural risk only.

Disclaimer

Findings reflect the state of the tested systems during the engagement window. Security posture changes over time; a finding documented here does not imply the condition persists today.

The wallet-API CORS-with-credentials claim is explicitly reported as an evidence gap rather than a confirmed High because raw capture files lacked HTTP response headers.

Seven hypotheses (including administrative bearer-scope separation and wallet-API HTTP Basic enforcement) remain unverified because this assessment operated strictly without credentials.


Methodology and tooling by BlackBit. Three configuration weaknesses verified cleanly; one claimed High honestly downgraded for missing header proof; all unauthenticated API gates confirmed intact. Published with the client's permission.

More in Web3

← All case studies