CVE-2023-6245
JSON

7.5high

Infinite decoding loop through specially crafted payload

Severity
7.5high CVSS:3.1 by Dfinity
Exploit likelihood
1.21% (higher than 69% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Dfinity
Also known as
GHSA-7787-p7x6-fq3jRUSTSEC-2023-0073

Description

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 the 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. Note: Canisters written in Motoko are unaffected.

Affected

Product or packageVersionsReported by
Internet Computer Candidfrom 0.9.0 before 0.9.10CVE List
candid (crates.io)from 0.9.0 before 0.9.10GitHub Advisory Database, RustSec Advisory Database
dfinity candidfrom 0.9.0 before 0.9.10NVD

All scores

Dfinity7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
RustSec Advisory Database7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-20CWE-168CWE-400CWE-835CWE-1288

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

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 the 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. Note: Canisters written in Motoko are unaffected.

GitHub Advisory Database
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
RustSec Advisory Database

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
References
NVD (es)

La librería Candid provoca una denegación de servicio mientras analiza un payload especialmente manipulado con un tipo de datos "vacío". Por ejemplo, si el payload es `record { * ; empty }` y la interfaz del recipiente espera `record { * }`, entonces el decodificador sincero de Rust trata el vacío como un campo adicional requerido por el tipo. El problema con el tipo vacío es que la sincera librería Rust clasifica erróneamente vacío como un error recuperable al omitir el campo y, por lo tanto, provoca un bucle de decodificación infinito. Los contenedores que utilizan versiones afectadas de candid están expuestos a una denegación de servicio al hacer que la decodificación se ejecute indefinidamente hasta que el contenedor se bloquea debido a que alcanza el límite máximo de instrucciones por ronda de ejecución. La exposición repetida a el payload dará como resultado un rendimiento degradado del recipiente. Nota: Los botes escritos en Motoko no se ven afectados.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-6245 changed 2024-12-02CVE Terms of Use
GitHub Advisory DatabaseGHSA-7787-p7x6-fq3j changed 2026-05-04CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2023-0073 changed 2023-12-09CC0-1.0
NVDCVE-2023-6245 changed 2026-06-17Public domain