GitHub Advisoryadvisory · PyPI
GHSA-fpmr-m242-xm7x Malciously crafted QPY files can allows Remote Attackers to Cause Denial of Service in Qiskit
HIGH
Official page ↗
- Aliases
- CVE-2025-1403
- Ecosystem
- PyPI
- Packages
- qiskit, qiskit-terra
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:N/A:H
- Weaknesses
- CWE-502
- Reviewed
- 2025-02-21
Affected packages
• PyPI qiskit: >= 0.45.0, < 1.3.0 → fixed in 1.3.0
• PyPI qiskit-terra: >= 0.45.0, <= 0.46.3 (no fix yet)
Description
Impact
A maliciously crafted QPY file containing a malformed `symengine` serialization stream as part of the larger QPY serialization of a `ParameterExpression` object can cause a segfault within the `symengine` library, allowing an attacker to terminate the hosting process deserializing the QPY payload.
Patches
This issue is addressed in 1.3.0 when using QPY format version 13. QPY format versions 10, 11, and 12 are all still inherently vulnerable if they are using symengine symbolic encoding and `symengine bool:
"""Function to check if a QPY payload is potentially vulnerable to a symengine vulnerability.
Args:
path: The path to the QPY file
Returns:
Whether the specified payload is potentially vulnerable. If ``True`` the conditions for
being vulnerable exist, however the payload may not be vulnerable it can't be detected
until trying to deserialize.
"""
with open(path, "rb") as file_obj:
version = struct.unpack("!6sB", file_obj.read(7))[1]
if version = 13:
return False
file_obj.seek(0)
header_tuple = namedtuple(
"FILE_HEADER",
[
"preface",
"qpy_version",
"major_version",
"minor_version",
"patch_version",
"num_programs",
"symbolic_encoding",
],
)
header_pack_str = "!6sBBBBQc"
header_read_size = struct.calcsize(header_pack_str)
data = struct.unpack(header_pack_str, file_obj.read(header_read_size))
header = header_tuple(*data)
return header.symbolic_encoding == b"e"
```
Note, this function does not tell you whether the payload is malicious and will cause the segfault, just that conditions for it to be potentially malicious exist. It's not possible to know ahead of time whether `symengine` will segfault until the data is passed to that library.
References
[1] https://github.com/symengine/symengine/commit/eb3e292bf13b2dfdf0fa1c132944af8df2bc7d51
Related
Alias · CVE (1)
- CVE-2025-1403 Qiskit SDK 0.45.0 through 1.2.4 could allow a remote attacker to cause a denial of service using a maliciously crafted QPY file containing… vulnerability
Weakness · CWE (1)
- CWE-502 Deserialization of Untrusted Data weakness
References
- https://github.com/Qiskit/qiskit/security/advisories/GHSA-fpmr-m242-xm7x web
- https://nvd.nist.gov/vuln/detail/CVE-2025-1403 advisory
- https://github.com/symengine/symengine/commit/eb3e292bf13b2dfdf0fa1c132944af8df2bc7d51 web
- https://github.com/Qiskit/qiskit package
- https://www.ibm.com/support/pages/node/7183868 web