CVE-2020-13388: OS Command Injection in jw.util
Summary
CVE-2020-13388: OS Command Injection in jw.util. Affects jw-util versions < 2.3. Fixed in 2.3. How to fix ↓
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
jw-util is a Python package available on PyPI that provides various utility functions for working with JSON and YAML configurations. It is commonly used in Python applications to load and manipulate configuration files. However, versions before 2.3 of jw-util are vulnerable to an OS command injection attack when loading configurations with YAML. This vulnerability allows an attacker to execute arbitrary Python code, leading to potential OS command execution.
Vulnerability Detail
The vulnerability in jw-util arises from the insecure loading of configurations using YAML. When loading a configuration with the FromString or FromStream methods, the package does not utilize safe_load, which is a secure method for parsing YAML. As a result, an attacker can craft a malicious YAML configuration that includes Python code, which will be executed when the configuration is loaded. This can lead to unauthorized OS command execution with the privileges of the application or user running the vulnerable code.
How To Fix
Minimum fixed version
2.3
This is the first release that contains the fix.
pip install --upgrade "jw-util==2.3"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a workaround, developers can manually sanitize and validate the YAML configurations before loading them with jw-util. This involves inspecting the configuration files for any suspicious or potentially malicious code and removing or neutralizing it. However, this approach is error-prone and not recommended as it may introduce human errors and overlook certain attack vectors. It is strongly advised to upgrade to the fixed version of jw-util instead.
Conclusion
In conclusion, the jw-util package before version 2.3 is vulnerable to OS command injection when loading YAML configurations. This can lead to unauthorized OS command execution. It is crucial for developers to upgrade to the fixed version and ensure their applications are not exposed to this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for jw-util →
FAQ
jw-util is a Python package available on PyPI that provides utility functions for working with JSON and YAML configurations. It is commonly used in Python applications to load and manipulate configuration files.
This vulnerability allows an attacker to execute arbitrary Python code, potentially leading to unauthorized OS command execution. The impact depends on the privileges of the application or user running the vulnerable code.
To fix this vulnerability, it is recommended to upgrade to version 2.3 or later of jw-util. This version includes secure parsing of YAML configurations, preventing the execution of malicious code.
A workaround involves manually inspecting and sanitizing the YAML configurations before loading them with jw-util. However, this approach is error-prone and not recommended. Upgrading to the fixed version is the recommended solution.
For more information about this vulnerability, you can refer to the official GitHub advisory at: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/06/GHSA-h72c-w3q3-55qq/GHSA-h72c-w3q3-55qq.json