GHSA-cq96-9974-v8hm: Qiskit ibm runtime Dynamic Variable Evaluation Vulnerability

LOW
CVSS 2.8
CWE-627
Published
Advisory Summary

GHSA-cq96-9974-v8hm is a LOW (CVSS 2.8) dynamic variable evaluation vulnerability (CWE-627: Dynamic Variable Evaluation) affecting Qiskit ibm runtime libraries in the PyPI ecosystem. The issue involves dynamic variable evaluation in qiskit-ibm-runtime. Remediation is available by upgrading affected packages to version 0.11.1.

GHSA-cq96-9974-v8hm at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-cq96-9974-v8hm
Severity LOW
CVSS v3.1 Base Score 2.8
CWE Classification CWE-627: Dynamic Variable Evaluation
Affected Product Qiskit ibm runtime
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 2.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:N/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix GHSA-cq96-9974-v8hm

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.

qiskit-ibm-runtime fixed: 0.11.1
pip install qiskit-ibm-runtime>=0.11.1
Verify Direct and Transitive Dependencies

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 GHSA-cq96-9974-v8hm, 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.11.1), 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-627: Dynamic Variable Evaluation, where in a language where the user can influence the name of a variable at runtime, if the variable names are not controlled, an attacker can read or write to arbitrary variables, or access arbitrary functions. 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

### Summary An `eval()` method exists `Options._get_program_inputs`. This is bad in any case, but especially bad because `Options` are also used server side, so this has the potential to expose arbitrary code injection in runtime containers, now or at a later time. ### Details https://github.com/Qiskit/qiskit-ibm-runtime/blob/da94a42060f1a22e6f306227deb45b70e0075723/qiskit_ibm_runtime/options/options.py#L140 ### PoC A local exploit would be something like ```python from qiskit import transpiler class BadActor(transpiler.CouplingMap): def __str__(self): return "print('external code')" ``` Where `print("external code")` can be any arbitrary python code string. Then if you did a normal workflow and used a specifically constructed `CouplingMap` subclass like `BadActor` above: ```python from qiskit_ibm_runtime import QiskitRuntimeService, Session, Options, Sampler from qiskit import QuantumCircuit cmap = BadActor.from_line(42) service = QiskitRuntimeService() options = Options(optimization_level=1) options.simulator = dict(coupling_map=cmap)) bell = QuantumCircuit(2) bell.h(0) bell.cx(0, 1) bell.measure_all() with Session(service=service, backend="ibmq_qasm_simulator") as session: sampler = Sampler(session=session, options=options).run(bell) ``` This will print `external code` ### Impact Security vulnerability.

GHSA-cq96-9974-v8hm Affected Qiskit ibm runtime Versions

1 component(s)
Fixed Versions:
0.11.1
Product / Package Ecosystem Affected Versions Fixed Version
qiskit-ibm-runtime
PyPI
≥ 0.11.0
< 0.11.1
0.11.1

References

Frequently Asked Questions

What is GHSA-cq96-9974-v8hm?
GHSA-cq96-9974-v8hm is a security vulnerability in Qiskit ibm runtime involving Dynamic Variable Evaluation in qiskit-ibm-runtime under CWE-627: Dynamic Variable Evaluation.
Which Qiskit ibm runtime versions are affected?
Affected versions include releases prior to 0.11.1 across affected packages: qiskit-ibm-runtime.
What version fixes GHSA-cq96-9974-v8hm?
Upgrading to 0.11.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is qiskit-ibm-runtime affected?
Yes, qiskit-ibm-runtime is affected in releases prior to 0.11.1. Upgrade your dependency to 0.11.1 or later.
What is the CVSS score of GHSA-cq96-9974-v8hm?
GHSA-cq96-9974-v8hm has a CVSS v3.1 base score of 2.8 (LOW) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:N/I:L/A:N.
What CWE is associated with GHSA-cq96-9974-v8hm?
GHSA-cq96-9974-v8hm is classified under CWE-627: Dynamic Variable Evaluation (In a language where the user can influence the name of a variable at runtime, if the variable names are not controlled, an attacker can read or write to arbitrary variables, or access arbitrary functions.).
How can I check PyPI dependencies for GHSA-cq96-9974-v8hm?
Run the dependency tree command: 'pip show qiskit-ibm-runtime'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cq96-9974-v8hm",
  "modified" : "2024-03-20T15:41:27Z",
  "published" : "2024-03-20T15:41:26Z",
  "aliases" : [ ],
  "summary" : "Dynamic Variable Evaluation in qiskit-ibm-runtime",
  "details" : "### Summary\n\nAn `eval()` method exists `Options._get_program_inputs`. This is bad in any case, but especially bad because `Options` are also used server side, so this has the potential to expose arbitrary code injection in runtime containers, now or at a later time.\n\n### Details\n\nhttps://github.com/Qiskit/qiskit-ibm-runtime/blob/da94a42060f1a22e6f306227deb45b70e0075723/qiskit_ibm_runtime/options/options.py#L140\n\n### PoC\nA local exploit would be something like\n\n```python\nfrom qiskit import transpiler\n\nclass BadActor(transpiler.CouplingMap):\n    def __str__(self):\n        return \"print('external code')\"\n\n```\n\nWhere `print(\"external code\")` can be any arbitrary python code string.\n\nThen if you did a normal workflow and used a specifically constructed `CouplingMap` subclass like `BadActor` above:\n\n```python\nfrom qiskit_ibm_runtime import QiskitRuntimeService, Session, Options, Sampler\nfrom qiskit import QuantumCircuit\n\ncmap = BadActor.from_line(42)\nservice = QiskitRuntimeService()\noptions = Options(optimization_level=1)\noptions.simulator = dict(coupling_map=cmap))\n\nbell = QuantumCircuit(2)\nbell.h(0)\nbell.cx(0, 1)\nbell.measure_all()\n\nwith Session(service=service, backend=\"ibmq_qasm_simulator\") as session:\n    sampler = Sampler(session=session, options=options).run(bell)\n```\n\nThis will print `external code`\n\n### Impact\n\nSecurity vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "qiskit-ibm-runtime"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.11.0"
      }, {
        "fixed" : "0.11.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Qiskit/qiskit-ibm-runtime/security/advisories/GHSA-cq96-9974-v8hm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Qiskit/qiskit-ibm-runtime/commit/2e8c8c8df83ba310f52d1651a426bad879e0bd38"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Qiskit/qiskit-ibm-runtime"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-627" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-20T15:41:26Z",
    "nvd_published_at" : null
  }
}