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
The rsa v0.10 series includes a migration to crypto-bigint and constant-time mitigations recommended in draft-irtf-cfrg-rsa-guidance. Upgrading to this release should resolve all known constant-time issues.
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.
pyo3: Out-of-bounds read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators
PyO3 0.24.0 added optimized implementations of Iterator::nth and
DoubleEndedIterator::nth_back for the BoundListIterator and
BoundTupleIterator types. These implementations computed the target index
using unchecked usize addition (index + n) before bounds-checking against
the sequence length, then read the element via get_item_unchecked.
In nth methods, a sufficiently large n (combined with a non-zero internal
index) could cause the addition to overflow and wrap around, producing a small
"target index" that passed the bounds check and enabling reads at the front
of the list or tuple of elements previously yielded by the iterator.
In nth_back methods, a sufficiently large n could cause underflow in a
similar fashion, however would instead allow reads of arbitrary memory past
the end of the list or tuple storage.
PyO3 0.29.0 has corrected these methods to use checked arithmetic at the
positions which could be at risk of overflow.
pyo3: Missing `Sync` bound on `PyCFunction::new_closure` closures
PyCFunction::new_closure (and the temporary new_closure_bound complement in
the 0.21–0.22 series) required the supplied closure to be Send + 'static but
not Sync. The resulting PyCFunction is a Python callable that can be
invoked from any Python thread, which means the closure may be called
concurrently from multiple threads, and needs a Sync bound to prevent
possible data races.
The problem exists under all Python versions but is particularly vulnerable under
the newer free-threaded Python variant, which do not have serial execution
imposed by the Global Interpreter Lock. Under releases protected by the GIL,
the ability to "detach" from the Python interpreter temporarily inside the closure
(e.g. by Python::detach) makes it possible for interleaved and/or concurrent
execution of various portions of the closure.
PyO3 0.29.0 added a Sync bound to close this thread-safety bug.
zip: Insecure Preservation of SUID/SGID Bits during ZIP Extraction Leading to Potential Privilege Escalation
The zip crate preserves privileged Unix permission bits (SUID, SGID, and sticky bits) from ZIP external_attributes during extraction, instead of masking them to safe permission bits. If a privileged process (for example, root in an installer, CI/CD pipeline, or container build) extracts an attacker-controlled ZIP archive using ZipArchive::extract() or the stream extraction API, files can be created as setuid-root or setgid. This behavior allows the creation of SUID/SGID files during extraction, which can lead to local privilege escalation depending on the execution environment.
For further details see: https://github.com/zip-rs/zip2/security/advisories/GHSA-vv5m-jxxh-4627
zip: zip: `ZipArchive::extract` creates symbolic links whose attacker-controlled targets are outside the destination directory
In zip 9.0.0-pre2, ZipArchive::extract creates a symbolic link from an archive entry after validating only the output entry path. The link target bytes are passed directly to the platform symlink API, so a malicious archive can create an entry inside the destination that resolves to an attacker-chosen path outside it. This behavior was verified on macOS and Linux. On either platform, a subsequent application read or write through that extracted entry accesses the external target with the extracting process's permissions.
For further details see: https://github.com/zip-rs/zip2/security/advisories/GHSA-4v9h-p7m9-rh26
zip: ZipStreamReader::extract() and ZipArchive::extract() apply Unix permissions through symlinks without confining the target
ZipArchive::extract() sizes the symlink-target buffer from the uncompressed
size declared in the central directory record, before reading a single byte of
entry data:
let mut target = Vec::with_capacity(file.size() as usize);
Both inputs are attacker-controlled. ZipFile::size() returns
uncompressed_size verbatim from the central directory, widened to a full u64
by a ZIP64 extended-information extra field, and is never cross-checked against
the compressed size, the remaining archive length, or any platform-appropriate
bound for a symlink target. ZipFile::is_symlink() is decided entirely by the
S_IFLNK bit of the external-attributes field.
Vec::with_capacity() is infallible: when the reservation is refused it calls
handle_alloc_error() and aborts the process. This is not a Rust panic. It is
not caught by catch_unwind(), is unaffected by panic = "unwind", and is not
contained by running the call on a worker thread.
A 112-byte archive is sufficient. One Stored entry flagged S_IFLNK with a
ZIP64 field declaring uncompressed_size = 2^62 and a zero-byte payload makes
extract() fail with:
The declared value only needs to exceed the host's address space, not its RAM:
Vec::with_capacity() maps address space without touching pages, so resident
memory stays flat and the abort happens on the refused reservation itself. Under
a ulimit -v cap or a memory-constrained container the threshold drops far
enough that a plain 32-bit uncompressed_size with no ZIP64 field suffices.
Applications that extract archives from untrusted input are affected on Unix and
Windows targets with default features and no special configuration: upload
handling, mail-attachment processing, package and artefact ingestion, backup
restore and container-image layer extraction. No confidentiality or integrity
property is affected: there is no memory unsafety, no out-of-bounds access, no
disclosure and no data corruption.
For WinZip AES (AE-1 and AE-2) entries, the 10-byte HMAC authentication code was read and checked only after the reader had consumed exactly the entry's declared compressed size. If the archive ended before that size was reached, the read returned end-of-stream and the truncated plaintext was accepted without the check. The authentication code of an entry with no encrypted data was never checked.
AES-CTR ciphertext can be changed bit by bit without the password, and AE-2 entries carry no CRC-32, so an attacker who can modify an archive can alter the decrypted contents of such an entry without any error being reported.
This affects reading AES-encrypted entries with a password (for example ZipArchive::by_name_decrypt) with the aes-crypto feature.
The fix returns an error when the data ends before the declared size, and checks the authentication code of empty entries.
zip: `ZipStreamReader` extracts entries under local-header names that can differ from the central directory
A ZIP archive names each entry twice: in the local file header in front of the entry's data, and in the central directory at the end of the archive. ZipArchive lists and opens entries by their central-directory names. ZipStreamReader::visit and ZipStreamReader::extract, like read_zipfile_from_stream, read the local headers in order and use the local-header names without comparing them with the central directory.
An archive can therefore show one set of file names to code that inspects it with ZipArchive and write files under other names when it is extracted with ZipStreamReader. If an application checks an archive one way and extracts it the other way, an attacker can get files written or overwritten inside the destination directory that the check never saw.
The fix adds an opt-in check. ZipStreamReader::enforce_header_consistency(true) compares each local header with its central-directory entry (name, sizes, CRC-32, compression method, flags and modification time) and fails extraction on a mismatch; ZipReadOptions::enforce_header_consistency(true) and ZipArchive::validate_header_consistency() do the same for ZipArchive. The check is off by default, so upgrading alone does not change what ZipStreamReader::new(...) extracts: applications that extract untrusted archives with ZipStreamReader need to turn it on.
curve25519-dalek: Scalar Multiplication Arithmetic Bug in AVX-512 Backend
Any user using the AVX-512 backend of curve25519-dalek could have produced incorrect outputs on computations involving a scalar multiplication on an attacker-chosen Edwards or Ristretto point. This affects all versions of curve25519-dalek in the range 1.1.0–5.0.0, inclusive. No other backends are affected: serial, fiat, and simd (AVX2) are all fine.
Who Is Affected
Anyone who used curve25519-dalek with the AVX-512 backend. Here is how that would happen, based on crate version:
|Version|How AVX-512 backend is enabled|
|-------|----------------------|
|5.0.0 | The crate must be compiled with --cfg curve25519_dalek_backend="avx512" or built with target_feature=+avx512ifma,+avx512vl (or -C target-cpu=native on an AVX-512 target) on rustc ≥ 1.89 or nightly. In addition, the CPU it's being run on must have those features (runtime selection) |
|4.2.0–5.0.0-rc.1 | The crate must be compiled with --cfg curve25519_dalek_backend="unstable_avx512" on nightly. |
|4.0.0–4.1.3 | The crate must be compiled with nightly and the CPU it's being run on must have avx512ifma and avx512vl (i.e., runtime backend selection). |
|1.1.0–3.2.1 | The nightly-only simd_backend feature must be set and the build must have target_feature=+avx512ifma |
Impact
On the AVX-512 backend, Edwards or Ristretto computations including scalar multiplication with an attacker-chosen point could be made to be incorrect. No other backends are affected. x-only multiplication used in x25519-dalek is unaffected. ed25519-dalekmay be affected, though, in the worst case, a valid signature under an attacker-chosen public key would appear as invalid.
Workaround
The workaround depends on the version you're using:
|Version|Workaround|
|-------|----------|
|5.0.0 | Do not compile with --cfg curve25519_dalek_backend="avx512" and do not build with target_feature=+avx512ifma,+avx512vl or -C target-cpu=native on an AVX-512 target. You can set --cfg curve25519_dalek_backend="simd" instead. |
|4.2.0–5.0.0-rc.1 | Do not set --cfg curve25519_dalek_backend="unstable_avx512". Or compile on stable. |
|4.0.0–4.1.3 | Override the backend to --cfg curve25519_dalek_backend="serial", or compile on stable. |
|1.1.0–3.2.1 | Do not set the simd_backend feature. Or do not set target_feature=+avx512ifma or -C target-cpu=native on an AVX-512 target in the build. |
More Details
A more complete writeup can be found at https://github.com/dalek-cryptography/curve25519-dalek/issues/934