CVE-2018-20325: Definitions Code Injection Vulnerability
HIGHCVE-2018-20325 is a HIGH (CVSS 9.8) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Definitions libraries in the PyPI ecosystem. The issue involves code injection in danijar definitions. Remediation is available in the latest vendor maintenance releases.
CVE-2018-20325 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2018-20325
To remediate this vulnerability, upgrade all affected Definitions dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install definitions>=Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show definitions
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2018-20325, inspect your installed packages using pip:
pip show definitions
Analyze the terminal output to locate any version of Definitions in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The pip show definitions command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Definitions, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2018-20325 Affected Definitions Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
definitions
|
PyPI |
≤ 0.2.0
|
|
References
Frequently Asked Questions
What is CVE-2018-20325?
Which Definitions versions are affected?
What version fixes CVE-2018-20325?
Is definitions affected?
What is the CVSS score of CVE-2018-20325?
What CWE is associated with CVE-2018-20325?
How can I check PyPI dependencies for CVE-2018-20325?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v4x4-98cg-wr4g",
"modified" : "2024-09-13T20:11:10Z",
"published" : "2018-12-26T17:45:19Z",
"aliases" : [ "CVE-2018-20325" ],
"summary" : "Code injection in Danijar Definitions",
"details" : "There is a vulnerability in `load()` method in definitions/parser.py in the Danijar Hafner definitions package for Python. It can execute arbitrary python commands resulting in command execution.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "definitions"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "0.2.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-20325"
}, {
"type" : "WEB",
"url" : "https://github.com/danijar/definitions/issues/14"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-v4x4-98cg-wr4g"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/danijar/definitions"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/definitions/PYSEC-2018-82.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:56:38Z",
"nvd_published_at" : null
}
}