CVE-2024-29032: Qiskit ibm runtime `qiskit_ibm_runtime.RuntimeDecoder` Can Execute Arbitrary Code Vulnerability
MODERATECVE-2024-29032 is a MODERATE (CVSS 5.3) `qiskit_ibm_runtime.runtimedecoder` can execute arbitrary code vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Qiskit ibm runtime libraries in the PyPI ecosystem. The issue involves `qiskit_ibm_runtime.runtimedecoder` can execute arbitrary code. Remediation is available by upgrading affected packages to version 0.21.2.
CVE-2024-29032 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L).
How to Fix CVE-2024-29032
To remediate this vulnerability, upgrade all affected Qiskit ibm runtime dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install qiskit-ibm-runtime>=0.21.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show qiskit-ibm-runtime
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-29032, inspect your installed packages using pip:
pip show qiskit-ibm-runtime
Analyze the terminal output to locate any version of Qiskit ibm runtime in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.21.2), your application is affected.
Note: The pip show qiskit-ibm-runtime command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Qiskit ibm runtime, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-29032 Affected Qiskit ibm runtime Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
qiskit-ibm-runtime
|
PyPI |
≥ 0.1.0
< 0.21.2
|
0.21.2
|
References
Frequently Asked Questions
What is CVE-2024-29032?
Which Qiskit ibm runtime versions are affected?
What version fixes CVE-2024-29032?
Is qiskit-ibm-runtime affected?
What is the CVSS score of CVE-2024-29032?
What CWE is associated with CVE-2024-29032?
How can I check PyPI dependencies for CVE-2024-29032?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x4x5-jv3x-9c7m",
"modified" : "2024-03-20T21:37:56Z",
"published" : "2024-03-20T15:44:22Z",
"aliases" : [ "CVE-2024-29032" ],
"summary" : "`qiskit_ibm_runtime.RuntimeDecoder` can execute arbitrary code",
"details" : "### Summary\n\ndeserializing json data using `qiskit_ibm_runtime.RuntimeDecoder` can be made to execute arbitrary code given a correctly formatted input string\n\n### Details\n\n`RuntimeDecoder` is supposed to be able to deserialize JSON strings containing various special types encoded via `RuntimeEncoder`. However, one can structure a malicious payload to cause the decoder to spawn a subprocess and execute arbitrary code, exploiting this block of code: https://github.com/Qiskit/qiskit-ibm-runtime/blob/16e90f475e78a9d2ae77daa139ef750cfa84ca82/qiskit_ibm_runtime/utils/json.py#L156-L159\n\n### PoC\n\n```python\nmalicious_data = {\n \"__type__\": \"settings\",\n \"__module__\": \"subprocess\",\n \"__class__\": \"Popen\",\n \"__value__\": {\n \"args\": [\"echo\", \"hi\"]\n },\n}\njson_str = json.dumps(malicious_data)\n\n_ = json.loads(json_str, cls=qiskit_ibm_runtime.RuntimeDecoder) # prints \"hi\" to the terminal\n```\n(where obviously \"echo hi\" can be replaced with something much more malicious)\n\nnotably the following also makes it through the runtime API, with `malicious_data` serialized client-side via `RuntimeEncoder` (and therefore presumably deserialized server-side via `RuntimeDecoder`?)\n```python\nservice = qiskit_ibm_runtime(<ibm_cloud_credentials>)\njob = service.run(\"qasm3-runner\", malicious_data)\nprint(job.status()) # prints \"JobStatus.QUEUED\"\n```\n\n### Impact\n\ni don't know if `qiskit_ibm_runtime.RuntimeDecoder` is used server-side so this may or may not be a serious vulnerability on your end (however it's definitely a security hole for anyone using the library to deserialize third-party data)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "qiskit-ibm-runtime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.1.0"
}, {
"fixed" : "0.21.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Qiskit/qiskit-ibm-runtime/security/advisories/GHSA-x4x5-jv3x-9c7m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-29032"
}, {
"type" : "WEB",
"url" : "https://github.com/Qiskit/qiskit-ibm-runtime/commit/b78fca114133051805d00043a404b25a33835f4d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Qiskit/qiskit-ibm-runtime"
}, {
"type" : "WEB",
"url" : "https://github.com/Qiskit/qiskit-ibm-runtime/blob/16e90f475e78a9d2ae77daa139ef750cfa84ca82/qiskit_ibm_runtime/utils/json.py#L156-L159"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-502" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-03-20T15:44:22Z",
"nvd_published_at" : "2024-03-20T21:15:31Z"
}
}