This project contains known security vulnerabilities. Find detailed information at the bottom.

Crate age

Dependencies

(36 total, 10 outdated, 1 insecure, 2 possibly insecure)

CrateRequiredLatestStatus
 aes^0.80.8.4up to date
 aes-gcm ⚠️^0.100.10.3maybe insecure
 age-core^0.10.00.11.0out of date
 base64^0.210.22.1out of date
 bcrypt-pbkdf^0.100.10.0up to date
 bech32^0.90.11.1out of date
 cbc^0.10.1.2up to date
 chacha20poly1305^0.100.10.1up to date
 cipher^0.4.30.4.4up to date
 console^0.150.16.2out of date
 cookie-factory^0.3.10.3.3up to date
 ctr^0.90.9.2up to date
 curve25519-dalek ⚠️^44.1.3maybe insecure
 futures^0.30.3.31up to date
 hmac^0.120.12.1up to date
 i18n-embed^0.140.16.0out of date
 i18n-embed-fl^0.70.10.0out of date
 is-terminal^0.40.4.17up to date
 lazy_static^11.5.0up to date
 memchr^2.52.7.6up to date
 nom^78.0.0out of date
 num-traits^0.20.2.19up to date
 pin-project^11.1.10up to date
 pinentry^0.50.8.0out of date
 rand^0.80.9.2out of date
 rpassword^77.4.0up to date
 rsa ⚠️^0.90.9.9insecure
 rust-embed^88.9.0up to date
 scrypt^0.110.11.0up to date
 sha2^0.100.10.9up to date
 subtle^22.6.1up to date
 web-sys^0.30.3.83up to date
 which^48.0.0out of date
 wsl^0.10.1.0up to date
 x25519-dalek^22.0.1up to date
 zeroize^11.8.2up to date

Dev dependencies

(9 total, 4 outdated, 1 possibly insecure)

CrateRequiredLatestStatus
 criterion^0.50.8.1out of date
 criterion-cycles-per-byte^0.60.8.0out of date
 futures-test^0.30.3.31up to date
 hex^0.40.4.3up to date
 i18n-embed^0.140.16.0out of date
 pprof^0.130.15.0out of date
 proptest^11.9.0up to date
 test-case^33.3.1up to date
 tokio ⚠️^11.49.0maybe insecure

Security Vulnerabilities

tokio: reject_remote_clients Configuration corruption

RUSTSEC-2023-0001

On Windows, configuring a named pipe server with pipe_mode will force ServerOptions::reject_remote_clients as false.

This drops any intended explicit configuration for the reject_remote_clients that may have been set as true previously.

The default setting of reject_remote_clients is normally true meaning the default is also overridden as false.

Workarounds

Ensure that pipe_mode is set first after initializing a ServerOptions. For example:

let mut opts = ServerOptions::new();
opts.pipe_mode(PipeMode::Message);
opts.reject_remote_clients(true);

rsa: Marvin Attack: potential key recovery through timing sidechannels

RUSTSEC-2023-0071

Impact

Due to a non-constant-time implementation, information about the private key is leaked through timing information which is observable over the network. An attacker may be able to use that information to recover the key.

Patches

No patch is yet available, however work is underway to migrate to a fully constant-time implementation.

Workarounds

The only currently available workaround is to avoid using the rsa crate in settings where attackers are able to observe timing information, e.g. local use on a non-compromised computer is fine.

References

This vulnerability was discovered as part of the "Marvin Attack", which revealed several implementations of RSA including OpenSSL had not properly mitigated timing sidechannel attacks.

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

curve25519-dalek: Timing variability in `curve25519-dalek`'s `Scalar29::sub`/`Scalar52::sub`

RUSTSEC-2024-0344

Timing variability of any kind is problematic when working with potentially secret values such as elliptic curve scalars, and such issues can potentially leak private keys and other secrets. Such a problem was recently discovered in curve25519-dalek.

The Scalar29::sub (32-bit) and Scalar52::sub (64-bit) functions contained usage of a mask value inside a loop where LLVM saw an opportunity to insert a branch instruction (jns on x86) to conditionally bypass this code section when the mask value is set to zero as can be seen in godbolt:

A similar problem was recently discovered in the Kyber reference implementation:

https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/hqbtIGFKIpU/m/cnE3pbueBgAJ

As discussed on that thread, one portable solution, which is also used in this PR, is to introduce a volatile read as an optimization barrier, which prevents the compiler from optimizing it away.

The fix can be validated in godbolt here:

The problem was discovered and the solution independently verified by Alexander Wagner [email protected] and Lea Themint [email protected] using their DATA tool:

https://github.com/Fraunhofer-AISEC/DATA