Haproxy 2.0.4 - HTTP/2 on stats page prevents actions

2019-08-14 Thread Marco Corte

Hi.

Environment:
- Ubuntu 18.04
- Haproxy 2.0.4 from vbernat repository

I found a strange behaviour of the statistics page if when
  alpn h2,http/1.1
is in the "bind" line of the statistics like:

frontend stats-http
  mode http
  option httplog
  bind 10.64.69.192:443 alpn h2,http/1.1 ssl crt 
/etc/ssl/private/-full.pem ssl-min-ver TLSv1.2




How to reproduce:
. select a server in the statistics web page
. choose an action (for example "Set state to DRAIN") in the drop-down 
list

. click "Apply"

It seems that the POST never ends and the status is not changed.

If I remove
  alpn h2,http/1.1
from the "bind" line, the actions work as usual.

I did not see this behaviour in version 1.9.x.
Is it a known behaviour?

Thank you

.marcoc



Re: HTTP/2 Denial of Service Advisory

2019-08-14 Thread Willy Tarreau
Hi again,

small update on this below.

On Tue, Aug 13, 2019 at 10:50:46PM +0200, Willy Tarreau wrote:
> Hi Aleks,
> 
> On Tue, Aug 13, 2019 at 07:02:49PM +, Aleksandar Lazic wrote:
> > Have anyone seen this and maybe some information is haproxy vulnerable
> > against this attacks?
> > 
> > https://github.com/Netflix/security-bulletins/blob/master/advisories/third-party/2019-002.md
> 
> Yes I had a look after being kindly notified by Piotr. In practice almost
> all of them are irrelevant in our case, either because the processing cost
> is trivial (e.g. RST_STREAM, PING, SETTINGS, empty frames...) or because
> we don't have the required feature (priority, push_promise). The one I'd
> like to have a deeper look at is the 1-byte window increments, which may
> result in several streams to be woken up just to write one byte and wait
> for the next update. It should even have a higher impact on 1.9+ than on
> 1.8, but nothing alarming in my opinion. We could easily mitigate this by
> waiting for at least a part of the pending data to be refilled before
> waking the streams up.

So I checked between 1.8 and 2.1-dev today and the result is that we're
not impacted by these issues (checked in code review and tests). I found
that the code was nicely cleaned up between 1.8 and 2.1 because I was
first worried about the apparent missing 0-length check on the headers
frame in 1.9+ then I figured I had already centralized these checks for
safer control :-)

I ran a few performance tests using some of these types of attacks and
as expected my laptop swallows multi-gigabit/s of such traffic on a
single core. And while looking into this I discovered we had a sub-
optimization of window increment processing which can cause some minor
unfairness between several streams if the window grows in small steps
(typically what can happen if a client sends a connection window update
for each received frame). I found that improving this point resulted in
doubling our capacity to swallow WINDOW_UPDATE frames, jumping from 30
million frames per second to 65 million per second because we don't try
to make some streams prepare DATA frames if others are already blocked.
So I'm going to merge this into -dev once cleaned up (and don't expect
to backport these since I'm not seeing any real world case where it
matters).

I also have some slowly ongoing work on a trace mechanism that is still
rudimentary but proved very useful here, that I hope to finish soon,
and that may possibly end up being backported if we find that it speeds
up bug chasing and resolving interoperability issues at a low level.
More on this later.

Cheers,
Willy