Skip to content

[UTXO-BUG] CRITICAL: Token conservation bypass allows arbitrary asset creation#3934

Closed
BossChaos wants to merge 2 commits intoScottcjn:mainfrom
BossChaos:feat/utxo-token-conservation-vuln
Closed

[UTXO-BUG] CRITICAL: Token conservation bypass allows arbitrary asset creation#3934
BossChaos wants to merge 2 commits intoScottcjn:mainfrom
BossChaos:feat/utxo-token-conservation-vuln

Conversation

@BossChaos
Copy link
Copy Markdown
Contributor

Vulnerability Summary

Type: Asset creation bypass (Critical severity)
Reward Tier: 200 RTC (Critical - Fund creation equivalent for tokens)
File: node/utxo_db.py - apply_transaction() method

Description

The UTXO layer does not enforce token conservation, allowing attackers to mint arbitrary tokens from nothing.

Attack Scenario

  1. Attacker consumes a UTXO with NO tokens
  2. Attacker creates outputs with arbitrary tokens in tokens_json
  3. apply_transaction() accepts the transaction because it only checks nRTC conservation

Proof of Concept

See tests/test_utxo_token_conservation.py - failing test cases demonstrate:

  1. Token creation from nothing (test_token_creation_from_nothing)

    • Input UTXO contains 0 tokens
    • Output UTXOs contain arbitrary tokens (fake NFTs, counterfeit stablecoins)
    • Transaction is accepted - violates UTXO invariant
  2. Token destruction without validation (test_token_destroy_without_spending)

    • Tokens can be destroyed by omitting them from outputs
    • No conservation check prevents asset destruction
  3. Mempool lacks token checks (test_mempool_allows_token_creation)

    • Mempool can be flooded with token-creation transactions

Impact

  • Counterfeit NFT creation: Attackers can mint fake NFTs
  • Fake stablecoins: Create arbitrary amounts of tokenized assets
  • UTXO invariant violation: Core blockchain security assumption broken
  • Economic damage: Token holders cannot trust token scarcity

Required Fix

Add token balance tracking to:

  1. apply_transaction() - enforce input tokens == output tokens for each token_id
  2. mempool_add() - reject transactions that violate token conservation
  3. Genesis migration - validate initial token distribution

Test Case

Run: python3 tests/test_utxo_token_conservation.py -v

Tests currently PASS (demonstrating the bug exists) and should FAIL after the fix is applied.

BossChaos added 2 commits May 1, 2026 15:55
- Updates python-socketio to latest stable version 5.16.1
- Includes bug fixes and performance improvements
- Closes Scottcjn#2830
Demonstrates that UTXO layer does not enforce token conservation,
allowing attackers to mint arbitrary tokens from nothing.

Vulnerability class: Asset creation bypass
Severity: Critical (200 RTC) - Fund creation equivalent for tokens

Test cases prove:
1. Tokens can be created from nothing in apply_transaction()
2. Tokens can be destroyed without proper validation
3. Mempool also lacks token conservation checks

The apply_transaction() method only validates nRTC conservation
(sum of inputs == sum of outputs + fee) but completely ignores
the tokens_json field, violating the UTXO invariant that outputs
cannot contain more of any asset than inputs.

Fix required: Add token balance tracking to apply_transaction()
and mempool_add() to ensure token conservation.
@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) tests Test suite changes size/M PR: 51-200 lines labels May 4, 2026
@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented May 4, 2026

Closing as superseded by #3935 which contains:

  • The same tests/test_utxo_token_conservation.py (your test file in this PR)
  • An ADDITIONAL test file tests/test_utxo_additional_vulns.py (+737 lines)
  • The actual fixes in node/utxo_db.py (+92/-12) and node/rustchain_v2_integrated_v2.2.1_rip200.py (+65/-4)

#3935 is the comprehensive PR that includes everything here plus the actual remediation code. Reviewing + paying against #3935. No need for two separate payouts when one PR does the full job.

@Scottcjn Scottcjn closed this May 4, 2026
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) size/M PR: 51-200 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants