VAITP Dataset

← Back to the dataset

CVE-2026-133708

Code execution via malicious CIF symmetry ops in diffpy.structure ≤ 3.5.0

  • CVSS 8.5
  • CWE-95
  • Input Validation and Sanitization
  • Local

diffpy.structure before 3.5.1 contains a code execution vulnerability that allows attackers to run Python code by supplying crafted CIF symmetry operations passed to eval() in get_symop(). Attackers can embed expressions in the _space_group_symop_operation_xyz or _symmetry_equiv_pos_as_xyz loop to execute code with victim privileges when the CIF file is parsed locally.

CVSS base score
8.5
Published
2026-11-20
OWASP
A03 Injection
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Local
Impact
Arbitrary Code Execution
Affected component
diffpy.structure
Fixed by upgrading
Yes

Solution

Upgrade diffpy.structure to version 3.5.1 or later.

Vulnerable code sample

import os
from diffpy.structure import Structure

def load_structure(cif_path):
    """Load a CIF file and return a Structure object."""
    with open(cif_path, 'r') as f:
        cif_text = f.read()
    # VULNERABLE: eval() on untrusted CIF symmetry operation
    symop_str = extract_symop(cif_text)          # extracts _space_group_symop_operation_xyz line
    symop = eval(symop_str)                     # executes attacker-controlled code
    struct = Structure()
    struct.symop = symop
    return struct

def extract_symop(cif_text):
    """Return the first symmetry operation string from a CIF file."""
    for line in cif_text.splitlines():
        if line.strip().startswith('_space_group_symop_operation_xyz'):
            # line format: _space_group_symop_operation_xyz   'x,y,z'
            return line.split()[-1].strip("'")
    return 'x,y,z'

Patched code sample

import os
import ast
from diffpy.structure import Structure

def load_structure(cif_path):
    """Load a CIF file and return a Structure object."""
    with open(cif_path, 'r') as f:
        cif_text = f.read()
    # FIX: use ast.literal_eval to avoid code execution
    symop_str = extract_symop(cif_text)          # extracts _space_group_symop_operation_xyz line
    symop = ast.literal_eval(f"'{symop_str}'")   # safely parse the string without eval
    struct = Structure()
    struct.symop = symop
    return struct

def extract_symop(cif_text):
    """Return the first symmetry operation string from a CIF file."""
    for line in cif_text.splitlines():
        if line.strip().startswith('_space_group_symop_operation_xyz'):
            return line.split()[-1].strip("'")
    return 'x,y,z'

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve2026133708,
  title        = {{Code execution via malicious CIF symmetry ops in diffpy.structure ≤ 3.5.0}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-133708},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-133708/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.