VAITP Dataset

← Back to the dataset

CVE-2026-134694

Code injection via eval() in Gammapy WcsGeom.from_header() using crafted WCSSHAPE FITS header.

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

Gammapy through 2.1 contains a code injection vulnerability in WcsGeom.from_header() that passes the WCSSHAPE FITS header card to eval(). Attackers can supply a crafted .fits file with a Python expression in WCSSHAPE, executing code as the user who loads it via Map.read().

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

Solution

Upgrade Gammapy to version 2.2 or later, which removes the unsafe eval() call in WcsGeom.from_header().

Vulnerable code sample

import ast
from astropy.io import fits

def load_wcs_geom(header_path: str):
    """
    Load a WcsGeom from a FITS header.
    Vulnerable to code injection via the WCSSHAPE header card.
    """
    hdr = fits.getheader(header_path)
    # VULNERABLE: eval on untrusted header value
    wcs_shape = eval(hdr['WCSSHAPE'])
    return {
        'shape': wcs_shape,
        'crval': hdr.get('CRVAL1'),  # example additional fields
        'crpix': hdr.get('CRPIX1')
    }

Patched code sample

import ast
from astropy.io import fits

def load_wcs_geom(header_path: str):
    """
    Load a WcsGeom from a FITS header.
    Fixed by safely parsing the header value.
    """
    hdr = fits.getheader(header_path)
    # FIX: use literal_eval to avoid executing code
    wcs_shape = ast.literal_eval(hdr['WCSSHAPE'])
    return {
        'shape': wcs_shape,
        'crval': hdr.get('CRVAL1'),  # example additional fields
        'crpix': hdr.get('CRPIX1')
    }

Cite this entry

@misc{vaitp:cve2026134694,
  title        = {{Code injection via eval() in Gammapy WcsGeom.from_header() using crafted WCSSHAPE FITS header.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-134694},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-134694/}}
}

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.