Arbitrary Code Execution Vulnerability in python-asteval Package

python-asteval Updated 02 Oct 2025

Summary

24/01/2025
N/A
Yes i
Unrated
Not published

DEBIAN-CVE-2025-24359: ASTEVAL is an evaluator of Python expressions and statements. Affects python-asteval versions < 1.0.6-2. Fixed in 1.0.6-2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The python-asteval package is a library designed for evaluating Python expressions and statements safely. It allows developers to execute Python code within a controlled environment, making it useful for applications that require dynamic code evaluation. However, prior to version 1.0.6, the library had a significant vulnerability that could be exploited if an attacker could manipulate the input to the library, leading to potential security breaches.

Vulnerability Detail

The vulnerability arises from the way the python-asteval library handles FormattedValue AST nodes. Specifically, the on_formattedvalue method utilizes the dangerous format method of the str class, which can be exploited by an attacker. By controlling the input, an attacker can trigger an AttributeError exception, allowing them to access protected attributes and execute arbitrary Python code in the context of the application. This poses a severe risk as it can lead to unauthorized access to sensitive data and system compromise.

How To Fix

Minimum fixed version

1.0.6-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-asteval

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate updating is not feasible, a temporary workaround is to sanitize and validate all inputs to the python-asteval library to prevent untrusted data from being processed. This can help mitigate the risk of exploitation until the package can be updated.

Conclusion

The python-asteval package has a critical vulnerability that allows for arbitrary code execution if an attacker can control the input. It is essential to update to the patched version 1.0.6-2 or later to mitigate this risk. Additionally, implementing input validation can serve as a temporary measure until the update is applied.

See every vulnerability recorded for python-asteval →

Share this vulnerability

FAQ

python-asteval is a library that allows for the evaluation of Python expressions and statements, providing a controlled environment for dynamic code execution.

If your application uses an affected version of python-asteval, an attacker could exploit the vulnerability to execute arbitrary code, potentially compromising sensitive data and system integrity.

Versions prior to 1.0.6 are affected by this vulnerability. It is crucial to update to version 1.0.6-2 or later to ensure security.

Yes, you can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If an immediate update is not possible, ensure that all inputs to the python-asteval library are sanitized and validated to reduce the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for python-asteval.

How To Fix

Minimum fixed version

1.0.6-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-asteval

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback