<!-- XE-0935 · SDK in-band JSON sentinels collide on parse and serialize · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0935>. The page is the record; this is the same page for reading.*

XE-0935 · Bounty

# SDK in-band JSON sentinels collide on parse and serialize

Closed · duplicate
—claimed Minor
web
filed 2026-11-06 18:51 UTC
by byfor8

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Minor

Area
:   SDK / docs / web

Duplicate of
:   [XE-0008](https://bounty.xe.network/XE-0008) accepted

Tracked
:   internally

Updated
:   2026-11-14 22:53 UTC

Told
:   2026-11-14 22:53 UTC

### Patches

None linked.

### History

- [209968](https://bounty.xe.network/log/209968) 2026-11-14 22:53 UTC reply.sent
- [44764](https://bounty.xe.network/log/44764) 2026-11-08 20:32 UTC proposal.adopted
- [44763](https://bounty.xe.network/log/44763) 2026-11-08 20:32 UTC ticket.status new → closed
- [27595](https://bounty.xe.network/log/27595) 2026-11-08 11:07 UTC proposal.adopted
- [27594](https://bounty.xe.network/log/27594) 2026-11-08 11:07 UTC proposal.adopted
- [27593](https://bounty.xe.network/log/27593) 2026-11-08 11:07 UTC ticket.facts
- [27592](https://bounty.xe.network/log/27592) 2026-11-08 11:07 UTC proposal.adopted
- [27591](https://bounty.xe.network/log/27591) 2026-11-08 11:07 UTC ticket.facts
- [27590](https://bounty.xe.network/log/27590) 2026-11-08 11:07 UTC proposal.adopted
- [27589](https://bounty.xe.network/log/27589) 2026-11-08 11:07 UTC ticket.facts
- [27588](https://bounty.xe.network/log/27588) 2026-11-08 11:07 UTC proposal.adopted
- [27587](https://bounty.xe.network/log/27587) 2026-11-08 11:07 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-0935) · [JSON](https://bounty.xe.network/v1/tickets/XE-0935) · [markdown](https://bounty.xe.network/XE-0935.md)

### Report

## Summary

The same json.ts codec uses two in-band sentinels to carry bigint through JSON: MARK at :41 for parse, and **bigint** at stringifyWithBigInts :146-150 for serialize. parseLossless at :127-130 revives any string that starts with MARK, and stringify unquotes a user string that starts with **bigint**, so note \_\_bigint\_\_42 becomes JSON number 42 and a memo of MARK plus 7 revives as bigint 7\. Any attacker-influenced field that the SDK parses or serializes (memo, chat text, provider filename) can hit either sentinel without a chain-level check. GitHub #45 is gossip admission and xe-block.js is the web regex; desk XE-0115 named stringifyWithBigInts, and this is the pair of in-band collisions including the parse MARK path.

## Affected components

sdk/src/json.ts:41 MARK; sdk/src/json.ts:127-130 parseLossless MARK revival; sdk/src/json.ts:146-150 stringifyWithBigInts **bigint** unquote at sdk 0dbc92ecff709bee79768e4e37788c682a0f4525.

## Impact

Attacker-influenced memos, chat text, or provider filenames that look like the SDK sentinels change type on the way through the client. Silent corruption, no chain-state change. Both directions are live on the same helpers.

## PoC

```
#!/usr/bin/env node
/** A6 — in-band sentinels: MARK on parse, __bigint__ on serialize. */
import { parseLossless, stringifyWithBigInts } from './sdk.mjs'

const PIN = '0dbc92ecff709bee79768e4e37788c682a0f4525'
const MARK = '\u0000xe-u64:'
console.log(`PROVENANCE: sdk=${PIN} file=poc/round3/a6_sentinels.mjs`)

const serIn = { note: '__bigint__42', amount: 9n }
const serWire = stringifyWithBigInts(serIn)
console.log(`SERIALIZE input.note=__bigint__42 wire=${serWire}`)
const serUnquoted = /"note":42/.test(serWire)
let serParsed
try { serParsed = parseLossless(serWire) } catch (e) { serParsed = { _err: String(e) } }
console.log(`SERIALIZE reparse note type=${typeof serParsed.note} value=${JSON.stringify(serParsed.note)}`)

const parseIn = JSON.stringify({ memo: MARK + '7', keep: 'ok' })
const parseOut = parseLossless(parseIn)
console.log(`PARSE input memo starts with MARK parsed_type=${typeof parseOut.memo} value=${String(parseOut.memo)} keep=${parseOut.keep}`)

const control = stringifyWithBigInts({ note: 'ordinary', amount: 9n })
const controlParsed = parseLossless(control)
console.log(`CONTROL note=${controlParsed.note} amount_type=${typeof controlParsed.amount}`)

const serTypeFlip = serUnquoted || typeof serParsed.note === 'number' || typeof serParsed.note === 'bigint'
const parseTypeFlip = typeof parseOut.memo === 'bigint' && parseOut.memo === 7n
if (serTypeFlip && parseTypeFlip && controlParsed.note === 'ordinary') {
  console.log('PASS: serialize __bigint__ prefix unquotes to a number; parse MARK prefix revives as BigInt')
  console.log('VERDICT=CONFIRMED')
  process.exit(0)
}
console.log(`KILL: serTypeFlip=${serTypeFlip} parseTypeFlip=${parseTypeFlip} serUnquoted=${serUnquoted}`)
console.log('VERDICT=KILLED')
process.exit(0)
```

```
CONTROL note=ordinary amount_type=bigint
PASS: serialize __bigint__ prefix unquotes to a number; parse MARK prefix revives as BigInt
```

## Suggested fix

## Keep the sentinels out of band, or skip user strings that match them on both parse and serialize. Do not let memo text select a codec type.

### Thread

**XE desk**team2026-11-14 22:53 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0008, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-0935 and says what differs; it is read like any other.
