← services

case study · security review

Nonce-laundering trace

Traced a server value into a nonce'd inline script, then proved the server sanitised it — a documented negative with a reusable scanner.

Case study: nonce-laundering trace in a production bundle

Engagement: authorized web-security research on a large commerce platform. Role: independent security researcher. Deliverable: a verified input map, a reproducible bundle set, and a small scanner — ending in a documented negative.

The problem

Modern apps routinely build inline <script nonce="…"> blocks by concatenating server values. A quote in one of those values breaks out of the string — and the CSP never sees it, because the script was already trusted. This is nonce laundering: the trusted script does the injection for you.

The question: does this app have that shape, and can an attacker actually reach it?

Approach

  1. Pull the real code. Download the public home bundle and its chunks; record SHA-256 for each so every claim is reproducible.

  2. Find the sink. Static scan for ${…} interpolated into a template literal that also builds <script> / window.location / innerHTML.

  3. Find the call site. Trace the component's props back to the server render context (_n.ctx.r.openInApp), including the gate (shouldRedirect) that decides whether it mounts at all.

  4. Find the source. Probe each candidate input with a benign marker, then a dangerous one, and watch the emitted script:

    InputObservedVerdict
    query string → redirectUrlreflected for benign charscandidate
    ' in queryredirectUrl set to nullblocked by guard
    \ in querystays percent-encodedsafe
    </script> in queryedge block pagesafe
    x-d2id non-UUIDdeeplink set to nullblocked by validation
    x-d2id with " / </script>JSON/HTML-escapedsafe
  5. Check other chunks. A second nonce-copy helper existed in a viewability bundle, but its input was ad config and the ad path rendered in a cross-origin iframe — no in-scope caller.

  6. Compare hosts. The same quote guard held on the sibling country site; a payments host was a different application that never mounted the component.

What was delivered

  • A verified input map: exact props, server origin, mount gate, and the outcome for every reachable input.
  • A byte-for-byte bundle set with SHA256SUMS and a rate-limited fetch script.
  • A reusable scanner (security-toolkit/nonce_scan.py) that flags nonce-copy helpers and script-literal interpolation.
  • An honest negative: the sink is real, the mount is real, the sanitiser is real, and there is no execution on the tested paths.

Result

No vulnerability. The server validates the deep-link id as a UUID, nulls the redirect URL when the query contains a quote, and an edge blocks </script>. The value of the work is that the client now knows this — instead of a speculative "looks exploitable" report that triage would close.

Why this matters to a client

  • A rigorous negative is cheaper than a false positive: no wasted triage, no credibility hit.
  • The input map tells your engineers exactly which fields are guarded and where the next bug would have to live.
  • The scanner is reusable on every future release.

Only public assets and in-scope endpoints were fetched; no authenticated requests, no payloads beyond a benign marker, no scanning.