| 1 |
:orphan: |
| 2 |
|
| 3 |
HPACK Bomb |
| 4 |
========== |
| 5 |
|
| 6 |
Hyper Project security advisory, August 4th 2016. |
| 7 |
|
| 8 |
Vulnerability |
| 9 |
------------- |
| 10 |
|
| 11 |
A HTTP/2 implementation built using the priority library could be targetted for |
| 12 |
a denial of service attack based on HPACK, specifically a so-called "HPACK |
| 13 |
Bomb" attack. |
| 14 |
|
| 15 |
This attack occurs when an attacker inserts a header field that is exactly the |
| 16 |
size of the HPACK dynamic header table into the dynamic header table. The |
| 17 |
attacker can then send a header block that is simply repeated requests to |
| 18 |
expand that field in the dynamic table. This can lead to a gigantic compression |
| 19 |
ratio of 4,096 or better, meaning that 16kB of data can decompress to 64MB of |
| 20 |
data on the target machine. |
| 21 |
|
| 22 |
It only takes a few such header blocks before the attacker has forced the |
| 23 |
target to allocate gigabytes of memory, which will take the process down. This |
| 24 |
requires relatively few resources on the part of the attacker. |
| 25 |
|
| 26 |
While we are not aware of any attacker actively exploiting this vulnerability, |
| 27 |
it has been public disclosed in `this report`_, and so users should assume that |
| 28 |
they are likely to be targetted by such an attack. |
| 29 |
|
| 30 |
Info |
| 31 |
---- |
| 32 |
|
| 33 |
This issue has been given the name CVE-2016-6581. |
| 34 |
|
| 35 |
Affected Versions |
| 36 |
----------------- |
| 37 |
|
| 38 |
This issue affects all versions of the HPACK library prior to 2.3.0. It also |
| 39 |
affects versions of the Hyper client library earlier than 0.6.0, which bundled |
| 40 |
a copy of the HPACK library. |
| 41 |
|
| 42 |
The Solution |
| 43 |
------------ |
| 44 |
|
| 45 |
In version 2.3.0, the HPACK library limits the maximum decompressed size of the |
| 46 |
header block. It does so by essentially adding support for the HTTP/2 setting |
| 47 |
``SETTINGS_MAX_HEADER_LIST_SIZE``. This value defaults to 64kB, but is |
| 48 |
user-configurable. |
| 49 |
|
| 50 |
If it is necessary to backport a patch, the patch can be found in |
| 51 |
`this GitHub pull request`_. |
| 52 |
|
| 53 |
Recommendations |
| 54 |
--------------- |
| 55 |
|
| 56 |
We suggest you take the following actions immediately, in order of preference: |
| 57 |
|
| 58 |
1. Update HPACK to 2.3.0 immediately. |
| 59 |
2. Backport the patch made available on GitHub. |
| 60 |
3. Substantially decrease the maximum size of the compressed header block your |
| 61 |
application will accept, or alternatively ensure that each decompressed |
| 62 |
header block is freed before your application processes the next one. |
| 63 |
|
| 64 |
If you have a copy of the Hyper client library, we recommend taking the |
| 65 |
following actions, in order of preference: |
| 66 |
|
| 67 |
1. Update hyper to any version later than 0.6.0 |
| 68 |
2. Backport the patch made available on GitHub. |
| 69 |
|
| 70 |
Timeline |
| 71 |
-------- |
| 72 |
|
| 73 |
This class of vulnerability was publicly reported in `this report`_ on the |
| 74 |
3rd of August. We requested a CVE ID from Mitre the same day. |
| 75 |
|
| 76 |
HPACK 2.3.0 was released on the 4th of August, at the same time as the |
| 77 |
publication of this advisory. |
| 78 |
|
| 79 |
|
| 80 |
.. _this report: http://www.imperva.com/docs/Imperva_HII_HTTP2.pdf |
| 81 |
.. _this GitHub pull request: https://github.com/python-hyper/hpack/pull/56 |