Skip to content

Harden legacy RingCT prunable deserialization against oversized output counts#28

Merged
MoneroOcean merged 1 commit into
masterfrom
codex/fix-vulnerability-allowing-memory-exhaustion
May 29, 2026
Merged

Harden legacy RingCT prunable deserialization against oversized output counts#28
MoneroOcean merged 1 commit into
masterfrom
codex/fix-vulnerability-allowing-memory-exhaustion

Conversation

@MoneroOcean
Copy link
Copy Markdown
Owner

Motivation

  • The RingCT prunable deserializer can call vec.resize(outputs) using an attacker-controlled outputs count obtained from a parsed transaction prefix, enabling large allocations and OOM when parsing untrusted block blobs.
  • Rather than changing transaction-version acceptance, the change hardens the reachable deserialization path to reject unreasonable legacy RingCT output counts before any vector resizing occurs.

Description

  • Add a constant MAX_LEGACY_RINGCT_OUTPUTS = 1024 in rct namespace to bound legacy (non-bulletproof) RingCT outputs.
  • Insert an early check if (outputs > MAX_LEGACY_RINGCT_OUTPUTS) return false; in rctSigPrunable::serialize_rctsig_prunable before PREPARE_CUSTOM_VECTOR_SERIALIZATION(outputs, rangeSigs); to prevent oversized rangeSigs allocations.
  • Keep existing behavior for bulletproof, bulletproof+, and other RingCT paths unchanged.

Testing

  • Attempted to run the repository test suite with npm test, but it failed due to external registry access returning 403 Forbidden for https://registry.npmjs.org/bech32, so automated tests could not be completed in this environment.
  • No unit test failures attributable to the change were observed locally because the test run could not proceed to completion due to the registry error.

Codex Task

@MoneroOcean MoneroOcean merged commit 803dea2 into master May 29, 2026
3 checks passed
@MoneroOcean MoneroOcean deleted the codex/fix-vulnerability-allowing-memory-exhaustion 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