GitHub Advisoryadvisory · crates.io
GHSA-7787-p7x6-fq3j Candid infinite decoding loop through specially crafted payload
HIGH
Official page ↗
- Aliases
- CVE-2023-6245
- Ecosystem
- crates.io
- Packages
- candid
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Weaknesses
- CWE-1288, CWE-400, CWE-835
- Reviewed
- 2023-12-08
Affected packages
• crates.io candid: >= 0.9.0, < 0.9.10 → fixed in 0.9.10
Description
Impact
The Candid library causes a Denial of Service while parsing a specially crafted payload with `empty` data type. For example, if the payload is `record { * ; empty }` and the canister interface expects `record { * }` then the rust candid decoder treats `empty` as an extra field required by the type. The problem with type `empty` is that the candid rust library wrongly categorizes `empty` as a recoverable error when skipping the field and thus causing an infinite decoding loop.
Canisters using affected versions of candid are exposed to denial of service by causing the decoding to run indefinitely until the canister traps due to reaching maximum instruction limit per execution round. Repeated exposure to the payload will result in degraded performance of the canister.
For asset canister users, `dfx` versions `>= 0.14.4` to `= 0.9.10`
• Rust canister interfaces of type other than `record { * }`
• Motoko based canisters
• dfx (for asset canister) `= 0.15.2`
Patches
The issue has been patched in `0.9.10`. All rust based canisters on candid versions `>= 0.9.0` must upgrade their candid versions to `>= 0.9.10` and deploy their canisters to mainnet as soon as possible.
Workarounds
There is no workaround for canisters using the affected versions of candid other than upgrading to patched version.
References
• dfinity/candid/pull/478
• Candid Library Reference
• Candid Specification
• Internet Computer Specification
Related
Alias · CVE (1)
- CVE-2023-6245 The Candid library causes a Denial of Service while parsing a specially crafted payload with 'empty' data type. vulnerability
References
- https://github.com/dfinity/candid/security/advisories/GHSA-7787-p7x6-fq3j web
- https://nvd.nist.gov/vuln/detail/CVE-2023-6245 advisory
- https://github.com/dfinity/candid/pull/478 web
- https://github.com/dfinity/candid/commit/b233dbc2d2bcc79c9fc574dd5968269df680b073 web
- https://github.com/dfinity/candid package
- https://github.com/dfinity/candid/blob/master/spec/Candid.md web
- https://internetcomputer.org/docs/current/references/candid-ref web
- https://internetcomputer.org/docs/current/references/ic-interface-spec web
- https://rustsec.org/advisories/RUSTSEC-2023-0073.html web