[UTXO-BUG] HIGH-2: Unbounded mining_reward — no output cap on minting transactions#2070
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
|
MY WALLET IS aroky-x86-miner |
|
Great security audit work! These fixes are critical for the protocol. |
|
@Scottcjn , please review |
|
Novel and important hardening — without
Wallet: |
|
Verified. When The epoch rewards module defines Severity: HIGH. Requires internal compromise to exploit today, but the UTXO layer should be self-securing. Payment: 50 RTC (bounty #2819) Please rebase onto main after #2067 is merged (both touch @ArokyaMatthew — 125 RTC total across both findings. Consistently the best security researcher in the ecosystem. |
|
Hey @ArokyaMatthew — PR #2067 (CRIT-1 negative value outputs) has been rebased and is ready to merge. Since both PRs touch If you'd prefer, I can handle the rebase for this one too once #2067 lands. |
|
Cross-verification note (from independent GPT-5.4 review): The mining_reward bug was independently reproduced — Two additional edge cases to consider in your fix:
If your fix already handles these, great. If not, consider adding them before we merge. |
… transactions When tx_type='mining_reward' and inputs=[], the conservation check is completely skipped (line 347: 'if inputs and ...' is falsy). Any code that can call apply_transaction() with tx_type='mining_reward' can mint arbitrary amounts with no upper bound. Fix: add MAX_COINBASE_OUTPUT_NRTC = 150 * UNIT (1.5 RTC, matching the block reward) and reject minting transactions whose output_total exceeds this cap. Tests added: - test_mining_reward_at_cap_allowed (boundary) - test_mining_reward_over_cap_rejected (demonstrates the bug) Existing test updated: - test_mempool_block_candidates: lowered coinbase from 200 to 120 RTC to stay within the new cap All 36 tests pass. Bounty: #2819 (High, 100 RTC)
2470e35 to
068d93c
Compare
|
Rebased onto current
All 50 tests pass. Ready to merge. |
|
Payment: 50 RTC transferred to Memo: UTXO HIGH-2: Unbounded mining_reward cap — bounty #2819 Thank you for the contribution! |
Bounty Recognition Request — 13 Merged PRsHi @Scottcjn, I've had 13 PRs merged into the RustChain codebase covering security fixes, validation hardening, and test coverage across BFT consensus, UTXO, sync, governance, bridge, and transfer modules. I'd like to request the associated bounty credits be recognized. Merged PRs Summary
All PRs have been reviewed and merged. Each included regression tests and detailed vulnerability descriptions per the bounty guidelines. i have given my wallet in every messageMY WALLET IS aroky-x86-miner AND IT IS NOT ArokyaMatthew , please consider |
Vulnerability Class
High — Conservation law bypass (100 RTC bounty)
The Bug
When
tx_type='mining_reward'andinputs=[], the conservation check on line 347 is completely skipped:Any code path that can call apply_transaction() with tx_type='mining_reward' can mint arbitrary amounts with no upper bound. There is no cryptographic authentication of the tx_type field.
Attack
Fix
Added MAX_COINBASE_OUTPUT_NRTC = 150 * UNIT (1.5 RTC, matching the consensus block reward) and reject any minting transaction whose output_total exceeds this cap.
Tests Added
test_mining_reward_at_cap_allowed — boundary: exactly at cap succeeds
test_mining_reward_over_cap_rejected — cap+1 nanoRTC is rejected
Updated test_mempool_block_candidates to use 120 RTC coinbase (within cap)
All 36 tests pass.
Files Changed
node/utxo_db.py — added constant + 6-line validation block
node/test_utxo_db.py — 2 new tests + 1 existing test adjusted
Ref: Bounty #2819