Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXY2NjYtNnc5Ny1wY3dt

Miner fails to get block template when a cell used as a cell dep has been destroyed.

Impact

The RPC get_block_template fails when a cell has been used as a cell dep and an input in the different transactions.

Say cell C is used as a dep group in the transaction A, and is destroyed in the transaction B.

The node adds transaction A first, then B into the transaction pool. They are both valid. But when generating the block template, if the fee rate of B is higher, it comes before A, which will invalidate A. Currently the RPC get_block_template will fail instead of dropping A.

Patch

First, the get_block_template should not fail but dropping the conflict transactions.

Then we can propose solution to this issue. Here is an example. When a transaction is added to the pool, the pool must consider it depending on all the transactions which dep cell (direct or indirect via dep group) has been destroyed in this transaction. Because future transactions using the destroyed cells as dep will be rejected, the spending transaction only need to wait for all the existing dep transactions on chain.

Workaround

  1. Submit transaction B when A is already on chain.
  2. Let B depend on A explicitly, there are several solutions:
    • a. Add any output cell on A as a dep cell or input in B.
    • b. Merge A and B. CKB allows using the same cell as both dep and input in the same transaction.
  3. Ensure the fee rate of B is less than A so A always has higher priority.
Permalink: https://github.com/advisories/GHSA-v666-6w97-pcwm
JSON: https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLXY2NjYtNnc5Ny1wY3dt
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: over 3 years ago
Updated: almost 2 years ago


Identifiers: GHSA-v666-6w97-pcwm
References: Repository: https://github.com/nervosnetwork/ckb
Blast Radius: 1.0

Affected Packages

cargo:ckb
Dependent packages: 0
Dependent repositories: 0
Downloads: 69,742 total
Affected Version Ranges: < 0.40.0
Fixed in: 0.40.0
All affected versions: 0.1.0, 0.37.0, 0.38.0, 0.39.0, 0.39.1
All unaffected versions: 0.40.0, 0.42.0, 0.43.0, 0.43.2, 0.100.0, 0.101.0, 0.101.1, 0.101.2, 0.101.3, 0.101.4, 0.101.5, 0.101.6, 0.101.7, 0.101.8, 0.102.0, 0.103.0, 0.104.0, 0.104.1, 0.105.0, 0.105.1, 0.106.0, 0.107.0, 0.108.0, 0.108.1, 0.109.0, 0.110.0, 0.110.1, 0.110.2, 0.111.0, 0.112.0, 0.112.1, 0.113.0, 0.113.1, 0.114.0, 0.115.0, 0.116.0, 0.116.1, 0.117.0, 0.118.0, 0.119.0, 0.120.0