{"id":"XE-0935","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":13,"title":"SDK in-band JSON sentinels collide on parse and serialize","area":"sdk-docs-web","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0008","tracked":true,"internal_ref":"#1086","internal_url":"https://github.com/xeprotocol/core/issues/1086","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-06T18:51:25.495273+00:00","updated_at":"2026-11-14T22:53:33.031826+00:00","source_created_at":null,"told_at":"2026-11-14T22:53:33.772956+00:00","status_changed_at":"2026-11-08T20:32:08.831842+00:00","url":"https://bounty.xe.network/XE-0935","body":"## Summary\r\nThe 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.\r\n\r\n## Affected components\r\nsdk/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.\r\n\r\n## Impact\r\nAttacker-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.\r\n\r\n## PoC\r\n\r\n```javascript\r\n#!/usr/bin/env node\r\n/** A6 — in-band sentinels: MARK on parse, __bigint__ on serialize. */\r\nimport { parseLossless, stringifyWithBigInts } from './sdk.mjs'\r\n\r\nconst PIN = '0dbc92ecff709bee79768e4e37788c682a0f4525'\r\nconst MARK = '\\u0000xe-u64:'\r\nconsole.log(`PROVENANCE: sdk=${PIN} file=poc/round3/a6_sentinels.mjs`)\r\n\r\nconst serIn = { note: '__bigint__42', amount: 9n }\r\nconst serWire = stringifyWithBigInts(serIn)\r\nconsole.log(`SERIALIZE input.note=__bigint__42 wire=${serWire}`)\r\nconst serUnquoted = /\"note\":42/.test(serWire)\r\nlet serParsed\r\ntry { serParsed = parseLossless(serWire) } catch (e) { serParsed = { _err: String(e) } }\r\nconsole.log(`SERIALIZE reparse note type=${typeof serParsed.note} value=${JSON.stringify(serParsed.note)}`)\r\n\r\nconst parseIn = JSON.stringify({ memo: MARK + '7', keep: 'ok' })\r\nconst parseOut = parseLossless(parseIn)\r\nconsole.log(`PARSE input memo starts with MARK parsed_type=${typeof parseOut.memo} value=${String(parseOut.memo)} keep=${parseOut.keep}`)\r\n\r\nconst control = stringifyWithBigInts({ note: 'ordinary', amount: 9n })\r\nconst controlParsed = parseLossless(control)\r\nconsole.log(`CONTROL note=${controlParsed.note} amount_type=${typeof controlParsed.amount}`)\r\n\r\nconst serTypeFlip = serUnquoted || typeof serParsed.note === 'number' || typeof serParsed.note === 'bigint'\r\nconst parseTypeFlip = typeof parseOut.memo === 'bigint' && parseOut.memo === 7n\r\nif (serTypeFlip && parseTypeFlip && controlParsed.note === 'ordinary') {\r\n  console.log('PASS: serialize __bigint__ prefix unquotes to a number; parse MARK prefix revives as BigInt')\r\n  console.log('VERDICT=CONFIRMED')\r\n  process.exit(0)\r\n}\r\nconsole.log(`KILL: serTypeFlip=${serTypeFlip} parseTypeFlip=${parseTypeFlip} serUnquoted=${serUnquoted}`)\r\nconsole.log('VERDICT=KILLED')\r\nprocess.exit(0)\r\n```\r\n\r\n```\r\nCONTROL note=ordinary amount_type=bigint\r\nPASS: serialize __bigint__ prefix unquotes to a number; parse MARK prefix revives as BigInt\r\n```\r\n\r\n## Suggested fix\r\nKeep 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.\r\n---","patch_refs":[],"thread":[{"id":3790,"source":"desk","source_ref":"reply:2532","author":"XE desk","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0008, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-0935 and says what differs; it is read like any other.","created_at":"2026-11-14T22:53:33.031826+00:00"}]}