CVE-2021-23331: Connect Connect Vulnerability
LOWCVE-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
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).
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.
<dependency>
<groupId>com.squareup</groupId>
<artifactId>connect</artifactId>
<version>Latest secure release</version>
</dependency>
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
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?
Which Connect versions are affected?
What version fixes CVE-2021-23331?
Is connect affected?
What is the CVSS score of CVE-2021-23331?
What CWE is associated with CVE-2021-23331?
How can I check Maven dependencies for CVE-2021-23331?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}