Repository navigation
Bound PKCS#1 modulus sizes before bigint conversion - #793
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #793 +/- ##
==========================================
+ Coverage 93.13% 93.14% +0.01%
==========================================
Files 29 29
Lines 4091 4097 +6
==========================================
+ Hits 3810 3816 +6
Misses 281 281 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Reject moduli from `pkcs1::{RsaPublicKey, RsaPrivateKey}` (which are
stored as `der::asn1::UintRef`) which exceed `rsa::PublicKey::MAX_SIZE`
prior to allocating a `BoxedUint` on the heap.
Eagerly rejecting these inputs prevents potential DoS from malicious
PKCS#1 and PKCS#8 (which wraps PKCS#1) inputs.
Thanks to @AlexxcelerateDev for reporting this.
tarcieri
force-pushed
the
bound-pkcs1-private-key-modulus-size
branch
from
November 9, 2026 05:08
5035d73 to
be663c9
Compare
tarcieri
added a commit
to RustCrypto/SSH
that referenced
this pull request
Nov 9, 2026
OpenSSH enforces the following limit on the size of `mpint`: https://github.com/openssh/openssh-portable/blob/e416edf/sshbuf.h#L41 This commit enforces the same limit for the standard `Mpint` constructors. Unfortunately we support infallible `From<Uint>` impls that can't enforce the size limit, which are currently TODOs. Perhaps before the next `ssh-key` release we can consider making another breaking release of `ssh-encoding` to address those TODOs properly. See also: RustCrypto/RSA#793
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reject moduli from
pkcs1::{RsaPublicKey, RsaPrivateKey}(which are stored asder::asn1::UintRef) which exceedrsa::PublicKey::MAX_SIZEprior to allocating aBoxedUinton the heap.Eagerly rejecting these inputs prevents potential DoS from malicious PKCS#1 and PKCS#8 (which wraps PKCS#1) inputs.
Thanks to @AlexxcelerateDev for reporting this.