CVE-2026-102734: 
Python Análise e mitigação de vulnerabilidades

Visão geral

CVE-2026-102734 is a sandbox escape vulnerability in asteval, a Python expression evaluator by lmfit designed for restricted execution. In versions prior to 1.0.9, the default Interpreter (with numpy enabled) exposes ctypes type objects and permits arbitrary native memory read/write via from_address, allowing an attacker-controlled expression to escape the sandbox, execute code, disclose secrets, or crash the host process. The vulnerability was disclosed on June 11, 2026 via GitHub Security Advisory GHSA-9w56-46f6-3qhx and published to NVD on October 13, 2026. It carries a CVSS v3.1 base score of 5.5 (Medium) (GitHub Advisory, Feedly).

Detalhes técnicos

The root cause is a protection mechanism failure (CWE-693) combining an exposed dangerous method (CWE-749) and improper control of dynamically-managed code resources (CWE-913). safe_getattr in asteval/astutils.py blocks the ctypes module by identity check but does not block ctypes type objects reachable through numpy's ndarray.ctypes wrapper — for example, zeros(1, dtype=int32).ctypes.shape._type_ yields ctypes.c_long, none of whose attribute names are dunders or listed in UNSAFE_ATTRS. Additionally, the node_assign handler performs attribute writes via unfiltered setattr rather than safe_setattr, enabling arbitrary memory writes. An attacker can use the permitted id() builtin to obtain object addresses, then call from_address for arbitrary reads and perform attribute assignment for arbitrary writes — all without using import, dunder attributes, or eval/exec (GitHub Advisory). A public PoC is available at https://gist.github.com/thegr1ffyn/16b67c5f9b5339a7e2bdc91423ff09e3, verified on asteval 1.0.8, numpy 2.4.6, CPython 3.12.3 (GitHub Advisory).

Impacto

Successful exploitation grants an attacker arbitrary in-process native memory read and write primitives, which is functionally equivalent to arbitrary code execution. An attacker can disclose any data in the host process's address space (secrets, cryptographic keys, other users' data), corrupt memory to hijack control flow, or crash the host process (denial of service). Any application that evaluates untrusted or attacker-influenced expressions with asteval while numpy is installed — the default configuration — is affected, with no authentication or special configuration required (GitHub Advisory).

Exploração

A public proof-of-concept exploit script (poc_asteval_ctypes.py) was published by the reporter (thegr1ffyn) alongside the advisory, demonstrating both arbitrary read and write primitives in a self-contained script (GitHub Advisory). No in-the-wild exploitation has been reported as of the disclosure date, and the EPSS score is 0.0 (Feedly). The vulnerability is not listed in the CISA KEV catalog. Exploitation requires that the target application passes attacker-controlled input to an asteval Interpreter with numpy installed, which is the default setup.

Etapas de exploração

  1. Identify target: Locate an application that passes attacker-controlled strings to an asteval Interpreter with numpy installed (the default configuration, use_numpy=True, import disabled).
  2. Obtain a ctypes type object: Craft an expression that traverses numpy's ndarray.ctypes wrapper to reach a ctypes type — e.g., zeros(1, dtype=int32).ctypes.shape._type_ — which safe_getattr permits because none of the attribute names are dunders or in UNSAFE_ATTRS, and the returned value is a type, not the ctypes module itself.
  3. Arbitrary memory read: Use the permitted id() builtin to obtain the address of a target Python object, then call from_address on the ctypes type to read 8 bytes at that address: zeros(1,dtype=int32).ctypes.shape._type_.from_address(id(target_object)).value.
  4. Arbitrary memory write: Create a ctypes object pointing to a chosen address and exploit the unfiltered setattr in node_assign to write an arbitrary value: cell = a.ctypes.shape._type_.from_address(a.ctypes.data); cell.value = 0x4142434445464748.
  5. Achieve objective: Use the read/write primitive to corrupt Python object internals (e.g., function pointers, type structures) to redirect execution, exfiltrate in-memory secrets, or crash the process (GitHub Advisory).

Indicadores de compromisso

  • Logs: Application logs showing evaluation of expressions containing .ctypes.shape._type_, from_address, or id( passed to asteval; unexpected AttributeError or RuntimeError messages from asteval in application logs.
  • Process Behavior: Unexpected crashes or memory corruption errors in Python processes using asteval with numpy; unusual process behavior such as unexpected data output or segmentation faults originating from the asteval interpreter.
  • File System: Presence of poc_asteval_ctypes.py or similar PoC scripts on the system; unexpected files written via ndarray.tofile() or ndarray.dump() if those vectors were also attempted.

Mitigação e soluções alternativas

Upgrade asteval to version 1.0.9, which adds ctypes, dump, and tofile as unsafe attributes of numpy ndarray objects, preventing traversal to ctypes type objects (GitHub Release). The fix also removes SystemExit and GeneratorExit from the symbol table and adds explicit BaseException handling throughout the interpreter (GitHub PR #153). As an immediate workaround for those unable to upgrade, construct the interpreter with use_numpy=False to eliminate the attack surface entirely (GitHub Advisory).

Reações da comunidade

The vulnerability was reported by security researcher thegr1ffyn, who provided a detailed write-up and self-contained PoC in the GitHub advisory (GitHub Advisory). The asteval maintainer (newville) acknowledged the issue and merged the fix (PR #153) on June 11, 2026, the same day the advisory was published, noting it also addressed a related advisory (GHSA-89v8-rhwq-hf77) (GitHub PR #153). The NixOS security tracker referenced the issue in September 2026 in the context of packaging updates (GitHub PR #153).

Recursos adicionais


Origem: Este relatório foi gerado usando IA

Relacionado Python Vulnerabilidades:

CVE ID

Gravidade

Pontuação

Tecnologias

Nome do componente

Exploração do CISA KEV

Tem correção

Data de publicação

CVE-2026-55786HIGH8.4
  • Python logoPython
  • flyto-core
NãoSimOct 14, 2026
CVE-2026-55787HIGH7.1
  • Python logoPython
  • flyto-core
NãoSimOct 14, 2026
CVE-2026-49265MEDIUM6.8
  • Python logoPython
  • dbt-bigquery
NãoSimOct 13, 2026
CVE-2026-49264MEDIUM6.1
  • Python logoPython
  • dagster
NãoSimOct 13, 2026
CVE-2026-102734MEDIUM5.5
  • Python logoPython
  • python-asteval
NãoSimOct 13, 2026

Avaliação de vulnerabilidade gratuita

Compare sua postura de segurança na nuvem

Avalie suas práticas de segurança na nuvem em 9 domínios de segurança para comparar seu nível de risco e identificar lacunas em suas defesas.

Solicitar avaliação

Marque uma demonstração personalizada

Pronto para ver a Wiz em ação?

"A melhor experiência do usuário que eu já vi, fornece visibilidade total para cargas de trabalho na nuvem."
David EstlickCISO
"A Wiz fornece um único painel de vidro para ver o que está acontecendo em nossos ambientes de nuvem."
Adam FletcherDiretor de Segurança
"Sabemos que se a Wiz identifica algo como crítico, na verdade é."
Greg PoniatowskiChefe de Gerenciamento de Ameaças e Vulnerabilidades