CVE-2021-38305: Yamale Command Injection Vulnerability
HIGHCVE-2021-38305 is a HIGH (CVSS 7.8) command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Yamale libraries in the PyPI ecosystem. The issue involves command injection in yamale. Remediation is available by upgrading affected packages to version 3.0.8.
CVE-2021-38305 at a Glance
Security Impact
CVSS: 7.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-38305
To remediate this vulnerability, upgrade all affected Yamale 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 yamale>=3.0.8
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show yamale
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-38305, inspect your installed packages using pip:
pip show yamale
Analyze the terminal output to locate any version of Yamale in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.8), your application is affected.
Note: The pip show yamale command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Yamale, 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-2021-38305 Affected Yamale Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
yamale
|
PyPI |
< 3.0.8
|
3.0.8
|
References
Frequently Asked Questions
What is CVE-2021-38305?
Which Yamale versions are affected?
What version fixes CVE-2021-38305?
Is yamale affected?
What is the CVSS score of CVE-2021-38305?
What CWE is associated with CVE-2021-38305?
How can I check PyPI dependencies for CVE-2021-38305?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-435p-f82x-mxwm",
"modified" : "2024-11-19T18:25:44Z",
"published" : "2021-08-11T15:19:23Z",
"aliases" : [ "CVE-2021-38305" ],
"summary" : "Command injection in Yamale",
"details" : "23andMe Yamale before 3.0.8 allows remote attackers to execute arbitrary code via a crafted schema file. The schema parser uses eval as part of its processing, and tries to protect from malicious expressions by limiting the builtins that are passed to the eval. When processing the schema, each line is run through Python's eval function to make the validator available. A well-constructed string within the schema rules can execute system commands; thus, by exploiting the vulnerability, an attacker can run arbitrary code on the image that invokes Yamale.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "yamale"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.0.8"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-38305"
}, {
"type" : "WEB",
"url" : "https://github.com/23andMe/Yamale/pull/165"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/23andMe/Yamale"
}, {
"type" : "WEB",
"url" : "https://github.com/23andMe/Yamale/releases/tag/3.0.8"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/yamale/PYSEC-2021-119.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-434", "CWE-78" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-08-10T17:33:14Z",
"nvd_published_at" : "2021-08-09T21:15:00Z"
}
}