Skip to content

Candid infinite decoding loop through specially crafted payload

High severity GitHub Reviewed Published Dec 8, 2023 in dfinity/candid • Updated Dec 13, 2023

Package

cargo candid (Rust)

Affected versions

>= 0.9.0, < 0.9.10

Patched versions

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.15.2-beta.0 ships asset canister with an affected version of candid.

Unaffected

  • Rust canisters using candid < 0.9.0 or >= 0.9.10
  • Rust canister interfaces of type other than record { * }
  • Motoko based canisters
  • dfx (for asset canister) <= 0.14.3 or >= 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

References

@rsundar01 rsundar01 published to dfinity/candid Dec 8, 2023
Published by the National Vulnerability Database Dec 8, 2023
Published to the GitHub Advisory Database Dec 8, 2023
Reviewed Dec 8, 2023
Last updated Dec 13, 2023

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

EPSS score

0.070%
(32nd percentile)

CVE ID

CVE-2023-6245

GHSA ID

GHSA-7787-p7x6-fq3j

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.