CVE-2023-39631: Arbitrary Code Execution in numexpr
Summary
CVE-2023-39631: An issue in LanChain-ai Langchain v.0.0.245 allows a remote attacker to execute arbitrary code via the evaluate function in the numexpr library. Affects numexpr versions < 2.8.5. Fixed in 2.8.5. How to fix ↓
Also tracked for
The same CVE-2023-39631 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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.
No signup required · Results in about 60 seconds
Background
numexpr is a Python package available on PyPI that provides fast numerical expression evaluation. It is commonly used in scientific computing and data analysis applications. The vulnerability in version 0.0.245 of the LanChain-ai Langchain software allows a remote attacker to execute arbitrary code through the evaluate function in the numexpr library.
Vulnerability Detail
The vulnerability arises due to insufficient input validation in the evaluate function of the numexpr library. By crafting a malicious input, an attacker can exploit this vulnerability to execute arbitrary code on the target system. This can lead to various consequences, including unauthorized access, data theft, or system compromise. The vulnerability has a CVSSv3 score of 9.8, indicating its critical severity.
How To Fix
Minimum fixed version
2.8.5
This is the first release that contains the fix.
pip install --upgrade "numexpr==2.8.5"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can disable or restrict the usage of the evaluate function in the numexpr library. This can be achieved by modifying the code that invokes the evaluate function or by implementing input validation checks to ensure only trusted inputs are processed. Here is an example of how to disable the evaluate function:
import numexpr
def evaluate(expression):
raise NotImplementedError('evaluate function is disabled due to security vulnerability')
# Rest of the code
Conclusion
In conclusion, the vulnerability in the numexpr library used by LanChain-ai Langchain allows remote code execution, posing a significant security risk. It is crucial to update the numexpr package to a patched version or apply the provided workaround to mitigate the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for numexpr →
FAQ
numexpr is a Python package that provides fast numerical expression evaluation. It is commonly used in scientific computing and data analysis applications.
This vulnerability allows a remote attacker to execute arbitrary code on the target system. This can lead to unauthorized access, data theft, or system compromise.
The CVSSv3 score of this vulnerability is 9.8, indicating its critical severity.
To fix this vulnerability, update the numexpr package to a version that includes a patch for this issue. Alternatively, you can disable or restrict the usage of the evaluate function in the numexpr library.
Yes, as a temporary workaround, you can disable or restrict the usage of the evaluate function in the numexpr library. See the 'workaround' section for more details.