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 webrtc-dtls

Dependencies

(29 total, 10 outdated, 3 possibly insecure)

CrateRequiredLatestStatus
 aes^0.80.8.4up to date
 aes-gcm ⚠️^0.100.10.3maybe insecure
 async-trait^0.10.1.89up to date
 bincode^13.0.0out of date
 byteorder^11.5.0up to date
 cbc^0.10.1.2up to date
 ccm^0.50.5.0up to date
 der-parser^8.110.0.0out of date
 hkdf^0.120.12.4up to date
 hmac^0.120.12.1up to date
 log^0.40.4.29up to date
 p256^0.130.13.2up to date
 p384^0.130.13.1up to date
 pem^33.0.6up to date
 rand^0.80.9.2out of date
 rand_core^0.60.9.3out of date
 rcgen^0.110.14.6out of date
 ring ⚠️^0.16.190.17.14out of date
 rustls ⚠️^0.210.23.35out of date
 sec1^0.70.7.3up to date
 serde^11.0.228up to date
 sha1^0.100.10.6up to date
 sha2^0.100.10.9up to date
 subtle^22.6.1up to date
 thiserror^12.0.17out of date
 tokio^1.32.01.48.0up to date
 webrtc-util^0.80.12.0out of date
 x25519-dalek^22.0.1up to date
 x509-parser^0.150.18.0out of date

Dev dependencies

(4 total, 2 outdated)

CrateRequiredLatestStatus
 chrono^0.4.280.4.42up to date
 clap^34.5.53out of date
 env_logger^0.100.11.8out of date
 tokio-test^0.40.4.4up to date

Security Vulnerabilities

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

rustls: `rustls::ConnectionCommon::complete_io` could fall into an infinite loop based on network input

RUSTSEC-2024-0336

If a close_notify alert is received during a handshake, complete_io does not terminate.

Callers which do not call complete_io are not affected.

rustls-tokio and rustls-ffi do not call complete_io and are not affected.

rustls::Stream and rustls::StreamOwned types use complete_io and are affected.

ring: Some AES functions may panic when overflow checking is enabled.

RUSTSEC-2025-0009

ring::aead::quic::HeaderProtectionKey::new_mask() may panic when overflow checking is enabled. In the QUIC protocol, an attacker can induce this panic by sending a specially-crafted packet. Even unintentionally it is likely to occur in 1 out of every 2**32 packets sent and/or received.

On 64-bit targets operations using ring::aead::{AES_128_GCM, AES_256_GCM} may panic when overflow checking is enabled, when encrypting/decrypting approximately 68,719,476,700 bytes (about 64 gigabytes) of data in a single chunk. Protocols like TLS and SSH are not affected by this because those protocols break large amounts of data into small chunks. Similarly, most applications will not attempt to encrypt/decrypt 64GB of data in one chunk.

Overflow checking is not enabled in release mode by default, but RUSTFLAGS="-C overflow-checks" or overflow-checks = true in the Cargo.toml profile can override this. Overflow checking is usually enabled by default in debug mode.