postgresql/src/backend/tcop
Michael Paquier f7a191f537 Fix unbounded recursive handling of SSL/GSS in ProcessStartupPacket()
The handling of SSL and GSS negotiation messages in
ProcessStartupPacket() could cause a recursion of the backend,
ultimately crashing the server as the negotiation attempts were not
tracked across multiple calls processing startup packets.

A malicious client could therefore alternate rejected SSL and GSS
requests indefinitely, each adding a stack frame, until the backend
crashed with a stack overflow, taking down a server.

This commit addresses this issue by modifying ProcessStartupPacket() so
as processed negotiation attempts are tracked, preventing infinite
recursive attempts.  A TAP test is added to check this problem, where
multiple SSL and GSS negotiated attempts are stacked.

Reported-by: Calif.io in collaboration with Claude and Anthropic
Research
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Security: CVE-2026-6479
Backpatch-through: 14
2026-05-11 05:13:47 -07:00
..
backend_startup.c Fix unbounded recursive handling of SSL/GSS in ProcessStartupPacket() 2026-05-11 05:13:47 -07:00
cmdtag.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
dest.c Avoid including explain.h in explain_format.h and explain_dr.h 2025-02-28 13:17:29 -05:00
fastpath.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
Makefile Move code for backend startup to separate file 2024-03-18 11:38:10 +02:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
postgres.c Fix slotsync worker blocking promotion when stuck in wait 2026-04-08 11:23:13 +09:00
pquery.c Remove assertion from PortalRunMulti 2025-07-17 17:40:22 +02:00
utility.c Check for CREATE privilege on the schema in CREATE STATISTICS. 2025-11-10 09:00:00 -06:00