BUG/CRITICAL: h2: fix incorrect frame length check
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Apr 2018 08:28:27 +0000 (10:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Apr 2018 08:35:30 +0000 (10:35 +0200)
commit3f0e1ec70173593f4c2b3681b26c04a4ed5fc588
tree73d60658e3fa96edf3c4d7a5329f2e8c9e860b81
parent9eb2a4addfb25c4a3c99cd6c78101b9ec7469393
BUG/CRITICAL: h2: fix incorrect frame length check

The incoming H2 frame length was checked against the max_frame_size
setting instead of being checked against the bufsize. The max_frame_size
only applies to outgoing traffic and not to incoming one, so if a large
enough frame size is advertised in the SETTINGS frame, a wrapped frame
will be defragmented into a temporary allocated buffer where the second
fragment my overflow the heap by up to 16 kB.

It is very unlikely that this can be exploited for code execution given
that buffers are very short lived and their address not realistically
predictable in production, but the likeliness of an immediate crash is
absolutely certain.

This fix must be backported to 1.8.

Many thanks to Jordan Zebor from F5 Networks for reporting this issue
in a responsible way.
src/mux_h2.c