CVE-2023-42811: AEADs/aes-gcm Plaintext Exposed Vulnerability

MODERATE
Advisory Identifier: GHSA-423w-p2w9-r7vq
CVSS 4.7
CWE-347
Published
Advisory Summary

CVE-2023-42811 is a MODERATE (CVSS 4.7) plaintext exposed vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting AEADs/aes-gcm libraries in the crates.io ecosystem. The issue involves plaintext exposed in decrypt_in_place_detached even on tag verification failure. Remediation is available by upgrading affected packages to version 0.10.3.

CVE-2023-42811 at a Glance

CVE Identifier CVE-2023-42811
GHSA Identifier GHSA-423w-p2w9-r7vq
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-347: Improper Verification of Cryptographic Signature
Affected Product AEADs/aes-gcm
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 4.7

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

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

How to Fix CVE-2023-42811

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

aes-gcm fixed: 0.10.3
Upgrade aes-gcm to 0.10.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for aes-gcm

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-42811, inspect your project dependencies for AEADs/aes-gcm:

inspect dependencies for aes-gcm

Analyze the terminal output to locate any version of AEADs/aes-gcm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.10.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-347: Improper Verification of Cryptographic Signature, where the product does not verify, or incorrectly verifies, the cryptographic signature for data. In AEADs/aes-gcm, 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

### Summary In the AES GCM implementation of decrypt_in_place_detached, the decrypted ciphertext (i.e. the correct plaintext) is exposed even if tag verification fails. ### Impact If a program using the `aes-gcm` crate's `decrypt_in_place*` APIs accesses the buffer after decryption failure, it will contain a decryption of an unauthenticated input. Depending on the specific nature of the program this may enable Chosen Ciphertext Attacks (CCAs) which can cause a catastrophic breakage of the cipher including full plaintext recovery. ### Details As seen in the implementation of [decrypt_in_place_detached](https://docs.rs/aes-gcm/latest/src/aes_gcm/lib.rs.html#309) for AES GCM, if the tag verification fails, an error is returned. Because the decryption of the ciphertext is done in place, the plaintext contents are now exposed via `buffer`. This should ideally not be the case - as noted in page 17 of[ NIST's publication _Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC_](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf): _In Step 8, the result of Step 7 is compared with the authentication tag that was received as an input: if they are identical, then the plaintext is returned; otherwise,FAIL is returned._ This is seems correctly addressed in the [AES GCM SIV implementation](https://docs.rs/aes-gcm-siv/latest/src/aes_gcm_siv/lib.rs.html#307), where the decrypted buffer is encrypted again before the error is returned - this fix is straightforward to implement in AES GCM. To ensure that these types of cases are covered during testing, it would be valuable to add test cases like [23, 24 ](https://github.com/google/wycheproof/blob/master/testvectors/aes_gcm_test.json#L288)etc from [project wycheproof ](https://github.com/google/wycheproof)to ensure that when a bad tag is used, there is an error on decryption _**and**_ that the plaintext value is not exposed. ### PoC To reproduce this issue, I'm using [test case 23](https://github.com/google/wycheproof/blob/master/testvectors/aes_gcm_test.json#L288) from project wycheproof. ```rust let key = GenericArray::from_slice(&hex!("000102030405060708090a0b0c0d0e0f")); let nonce = GenericArray::from_slice(&hex!("505152535455565758595a5b")); let tag = GenericArray::from_slice(&hex!("d9847dbc326a06e988c77ad3863e6083")); // bad tag let mut ct = hex!("eb156d081ed6b6b55f4612f021d87b39"); let msg = hex!("202122232425262728292a2b2c2d2e2f"); let aad = hex!(""); let cipher = Aes128Gcm::new(&key); let _plaintext = cipher.decrypt_in_place_detached(&nonce, &aad, &mut ct, &tag); assert_eq!(ct, msg); ```

CVE-2023-42811 Affected AEADs/aes-gcm Versions

1 component(s)
Fixed Versions:
0.10.3
Product / Package Ecosystem Affected Versions Fixed Version
aes-gcm
crates.io
≥ 0.10.0
< 0.10.3
0.10.3

References

Frequently Asked Questions

What is CVE-2023-42811?
CVE-2023-42811 is a security vulnerability in AEADs/aes-gcm involving Plaintext exposed in decrypt_in_place_detached even on tag verification failure under CWE-347: Improper Verification of Cryptographic Signature.
Which AEADs/aes-gcm versions are affected?
Affected versions include releases prior to 0.10.3 across affected packages: aes-gcm.
What version fixes CVE-2023-42811?
Upgrading to 0.10.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is aes-gcm affected?
Yes, aes-gcm is affected in releases prior to 0.10.3. Upgrade your dependency to 0.10.3 or later.
What is the CVSS score of CVE-2023-42811?
CVE-2023-42811 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:H/A:N.
What CWE is associated with CVE-2023-42811?
CVE-2023-42811 is classified under CWE-347: Improper Verification of Cryptographic Signature (The product does not verify, or incorrectly verifies, the cryptographic signature for data.).
How can I check crates.io dependencies for CVE-2023-42811?
Run the dependency tree command: 'inspect dependencies for aes-gcm'. 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-423w-p2w9-r7vq",
  "modified" : "2025-12-31T22:00:24Z",
  "published" : "2023-09-22T16:11:47Z",
  "aliases" : [ "CVE-2023-42811" ],
  "summary" : "AEADs/aes-gcm: Plaintext exposed in decrypt_in_place_detached even on tag verification failure",
  "details" : "### Summary\nIn the AES GCM implementation of decrypt_in_place_detached, the decrypted ciphertext (i.e. the correct plaintext) is exposed even if tag verification fails. \n\n### Impact\nIf a program using the `aes-gcm` crate's `decrypt_in_place*` APIs accesses the buffer after decryption failure, it will contain a decryption of an unauthenticated input. Depending on the specific nature of the program this may enable Chosen Ciphertext Attacks (CCAs) which can cause a catastrophic breakage of the cipher including full plaintext recovery.\n\n### Details\nAs seen in the implementation of [decrypt_in_place_detached](https://docs.rs/aes-gcm/latest/src/aes_gcm/lib.rs.html#309) for AES GCM, if the tag verification fails, an error is returned. Because the decryption of the ciphertext is done in place, the plaintext contents are now exposed via `buffer`. \n\nThis should ideally not be the case - as noted in page 17 of[ NIST's publication _Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC_](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf): \n_In Step 8, the result of Step 7 is compared with the authentication tag that was received as an input: if they are identical, then the plaintext is returned; otherwise,FAIL is returned._\n\nThis is seems correctly addressed in the [AES GCM SIV implementation](https://docs.rs/aes-gcm-siv/latest/src/aes_gcm_siv/lib.rs.html#307), where the decrypted buffer is encrypted again before the error is returned - this fix is straightforward to implement in AES GCM. To ensure that these types of cases are covered during testing, it would be valuable to add test cases like [23, 24 ](https://github.com/google/wycheproof/blob/master/testvectors/aes_gcm_test.json#L288)etc from [project wycheproof ](https://github.com/google/wycheproof)to ensure that when a bad tag is used, there is an error on decryption _**and**_ that the plaintext value is not exposed. \n\n### PoC\nTo reproduce this issue, I'm using [test case 23](https://github.com/google/wycheproof/blob/master/testvectors/aes_gcm_test.json#L288) from project wycheproof. \n```rust\n    let key = GenericArray::from_slice(&hex!(\"000102030405060708090a0b0c0d0e0f\"));\n    let nonce = GenericArray::from_slice(&hex!(\"505152535455565758595a5b\"));\n    let tag = GenericArray::from_slice(&hex!(\"d9847dbc326a06e988c77ad3863e6083\")); // bad tag\n    let mut ct = hex!(\"eb156d081ed6b6b55f4612f021d87b39\");\n    let msg = hex!(\"202122232425262728292a2b2c2d2e2f\");\n    let aad = hex!(\"\");\n    let cipher = Aes128Gcm::new(&key);\n    let _plaintext = cipher.decrypt_in_place_detached(&nonce, &aad, &mut ct, &tag);\n    assert_eq!(ct, msg);\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "aes-gcm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.10.0"
      }, {
        "fixed" : "0.10.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.10.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/RustCrypto/AEADs/security/advisories/GHSA-423w-p2w9-r7vq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-42811"
  }, {
    "type" : "WEB",
    "url" : "https://docs.rs/aes-gcm/latest/src/aes_gcm/lib.rs.html#309"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/RustCrypto/AEADs"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ROBB6TBDAGEQ2WIINR34F3DPSN3FND6K"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RYQCICN6BVC6I75O3F6W4VK4J3MOYDJU"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/U67ZSMNX5V3WTBYPUYF45PSFG4SF5SGF"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2023-0096.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-09-22T16:11:47Z",
    "nvd_published_at" : "2023-09-22T16:15:10Z"
  }
}