Skip to content

Harden RTM template parsing to prevent DoS on malformed/unbounded tx data#25

Merged
MoneroOcean merged 1 commit into
masterfrom
codex/propose-fix-for-rtm-transaction-parsing-dos
May 29, 2026
Merged

Harden RTM template parsing to prevent DoS on malformed/unbounded tx data#25
MoneroOcean merged 1 commit into
masterfrom
codex/propose-fix-for-rtm-transaction-parsing-dos

Conversation

@MoneroOcean
Copy link
Copy Markdown
Owner

Motivation

  • Prevent availability attacks where a malicious or compromised RTM daemon can supply an unbounded or malformed transaction list that forces large allocations, synchronous parsing, extensive per-transaction logging, or uncaught exceptions in the single-threaded Node process.
  • Restore bounds and defensive checks to the RTM merkle recomputation path so daemon-supplied template data cannot trigger excessive work or crash the pool.

Description

  • Add a hard cap MAX_TEMPLATE_TRANSACTIONS = 5000 and validate the decoded transaction count, rejecting counts outside the allowed range.
  • Validate transaction offsets against blob_in.length and throw on out-of-range offsets to avoid reading past the buffer.
  • Wrap rtm.readTransaction in try/catch and validate the returned parsed.offset to ensure parsed sizes are sane before advancing.
  • Guard public RTM entrypoints convertRtmBlob and constructNewRtmBlob with try/catch around update_merkle_root_hash so malformed daemon templates do not crash the process while preserving return shapes.

Testing

  • Ran a Node syntax check with node -c index.js, which succeeded.
  • No existing unit tests were modified or added as part of this change.

Codex Task

@MoneroOcean MoneroOcean merged commit 496cf10 into master May 29, 2026
3 checks passed
@MoneroOcean MoneroOcean deleted the codex/propose-fix-for-rtm-transaction-parsing-dos branch May 29, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant