8.6
CWE
502
Advisory Published
Updated

GHSA-fpmr-m242-xm7x

First published: Fri Feb 21 2025(Updated: )

### 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 <= 0.13.0` is installed in the deserializing environment (as of publishing there is no newer compatible release of symengine available). Using QPY 13 is strongly recommended for this reason. The symengine 0.14.0 release has addressed the segfault issue, but it is backward incompatible and will not work with any Qiskit release; it also prevents loading a payload generated with any other version of symengine. Using QPY 13 is strongly recommended for this reason. It is also strongly suggested to patch the locally installed version of symengine in the deserializing environment to prevent the specific segfault. The commit [1] can be applied on top of symengine 0.13.0 and used to build a patched python library that will not segfault in the presence of a malformed payload and instead raise a `RuntimeError` which will address the vulnerability. ### Workarounds As QPY is backwards compatible `qiskit.qpy.load()` function will always attempt to deserialize the `symengine`-serialized payloads in QPY format versions 10, 11, and 12. These are any payloads generated with the `use_symengine` argument on `qiskit.qpy.dump()` set to `True` (which is the default value starting in Qiskit 1.0.0. The only option is to disallow parsing if those QPY formats are being read and the `use_symengine` flag was set in the file's header. You can detect whether a payload is potentially vulnerable by using the following function built using the Python standard library: ```python import struct from collections import namedtuple def check_qpy_payload(path: str) -> 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 < 10 or 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

Affected SoftwareAffected VersionHow to fix
pip/qiskit-terra>=0.45.0<=0.46.3
pip/qiskit>=0.45.0<1.3.0
1.3.0

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Frequently Asked Questions

  • What is the severity of GHSA-fpmr-m242-xm7x?

    The vulnerability GHSA-fpmr-m242-xm7x has been classified as high severity due to its potential to cause a denial of service.

  • How do I fix GHSA-fpmr-m242-xm7x?

    To mitigate the GHSA-fpmr-m242-xm7x vulnerability, upgrade the 'qiskit' package to version 1.3.0 or later.

  • Which software packages are affected by GHSA-fpmr-m242-xm7x?

    The affected software packages for GHSA-fpmr-m242-xm7x include 'qiskit-terra' versions between 0.45.0 and 0.46.3 and 'qiskit' versions between 0.45.0 and 1.3.0.

  • What types of attacks does GHSA-fpmr-m242-xm7x enable?

    GHSA-fpmr-m242-xm7x allows attackers to execute denial-of-service attacks by exploiting a crafted QPY file.

  • What components trigger the vulnerability GHSA-fpmr-m242-xm7x?

    The vulnerability GHSA-fpmr-m242-xm7x is triggered by a malformed 'symengine' serialization stream within a 'ParameterExpression' object.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2025 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203