asteval sandbox escape: arbitrary native memory read/write via numpy ctypes in default asteval Interpreter
What fixes it
- 1.0.9asteval, PyPIOSV
pip install "asteval>=1.0.9"
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
asteval is a Python expression evaluator designed for restricted execution. Prior to 1.0.9, in asteval/astutils.py, the default Interpreter with numpy enabled exposes a ctypes type and permits from_address memory access. safe_getattr blocks the ctypes module but not reachable ctypes type objects, while attribute assignments use unfiltered setattr instead of safe_setattr. An attacker-controlled expression can derive an address with id, read memory through from_address, and write through an attribute assignment. The expression can read or corrupt arbitrary process memory, escape the intended sandbox, execute code, disclose secrets, or crash the host process. This issue is fixed in version 1.0.9.
Text from CVE List
Affected versions 45
- astevalaffected: < 1.0.9CVE List
- asteval, PyPIfrom first release, fixed in 1.0.9OSV
- asteval, PyPI0.9OSV
- asteval, PyPI0.9.1OSV
- asteval, PyPI0.9.10OSV
- asteval, PyPI0.9.11OSV
- asteval, PyPI0.9.12OSV
- asteval, PyPI0.9.13OSV
- asteval, PyPI0.9.14OSV
- asteval, PyPI0.9.15OSV
- asteval, PyPI0.9.16OSV
- asteval, PyPI0.9.17OSV
- asteval, PyPI0.9.18OSV
- asteval, PyPI0.9.19OSV
- asteval, PyPI0.9.2OSV
- asteval, PyPI0.9.20OSV
- asteval, PyPI0.9.21OSV
- asteval, PyPI0.9.22OSV
- asteval, PyPI0.9.23OSV
- asteval, PyPI0.9.24OSV
- asteval, PyPI0.9.25OSV
- asteval, PyPI0.9.26OSV
- asteval, PyPI0.9.27OSV
- asteval, PyPI0.9.28OSV
- asteval, PyPI0.9.29OSV
- asteval, PyPI0.9.3OSV
- asteval, PyPI0.9.30OSV
- asteval, PyPI0.9.31OSV
- asteval, PyPI0.9.32OSV
- asteval, PyPI0.9.33OSV
- asteval, PyPI0.9.4OSV
- asteval, PyPI0.9.5OSV
- asteval, PyPI0.9.6OSV
- asteval, PyPI0.9.7OSV
- asteval, PyPI0.9.8OSV
- asteval, PyPI0.9.9OSV
- asteval, PyPI1.0.0OSV
- asteval, PyPI1.0.1OSV
- asteval, PyPI1.0.2OSV
- asteval, PyPI1.0.3OSV
- asteval, PyPI1.0.4OSV
- asteval, PyPI1.0.5OSV
- asteval, PyPI1.0.6OSV
- asteval, PyPI1.0.7OSV
- asteval, PyPI1.0.8OSV