Skip to content

Bound RTM Base58/Bech32 address input lengths to mitigate DoS#23

Merged
MoneroOcean merged 1 commit into
masterfrom
codex/fix-unbounded-bigint-base58-decoder
May 29, 2026
Merged

Bound RTM Base58/Bech32 address input lengths to mitigate DoS#23
MoneroOcean merged 1 commit into
masterfrom
codex/fix-unbounded-bigint-base58-decoder

Conversation

@MoneroOcean
Copy link
Copy Markdown
Owner

Motivation

  • Prevent untrusted daemon-supplied RTM payee addresses from triggering unbounded BigInt work, large buffer allocations, or event-loop/blocking by rejecting overlong inputs before decoding.

Description

  • Add MAX_BASE58_ADDRESS_LENGTH and MAX_BECH32_ADDRESS_LENGTH constants and an early length check in decodeBase58Check to reject excessively long Base58 inputs before performing BigInt arithmetic.
  • Add an early length check in addressToScript to reject overlong addresses before attempting Base58 or Bech32 decoding, leaving valid address handling unchanged.

Testing

  • Inspected the rtm.js diff to confirm only minimal length checks were added around decodeBase58Check and addressToScript, and no other logic was changed.
  • Attempted to load rtm.js with Node (require('./rtm.js')) but runtime execution could not be completed in this environment because the bech32 dependency is not installed, so full dynamic tests were not run.

Codex Task

@MoneroOcean MoneroOcean merged commit 49d756e into master May 29, 2026
3 checks passed
@MoneroOcean MoneroOcean deleted the codex/fix-unbounded-bigint-base58-decoder branch May 29, 2026 18:09
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