by silvestrov · 5y ago · 0 comments
Otherwise we will keep chasing bugs forever.
There is a talk by James Kettle about request smuggling with HTTP/2, but it is largely about attacks when the frontend talks HTTP/2 and then converts to HTTP/1.1 to talk to backend servers [1]. That said, it does also highlight some HTTP/2-only quirks, so it’s not completely perfect, but it’s so much better than HTTP/1.1.
[1]: https://portswigger.net/kb/papers/rfekn2Uv/HTTP2whitepaper.p...
The problem isn’t that we don’t have a good header format. The problem is we have too many.
JSON is a terrible format. Especially for streaming data.
Here's a super simple shell script for generating invalid JSON that will blow Python's stack:
n="$(python3 -c 'import math; import sys; sys.stdout.write(str(math.floor(sys.getrecursionlimit() - 4)))')"
left="$(yes [ | head -n "$n" | tr -d '\n')"
echo "$left" | python3 -c 'import json; print(json.loads(input()))'
It is invalid JSON. But you cannot tell if it's invalid until either:a) You run out of memory.
b) The connection ends.
Because JSON is terrible for streaming data.