[gnutls-devel] GnuTLS | srptool: fix stack buffer overflow with large SRP groups (!2050)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Wed Dec 24 13:56:22 CET 2025



Mikhail created a merge request: https://gitlab.com/gnutls/gnutls/-/merge_requests/2050

Project:Branches: grey3228/gnutls:fix/large-srp-group-stack-buff-overflow to gnutls/gnutls:master
Author:   Mikhail



The static buffer result in _srp_crypt() was only 1024 bytes, while the
8192-bit SRP group code produces base64-encoded verifier of 1366
characters.

Using sprintf() with the old buffer caused a stack buffer overflow
(undefined behaviour) when --index=6 or --index=7 was used.

This MR:
- increases the static buffer size to 2048 bytes (sufficient for all
  currently supported groups),
- replaces sprintf() with snprintf() to prevent overflow even if the
  buffer were accidentally too small.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: #1777

## Checklist
 * [x] Commits have `Signed-off-by:` with name/author being identical to the commit author
 * [x] Code modified for feature
 * [x] Test suite updated with functionality tests
 * [x] Test suite updated with negative tests
 * [x] Documentation updated / NEWS entry present (for non-trivial changes)

## Reviewer's checklist:
 * [ ] Any issues marked for closing are addressed
 * [ ] There is a test suite reasonably covering new functionality or modifications
 * [ ] Function naming, parameters, return values, types, etc., are consistent and according to `CONTRIBUTION.md`
 * [ ] This feature/change has adequate documentation added
 * [ ] No obvious mistakes in the code

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/2050
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20251224/edd30511/attachment.html>


More information about the Gnutls-devel mailing list