Repository navigation
userauth.c: username_len bounds checking - #1858
Merged
Merged
Conversation
return errors when username_len will exceed bounds
This was referenced May 2, 2026
shivammathur
added a commit
to winlibs/libssh2
that referenced
this pull request
May 24, 2026
Backport upstream libssh2 fix for username_len bounds checking in src/userauth.c. CVE-2026-7598: integer overflow in userauth_password via crafted username_len/password_len values, remotely triggerable in libssh2 up to 1.11.1. CWE: CWE-189, CWE-190 CVSS: 3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L (7.3 HIGH) Upstream-Commit: 256d04b60d80bf1190e96b0ad1e91b2174d744b1 Upstream-PR: libssh2/libssh2#1858
This was referenced Jun 8, 2026
This was referenced Jun 15, 2026
This was referenced Jun 22, 2026
This was referenced Jun 30, 2026
Closed
vszakats
added a commit
that referenced
this pull request
Jul 5, 2026
- cap username/password to `MAX_INPUT_LEN` in `userauth_password()` to avoid wraparound in 32-bit builds. `MAX_INPUT_LEN` is currently set to: 35 KB - 0x100. Reported by GitHub Code Quality Follow-up to 256d04b #1858 - cap username to `MAX_INPUT_LEN` where the limits were set higher. Follow-up to 256d04b #1858 - return `LIBSSH2_ERROR_OUT_OF_BOUNDARY` to indicate out of bounds errors. Were `LIBSSH2_ERROR_PROTO`, `LIBSSH2_ERROR_INVAL`, `LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED` prior to this patch. Closes #2223
This was referenced Jul 6, 2026
This was referenced Jul 15, 2026
This was referenced Aug 3, 2026
This was referenced Aug 17, 2026
This was referenced Aug 24, 2026
This was referenced Aug 31, 2026
This was referenced Sep 10, 2026
pratikfarkasest
added a commit
to pratikfarkasest/libssh2
that referenced
this pull request
Oct 5, 2026
The userauth request builders size their packet buffer from username_len plus a fixed overhead. An oversized username_len must be rejected before any network I/O rather than wrapped around (fix: libssh2#1858, commit 256d04b). Extend test_simple to call every userauth entry point reachable on an unconnected session with username_len = 0xFFFFFFFF and assert each one rejects it: libssh2_userauth_list(), libssh2_userauth_password_ex(), libssh2_userauth_publickey_fromfile_ex(), libssh2_userauth_hostbased_fromfile_ex() and libssh2_userauth_keyboard_interactive_ex(). The checks reuse the session test_simple already creates, so they add no setup cost. Ref: libssh2#1858
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.
Return errors when username_len will exceed bounds, fix existing bounds check.
Credit:
dapickle