Executive brief
asteval is a Python library that safely evaluates mathematical and Python expressions within a sandboxed interpreter. An attacker who can supply untrusted expressions to the interpreter can raise uncontrolled exceptions (SystemExit, KeyboardInterrupt, GeneratorExit, or BaseException) that bypass the sandbox's exception handling and propagate to the calling application, causing process termination or disruption of signal handlers and cleanup code. This results in denial of service.
Technical details
The vulnerability exists in asteval's exception hierarchy handling. The FROM_PY tuple in astutils.py (lines 89–108) exposes dangerous exception classes including BaseException, SystemExit, KeyboardInterrupt, and GeneratorExit to sandbox users. When a user expression raises one of these exceptions, they bypass the except Exception: guards in run() (line 322) and eval() (line 370) because these non-Exception subclasses of BaseException are not caught by except Exception:. The exception then propagates uncontrolled to the calling application. The attack is network-reachable if the application accepts user-supplied expressions, requires no authentication or user interaction, and affects availability through process termination or handler disruption. The vulnerability exists in all versions up to and including 1.0.6. A patch is available in version 1.0.9, which removes the dangerous classes from FROM_PY.
Affected products
- lmfit asteval < 1.0.9
Timeline
- 2026-06-09: disclosed: Vulnerability discovered during code review
- 2026-06-11: advisory: GitHub Security Advisory published
- 2026-08-20: patched: Fix released in version 1.0.9