{"id":"CVE-2023-42811","aliases":["CVE-2023-42811","GHSA-423w-p2w9-r7vq","RUSTSEC-2023-0096"],"related":[],"kind":"vulnerability","state":"published","title":"AEADs/aes-gcm: Plaintext exposed in decrypt_in_place_detached even on tag verification failure","summary":"aes-gcm is a pure Rust implementation of the AES-GCM. Starting in version 0.10.0 and prior to version 0.10.3, 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. 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. Version 0.10.3 contains a fix for this issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"aes-gcm is a pure Rust implementation of the AES-GCM. Starting in version 0.10.0 and prior to version 0.10.3, 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. 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. Version 0.10.3 contains a fix for this issue.","source":"cvelist"},{"lang":"en","text":"### 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```","format":"markdown","source":"ghsa"},{"lang":"en","text":"## Summary\n\nIn the AES GCM implementation of decrypt_in_place_detached,\nthe decrypted ciphertext (i.e. the correct plaintext) is\nexposed even if tag verification fails.\n\n## Impact\n\nIf a program using the aes-gcm crate's decrypt_in_place*\nAPIs accesses the buffer after decryption failure, it will\ncontain a decryption of an unauthenticated input. Depending\non the specific nature of the program this may enable\nChosen Ciphertext Attacks (CCAs) which can cause a\ncatastrophic breakage of the cipher including full\nplaintext recovery.\n\n## Details\n\nAs seen in the implementation of decrypt_in_place_detached for\nAES GCM, if the tag verification fails, an error is returned.\nBecause the decryption of the ciphertext is done in place,\nthe plaintext contents are now exposed via buffer.\n\nThis should ideally not be the case - as noted in page 17 of\nNIST's publication Recommendation for Block Cipher Modes of\nOperation: Galois/Counter Mode (GCM) and GMAC:\n\nIn Step 8, the result of Step 7 is compared with the\nauthentication tag that was received as an input: if\nthey are identical, then the plaintext is returned;\notherwise,FAIL is returned.\n\nThis is seems correctly addressed in the AES GCM SIV\nimplementation, where the decrypted buffer is encrypted\nagain before the error is returned - this fix is\nstraightforward to implement in AES GCM. To ensure that\nthese types of cases are covered during testing, it\nwould be valuable to add test cases like 23, 24 etc\nfrom project wycheproof to ensure that when a bad tag\nis used, there is an error on decryption and that the\nplaintext value is not exposed.\n\n## PoC\n\nTo reproduce this issue, I'm using test case 23 from\nproject wycheproof.\n\n```\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```","format":"markdown","source":"rustsec"},{"lang":"es","text":"aes-gcm es una implementación Rust pura de AES-GCM. A partir de la versión 0.10.0 y antes de la versión 0.10.3, en la implementación AES GCM de decrypt_in_place_detached, el texto cifrado descifrado (es decir, el texto plano correcto) se expone incluso si falla la verificación de la etiqueta. Si un programa que utiliza las API `decrypt_in_place*` de la caja `aes-gcm` accede al búfer después de un error de descifrado, contendrá un descifrado de una entrada no autenticada. Dependiendo de la naturaleza específica del programa, esto puede permitir Chosen Ciphertext Attacks (CCA), que pueden provocar una rotura catastrófica del cifrado, incluida la recuperación completa del texto plano. La versión 0.10.3 contiene una solución para este problema.","source":"nvd"}],"published":"2023-09-22T15:19:15.445Z","modified":"2026-10-12T18:00:05.861Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:H/A:N","score":4.7,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:H/A:N","score":4.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:H/A:N","score":4.7,"rating":"MEDIUM"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:H/A:N","score":4.7,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-347"],"affected":[{"ranges":[{"version":">= 0.10.0, < 0.10.3","status":"affected"}],"vendor":"RustCrypto","product":"AEADs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.10.0","status":"affected","fixed":"0.10.3"}],"ecosystem":"crates.io","package":"aes-gcm","purl":"pkg:cargo/aes-gcm","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.10.0","status":"affected","fixed":"0.10.3"}],"ecosystem":"crates.io","package":"aes-gcm","purl":"pkg:cargo/aes-gcm","source":"rustsec"},{"ranges":[{"status":"affected","introduced":"0.10.0","fixed":"0.10.3"}],"vendor":"aes-gcm_project","product":"aes-gcm","cpe":"cpe:2.3:a:aes-gcm_project:aes-gcm:*:*:*:*:*:rust:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"37"},{"status":"affected","version":"38"},{"status":"affected","version":"39"}],"vendor":"fedoraproject","product":"fedora","cpe":"cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/RustCrypto/AEADs/security/advisories/GHSA-423w-p2w9-r7vq","tags":["exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://docs.rs/aes-gcm/latest/src/aes_gcm/lib.rs.html#309","tags":["product","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RYQCICN6BVC6I75O3F6W4VK4J3MOYDJU/","tags":["mailing-list","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/U67ZSMNX5V3WTBYPUYF45PSFG4SF5SGF/","tags":["mailing-list","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ROBB6TBDAGEQ2WIINR34F3DPSN3FND6K/","tags":["mailing-list","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-42811","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/RustCrypto/AEADs","tags":["package"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ROBB6TBDAGEQ2WIINR34F3DPSN3FND6K","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RYQCICN6BVC6I75O3F6W4VK4J3MOYDJU","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/U67ZSMNX5V3WTBYPUYF45PSFG4SF5SGF","tags":["web"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2023-0096.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/aes-gcm","tags":["package"],"sources":["rustsec"]},{"url":"https://github.com/RustCrypto/AEADs/pull/551","tags":["web"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2024-02-19T18:49:22.620Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-42811","url":"https://www.cve.org/CVERecord?id=CVE-2023-42811","licence":"CVE Terms of Use","modified":"2025-06-18T14:22:56.534Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-423w-p2w9-r7vq","url":"https://github.com/advisories/GHSA-423w-p2w9-r7vq","licence":"CC-BY-4.0","modified":"2026-02-03T03:15:54.086Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2023-0096","url":"https://rustsec.org/advisories/RUSTSEC-2023-0096.html","licence":"CC0-1.0","modified":"2026-10-12T18:00:05.861Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-42811","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-42811","licence":"Public domain","modified":"2026-06-17T06:24:34.020Z"}],"updatedAt":"2026-11-25T22:58:28.077Z","epss":{"score":0.00217,"percentile":0.07036,"date":"2026-11-30T12:00:22.000Z"}}