CVE-2021-37941: Elastic apm APM Java Agent Local Privilege Vulnerability
HIGHCVE-2021-37941 is a HIGH (CVSS 7.8) apm java agent local privilege vulnerability (CWE-269: Improper Privilege Management) affecting Elastic apm libraries in the PyPI ecosystem. The issue involves apm java agent local privilege escalation. Remediation is available by upgrading affected packages to version 1.27.0.
CVE-2021-37941 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:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-37941
To remediate this vulnerability, upgrade all affected Elastic apm 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 elastic-apm>=1.27.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show elastic-apm
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-37941, inspect your installed packages using pip:
pip show elastic-apm
Analyze the terminal output to locate any version of Elastic apm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.27.0), your application is affected.
Note: The pip show elastic-apm command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In Elastic apm, 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-37941 Affected Elastic apm Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
elastic-apm
|
PyPI |
≥ 1.10.0
< 1.27.0
|
1.27.0
|
References
Frequently Asked Questions
What is CVE-2021-37941?
Which Elastic apm versions are affected?
What version fixes CVE-2021-37941?
Is elastic-apm affected?
What is the CVSS score of CVE-2021-37941?
What CWE is associated with CVE-2021-37941?
How can I check PyPI dependencies for CVE-2021-37941?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r562-m862-63w3",
"modified" : "2024-04-22T22:34:38Z",
"published" : "2021-12-09T00:00:28Z",
"aliases" : [ "CVE-2021-37941" ],
"summary" : "APM Java Agent Local Privilege Escalation",
"details" : "A local privilege escalation issue was found with the APM Java agent, where a user on the system could attach a malicious file to an application running with the APM Java agent. Using this vector, a malicious or compromised user account could use the agent to run commands at a higher level of permissions than they possess. This vulnerability affects users that have set up the agent via the attacher cli 3, the attach API 2, as well as users that have enabled the profiling_inferred_spans_enabled option",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "elastic-apm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.10.0"
}, {
"fixed" : "1.27.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-37941"
}, {
"type" : "WEB",
"url" : "https://discuss.elastic.co/t/apm-java-agent-security-update/289627"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/elastic/apm-agent-python"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-269" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-04-22T22:34:38Z",
"nvd_published_at" : "2021-12-08T22:15:00Z"
}
}