Vulnerabilites related to dfinity - candid
CVE-2023-6245 (GCVE-0-2023-6245)
Vulnerability from cvelistv5
Published
2023-12-08 14:26
Modified
2024-12-02 14:33
CWE
  • CWE-835 - Loop with Unreachable Exit Condition ('Infinite Loop')
  • CWE-1288 - Improper Validation of Consistency within Input
  • CWE-168 - Improper Handling of Inconsistent Special Elements
  • CWE-20 - Improper Input Validation
Summary
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.
Impacted products
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-02T08:21:17.978Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://github.com/dfinity/candid/pull/478"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://internetcomputer.org/docs/current/references/candid-ref"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://github.com/dfinity/candid/blob/master/spec/Candid.md"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://github.com/dfinity/candid/security/advisories/GHSA-7787-p7x6-fq3j"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://internetcomputer.org/docs/current/references/ic-interface-spec"
          }
        ],
        "title": "CVE Program Container"
      },
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2023-6245",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "yes"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-12-02T14:31:05.379872Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-12-02T14:33:16.496Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Candid",
          "repo": "https://github.com/dfinity/candid",
          "vendor": "Internet Computer",
          "versions": [
            {
              "lessThan": "0.9.10",
              "status": "affected",
              "version": "0.9.0",
              "versionType": "0.0.0"
            }
          ]
        }
      ],
      "datePublic": "2023-12-08T01:55:00.000Z",
      "descriptions": [
        {
          "lang": "en",
          "supportingMedia": [
            {
              "base64": false,
              "type": "text/html",
              "value": "\u003cp\u003eThe Candid library causes a Denial of Service while \nparsing a specially crafted payload with \u0027empty\u0027 data type. For example,\n if the payload is \u003ccode\u003e`record { * ; empty }`\u003c/code\u003e and the canister interface expects \u003ccode\u003e`record { * }`\u003c/code\u003e then the Rust candid decoder treats \u003ccode\u003eempty\u003c/code\u003e as an extra field required by the type.  The problem with the type \u003ccode\u003eempty\u003c/code\u003e is that the candid Rust library wrongly categorizes \u003ccode\u003eempty\u003c/code\u003e as a recoverable error when skipping the field and thus causing an infinite decoding loop.\u003c/p\u003e\n\u003cp\u003eCanisters using affected versions of candid\n are exposed to denial of service by causing the decoding to run \nindefinitely until the canister traps due to reaching maximum \ninstruction limit per execution round. Repeated exposure to the payload \nwill result in degraded performance of the canister. Note: Canisters written in Motoko are unaffected.\u003cbr\u003e\u003c/p\u003e\u003cbr\u003e"
            }
          ],
          "value": "The Candid library causes a Denial of Service while \nparsing a specially crafted payload with \u0027empty\u0027 data type. For example,\n 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.\n\n\nCanisters using affected versions of candid\n are exposed to denial of service by causing the decoding to run \nindefinitely until the canister traps due to reaching maximum \ninstruction limit per execution round. Repeated exposure to the payload \nwill result in degraded performance of the canister. Note: Canisters written in Motoko are unaffected.\n\n\n\n"
        }
      ],
      "impacts": [
        {
          "descriptions": [
            {
              "lang": "en",
              "value": "Denial of Service"
            }
          ]
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "attackComplexity": "LOW",
            "attackVector": "NETWORK",
            "availabilityImpact": "HIGH",
            "baseScore": 7.5,
            "baseSeverity": "HIGH",
            "confidentialityImpact": "NONE",
            "integrityImpact": "NONE",
            "privilegesRequired": "NONE",
            "scope": "UNCHANGED",
            "userInteraction": "NONE",
            "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
            "version": "3.1"
          },
          "format": "CVSS",
          "scenarios": [
            {
              "lang": "en",
              "value": "GENERAL"
            }
          ]
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-835",
              "description": "CWE-835 Loop with Unreachable Exit Condition (\u0027Infinite Loop\u0027)",
              "lang": "en",
              "type": "CWE"
            }
          ]
        },
        {
          "descriptions": [
            {
              "cweId": "CWE-1288",
              "description": "CWE-1288 Improper Validation of Consistency within Input",
              "lang": "en",
              "type": "CWE"
            }
          ]
        },
        {
          "descriptions": [
            {
              "cweId": "CWE-168",
              "description": "CWE-168 Improper Handling of Inconsistent Special Elements",
              "lang": "en",
              "type": "CWE"
            }
          ]
        },
        {
          "descriptions": [
            {
              "cweId": "CWE-20",
              "description": "CWE-20 Improper Input Validation",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2023-12-08T14:26:09.331Z",
        "orgId": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
        "shortName": "Dfinity"
      },
      "references": [
        {
          "url": "https://github.com/dfinity/candid/pull/478"
        },
        {
          "url": "https://internetcomputer.org/docs/current/references/candid-ref"
        },
        {
          "url": "https://github.com/dfinity/candid/blob/master/spec/Candid.md"
        },
        {
          "url": "https://github.com/dfinity/candid/security/advisories/GHSA-7787-p7x6-fq3j"
        },
        {
          "url": "https://internetcomputer.org/docs/current/references/ic-interface-spec"
        }
      ],
      "source": {
        "discovery": "INTERNAL"
      },
      "title": "Infinite decoding loop through specially crafted payload",
      "x_generator": {
        "engine": "Vulnogram 0.1.0-dev"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
    "assignerShortName": "Dfinity",
    "cveId": "CVE-2023-6245",
    "datePublished": "2023-12-08T14:26:09.331Z",
    "dateReserved": "2023-11-21T16:28:51.715Z",
    "dateUpdated": "2024-12-02T14:33:16.496Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1"
}

Vulnerability from fkie_nvd
Published
2023-12-08 15:15
Modified
2024-11-21 08:43
Summary
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.
Impacted products
Vendor Product Version
dfinity candid *



{
  "configurations": [
    {
      "nodes": [
        {
          "cpeMatch": [
            {
              "criteria": "cpe:2.3:a:dfinity:candid:*:*:*:*:*:rust:*:*",
              "matchCriteriaId": "F95D6602-30FA-4473-9660-F87B18A446FD",
              "versionEndExcluding": "0.9.10",
              "versionStartIncluding": "0.9.0",
              "vulnerable": true
            }
          ],
          "negate": false,
          "operator": "OR"
        }
      ]
    }
  ],
  "cveTags": [],
  "descriptions": [
    {
      "lang": "en",
      "value": "The Candid library causes a Denial of Service while \nparsing a specially crafted payload with \u0027empty\u0027 data type. For example,\n 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.\n\n\nCanisters using affected versions of candid\n are exposed to denial of service by causing the decoding to run \nindefinitely until the canister traps due to reaching maximum \ninstruction limit per execution round. Repeated exposure to the payload \nwill result in degraded performance of the canister. Note: Canisters written in Motoko are unaffected.\n\n\n\n"
    },
    {
      "lang": "es",
      "value": "La librer\u00eda Candid provoca una denegaci\u00f3n de servicio mientras analiza un payload especialmente manipulado con un tipo de datos \"vac\u00edo\". Por ejemplo, si el payload es `record { * ; empty }` y la interfaz del recipiente espera `record { * }`, entonces el decodificador sincero de Rust trata el vac\u00edo como un campo adicional requerido por el tipo. El problema con el tipo vac\u00edo es que la sincera librer\u00eda Rust clasifica err\u00f3neamente vac\u00edo como un error recuperable al omitir el campo y, por lo tanto, provoca un bucle de decodificaci\u00f3n infinito. Los contenedores que utilizan versiones afectadas de candid est\u00e1n expuestos a una denegaci\u00f3n de servicio al hacer que la decodificaci\u00f3n se ejecute indefinidamente hasta que el contenedor se bloquea debido a que alcanza el l\u00edmite m\u00e1ximo de instrucciones por ronda de ejecuci\u00f3n. La exposici\u00f3n repetida a el payload dar\u00e1 como resultado un rendimiento degradado del recipiente. Nota: Los botes escritos en Motoko no se ven afectados."
    }
  ],
  "id": "CVE-2023-6245",
  "lastModified": "2024-11-21T08:43:27.050",
  "metrics": {
    "cvssMetricV31": [
      {
        "cvssData": {
          "attackComplexity": "LOW",
          "attackVector": "NETWORK",
          "availabilityImpact": "HIGH",
          "baseScore": 7.5,
          "baseSeverity": "HIGH",
          "confidentialityImpact": "NONE",
          "integrityImpact": "NONE",
          "privilegesRequired": "NONE",
          "scope": "UNCHANGED",
          "userInteraction": "NONE",
          "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
          "version": "3.1"
        },
        "exploitabilityScore": 3.9,
        "impactScore": 3.6,
        "source": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
        "type": "Secondary"
      },
      {
        "cvssData": {
          "attackComplexity": "LOW",
          "attackVector": "NETWORK",
          "availabilityImpact": "HIGH",
          "baseScore": 7.5,
          "baseSeverity": "HIGH",
          "confidentialityImpact": "NONE",
          "integrityImpact": "NONE",
          "privilegesRequired": "NONE",
          "scope": "UNCHANGED",
          "userInteraction": "NONE",
          "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
          "version": "3.1"
        },
        "exploitabilityScore": 3.9,
        "impactScore": 3.6,
        "source": "nvd@nist.gov",
        "type": "Primary"
      }
    ]
  },
  "published": "2023-12-08T15:15:08.233",
  "references": [
    {
      "source": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
      "tags": [
        "Product"
      ],
      "url": "https://github.com/dfinity/candid/blob/master/spec/Candid.md"
    },
    {
      "source": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
      "tags": [
        "Patch"
      ],
      "url": "https://github.com/dfinity/candid/pull/478"
    },
    {
      "source": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
      "tags": [
        "Patch",
        "Third Party Advisory"
      ],
      "url": "https://github.com/dfinity/candid/security/advisories/GHSA-7787-p7x6-fq3j"
    },
    {
      "source": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
      "tags": [
        "Product"
      ],
      "url": "https://internetcomputer.org/docs/current/references/candid-ref"
    },
    {
      "source": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
      "tags": [
        "Product"
      ],
      "url": "https://internetcomputer.org/docs/current/references/ic-interface-spec"
    },
    {
      "source": "af854a3a-2127-422b-91ae-364da2661108",
      "tags": [
        "Product"
      ],
      "url": "https://github.com/dfinity/candid/blob/master/spec/Candid.md"
    },
    {
      "source": "af854a3a-2127-422b-91ae-364da2661108",
      "tags": [
        "Patch"
      ],
      "url": "https://github.com/dfinity/candid/pull/478"
    },
    {
      "source": "af854a3a-2127-422b-91ae-364da2661108",
      "tags": [
        "Patch",
        "Third Party Advisory"
      ],
      "url": "https://github.com/dfinity/candid/security/advisories/GHSA-7787-p7x6-fq3j"
    },
    {
      "source": "af854a3a-2127-422b-91ae-364da2661108",
      "tags": [
        "Product"
      ],
      "url": "https://internetcomputer.org/docs/current/references/candid-ref"
    },
    {
      "source": "af854a3a-2127-422b-91ae-364da2661108",
      "tags": [
        "Product"
      ],
      "url": "https://internetcomputer.org/docs/current/references/ic-interface-spec"
    }
  ],
  "sourceIdentifier": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
  "vulnStatus": "Modified",
  "weaknesses": [
    {
      "description": [
        {
          "lang": "en",
          "value": "CWE-20"
        },
        {
          "lang": "en",
          "value": "CWE-168"
        },
        {
          "lang": "en",
          "value": "CWE-835"
        },
        {
          "lang": "en",
          "value": "CWE-1288"
        }
      ],
      "source": "6b35d637-e00f-4228-858c-b20ad6e1d07b",
      "type": "Secondary"
    },
    {
      "description": [
        {
          "lang": "en",
          "value": "CWE-835"
        }
      ],
      "source": "nvd@nist.gov",
      "type": "Primary"
    }
  ]
}