One Message, Two Languages: Parser Differentials as a Security Boundary
Authorization and execution must agree about the same interpreted message.
قد تتضمن ترجمة الذكاء الاصطناعي أخطاء. يُرجى التحقق بالرجوع إلى النص الأصلي.
النص الأصلي باللغة الإنجليزية. ترجمات هذه المراجعة الجديدة غير متاحة بعد.
Abstract
A security boundary often depends on several parsers agreeing about one message, yet conformance and sanitization are commonly evaluated one component at a time. This review develops a relational account of parser differential risk using six primary specifications covering HTTP framing, JSON interoperability, constrained JSON profiles, canonicalization, URI syntax, and browser URL parsing. The central claim is that authorization must bind the same security-relevant interpretation that execution eventually uses, including consumed bytes and residual connection state when messages share a stream. Two reproducible analytical figures enumerate disagreements between first-wins and last-wins duplicate-member policies over finite alphabets. The resulting counts are constructed combinatorial results, not estimates of traffic prevalence or reported vulnerabilities. A restricted canonicalization experiment demonstrates that idempotent serialization cannot restore information already discarded by inconsistent parsing. The manuscript distinguishes acceptance subsets, semantic projections, schema decisions, and transformation order, and proposes a falsifiable differential-testing protocol for pinned service compositions. Limitations include finite coverage, common-mode parser defects, evolving standards, and the inability of agreement alone to prove that an application policy is correct. The contribution is a precise defensive testing contract rather than an exploit catalogue or a claim of universal parser equivalence.
In this paper
- Security decisions depend on interpretations
- Framing is part of meaning
- Duplicate members expose a policy gap
- Canonicalization needs a defined input domain
- A narrower profile can be easier to defend
- URL equality is purpose dependent
- A relational specification for a pipeline
- Exhaustive duplicate sequences
- Why rejection precedes information loss
- Testing the actual composition
- Limits of parser agreement
- A boundary made explicit
Security decisions depend on interpretations
A request is not merely a sequence of bytes once several components have interpreted it. An edge proxy, an authorization service, a cache, and an application can each assign different structure to the same representation. The resulting security question is relational: does the interpretation used to approve an operation agree with the interpretation used to execute it? A locally sensible parser is insufficient if another participant recognizes a different message boundary, member value, or resource identifier.
RFC 9112 explicitly discusses request smuggling as exploitation of differences among message recipients and provides framing rules intended to reduce that risk. This manuscript draws a broader architectural lesson without claiming that all parser differences are exploitable. A difference matters when it changes a security-relevant decision or the framing of subsequent data. We develop a small duplicate-member model to make this relation executable, then distinguish acceptance, semantic equivalence, canonicalization, and downstream behavior. The model generates no network traffic and contains no target-specific exploitation procedure. Its purpose is to demonstrate a class of disagreement and to specify a defensive evaluation method. A successful security boundary should either reject ambiguous representations or bind authorization and execution to a single validated interpretation, with a documented policy for every subsequent transformation.
Sources [1]
Framing is part of meaning
HTTP/1.1 body framing illustrates why parsing cannot be separated from connection state. RFC 9112 gives an ordered procedure for determining message length, treats combinations of Transfer-Encoding and Content-Length as suspicious, and requires specific handling of conflicting framing information. Its rules cannot be reduced to a generic instruction to trust whichever header appears first. We discuss the identified RFC revision; its registry page also reports a later update, which was not audited here.
For a defensive architecture, the object being compared is a stream transduction, not only a parsed request tree. Two recipients might agree on the first request's method and path while disagreeing on where its body ends. The remaining bytes then acquire different roles in the next parsing step. A conformance test that feeds isolated messages and discards leftovers can miss this class of defect. The observation should include consumed byte count, residual buffer, connection disposition, and message sequence. This extension also explains why a front-end rewrite needs an explicit contract: it must produce a downstream stream with the intended boundaries, not simply a pretty version of the fields it recognized. Closing a connection after a framing error is an operational action with consequences that an abstract syntax tree comparison does not capture.
Sources [1]
Duplicate members expose a policy gap
RFC 8259 says object names should be unique and notes that software differs in its handling of duplicates. Some implementations report the last pair, some reject, and some expose all pairs. The specification's interoperability discussion does not make every such outcome safe for authorization. If one component chooses a first occurrence while another chooses a last occurrence, both may accept the input while disagreeing about a field used in a decision.
Our constructed example uses a single key and values zero and one, with no association to a real endpoint. A policy component reads the first value and permits zero; a consumer uses the last value. The two-pair input with zero followed by one is therefore approved under one interpretation and consumed under another. The reverse ordering also creates disagreement, although it need not produce the same policy outcome. This distinction matters when counting tests: semantic disagreement is a broader set than successful policy violations. Rejecting duplicates removes this ambiguity for the toy language, but it does not prove that a real JSON service is safe. Nested structures, numeric ranges, Unicode handling, schema defaults, and field renaming can create additional gaps. The benefit of the example is its exactness: every claimed mismatch is reproducible from a finite input alphabet.
Sources [2]
Canonicalization needs a defined input domain
The JSON Canonicalization Scheme in RFC 8785 constructs an invariant representation using constrained input data and deterministic serialization. Its input requirements include excluding duplicate property names. It is an informational RFC, and the manuscript does not characterize it as an Internet Standard. The relevant insight is that canonicalization is a function on a specified semantic domain, not an operation that safely repairs every byte string a permissive parser happens to accept.
Suppose a system parses duplicate keys into an ordinary map before validating uniqueness. Information about multiplicity may already have been lost, so a later serializer cannot recover the rejected alternative interpretation. A signature over that serializer's output proves agreement about the selected map, not agreement about the original ambiguous bytes. The order of operations therefore belongs to the security contract: recognize the allowed representation, reject prohibited ambiguity while it is still visible, construct the semantic value, and only then serialize canonically. This is an architectural deduction, not a new theorem about JCS. Other applications may deliberately choose a multimap model; in that case the signature, authorization policy, and consumer must all bind the same ordered or unordered collection. A canonical form is useful only when its equivalence relation matches the behavior that the application intends to protect.
Sources [3]
A narrower profile can be easier to defend
I-JSON restricts JSON to improve interoperability, including a prohibition on duplicate member names. That profile provides a concrete example of reducing representational flexibility in exchange for more predictable processing. It does not define the business schema or establish that all conforming implementations have the same resource limits. A system can meet a syntax profile while disagreeing over a value's application meaning.
The design implication is to separate three layers of acceptance. A representation parser decides whether the bytes belong to the permitted language; a schema checker decides whether the value has the intended structure and ranges; the authorization layer decides whether this principal may perform the resulting operation. A field that is absent, explicitly null, empty, or defaulted can acquire different meanings at the latter layers even after representation ambiguity has been removed. A narrow accepted language reduces the number of cases that require alignment, but it cannot eliminate the need to align them. Rejection also creates an operational obligation: clients need stable errors and a migration path from older representations. Silent coercion is tempting during compatibility work, yet it changes the accepted language and should be reviewed as a security-relevant release. The profile is thus an enforceable boundary only when every ingress path applies it before information is discarded.
Sources [6]
URL equality is purpose dependent
RFC 3986 distinguishes reserved characters and percent-encoded representations and discusses normalization. The WHATWG URL Standard instead supplies a detailed browser-oriented parsing model, distinguishes validation errors from parser termination, and states an idempotence goal for parsing and serialization. These sources should not be collapsed into a single universal notion of URL validity. A component can follow one model while a downstream browser or client follows another.
For an allowlist, the relevant object may be a parsed host and port; for a file service it may be a normalized path after decoding; for a cache it may be a key derived from selected components. Equality at one layer does not automatically imply equality at the others. Our recommendation is to define each comparison at the component that will perform the protected action, then reuse that interpretation where possible. Repeated decoding is particularly suspicious because an early policy check may inspect a different representation from the eventual consumer. This manuscript does not provide a universal URL sanitizer or enumerate bypass payloads. Instead it requires a transform ledger: record the bytes or structured value entering each step, the rule used, and the security fields leaving it. A test can then identify exactly which transformation changed the protected meaning and whether that change was authorized.
A relational specification for a pipeline
Let each parser return either rejection or a structured value, and let a projection extract the fields relevant to a particular security decision. Acceptance agreement is stronger than necessary for some systems: the edge may intentionally accept a strict subset of backend inputs. The essential condition is that every edge-accepted request is either rejected safely downstream or interpreted consistently with the approved operation. When connection reuse is involved, safe rejection must also include the residual stream and connection state.
A normalizer between parsers complicates the equation but makes the responsibility explicit. The downstream projection after normalization must match the approved projection before it. Requiring only that normalization be idempotent is insufficient; a function that always erases a field is idempotent and may still destroy the intended semantics. Requiring only parse success is weaker still. The accompanying equations distinguish the disagreement set, a safe-subset condition, and idempotence. These are author-defined specifications for the study rather than claims of complete protocol verification. They should be instantiated separately for routing, authentication, body framing, signatures, and caching. An implementation may satisfy one projection while failing another. Publishing the exact projection prevents a narrow positive test from becoming an unsupported claim that every interpretation in a heterogeneous pipeline is equivalent.
Exhaustive duplicate sequences
The first analytical figure enumerates all binary value sequences for a repeated key, with lengths from one through eight. The first-wins and last-wins interpretations disagree exactly when their endpoint values differ. For length one there are no disagreements. For each greater length, half of the sequences disagree: fixing the first bit leaves exactly one opposite last bit, while the middle positions vary freely. At length eight, 128 of the 256 sequences disagree. The model independently computes both the enumeration and the closed-form count.
These ratios are properties of a uniform finite enumeration, not estimates of malicious traffic prevalence or vulnerability frequency. Real requests do not arrive uniformly over this alphabet, and applications may never authorize based on the repeated field. A strict uniqueness parser accepts only the single-occurrence cases in this experiment. A permissive pair of parsers may appear compatible on a test suite containing mostly unique keys, despite a large disagreement region in the constructed duplicate sublanguage. The figure therefore illustrates test-suite sensitivity. Its useful outcome is not the numerical fraction itself but the demonstrated need to stratify tests by ambiguity class. A reported aggregate agreement rate should show how many duplicate, nested, malformed, and boundary-length inputs were actually exercised.
Why rejection precedes information loss
The second figure expands the input alphabet from two to six possible values while keeping a duplicate sequence length of four. There are q to the fourth total sequences and q times q minus one times q squared endpoint disagreements. The disagreement fraction is one minus one over q. At four values, 192 of 256 sequences disagree; only four unique single-member inputs would be admitted by the separate strict corpus used for the uniqueness check. These populations are deliberately distinguished rather than combined into a misleading acceptance percentage.
The model also tests a restricted canonicalization function after uniqueness validation. For objects with distinct ASCII keys and small integer values, sorting keys and serializing produces the same byte string regardless of insertion order, and repeating the parse-and-serialize step is idempotent. This routine is not presented as a JCS implementation: it omits the complete string, number, and ordering requirements. Its role is to demonstrate the placement of validation in the pipeline. The negative example applies first-wins and last-wins before canonicalization and confirms that the resulting canonical bytes differ. Canonicalization cannot repair a disagreement that was resolved in incompatible ways before it was called. The security claim must consequently cover input adaptation as well as output formatting.
Testing the actual composition
A proposed differential test harness should pin every parser and intermediary version, capture byte-for-byte inputs, and define expected transformations before fuzzing begins. Feed the same corpus through the real composition and through separately instrumented stages. Collect acceptance, structured projections, consumed lengths, residual buffers, and connection closure outcomes. The comparison oracle must know which differences are intentional; otherwise harmless formatting variation can bury a security-relevant divergence under false positives.
Generate corpora by grammar and by transformation histories, not only by random bytes. Include duplicate members, truncation at each boundary, whitespace variants, encodings, depth limits, large numbers, and reserialization. Minimize each discovered difference while preserving the projection mismatch. A minimized example is evidence about the pinned composition; it is not automatically evidence about another deployment using similarly named products. Proposed repairs should be tested both against the minimized case and against valid-client compatibility suites. Finally, repeat the same test after upgrading any participant, because compatibility assumptions are dependencies even when the application source is unchanged. The study should publish the acceptance policy and reproducible harness, while restricting any live deployment testing to authorized environments. No such deployment test was performed for this manuscript; only the finite local model has executable results.
Limits of parser agreement
Agreement is a necessary relation for many boundaries, but two parsers can agree on a dangerous interpretation. They may both accept an unauthorized path, both overflow a numeric conversion, or both mis-handle a schema default. Differential testing therefore supplements a reference policy rather than replacing it. Likewise, the absence of differences in a finite corpus does not establish equivalence over an unbounded language. A useful report states the covered grammar fragment and the tested size limits instead of describing a parser as universally secure.
Shared libraries reduce accidental drift but introduce common-mode defects. Distinct libraries can reveal differences but complicate the task of keeping semantics aligned. The choice depends on where diversity improves detection and where identical interpretation is required at runtime. A promising architecture parses once into a validated, typed message and passes that message onward, preserving the original bytes separately for audit. Even that design needs careful handling of transformations that cannot be represented without reparsing, such as protocol gateways or browser redirects. The audit record must identify the interpretation on which authorization relied. Recording only the original request string may be insufficient to reconstruct a later decision if parser versions or defaults have changed. Reproducibility of the interpretation is part of the evidence, not merely a debugging convenience.
A boundary made explicit
The principal contribution of this review is a specification discipline: protect the relationship between approval and execution, and include the entire stream when framing matters. Standards provide individual parsing rules and profiles; a secure deployment still needs a policy for their composition. The duplicate-member model establishes a small counterexample with exact counts, while the canonicalization example isolates why validation must occur before ambiguity is collapsed. Neither experiment measures the prevalence of real vulnerabilities.
The next useful empirical result would compare complete, pinned service pipelines under the same structured corpus, reporting both semantic differences and valid-client rejection costs. A repair should be judged by whether it removes the dangerous projection mismatch without silently changing the permitted operation. For long-lived systems, this policy should become a release invariant checked whenever a proxy, parser library, schema, or serializer changes. That requirement is stricter than a one-time sanitizer review because the boundary exists between evolving components. It also makes the claim more reviewable: the accepted language, security projection, transformation order, and failure behavior can all be inspected. The goal is not maximum permissiveness or maximum rejection in isolation. It is a coherent interpretation whose connection to authorization survives every stage that can change the meaning of the message.
Mathematical model
(1) D is the disagreement set; parsers return rejection bottom or a value; pi selects security-relevant observations.
(2) An author-defined safe-subset condition; rejection must separately be safe for stream framing and connection reuse.
(3) Idempotence alone does not establish preservation of authorization meaning.
(4) Exact endpoint-disagreement count for k duplicate occurrences drawn from q values; all q^k sequences are enumerated uniformly.
(5) Constructed enumeration ratio; not a measured vulnerability or traffic rate.
Reproducible analytical figures

Assumptions: Only endpoint selection differs; Values are a finite alphabet; All sequences counted equally

Assumptions: Four occurrences of one key; First-wins and last-wins policies; No inference about real implementation prevalence
Executed finite checks
4 check groups passed. The listed cases validate this model; they are not independent experiments or system benchmarks.
- Endpoint disagreement formula versus exhaustive sequences · 25 cases. q=2..6 and length=1..5; finite uniform corpus only.
- Duplicate rejection precedes map conversion · 5 cases. Rejects conflicting duplicates and accepts each of four single-member values.
- Restricted canonicalization is order-independent and idempotent · 6 cases. Every permutation of three distinct ASCII-key/small-integer pairs; not full JCS.
- Canonicalization cannot erase earlier semantic disagreement · 1 cases. A first-wins approval and last-wins consumer disagree on the constructed input.
Comparison
| Boundary | Observation to compare | Insufficient check |
|---|---|---|
| HTTP framing | Consumed bytes, residual stream, closure | First request tree only |
| JSON authorization | Selected member and duplicate policy | Both parsers accept |
| Canonical signatures | Validated value and specified serialization | Hash after permissive parsing |
| URL allowlist | Consumer host, port and path interpretation | Substring check on original text |
Proposed validation protocol
- Pin parsers, gateway versions, schemas and configuration.
- Define the security projection for each protected decision.
- Record allowed normalization and rejected ambiguity classes.
- Generate structured corpora including duplicates and truncations.
- Instrument consumed lengths, residual buffers and connection outcomes.
- Compare complete pipelines with isolated-stage interpretations.
- Minimize disagreements while retaining the security projection mismatch.
- Test repairs against valid-client compatibility cases.
- Repeat the suite when any participant or schema changes.
- Publish corpus limits and distinguish model results from deployment measurements.
Limitations
- Finite enumeration proves only the toy endpoint-selection properties.
- The canonicalizer is restricted to distinct ASCII keys and small integers, not full JCS.
- Agreement does not establish a correct authorization policy.
- RFC 9112 is treated as a pinned revision; later updates are not exhaustively reviewed.
- The WHATWG page is a living standard snapshot.
- No live service or exploit validation was performed.
Open research questions
- Which pipeline transformations most often change an authorization-relevant projection?
- How much valid-client compatibility is lost by enforcing a shared strict profile?
- Can interpretation records make historical authorization decisions reproducible across parser upgrades?
Evidence and its boundaries
- [1] HTTP/1.1 specifies ordered framing rules and discusses request smuggling from parsing differences.
- Pinned RFC scope, not a full review of later updates. Inspected: Sections 2.2, 6.1-6.3, 11.2.
- [2] Duplicate JSON member handling differs among implementations.
- Does not define safe authorization behavior. Inspected: Section 4.
- [3] JCS requires constrained input and deterministic serialization.
- Informational specification; does not repair arbitrary ambiguous input. Inspected: Abstract and section 3.1.
- [4] The URL standard distinguishes validation errors from failure and targets parse/serialize idempotence.
- Not a universal application allowlist policy. Inspected: Goals and Infrastructure.
- [5] URI syntax distinguishes reserved characters and describes normalization.
- Not interchangeable with every browser parsing behavior. Inspected: Sections 2.1-2.4 and 6.
- [6] I-JSON narrows JSON and excludes duplicate object names.
- Does not define application schema or authorization. Inspected: Sections 1 and 2.3.
References
- HTTP/1.1 (RFC 9112)
Roy T. Fielding, Mark Nottingham, Julian Reschke. RFC Editor (2022). https://www.rfc-editor.org/rfc/rfc9112Source access and scope
Sections 2.2, 6.1-6.3 and 11.2 inspected; analysis is pinned to this RFC, not an exhaustive review of later updates.
- The JavaScript Object Notation (JSON) Data Interchange Format (RFC 8259)
Tim Bray. RFC Editor (2017). https://www.rfc-editor.org/rfc/rfc8259Source access and scope
Section 4 object member uniqueness and parser interoperability discussion.
- JSON Canonicalization Scheme (JCS), RFC 8785
Anders Rundgren, Bret Jordan, Samuel Erdtman. RFC Editor (2020). https://www.rfc-editor.org/rfc/rfc8785Source access and scope
Abstract and section 3.1 input adaptation; informational status inspected.
- URL Standard
WHATWG. WHATWG Living Standard (2026). https://url.spec.whatwg.org/Source access and scope
Goals, validation-error distinction and URL parsing outline; living page displayed update 19 October 2026.
- Uniform Resource Identifier (URI): Generic Syntax (RFC 3986)
Tim Berners-Lee, Roy T. Fielding, Larry Masinter. RFC Editor (2005). https://www.rfc-editor.org/rfc/rfc3986.txtSource access and scope
Original standard record and percent-encoding/normalization sections.
- The I-JSON Message Format (RFC 7493)
Tim Bray. RFC Editor (2015). https://www.rfc-editor.org/rfc/rfc7493.txtSource access and scope
Restricted-profile rationale and duplicate member prohibition.