Vulnerabilities in pkg:maven/com.datadoghq/datadog-api-client

PACKAGE
Advisory Identifier: GHSA-2cxf-6567-7pp6
Advisory Summary

CVE-2021-21331 is a LOW (CVSS 3.0) local information disclosure vulnerability vulnerability (CWE-379: Creation of Temporary File in Directory with Insecure Permissions) affecting Datadog api client libraries in the Maven ecosystem. The issue involves local information disclosure vulnerability. Remediation is available by upgrading affected packages to version 1.0.0-beta.9.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/com.datadoghq/datadog-api-client

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/com.datadoghq/datadog-api-client. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-2cxf-6567-7pp6 CVE-2021-21331 LOW Local Information Disclosure Vulnerability

CVE-2021-21331 at a Glance

CVE Identifier CVE-2021-21331
GHSA Identifier GHSA-2cxf-6567-7pp6
Severity LOW
CVSS v3.1 Base Score 3.0
CWE Classification CWE-379: Creation of Temporary File in Directory with Insecure Permissions
Affected Product Datadog api client
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 3.0

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

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

How to Fix CVE-2021-21331

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

com.datadoghq:datadog-api-client fixed: 1.0.0-beta.9
<dependency>
    <groupId>com.datadoghq</groupId>
    <artifactId>datadog-api-client</artifactId>
    <version>1.0.0-beta.9</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=com.datadoghq

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.datadoghq

Analyze the terminal output to locate any version of Datadog api client in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0-beta.9), your application is affected.

Note: The mvn dependency:tree -Dincludes=com.datadoghq 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-379: Creation of Temporary File in Directory with Insecure Permissions, where the product creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file. In Datadog api client, 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

### Impact Local information disclosure of sensitive information downloaded via the API using the API Client. ### Finding The Datadog API is executed on a unix-like system with multiple users. The API is used to download a file containing sensitive information. This sensitive information is exposed locally to other users. This vulnerability exists in the API Client for version 1 and 2. The method `prepareDownloadFilecreates` creates a temporary file with the permissions bits of `-rw-r--r--` on unix-like systems. On unix-like systems, the system temporary directory is shared between users. As such, the contents of the file downloaded via the `downloadFileFromResponse` method will be visible to all other users on the local system. Analysis of the finding determined that the affected code was unused, meaning that the exploitation likelihood is low. The unused code has been removed, effectively mitigating this issue. This vulnerability was found due to [this query](https://lgtm.com/query/8938575359870595124/) that [Jonathan Leitschuh](https://github.com/JLLeitschuh) contributed to the Semmle QL project. ### Patches This issue has been patched in [version 1.0.0-beta.9](https://github.com/DataDog/datadog-api-client-java/releases/tag/datadog-api-client-1.0.0-beta.9). See also [Remove unused downloadFile helpers](https://github.com/DataDog/datadog-api-client-java/pull/637). ### Workarounds The recommended workaround is to specify `java.io.tmpdir` when starting the JVM with the flag `-Djava.io.tmpdir`, specifying a path to a directory with `drw-------` permissions owned by `dd-agent`. ### References * [CWE-378: Creation of Temporary File With Insecure Permissions](https://cwe.mitre.org/data/definitions/378.html) * [CWE-379: Creation of Temporary File in Directory with Insecure Permissions](https://cwe.mitre.org/data/definitions/379.html) ### For more information If you have any questions or comments about this advisory: * Open an issue in [DataDog/datadog-api-client-java](https://github.com/DataDog/datadog-api-client-java) * Email us at [security@datadoghq.com](mailto:security@datadoghq.com)

CVE-2021-21331 Affected Datadog api client Versions

1 component(s)
Fixed Versions:
1.0.0-beta.9
Product / Package Ecosystem Affected Versions Fixed Version
com.datadoghq:datadog-api-client
Maven
≥ 1.0.0-beta.6
< 1.0.0-beta.9
1.0.0-beta.9

References

Frequently Asked Questions

What is CVE-2021-21331?
CVE-2021-21331 is a security vulnerability in Datadog api client involving Local Information Disclosure Vulnerability under CWE-379: Creation of Temporary File in Directory with Insecure Permissions.
Which Datadog api client versions are affected?
Affected versions include releases prior to 1.0.0-beta.9 across affected packages: com.datadoghq:datadog-api-client.
What version fixes CVE-2021-21331?
Upgrading to 1.0.0-beta.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is datadog-api-client affected?
Yes, com.datadoghq:datadog-api-client is affected in releases prior to 1.0.0-beta.9. Upgrade your dependency to 1.0.0-beta.9 or later.
What is the CVSS score of CVE-2021-21331?
CVE-2021-21331 has a CVSS v3.1 base score of 3.0 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2021-21331?
CVE-2021-21331 is classified under CWE-379: Creation of Temporary File in Directory with Insecure Permissions (The product creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file.).
How can I check Maven dependencies for CVE-2021-21331?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.datadoghq'. 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-2cxf-6567-7pp6",
  "modified" : "2021-07-08T17:02:28Z",
  "published" : "2021-03-03T23:01:17Z",
  "aliases" : [ "CVE-2021-21331" ],
  "summary" : "Local Information Disclosure Vulnerability",
  "details" : "### Impact\nLocal information disclosure of sensitive information downloaded via the API using the API Client. \n\n### Finding\nThe Datadog API is executed on a unix-like system with multiple users. The API is used to download a file containing sensitive information. This sensitive information is exposed locally to other users. This vulnerability exists in the API Client for version 1 and 2. The method `prepareDownloadFilecreates` creates a temporary file with the permissions bits of `-rw-r--r--` on unix-like systems. On unix-like systems, the system temporary directory is shared between users. As such, the contents of the file downloaded via the `downloadFileFromResponse` method will be visible to all other users on the local system.\n\nAnalysis of the finding determined that the affected code was unused, meaning that the exploitation likelihood is low. The unused code has been removed, effectively mitigating this issue. \n\nThis vulnerability was found due to [this query](https://lgtm.com/query/8938575359870595124/) that [Jonathan Leitschuh](https://github.com/JLLeitschuh) contributed to the Semmle QL project.\n\n### Patches\nThis issue has been patched in [version 1.0.0-beta.9](https://github.com/DataDog/datadog-api-client-java/releases/tag/datadog-api-client-1.0.0-beta.9). \n\nSee also [Remove unused downloadFile helpers](https://github.com/DataDog/datadog-api-client-java/pull/637). \n\n### Workarounds\nThe recommended workaround is to specify `java.io.tmpdir` when starting the JVM with the flag `-Djava.io.tmpdir`, specifying a path to a directory with `drw-------` permissions owned by `dd-agent`.\n\n### References\n* [CWE-378: Creation of Temporary File With Insecure Permissions](https://cwe.mitre.org/data/definitions/378.html)\n* [CWE-379: Creation of Temporary File in Directory with Insecure Permissions](https://cwe.mitre.org/data/definitions/379.html)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [DataDog/datadog-api-client-java](https://github.com/DataDog/datadog-api-client-java)\t\n* Email us at [security@datadoghq.com](mailto:security@datadoghq.com)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.datadoghq:datadog-api-client"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0-beta.6"
      }, {
        "fixed" : "1.0.0-beta.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/DataDog/datadog-api-client-java/security/advisories/GHSA-2cxf-6567-7pp6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21331"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DataDog/datadog-api-client-java/releases/tag/datadog-api-client-1.0.0-beta.9"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-378", "CWE-379" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-03T22:58:04Z",
    "nvd_published_at" : "2021-03-03T23:15:00Z"
  }
}