Skip to content
Business logic Write-up Intermediate

Split-Brain JSON: Exploiting Parser Disagreement Across Validation Boundaries for Privilege…

A gateway and a backend service parsed the same JSON body with different duplicate-key policies, so the gateway saw a harmless role while the backend saw an admin role. An attacker could send one request that passed validation yet granted elevated privileges at the backend.

pratikdahal777 Follow

Published on medium.com

In distributed API architectures, input validation is often decoupled from business logic. Gateways, WAFs, and microservices each perform their own parsing of inbound data.

Pratik Dahal, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the validation layer and the business-logic layer used JSON parsers with different duplicate-key resolution policies while forwarding the raw body unchanged.

Impact

A single request could pass gateway validation while the backend granted admin privileges, and the author notes such misalignment could survive WAF layers.

What the attacker needed

Two layers with differing JSON parsers; gateway forwards the raw body

The fix

Reject objects containing duplicate keys, and have the validating component produce the canonical JSON that downstream services consume.

How it was found

  1. Set up a gateway that validates JSON keeping the first duplicate key and forwards the raw body.
  2. Set up a backend that parses the same body keeping the last duplicate key.
  3. Send a body containing a role field twice, first as a normal user and then as admin.
  4. Observe the gateway accepting the request and the backend granting admin.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

JSON is a text format for data, and it can technically contain the same field name twice. Different programs disagree about which copy counts: some keep the first, some keep the last. Here the checking program kept the first copy and the program doing the real work kept the last, so one request looked safe to the checker but powerful to the worker.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.