CVE-2026-136922 in PyBioNetGen
Summary
by MITRE • 11/25/2026
PyBioNetGen 0.8.7 contains a code injection vulnerability in ParameterBlock.add_item() and ModelBlock.add_item() that allows attackers to execute Python code by passing parameter expressions to sympy.sympify(). Attackers can supply a crafted BNG-XML model file with Python code in a Parameter expr or value attribute to execute code as the user when loaded with bionetgen.bngmodel().
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 11/25/2026
PyBioNetGen version 0.8.7 is susceptible to a critical remote code execution vulnerability stemming from improper neutralization of special elements used within an expression language, specifically categorized under CWE-94 Improper Control of Generation of Code (Code Injection). The flaw resides in the ParameterBlock.add_item() and ModelBlock.add_item() methods, which are responsible for parsing XML-based model definitions. When these functions process input data from a BNG-XML file, they pass parameter expressions directly to sympy.sympify(). This function is designed to parse mathematical strings into SymPy expression objects but lacks sufficient sanitization against malicious payloads that exploit Python's evaluation capabilities.
The technical mechanism of this vulnerability relies on the fact that sympy.sympify() can execute arbitrary Python code if it encounters specific syntactic patterns within the input string, such as calls to built-in functions or access to module attributes like _import_. An attacker who controls the content of a BNG-XML model file can embed malicious Python expressions in either the expr attribute or the value attribute of a Parameter element. When an application loads this crafted file using bionetgen.bngmodel(), the vulnerable parsing logic invokes sympy.sympify() on these untrusted inputs, resulting in the immediate execution of the embedded code within the context of the user running the PyBioNetGen process.
From an operational perspective, this vulnerability poses a severe risk to system integrity and confidentiality because it allows for arbitrary command execution with the privileges of the invoking user. If the application is run by a privileged account or if the environment contains sensitive data accessible to that user, the attacker can achieve full control over the host system. This aligns with ATT&CK technique T1059 Command and Scripting Interpreter, specifically Python code injection, as well as T1203 Exploitation for Client Execution if the vulnerability is triggered via a client-side application loading malicious models. The impact extends beyond simple data corruption to potential complete compromise of the underlying infrastructure hosting the simulation or analysis tools.
Mitigation strategies must focus on preventing the execution of arbitrary code during the parsing phase. Developers should avoid using sympy.sympify() directly on untrusted input without rigorous validation and sanitization. Instead, they should implement a whitelist approach for allowed mathematical operators and functions, ensuring that only expected syntactic structures are processed. Alternatively, utilizing safer evaluation methods provided by SymPy or other libraries that do not support arbitrary Python expression execution is recommended. For users of PyBioNetGen 0.8.7, it is imperative to upgrade to the patched version as soon as possible where this input validation has been corrected. Until an update is available, applications should strictly validate and sanitize all XML inputs before passing them to parsing functions, or restrict the environment in which these tools run to minimize potential damage from successful exploitation.