{"id":"CVE-2025-24359","state":"PUBLISHED","title":"ASTEVAL Vulnerable to Maliciously Crafted Format Strings Leading to Sandbox Escape","description":"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.","publishedAt":"2025-01-24T16:52:44.304Z","updatedAt":"2025-02-12T20:01:18.799Z","severity":{"score":8.4,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"GitHub_M"},"assigner":"GitHub_M","products":["lmfit asteval"],"affected":[{"vendor":"lmfit","product":"asteval","versions":[{"version":"< 1.0.6","status":"affected"}]}],"references":["https://github.com/lmfit/asteval/security/advisories/GHSA-3wwr-3g9f-9gc7","https://github.com/lmfit/asteval/blob/cfb57f0beebe0dc0520a1fbabc35e66060c7ea71/asteval/asteval.py#L507","https://lucumr.pocoo.org/2016/12/29/careful-with-str-format"],"weaknesses":["CWE-134","CWE-749"],"ingestedAt":"2026-10-29T20:08:47.682Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/24xxx/CVE-2025-24359.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.1","cveMetadata":{"cveId":"CVE-2025-24359","state":"PUBLISHED","datePublished":"2025-01-24T16:52:44.304Z","dateUpdated":"2025-02-12T20:01:18.799Z","assignerShortName":"GitHub_M","assignerOrgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateReserved":"2025-01-20T15:18:26.989Z"},"containers":{"cna":{"title":"ASTEVAL Vulnerable to Maliciously Crafted Format Strings Leading to Sandbox Escape","descriptions":[{"lang":"en","value":"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."}],"affected":[{"vendor":"lmfit","product":"asteval","versions":[{"version":"< 1.0.6","status":"affected"}]}],"references":[{"url":"https://github.com/lmfit/asteval/security/advisories/GHSA-3wwr-3g9f-9gc7","name":"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","name":"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","name":"https://lucumr.pocoo.org/2016/12/29/careful-with-str-format","tags":["x_refsource_MISC"]}],"metrics":[{"cvssV3_1":{"attackComplexity":"LOW","attackVector":"LOCAL","availabilityImpact":"HIGH","baseScore":8.4,"baseSeverity":"HIGH","confidentialityImpact":"HIGH","integrityImpact":"HIGH","privilegesRequired":"NONE","scope":"UNCHANGED","userInteraction":"NONE","vectorString":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","version":"3.1"}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-134","lang":"en","description":"CWE-134: Use of Externally-Controlled Format String","type":"CWE"}]},{"descriptions":[{"cweId":"CWE-749","lang":"en","description":"CWE-749: Exposed Dangerous Method or Function","type":"CWE"}]}],"providerMetadata":{"shortName":"GitHub_M","orgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateUpdated":"2025-01-25T00:54:58.877Z"},"source":{"advisory":"GHSA-3wwr-3g9f-9gc7","discovery":"UNKNOWN"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2025-24359","role":"CISA Coordinator","options":[{"Exploitation":"poc"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2025-01-24T17:28:13.184358Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-02-12T20:01:18.799Z"}}]}}}