[Bundle] API consistency: GET /directory silently truncates to 100 of 217 entries (no total/cursor) + /chat/messages ignores every pagination parameter + chat inbox flooding evicts a victim's full his
Report
🐞 Bug Report (Bug bounty — XE Protocol)
Summary
Three live-verified API consistency/abuse findings on testnet-0005 (all tested with own registered accounts, ≤10 req/s, evidence transcripts retained):
1. MEDIUM — GET /directory silently truncates to 100 of 217 entries
GET /directory returns a bare JSON array capped at 100 entries with no total count, no cursor, no pagination parameters of its own that lift the cap. 217 accounts are registered (verified via per-account lookups); only the lexicographically-first 100 are ever returned — 117 accounts are permanently invisible to the list view (they remain reachable via direct GET /directory/{account}). Related root cause to XE-0058 (known, capped list) but on this endpoint the cap is silent: no header, no field, no way for a consumer to know data is missing. Wallet UIs and indexers listing accounts will systematically miss the majority of the directory.
2. LOW — /chat/messages ignores every pagination parameter
With a valid ownership proof (4-message inbox), 12 parameter variants were tested: limit=1&offset=0..3, limit=2&offset=3, offset=-1, offset=-99999999999, limit=0, limit=-1, limit=999999, offset=9223372036854775807, offset=18446744073709551616, limit=abc, offset=abc, since=-5, since=99999999999999999999999 — every variant → 200 with the full inbox. Parameters are silently swallowed (contrast: /directory where limit/offset work, and /pending//accounts where they cap at 100). No 500s, no type-name leaks — robust input handling, absent semantics. Impact: unbounded-by-params response size on an authenticated endpoint (self-DoS only) + inconsistent pagination contract across three endpoint families. Pairs with #1 as one pagination-contract theme.
3. LOW — chat inbox flooding: one IP can evict a victim's full 1000-msg history in ~100 s and pollute their contact list
Chat has no per-account rate limit: the only brakes are the per-IP write bucket (10 req/s, burst 50 — api/handler.go:295-298) and per-message PoW (blake2b-8 at 2^-14 ≈ trivial in Go). Live-proven on own accounts (S3/S3b): 1,000 rapid messages → 1000×200, zero 429s; recipient's 1000-cap FIFO evicts their entire prior history in ~100 seconds, and the sender's address is injected into the victim's derived contact list (contacts are derived from stored envelopes; no contact-mutation API exists, no removal possible). Adjacent code-only issues: the seen-ID map (100k entries, ~10 min aging) can be exhausted to block all new chat on a node (400 duplicate envelope misnomer), and the P2P chat ingress stores envelopes addressed to any account string (no homing check) — enabling third-party mailbox stuffing without connecting to the victim's node.
Steps to Reproduce
- (F1) Register ≥101 accounts via
POST /directory/register;GET /directory→ exactly 100 entries, no indication of truncation;GET /directory/{account}for entry #217 → 200 (it exists, it's just not listed). - (F2) Authenticate to
/chat/messageswith a valid proof; append?limit=1&offset=0, then?limit=abc,?offset=-1, etc. → all return the full inbox. - (F3) Register sender+victim; send 1,000 messages (PoW per message; ≤10 req/s sustained) → victim's pre-existing messages evicted FIFO; victim's
GET /chat/contactsnow contains the sender.
Impact
- F1: directory consumers (wallet UIs, indexers, monitoring) silently operate on 45% of the data — integrity of public directory views.
- F2: inconsistent API contract; unbounded responses.
- F3: targeted history-wipe + contact pollution of any account by a single IP; node-wide chat DoS via seen-map exhaustion (code-only).
Suggested fix
- F1: return
{entries, total, next_cursor}(or an explicit truncation flag); document the cap. - F2: parse+enforce
limit/offset/sinceon/chat/messages(or reject unknown params with 400) — one shared pagination helper for all list endpoints. - F3: per-account send rate limit (independent of the IP bucket); consider a contact-visibility rule (only derive contacts from received messages above a threshold, or allow contact removal); add a homing check on P2P chat ingress (drop envelopes addressed to unknown accounts).
Thread
Thanks for the bundle. The inbox-flooding item is already on file from an earlier report and will be handled there; the two pagination items are being reviewed as API consistency work. We will update you here: https://bounty.xe.network/XE-0610