Skip to content

Limit get_block_id transaction hash count to prevent stack overflow#32

Merged
MoneroOcean merged 1 commit into
masterfrom
codex/fix-vulnerability-in-get_block_id-api
May 29, 2026
Merged

Limit get_block_id transaction hash count to prevent stack overflow#32
MoneroOcean merged 1 commit into
masterfrom
codex/fix-vulnerability-in-get_block_id-api

Conversation

@MoneroOcean
Copy link
Copy Markdown
Owner

Motivation

  • Prevent a denial-of-service crash caused by parsing untrusted block blobs with an excessive number of tx_hashes, since get_block_id reaches Merkle tree hashing that uses stack-allocation in tree_hash.

Description

  • Add a defensive cap MAX_BLOCK_ID_TX_HASHES = 65535 in src/main.cc and return an error when b.tx_hashes.size() exceeds this limit before calling get_block_hash, preserving normal behavior for typical blocks.

Testing

  • Ran npm test in the environment, which failed due to a network/npm registry 403 Forbidden error fetching the bech32 dependency so no project tests executed successfully.

Codex Task

@MoneroOcean MoneroOcean merged commit 7523d20 into master May 29, 2026
3 checks passed
@MoneroOcean MoneroOcean deleted the codex/fix-vulnerability-in-get_block_id-api branch May 29, 2026 18:06
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