CVE-2021-40831: Aws iot device sdk Improper Certificate Management Vulnerability
HIGHCVE-2021-40831 is a HIGH (CVSS 6.3) improper certificate management vulnerability (CWE-295: Improper Certificate Validation) affecting Aws iot device sdk libraries in the Maven ecosystem. The issue involves improper certificate management in aws iot device sdk v2. Remediation is available by upgrading affected packages to version 1.5.0, 1.6.0, 1.7.0.
CVE-2021-40831 at a Glance
Security Impact
CVSS: 6.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-40831
To remediate this vulnerability, upgrade all affected Aws iot device sdk 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>software.amazon.awssdk.iotdevicesdk</groupId>
<artifactId>aws-iot-device-sdk</artifactId>
<version>1.5.0</version>
</dependency>
npm install aws-iot-device-sdk-v2@1.6.0
pip install awsiotsdk>=1.7.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=software.amazon.awssdk.iotdevicesdk
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-40831, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=software.amazon.awssdk.iotdevicesdk
Analyze the terminal output to locate any version of Aws iot device sdk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.0), your application is affected.
Note: The mvn dependency:tree -Dincludes=software.amazon.awssdk.iotdevicesdk 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-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Aws iot device sdk, 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-40831 Affected Aws iot device sdk Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk
|
Maven |
< 1.5.0
|
1.5.0
|
|
aws-iot-device-sdk-v2
|
npm |
< 1.6.0
|
1.6.0
|
|
awsiotsdk
|
PyPI |
< 1.7.0
|
1.7.0
|
References
Frequently Asked Questions
What is CVE-2021-40831?
Which Aws iot device sdk versions are affected?
What version fixes CVE-2021-40831?
Is aws-iot-device-sdk affected?
Is aws-iot-device-sdk-v2 affected?
What is the CVSS score of CVE-2021-40831?
What CWE is associated with CVE-2021-40831?
How can I check Maven dependencies for CVE-2021-40831?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-j3f7-7rmc-6wqj",
"modified" : "2024-11-18T16:26:17Z",
"published" : "2021-11-24T20:35:03Z",
"aliases" : [ "CVE-2021-40831" ],
"summary" : "Improper certificate management in AWS IoT Device SDK v2",
"details" : "The AWS IoT Device SDK v2 for Java, Python, C++ and Node.js appends a user supplied Certificate Authority (CA) to the root CAs instead of overriding it on macOS systems. Additionally, SNI validation is also not enabled when the CA has been \"overridden\". TLS handshakes will thus succeed if the peer can be verified either from the user-supplied CA or the system’s default trust-store. Attackers with access to a host’s trust stores or are able to compromise a certificate authority already in the host's trust store (note: the attacker must also be able to spoof DNS in this case) may be able to use this issue to bypass CA pinning. An attacker could then spoof the MQTT broker, and either drop traffic and/or respond with the attacker's data, but they would not be able to forward this data on to the MQTT broker because the attacker would still need the user's private keys to authenticate against the MQTT broker. The `aws_tls_ctx_options_override_default_trust_store_*` function within the aws-c-io submodule has been updated to address this behavior. This issue affects: Amazon Web Services AWS IoT Device SDK v2 for Java versions prior to 1.5.0 on macOS. Amazon Web Services AWS IoT Device SDK v2 for Python versions prior to 1.7.0 on macOS. Amazon Web Services AWS IoT Device SDK v2 for C++ versions prior to 1.14.0 on macOS. Amazon Web Services AWS IoT Device SDK v2 for Node.js versions prior to 1.6.0 on macOS. Amazon Web Services AWS-C-IO 0.10.7 on macOS.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:A/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.5.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "aws-iot-device-sdk-v2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.6.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "awsiotsdk"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.7.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-40831"
}, {
"type" : "WEB",
"url" : "https://github.com/aws/aws-iot-device-sdk-java-v2/commit/46375e9b1bfb34109b9ff3b1eff9c770f9daa186"
}, {
"type" : "WEB",
"url" : "https://github.com/aws/aws-iot-device-sdk-js-v2/commit/22f1989f5bdb0bdd9c912a5a2d255ee6c0854f68"
}, {
"type" : "WEB",
"url" : "https://github.com/aws/aws-iot-device-sdk-python-v2/commit/5aef82573202309063eb540b72cee0e565f85a2d"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-j3f7-7rmc-6wqj"
}, {
"type" : "WEB",
"url" : "https://github.com/aws/aws-iot-device-sdk-cpp-v2"
}, {
"type" : "WEB",
"url" : "https://github.com/aws/aws-iot-device-sdk-java-v2"
}, {
"type" : "WEB",
"url" : "https://github.com/aws/aws-iot-device-sdk-js-v2"
}, {
"type" : "WEB",
"url" : "https://github.com/aws/aws-iot-device-sdk-python-v2"
}, {
"type" : "WEB",
"url" : "https://github.com/awslabs/aws-c-io"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/awsiotsdk/PYSEC-2021-864.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-295" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-11-24T20:23:57Z",
"nvd_published_at" : "2021-11-23T00:15:00Z"
}
}