Skip to content

Commit 1ee8ee6

Browse files
authored
Hardening deserialization (#836)
* fuzz: add MMR and crypto type deserialization fuzz targets Add fuzz targets for high-severity attack surface: - mmr.rs: PartialMmr and Forest deserialization - crypto.rs: Falcon PublicKey, SealingKey, SealedMessage deserialization Also update keccak to 0.1.6 to fix RUSTSEC-2026-0012. * ci: add mmr and crypto fuzz targets to CI workflow Add new fuzz targets for MMR structures (PartialMmr, Forest) and cryptographic types (PublicKey, SealingKey, SealedMessage) to the daily CI fuzz job. * fix: replace unwrap with proper error handling in XChaCha decryption The AeadScheme implementation for XChaCha used unwrap() when deserializing EncryptedData from raw bytes, which could panic on malformed attacker-controlled input. Replace with proper error propagation. Also add AEAD fuzz target to catch similar issues and include it in CI fuzz job. * fuzz: add DSA signatures fuzz target Add fuzz coverage for all signature deserialization paths: - EdDSA (Ed25519) signatures and public keys - ECDSA (secp256k1) signatures, public keys, and recovery - Falcon512 signatures, public keys, and recovery Also exercises verify paths to catch panics on malformed input. * chore: Changelog
1 parent 6af6c7d commit 1ee8ee6

File tree

10 files changed

+406
-83
lines changed

10 files changed

+406
-83
lines changed

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
fail-fast: false
5050
max-parallel: 1
5151
matrix:
52-
target: [word, merkle, smt_serde]
52+
target: [word, merkle, smt_serde, mmr, crypto, aead, signatures]
5353
timeout-minutes: 15
5454
steps:
5555
- uses: actions/checkout@main

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Fixed tuple `min_serialized_size()` to exclude alignment padding, fixing `BudgetedReader` rejecting valid data ([#827](https://github.com/0xMiden/crypto/pull/827)).
1313
- [BREAKING] Added validation to `PartialMmr::from_parts()` and `Deserializable` implementation, added `from_parts_unchecked()` for performance-critical code ([#812](https://github.com/0xMiden/crypto/pull/812)).
1414
- Added `Signature::from_der()` for ECDSA signatures over secp256k1 ([#842](https://github.com/0xMiden/crypto/pull/842)).
15+
- Fix possible panic in `XChaCha::decrypt_bytes_with_associated_data` and harden deserialization with fuzzing across 7 new targets ([#836](https://github.com/0xMiden/crypto/pull/836)).
1516

1617
## 0.22.3 (2026-02-23)
1718

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,22 @@ fuzz-merkle: ## Run fuzzing for Merkle tree serialization
165165
fuzz-smt-serde: ## Run fuzzing for SMT serialization
166166
cargo +nightly fuzz run smt_serde --release --fuzz-dir miden-crypto-fuzz
167167

168+
.PHONY: fuzz-mmr
169+
fuzz-mmr: ## Run fuzzing for MMR structures serialization
170+
cargo +nightly fuzz run mmr --release --fuzz-dir miden-crypto-fuzz
171+
172+
.PHONY: fuzz-crypto
173+
fuzz-crypto: ## Run fuzzing for cryptographic types serialization
174+
cargo +nightly fuzz run crypto --release --fuzz-dir miden-crypto-fuzz
175+
176+
.PHONY: fuzz-aead
177+
fuzz-aead: ## Run fuzzing for AEAD decryption paths
178+
cargo +nightly fuzz run aead --release --fuzz-dir miden-crypto-fuzz
179+
180+
.PHONY: fuzz-signatures
181+
fuzz-signatures: ## Run fuzzing for DSA signature deserialization
182+
cargo +nightly fuzz run signatures --release --fuzz-dir miden-crypto-fuzz
183+
168184
# --- installing ----------------------------------------------------------------------------------
169185

170186
.PHONY: check-tools

0 commit comments

Comments
 (0)