From: William Lallemand Date: Fri, 20 Nov 2026 10:49:08 +0000 (+0000) Subject: BUG/MINOR: ssl/cli: use the right list member in "add ssl crt-list" release X-Git-Url: https://git.kaiwu.me/http/ngx_http_auth_basic_module.html?a=commitdiff_plain;h=778b7af9cb8a106f7a5eea0e2957b790deed7182;p=haproxy.git BUG/MINOR: ssl/cli: use the right list member in "add ssl crt-list" release cli_release_add_crtlist() walks the crtlist_entry's list of ckch_inst with the "by_ckchs" list member instead of "by_crtlist_entry". Since list_for_each_entry_safe() re-bases each node with the offset of the given member, walking a list whose elements are chained through "by_crtlist_entry" using the offset of "by_ckchs" produces a bogus struct ckch_inst pointer, which is then passed to ckch_inst_free(). The latter writes through it (LIST_DELETE on both members and free()), so this is not just a wild read but real memory corruption. This happens when "add ssl crt-list" fails after at least one ckch_inst was already generated and appended to the entry being added (e.g. a later bind_conf failing to instantiate), in which case the worker dies with a SIGSEGV during the cleanup of the discarded entry. This requires ADMIN CLI access so it stays out of the threat model, but it is a crash of the worker triggered by a legitimate command. Use "by_crtlist_entry" like every other walk of this list in the same file (crtlist_entry_free() and both loops of the delete handler). The bug is present since the introduction of the command in 2.2 (e67c80be7f "MEDIUM: ssl/cli: 'add ssl crt-list' command"), so every maintained branch is affected, but the fix applies cleanly everywhere as this code never changed since. This should be backported in every stable branches. Reported by Bruno Henc (@brhenc). Fixes issue #3586. --- diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index 7319b1307..7f7ef65d1 100644 --- a/src/ssl_crtlist.c +++ b/src/ssl_crtlist.c @@ -1186,7 +1186,7 @@ static void cli_release_add_crtlist(struct appctx *appctx) LIST_DELETE(&entry->by_crtlist); LIST_DELETE(&entry->by_ckch_store); - list_for_each_entry_safe(inst, inst_s, &entry->ckch_inst, by_ckchs) { + list_for_each_entry_safe(inst, inst_s, &entry->ckch_inst, by_crtlist_entry) { ckch_inst_free(inst); } crtlist_free_filters(entry->filters);