CVE-2021-23331: Connect Connect Vulnerability

LOW
Advisory Identifier: GHSA-q4hm-fwc9-hmv6
CVSS 3.3
CWE-377
Published
Advisory Summary

CVE-2021-23331 is a LOW (CVSS 3.3) connect vulnerability (CWE-377: Insecure Temporary File) affecting Connect libraries in the Maven ecosystem. The issue involves connect. Remediation is available in the latest vendor maintenance releases.

CVE-2021-23331 at a Glance

CVE Identifier CVE-2021-23331
GHSA Identifier GHSA-q4hm-fwc9-hmv6
Severity LOW
CVSS v3.1 Base Score 3.3
CWE Classification CWE-377: Insecure Temporary File
Affected Product Connect
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 3.3

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:L/I:N/A:N).

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

How to Fix CVE-2021-23331

To remediate this vulnerability, upgrade all affected Connect 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.squareup:connect fixed: Latest secure release
<dependency>
    <groupId>com.squareup</groupId>
    <artifactId>connect</artifactId>
    <version>Latest secure release</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.squareup

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.squareup

Analyze the terminal output to locate any version of Connect 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 mvn dependency:tree -Dincludes=com.squareup 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-377: Insecure Temporary File, where creating and using insecure temporary files can leave application and system data vulnerable to attack. In Connect, 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

This affects all versions of package com.squareup:connect. 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 by downloadFileFromResponse will be visible to all other users on the local system. A workaround fix for this issue is to set the system property java.io.tmpdir to a safe directory as remediation. Note: This version of the SDK is end of life and no longer maintained, please upgrade to the latest version.

CVE-2021-23331 Affected Connect Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
com.squareup:connect
Maven
≤ 2.20191120.0

References

Frequently Asked Questions

What is CVE-2021-23331?
CVE-2021-23331 is a security vulnerability in Connect involving connect under CWE-377: Insecure Temporary File.
Which Connect versions are affected?
Affected versions include releases prior to current release patches across affected packages: com.squareup:connect.
What version fixes CVE-2021-23331?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is connect affected?
Yes, com.squareup:connect is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2021-23331?
CVE-2021-23331 has a CVSS v3.1 base score of 3.3 (LOW) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2021-23331?
CVE-2021-23331 is classified under CWE-377: Insecure Temporary File (Creating and using insecure temporary files can leave application and system data vulnerable to attack.).
How can I check Maven dependencies for CVE-2021-23331?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.squareup'. 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-q4hm-fwc9-hmv6",
  "modified" : "2022-04-18T21:55:54Z",
  "published" : "2021-06-16T17:53:20Z",
  "aliases" : [ "CVE-2021-23331" ],
  "summary" : "Insecure temporary file used in com.squareup:connect",
  "details" : "This affects all versions of package com.squareup:connect. 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 by downloadFileFromResponse will be visible to all other users on the local system. A workaround fix for this issue is to set the system property java.io.tmpdir to a safe directory as remediation. Note: This version of the SDK is end of life and no longer maintained, please upgrade to the latest version.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.squareup:connect"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.20191120.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23331"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/square/connect-java-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/square/connect-java-sdk/blob/master/src/main/java/com/squareup/connect/ApiClient.java%23L613"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-COMSQUAREUP-1065988"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-377" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-22T22:46:28Z",
    "nvd_published_at" : "2021-02-03T18:15:00Z"
  }
}