/

CVE-2026-133708

Severity:

HIGH RISK

(7.8)

Code Injection (CWE-95) in diffpy.structure CIF Parser

CVE-2026-133708

Received

Vulnerability type

Category:

Code Injection

CWE:

CWE-95

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

diffpy.structure can execute Python code when crafted CIF symmetry-operation values are passed to eval() in get_symop(). If a victim parses a malicious CIF file, embedded expressions may run with the privileges of the parsing process.

Affected context

The issue affects diffpy.structure versions before 3.5.1 when CIF files are parsed and symmetry operations are read from the _space_group_symop_operation_xyz or _symmetry_equiv_pos_as_xyz loop. Risk depends on whether an attacker can supply a CIF file that a victim or automated workflow subsequently parses.

Exploit preconditions

  • Attack surface: Local CIF file parsing
  • Required access: Ability to provide or influence a CIF file that the victim parses
  • Trigger point: Processing symmetry-operation values in get_symop()
  • Why exploitation is possible: Crafted values reach Python's eval() and may be interpreted as executable expressions

Why this happens

The parser evaluates symmetry-operation input as Python code rather than treating it strictly as data. This is an eval injection weakness mapped to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code. Untrusted CIF content can therefore cross from data parsing into code execution.

Potential impact

  • An attacker may execute Python code with the parsing process's privileges.
  • Local files or accessible data could be read, changed, or deleted.
  • The affected application or workflow could be disrupted.
  • Credentials or other resources available to the process could be exposed.

General mitigation guidance

Defensive patterns focus on preventing untrusted input from being interpreted as code.

  • Replace dynamic evaluation with a dedicated parser or strict, non-executable grammar for symmetry operations.
  • Validate parsed values against an explicit schema and reject unexpected syntax before use.
  • Treat CIF files from external or user-controlled sources as untrusted.
  • Parse files in an isolated, least-privilege environment with limited filesystem and network access.
  • Avoid passing raw configuration or file content to general-purpose evaluation functions.

How teams detect issues like this

  • Use static analysis to identify eval() and similar dynamic execution functions that receive file-derived or otherwise untrusted values.
  • Review parsing paths to confirm CIF fields cannot reach code-evaluation APIs.
  • Add tests and policy checks that reject executable parsing patterns and unexpected symmetry-operation syntax.
  • Consider automated code review tools to flag data-to-evaluation flows.

Sources

SourceLink
github.comgithub.com/diffpy/diffpy.structure/blob/3.5.0/src/diffpy/structure/parsers/p_cif.py
github.comgithub.com/diffpy/diffpy.structure/commit/f4be1d534fa9cf488c8e83f258e59fe09b526f62
github.comgithub.com/diffpy/diffpy.structure/issues/204
github.comgithub.com/diffpy/diffpy.structure/releases/tag/3.5.1
vulncheck.comvulncheck.com/advisories/diffpy-structure-before-3.5.1-code-execution-via-eval-in-get-symop-cif-parsing

Frequently asked

questions

The described trigger is parsing a crafted CIF file locally. Remote exposure depends on whether an application or service accepts and parses attacker-supplied CIF files.

An attacker needs a way to provide or influence a CIF file that a victim or automated process will parse. The resulting code runs with the parser process's privileges.

Avoid evaluating file-provided text as code. Use a constrained parser for symmetry-operation syntax and validate the result against an explicit format.

Treat externally sourced files as untrusted, review data flows into dynamic execution APIs, and use least-privilege isolation when processing files.

Find out what's already
exploitable in your codebase.