GHSA-8gjm-h3xj-mp6w CVE-2021-45698 GHSA-v666-6w97-pcwm RUSTSEC-2021-0107
RPC call failure in ckb
- Severity
- 9.8 / 10
- Critical · CVSS 3.1
- Exploit chance (EPSS)
- 1.23%
- Chance of exploitation in the next 30 days. Higher than 68.95% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-367 Time-of-check Time-of-use (TOCTOU) Race Condition
- Fix
0.40.0- Upgrade ckb to this version or later
Description
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.
Affected versions
crates.io
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
ckb crates.io → 0.40.0
- cargo
cargo update -p ckb --precise 0.40.0
Severity breakdown
CVSS 3.1 9.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Weakness
CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.
How to prevent it
- Implementation: The most basic advice for TOCTOU vulnerabilities is to not perform a check before the use. This does not resolve the underlying issue of the execution of a function on a resource whose state and identity cannot be assured, but it does help to limit the false sense of security given by the check.
- Implementation: When the file being altered is owned by the current user and group, set the effective gid and uid to that of the current user and group when executing this statement.
- Architecture and Design: Limit the interleaving of operations on files from multiple processes.
- Implementation, Architecture and Design: If you cannot perform operations atomically and you must share access to the resource between multiple processes or threads, then try to limit the amount of time (CPU cycles) between the check and use of the resource. This will not fix the problem, but it could make it more difficult for an attack to succeed.
- Implementation: Recheck the resource after the use call to verify that the action was taken appropriately.
- Architecture and Design: Ensure that some environmental locking mechanism can be used to protect resources effectively.
- Implementation: Ensure that locking occurs before the check, as opposed to afterwards, such that the resource, as checked, is the same as it is when in use.
References
Advisories
Packages
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-29c2-65rj-h343 Nervos CKB Permit load cell data from memory | Medium | Also affects ckb |
| GHSA-h4c3-5275-vrmg Nervos CKB Pool does not remove the conflicting transactions from the statistics | Medium | Also affects ckb |
| GHSA-q73f-w3h7-7wcc Nervos CKB Transaction which calls syscall load_cell_data_hash has nondeterministic result | Critical | Also affects ckb |
| GHSA-3gjh-29fv-8hr6 Nervos CKB Snappy decompress length can be very large and causes out of memory error | High | Also affects ckb |
| GHSA-wjxc-pjx9-4wvm Nervos CKB Panic on malformed input | High | Also affects ckb |
| GHSA-hjqq-29pw-96wj Nervos CKB node panics when processing a block which parent timestamp is too new | High | Also affects ckb |
| GHSA-r9rv-9mh8-pxf4 Nervos CKB BlockTimeTooNew should not be considered as invalid block | Medium | Also affects ckb |
| GHSA-pr39-8257-fxc2 Nervos CKB DoS: Process exists when p2p discovery protocol receives unsupported peer IP | Low | Also affects ckb |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor