{"id":"CVE-2025-24359","published":"2025-01-24T16:52:44Z","modified":"2025-02-12T20:01:18Z","title":"ASTEVAL Vulnerable to Maliciously Crafted Format Strings Leading to Sandbox Escape","vendor":"lmfit","product":"asteval","tier":"tail","description":{"text":"ASTEVAL is an evaluator of Python expressions and statements. Prior to version 1.0.6, if an attacker can control the input to the `asteval` library, they can bypass asteval's restrictions and execute arbitrary Python code in the context of the application using the library. The vulnerability is rooted in how `asteval` performs handling of `FormattedValue` AST nodes. In particular, the `on_formattedvalue` value uses the dangerous format method of the str class. The code allows an attacker to manipulate the value of the string used in the dangerous call `fmt.format(__fstring__=val)`. This vulnerability can be exploited to access protected attributes by intentionally triggering an `AttributeError` exception. The attacker can then catch the exception and use its `obj` attribute to gain arbitrary access to sensitive or protected object properties. Version 1.0.6 fixes this issue.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.4,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00278,"percentile":0.20496,"provenance":"source"},"cwes":[{"id":"CWE-134","name":"Use of Externally-Controlled Format String"},{"id":"CWE-749","name":"Exposed Dangerous Method or Function"}],"references":[{"url":"https://github.com/lmfit/asteval/security/advisories/GHSA-3wwr-3g9f-9gc7","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/lmfit/asteval/blob/cfb57f0beebe0dc0520a1fbabc35e66060c7ea71/asteval/asteval.py#L507","tags":["x_refsource_MISC"]},{"url":"https://lucumr.pocoo.org/2016/12/29/careful-with-str-format","tags":["x_refsource_MISC"]}],"priority":{"score":10.0,"factors":[{"name":"EPSS percentile","points":4.1},{"name":"CVSS severity","points":5.88}]},"vendorSlug":"lmfit","affectedVersions":[{"vendor":"lmfit","product":"asteval","versions":["< 1.0.6"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total","timestamp":"2025-01-24T17:28:13.184358Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"asteval","vulnerableRanges":["<1.0.6"],"patched":["1.0.6"],"from":["GHSA-3wwr-3g9f-9gc7","PYSEC-2026-1195"],"provenance":"source"}],"summary":{"text":"ASTEVAL, the Python expression and statement evaluator from lmfit, has a flaw in how it handles FormattedValue AST nodes, where an externally controlled format string reaches the dangerous str.format method and allows sandbox escape. An attacker who can supply input to the asteval library, and who is able to trigger an AttributeError and read its obj attribute, can execute arbitrary Python code in the context of the application using it.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:00:19Z"},"euvd":{"id":"EUVD-2025-0127","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-lmfit-asteval-cve-2025-24359","children":[{"from":"CVE-2025-24359","to":"CVE-2026-55244","relation":"successor","confidence":"high","kind":"lineage","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:asteval","fromFixed":"1.0.6","toFixed":"1.0.9","daysApart":598},{"kind":"same-code","provenance":"machine","files":["asteval/asteval.py","asteval/astutils.py"],"commits":["https://github.com/lmfit/asteval/commit/45bb47533f7abb5479618ae7f6a809215700dcb2","https://github.com/lmfit/asteval/commit/9c625b3674f8d05f206708bb85afca17a87694a4","https://github.com/lmfit/asteval/commit/c49c99a67acb63eb7410231932250bd820380e45"],"basis":"rarely changed file"}]},{"from":"CVE-2025-24359","to":"CVE-2026-102734","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["asteval/asteval.py","asteval/astutils.py"],"commits":["https://github.com/lmfit/asteval/commit/45bb47533f7abb5479618ae7f6a809215700dcb2","https://github.com/lmfit/asteval/commit/a3e56e7f8ed567a4817684d94213b290359077b4"],"basis":"rarely changed file"}]}],"packageHistory":[{"cve":"CVE-2025-24359","published":"2025-01-24","fixed":"1.0.6","kev":false},{"cve":"CVE-2026-55244","published":"2026-09-14","fixed":"1.0.9","kev":false}],"package":"PyPI:asteval"}}