CVE-2021-37942: Apm agent parent APM Java Agent Local Privilege Vulnerability

HIGH
Advisory Identifier: GHSA-5xqm-hc45-f2g2
CVSS 7.0
CWE-269
Published
Advisory Summary

CVE-2021-37942 is a HIGH (CVSS 7.0) apm java agent local privilege vulnerability (CWE-269: Improper Privilege Management) affecting Apm agent parent libraries in the Maven ecosystem. The issue involves apm java agent local privilege escalation issue. Remediation is available by upgrading affected packages to version 1.27.1.

CVE-2021-37942 at a Glance

CVE Identifier CVE-2021-37942
GHSA Identifier GHSA-5xqm-hc45-f2g2
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-269: Improper Privilege Management
Affected Product Apm agent parent
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2021-37942

To remediate this vulnerability, upgrade all affected Apm agent parent dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

co.elastic.apm:apm-agent-parent fixed: 1.27.1
<dependency>
    <groupId>co.elastic.apm</groupId>
    <artifactId>apm-agent-parent</artifactId>
    <version>1.27.1</version>
</dependency>
co.elastic.apm:elastic-apm-agent fixed: 1.27.1
<dependency>
    <groupId>co.elastic.apm</groupId>
    <artifactId>elastic-apm-agent</artifactId>
    <version>1.27.1</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=co.elastic.apm

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2021-37942, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=co.elastic.apm

Analyze the terminal output to locate any version of Apm agent parent in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.27.1), your application is affected.

Note: The mvn dependency:tree -Dincludes=co.elastic.apm command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

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 Apm agent parent, 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

A local privilege escalation issue was found with the APM Java agent, where a user on the system could attach a malicious plugin to an application running the APM Java agent. By using this vulnerability, an attacker could execute code at a potentially higher level of permissions than their user typically has access to.

CVE-2021-37942 Affected Apm agent parent Versions

2 component(s)
Fixed Versions:
1.27.1
Product / Package Ecosystem Affected Versions Fixed Version
co.elastic.apm:apm-agent-parent
Maven
≥ 1.18.0
< 1.27.1
1.27.1
co.elastic.apm:elastic-apm-agent
Maven
≥ 1.18.0
< 1.27.1
1.27.1

References

Frequently Asked Questions

What is CVE-2021-37942?
CVE-2021-37942 is a security vulnerability in Apm agent parent involving APM Java Agent Local Privilege Escalation issue under CWE-269: Improper Privilege Management.
Which Apm agent parent versions are affected?
Affected versions include releases prior to 1.27.1 across affected packages: co.elastic.apm:apm-agent-parent, co.elastic.apm:elastic-apm-agent.
What version fixes CVE-2021-37942?
Upgrading to 1.27.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is apm-agent-parent affected?
Yes, co.elastic.apm:apm-agent-parent is affected in releases prior to 1.27.1. Upgrade your dependency to 1.27.1 or later.
Is elastic-apm-agent affected?
Yes, co.elastic.apm:elastic-apm-agent is affected in releases prior to 1.27.1. Upgrade your dependency to 1.27.1 or later.
What is the CVSS score of CVE-2021-37942?
CVE-2021-37942 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2021-37942?
CVE-2021-37942 is classified under CWE-269: Improper Privilege Management (The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.).
How can I check Maven dependencies for CVE-2021-37942?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=co.elastic.apm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5xqm-hc45-f2g2",
  "modified" : "2025-09-30T16:35:24Z",
  "published" : "2023-11-22T03:30:19Z",
  "aliases" : [ "CVE-2021-37942" ],
  "summary" : "APM Java Agent Local Privilege Escalation issue",
  "details" : "A local privilege escalation issue was found with the APM Java agent, where a user on the system could attach a malicious plugin to an application running the APM Java agent. By using this vulnerability, an attacker could execute code at a potentially higher level of permissions than their user typically has access to.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "co.elastic.apm:apm-agent-parent"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.18.0"
      }, {
        "fixed" : "1.27.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "co.elastic.apm:elastic-apm-agent"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.18.0"
      }, {
        "fixed" : "1.27.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-37942"
  }, {
    "type" : "WEB",
    "url" : "https://discuss.elastic.co/t/apm-java-agent-security-update/291355"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/elastic/apm-agent-java"
  }, {
    "type" : "WEB",
    "url" : "https://www.elastic.co/community/security"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-269" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-11-22T20:57:05Z",
    "nvd_published_at" : "2023-11-22T02:15:42Z"
  }
}