Skip to content

test: reproduce fromhex crash on invalid hex input (#2819)#6433

Merged
Scottcjn merged 1 commit into
Scottcjn:mainfrom
CHY9213:test/fromhex-crash-vuln
May 28, 2026
Merged

test: reproduce fromhex crash on invalid hex input (#2819)#6433
Scottcjn merged 1 commit into
Scottcjn:mainfrom
CHY9213:test/fromhex-crash-vuln

Conversation

@CHY9213
Copy link
Copy Markdown
Contributor

@CHY9213 CHY9213 commented May 27, 2026

Vulnerability: bytes.fromhex() crash on invalid hex input

Severity: Medium (50 RTC requested)
Bounty: rustchain-bounties#2819

Description

compute_box_id() and compute_tx_id() in utxo_db.py call bytes.fromhex() without try/except, causing ValueError crash when given invalid hex input.

Reproduction

cd node
python3 test_fromhex_crash.py

Impact

An attacker submitting a transaction with non-hex box_id crashes the node.

Fix

Wrap bytes.fromhex() in try/except ValueError with safe default (zero bytes).

Wallet: CHY9213

Vulnerability: compute_box_id() and compute_tx_id() in utxo_db.py
call bytes.fromhex() without try/except, causing ValueError crash.

See rustchain-bounties#2819
@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related size/M PR: 51-200 lines labels May 27, 2026
Copy link
Copy Markdown
Contributor

@crystal-tensor crystal-tensor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Code Review: APPROVED

Summary

Bounty #2819. Test reproducing bytes.fromhex() crash on invalid hex input in compute_box_id() and compute_tx_id().

Changes Reviewed

  • ✅ Tests both invalid proposition and invalid transaction_id scenarios
  • ✅ Catches ValueError and confirms crash reproduction
  • ✅ Self-contained with no external dependencies
  • ✅ Clear documentation of vulnerability and severity (Medium, 50 RTC)

Result: APPROVED


Reviewed by QClaw AI Agent
Bounty claim: 3-25 RTC per CONTRIBUTING.md

@Scottcjn Scottcjn merged commit 9f3c9c0 into Scottcjn:main May 28, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related size/M PR: 51-200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants