CVE-2019-9710: webargs - Thread-Safety Issue in JSON Parsing
Summary
CVE-2019-9710: An issue was discovered in webargs before 5.1.3, as used with marshmallow and other products. Affects webargs versions < 5.1.3. Fixed in 5.1.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
webargs is a Python library used for parsing and validating HTTP request arguments. It is commonly used with marshmallow and other related products. The library provides a convenient way to parse JSON bodies in HTTP requests. However, prior to version 5.1.3, webargs had a thread-safety issue in its JSON parsing functionality. This issue could lead to incorrect parsing of JSON payloads when multiple requests are processed concurrently.
Vulnerability Detail
The vulnerability (CVE-2019-9710) in webargs arises from the use of a short-lived cache to store parsed JSON bodies. This cache is not thread-safe, meaning that if multiple requests are processed simultaneously, there is a possibility of incorrect JSON payloads being parsed. This could result in unexpected behavior or security vulnerabilities in applications that rely on webargs for JSON parsing.
How To Fix
Minimum fixed version
5.1.3
This is the first release that contains the fix.
pip install --upgrade "webargs==5.1.3"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a workaround, developers can implement their own thread-safe JSON parsing logic instead of relying on webargs. This can be achieved by using other libraries or built-in functionality provided by the programming language. Here is an example of how to parse JSON using the json module in Python:
import json
def parse_json(json_string):
try:
parsed_json = json.loads(json_string)
# Process the parsed JSON
...
except json.JSONDecodeError:
# Handle JSON parsing error
...
Conclusion
In conclusion, the vulnerability (CVE-2019-9710) in webargs arises from a thread-safety issue in its JSON parsing functionality. Upgrading to webargs version 5.1.3 or later is recommended to fix this vulnerability. Alternatively, developers can implement their own thread-safe JSON parsing logic. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for webargs →
FAQ
webargs is a Python library used for parsing and validating HTTP request arguments. It provides a convenient way to handle various types of request parameters, including JSON bodies.
The vulnerability in webargs could lead to incorrect parsing of JSON payloads when multiple requests are processed concurrently. This could result in unexpected behavior or security vulnerabilities in applications that rely on webargs for JSON parsing.
To fix this vulnerability, it is recommended to upgrade webargs to version 5.1.3 or later. This version includes the necessary fixes to ensure thread-safety in JSON parsing.
As a workaround, developers can implement their own thread-safe JSON parsing logic instead of relying on webargs. This can be achieved by using other libraries or built-in functionality provided by the programming language.
You can find more information about this vulnerability in the webargs advisory database: https://github.com/pypa/advisory-database/blob/main/vulns/webargs/PYSEC-2019-139.yaml
Related vulnerabilities
Recent vulnerabilities recorded for webargs.