CVE-2021-40831
Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.
NVD · uneditedThe 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.
Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.
dbcve analysis · high confidenceThe AWS IoT Device SDK v2 for Java, Python, C++, and Node.js on macOS appends user-supplied CAs to the system's default trust store instead of overriding it, and also fails to enable SNI validation. This allows TLS handshakes to succeed if verified by EITHER the user-supplied CA or the system's default store, enabling attackers with access to compromised CAs (and DNS spoofing capability) to bypass CA pinning and spoof MQTT brokers.
Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.
Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.
NVD · CPE data= 0.10.7< 1.5.0< 1.6.0< 1.7.0< 1.14.0CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.
From the vector- Attack vector
- Network
- Complexity
- Low
- Privileges
- High
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.
dbcve checksWork through these to decide whether this CVE applies to you.
-
Confirm macOS environmentCheck if the system is running macOS by running 'uname -s' or 'sw_vers'Affected if The system is NOT macOS - this vulnerability only affects macOS environments
-
Identify installed AWS IoT Device SDK v2 languageDetermine which AWS IoT Device SDK v2 language binding is in use (Java, Python, C++, or Node.js) by reviewing project dependencies or import statementsAffected if The SDK language cannot be determined - you need to identify which SDK variant is in use
-
Check Java SDK versionFor Java projects, check the version in pom.xml or build.gradle under aws-iot-device-sdk-v2, or run 'mvn dependency:tree | grep aws-iot-device-sdk-v2'Affected if Version is less than 1.5.0
-
Check Node.js SDK versionRun 'npm list aws-iot-device-sdk-v2' or check package.json dependenciesAffected if Version is less than 1.6.0
-
Check Python SDK versionRun 'pip show aws-iot-device-sdk-v2' or check requirements.txtAffected if Version is less than 1.7.0
-
Check C++ SDK versionCheck the version in CMakeLists.txt or package manager listing for aws-iot-device-sdk-v2Affected if Version is less than 1.14.0
You are affected if you are running on macOS AND using any version of AWS IoT Device SDK v2 for Java <1.5.0, Node.js <1.6.0, Python <1.7.0, C++ <1.14.0, or aws-c-io =0.10.7, AND your application uses custom CA certificates for MQTT broker authentication.
Generated from the published advisory. Verify against your own configuration.
Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.
dbcve · scoped1.5.01.6.01.7.0
Upgrade AWS IoT Device SDK to Java 1.5.0+, Python 1.7.0+, C++ 1.14.0+, Node.js 1.6.0+, or aws-c-io 0.10.7+ which fixes the trust store override behavior in the aws_tls_ctx_options_override_default_trust_store_* function.
Upgrade to: AWS IoT Device SDK v2 Java >= 1.5.0, Python >= 1.7.0, C++ >= 1.14.0, Node.js >= 1.6.0, or aws-c-io >= 0.10.8
- 1. Identify which AWS IoT Device SDK v2 language/framework you are using (Java, Python, C++, or Node.js)
- 2. Identify the current version of the SDK in use by checking your project's dependencies
- 3. Upgrade to the fixed version for your SDK: Java: 1.5.0 or later, Python: 1.7.0 or later, C++: 1.14.0 or later, Node.js: 1.6.0 or later
- 4. If using aws-c-io directly, upgrade to version 0.10.8 or later
- 5. After upgrading, verify the fix is applied by testing MQTT connections on macOS
- 6. Ensure your code uses the aws_tls_ctx_options_override_default_trust_store_* function correctly to override (not append to) the system trust store
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation2.0 h
- Implementation4.0 h
- Testing4.0 h
- Review / QA2.0 h
An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $3,328.
Scan for this in your stack
Free · runs locallyCheck whether your project pulls in CVE-2021-40831 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.
References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.
Primary sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2021-40831 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
No notes yet
Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.
A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.
- Verified mitigations, workarounds, and config changes
- Version or environment caveats, and links to real fixes
- No weaponised exploit code, or anything meant to cause harm
- No spam, self-promotion, credentials, or personal data