Repository navigation
Commit 44f6173
pgconn: cap server-supplied SCRAM iteration count
recvServerFirstMessage parsed the server-supplied i= value with
strconv.Atoi and accepted any positive value. clientFinalMessage then
calls pbkdf2.Key(sha256.New, password, salt, sc.iterations, 32) with
that value. A malicious server can send i=2000000000, pinning a CPU
core for several minutes per connection attempt before any context
deadline check (PBKDF2 is not interruptible).
Reject iteration counts above 10,000,000 (~2500x PostgreSQL's default
of 4096). This makes pgx stricter than libpq, which accepts any
positive value.
Reported by CrowdStrike (F03).1 parent 1a976f7 commit 44f6173
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
287 | 294 | | |
288 | 295 | | |
289 | 296 | | |
| |||
0 commit comments