Commit b662d12
authored
Merge commit from fork
A malicious or compromised HTTP/2 server could exhaust client memory by
sending a HEADERS frame without END_HEADERS followed by an unbounded chain
of CONTINUATION frames. Each fragment was appended to
`conn.headers_being_processed` with no cap on size or count, and the block is
only decoded once END_HEADERS arrives — which a hostile server simply never
sends. A single connection could drive the client to OOM (~1 GiB from ~64k
16 KiB frames in the reported PoC).
The client now bounds the accumulated header block by the locally advertised
SETTINGS_MAX_HEADER_LIST_SIZE, which defaults to 256 KB (previously
:infinity, i.e. unbounded). The limit is checked against the compressed
accumulator as each fragment is parked, before it grows, and the connection
is torn down with a PROTOCOL_ERROR GOAWAY once exceeded. The default is also
advertised to the server so well-behaved peers never send oversized blocks;
the receive-side check backstops misbehaving ones. Because the compressed
accumulator is never larger than the header list it decodes to, the limit
never rejects a header block that fits within the advertised size.
The bound is tracked with a running byte count carried in
`headers_being_processed`, so enforcement is O(1) per frame rather than
rescanning the accumulator (which would be O(n^2) under a flood).1 parent fad0914 commit b662d12
2 files changed
Lines changed: 123 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
| |||
235 | 241 | | |
236 | 242 | | |
237 | 243 | | |
238 | | - | |
| 244 | + | |
239 | 245 | | |
240 | 246 | | |
241 | 247 | | |
| |||
297 | 303 | | |
298 | 304 | | |
299 | 305 | | |
300 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
301 | 312 | | |
302 | 313 | | |
303 | 314 | | |
| |||
1140 | 1151 | | |
1141 | 1152 | | |
1142 | 1153 | | |
1143 | | - | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1144 | 1157 | | |
1145 | 1158 | | |
1146 | 1159 | | |
| |||
1728 | 1741 | | |
1729 | 1742 | | |
1730 | 1743 | | |
1731 | | - | |
| 1744 | + | |
1732 | 1745 | | |
1733 | 1746 | | |
1734 | 1747 | | |
| |||
1906 | 1919 | | |
1907 | 1920 | | |
1908 | 1921 | | |
1909 | | - | |
| 1922 | + | |
1910 | 1923 | | |
1911 | 1924 | | |
1912 | 1925 | | |
| |||
2237 | 2250 | | |
2238 | 2251 | | |
2239 | 2252 | | |
2240 | | - | |
| 2253 | + | |
2241 | 2254 | | |
2242 | 2255 | | |
2243 | 2256 | | |
| |||
2392 | 2405 | | |
2393 | 2406 | | |
2394 | 2407 | | |
2395 | | - | |
| 2408 | + | |
2396 | 2409 | | |
2397 | 2410 | | |
2398 | 2411 | | |
2399 | 2412 | | |
2400 | 2413 | | |
2401 | 2414 | | |
2402 | | - | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
2403 | 2424 | | |
2404 | 2425 | | |
2405 | 2426 | | |
2406 | 2427 | | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
2407 | 2455 | | |
2408 | 2456 | | |
2409 | 2457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
963 | 963 | | |
964 | 964 | | |
965 | 965 | | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
966 | 1033 | | |
967 | 1034 | | |
968 | 1035 | | |
| |||
0 commit comments