{"id":"CVE-2021-45698","aliases":["CVE-2021-45698","GHSA-8gjm-h3xj-mp6w","GHSA-v666-6w97-pcwm","RUSTSEC-2021-0107"],"related":[],"kind":"vulnerability","state":"published","title":"RPC call failure in ckb","summary":"An issue was discovered in the ckb crate before 0.40.0 for Rust. A get_block_template RPC call may fail in situations where it is supposed to select a Nervos CKB blockchain transaction with a higher fee rate than another transaction.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"An issue was discovered in the ckb crate before 0.40.0 for Rust. A get_block_template RPC call may fail in situations where it is supposed to select a Nervos CKB blockchain transaction with a higher fee rate than another transaction.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nThe RPC `get_block_template` fails when a cell has been used as a cell dep and an input in the different transactions.\n\nSay cell C is used as a dep group in the transaction A, and is destroyed in the transaction B.\n\nThe 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.\n\n### Patch\n\nFirst, the `get_block_template` should not fail but dropping the conflict transactions.\n\nThen 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.\n\n### Workaround\n\n1. Submit transaction B when A is already on chain.\n2. Let B depend on A explicitly, there are several solutions:\n    * a. Add any output cell on A as a dep cell or input in B.\n    * b. Merge A and B. CKB allows using the same cell as both dep and input in the same transaction.\n3. Ensure the fee rate of B is less than A so A always has higher priority.","format":"markdown","source":"ghsa"},{"lang":"en","text":"## Impact\n\nThe RPC get_block_template fails when a cell has been used as a cell dep and an input in the different transactions.\n\nSay cell C is used as a dep group in the transaction A, and is destroyed in the transaction B.\n\nThe 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.\n\n## Patch\n\nFirst, the get_block_template should not fail but dropping the conflict transactions.\n\nThen 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.\n\n## Workaround\n\n    Submit transaction B when A is already on chain.\n    Let B depend on A explicitly, there are several solutions:\n        a. Add any output cell on A as a dep cell or input in B.\n        b. Merge A and B. CKB allows using the same cell as both dep and input in the same transaction.\n    Ensure the fee rate of B is less than A so A always has higher priority.","format":"markdown","source":"rustsec"},{"lang":"es","text":"Se ha detectado un problema en la crate ckb versiones anteriores a 0.40.0 para Rust. Una llamada RPC get_block_template puede fallar en situaciones en las que supone que debe seleccionar una transacción de Nervos CKB blockchain con una tasa más alta que otra transacción","source":"nvd"}],"published":"2021-07-25T12:00:00.000Z","modified":"2026-10-12T18:00:03.408Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"rating","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","score":7.5,"rating":"HIGH"}],"cwes":["CWE-367"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.40.0"}],"ecosystem":"crates.io","package":"ckb","purl":"pkg:cargo/ckb","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.40.0"}],"ecosystem":"crates.io","package":"ckb","purl":"pkg:cargo/ckb","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.40.0"}],"ecosystem":"crates.io","package":"ckb","purl":"pkg:cargo/ckb","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"0.40.0"}],"vendor":"nervos","product":"ckb","cpe":"cpe:2.3:a:nervos:ckb:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0107.html","tags":["advisory","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/ckb/RUSTSEC-2021-0107.md","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nervosnetwork/ckb/security/advisories/GHSA-v666-6w97-pcwm","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-45698","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/nervosnetwork/ckb","tags":["package"],"sources":["ghsa"]},{"url":"https://crates.io/crates/ckb","tags":["package"],"sources":["rustsec"]},{"url":"https://github.com/nervosnetwork/ckb/commit/e5b45795375d7dc2a689fb46790caca5c2653638","tags":["web"],"sources":["rustsec"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-45698","url":"https://www.cve.org/CVERecord?id=CVE-2021-45698","licence":"CVE Terms of Use","modified":"2024-08-04T04:47:02.103Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8gjm-h3xj-mp6w","url":"https://github.com/advisories/GHSA-8gjm-h3xj-mp6w","licence":"CC-BY-4.0","modified":"2023-11-08T04:07:22.565Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-v666-6w97-pcwm","url":"https://github.com/advisories/GHSA-v666-6w97-pcwm","licence":"CC-BY-4.0","modified":"2023-11-08T04:07:22.565Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2021-0107","url":"https://rustsec.org/advisories/RUSTSEC-2021-0107.html","licence":"CC0-1.0","modified":"2026-10-12T18:00:03.408Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-45698","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-45698","licence":"Public domain","modified":"2026-06-17T04:13:58.220Z"}],"updatedAt":"2026-11-25T22:58:06.267Z","epss":{"score":0.0123,"percentile":0.6893,"date":"2026-11-30T12:00:22.000Z"}}