You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CPace guard: forged UDP PAKE1 can ban a client's address or use up the global budget #207
From the Qodo review of #202 (finding 9), confirmed in the code.
The CPace guard (src/cpaceguard.c, server_handle_pake1()) counts PAKE1 attempts by the UDP source address, and nothing proves that the sender can receive at that address before the attempt is counted. Over UDP the source can be forged, so:
cpace_ban_after (30) forged PAKE1 packets from a victim's address (one camera, or a NAT with many) ban it for cpace_ban_time (600 s); an address with a confirmed client within the hour is never banned, but after a server restart no address has one yet;
forged PAKE1 from many random addresses at about cpace_total (300) a minute drain the shared bucket, so no unconfirmed client gets a CPace attempt, and they push the confirmed entries out of the fixed 256-slot table.
TCP is not affected: the handshake proves the address.
Options:
A cookie round trip before CPace on UDP (like DTLS / WireGuard under load): the first PAKE1 from an address gets a stateless cookie (a MAC of the address and a rotating secret); only a PAKE1 that carries it is counted and answered. Costs one round trip, only when the guard sees load.
Ban only on TCP, rate-limit only on UDP: forged UDP can still use up the budget, but cannot ban anyone.
Keep the confirmed entries apart from the table forged sources can fill.
1 is the real fix and fits the protocol's message types; 2 and 3 are small steps that can come first.
Activity