CVE-2023-6245: Candid infinite decoding loop through specially crafted payload
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.15.2-beta.0
ships asset canister with an affected version of candid.
References
- github.com/advisories/GHSA-7787-p7x6-fq3j
- github.com/dfinity/candid
- github.com/dfinity/candid/blob/master/spec/Candid.md
- github.com/dfinity/candid/commit/b233dbc2d2bcc79c9fc574dd5968269df680b073
- github.com/dfinity/candid/pull/478
- github.com/dfinity/candid/security/advisories/GHSA-7787-p7x6-fq3j
- internetcomputer.org/docs/current/references/candid-ref
- internetcomputer.org/docs/current/references/ic-interface-spec
- nvd.nist.gov/vuln/detail/CVE-2023-6245
- rustsec.org/advisories/RUSTSEC-2023-0073.html
Detect and mitigate CVE-2023-6245 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →