]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: jwe: fix memory leak in jwt_decrypt_secret with var argument
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Apr 2026 07:48:15 +0000 (09:48 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 7 Apr 2026 09:17:30 +0000 (11:17 +0200)
commit5161415653ce0fc21b3bfe76791c5d17b0bca3ff
treed0837af44fbdd133b2ad06505f95e5bf1bf4f2e6
parent648b0e7beac4746f1f4184a2f09eedad5246fff3
BUG/MEDIUM: jwe: fix memory leak in jwt_decrypt_secret with var argument

When the secret argument to jwt_decrypt_secret is a variable
(ARGT_VAR) rather than a literal string, alloc_trash_chunk() is
called to hold the base64-decoded secret but the buffer is never
released. The end: label frees input, decrypted_cek, out, and the
decoded_items array but not secret.

Each request leaks one trash chunk (~tune.bufsize, default 16KB).
At ~65000 requests per GiB this allows slow memory exhaustion DoS
against any config of the form:

    http-request set-var(txn.x) req.hdr(...),jwt_decrypt_secret(txn.key)

This must be backported as far as JWE support exists.
src/jwe.c