This project might be open to known security vulnerabilities, which can be prevented by tightening the version range of affected dependencies. Find detailed information at the bottom.

Crate confers

Dependencies

(43 total, 11 outdated, 2 possibly insecure)

CrateRequiredLatestStatus
 aes-gcm ⚠️^0.100.11.0out of date
 anyhow^1.01.0.104up to date
 arc-swap^1.91.9.2up to date
 async-nats^0.490.50.0out of date
 async-stream^0.30.3.6up to date
 async-trait^0.10.1.92up to date
 base64^0.220.23.1out of date
 chacha20poly1305^0.100.11.0out of date
 chrono ⚠️^0.40.4.45maybe insecure
 clap^4.64.6.6up to date
 compact_str^0.90.10.0out of date
 confers-macros^0.50.5.1up to date
 dashmap^6.16.2.1up to date
 dotenvy^0.150.15.7up to date
 etcd-client^0.180.19.0out of date
 futures-util^0.30.3.34up to date
 garde^0.220.23.0out of date
 getset^0.10.1.7up to date
 hex^0.40.4.3up to date
 hkdf^0.120.13.0out of date
 indexmap^2.132.14.0up to date
 ipnet^2.112.12.1up to date
 itoa^1.01.0.18up to date
 moka^0.120.12.16up to date
 notify-debouncer-full^0.70.7.0up to date
 rand^0.80.10.2out of date
 redis^1.11.5.0up to date
 regex^1.111.13.1up to date
 reqwest^0.130.13.4up to date
 schemars^1.21.2.2up to date
 secrecy^0.100.10.3up to date
 serde^1.01.0.229up to date
 serde_ini^0.10.2.0out of date
 serde_json^1.01.0.151up to date
 serde_yaml_ng^0.100.10.0up to date
 sha2^0.100.11.0out of date
 similar^3.13.1.2up to date
 thiserror^2.02.0.20up to date
 tokio^1.501.53.1up to date
 tokio-stream^0.10.1.19up to date
 toml^1.11.1.4+spec-1.1.0up to date
 url^2.52.5.8up to date
 zeroize^1.81.9.0up to date

Dev dependencies

(6 total, 3 outdated)

CrateRequiredLatestStatus
 async-nats^0.490.50.0out of date
 criterion^0.70.8.2out of date
 proptest^1.111.11.0up to date
 serial_test^3.54.0.1out of date
 tempfile^3.273.27.0up to date
 tokio^1.501.53.1up to date

Security Vulnerabilities

chrono: Potential segfault in `localtime_r` invocations

RUSTSEC-2020-0159

Impact

Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.

Workarounds

No workarounds are known.

References

aes-gcm: Plaintext exposed in decrypt_in_place_detached even on tag verification failure

RUSTSEC-2023-0096

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 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:

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, 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 etc from project 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 from project wycheproof.

    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);