<div dir="ltr"><font face="monospace">VSV00007 Varnish HTTP/2 Request Smuggling Attack<br>================================================<br><br>Date: 2021-07-13<br><br>A request smuggling attack can be performed on Varnish Cache and Varnish<br>Cache Plus servers that have the HTTP/2 protocol enabled. The smuggled<br>requests do not go through normal VCL processing, and any authorisation<br>steps implemented in VCL would be bypassed.<br><br>The responses to the smuggled requests can under some circumstances also<br>be obtained by the attacker. Also, it may be possible for an attacker to<br>use this for cache poisoning, where the response to a smuggled request is<br>inserted as the cached content.<br><br><br>Identifying smuggled requests<br>-----------------------------<br><br>Smuggled requests will not show in any logs generated by Varnish, but<br>would show in the backend logs. It may be possible to identify the<br>smuggled requests in the backend logs by missing Varnish inserted<br>artifacts, like the `X-Varnish` header. Though a determined attacker may<br>spoof these artifacts in the smuggled requests.<br><br><br>Versions affected<br>-----------------<br><br>* Varnish Cache releases 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.1.0,<br>  6.1.1, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.3.0, 6.3.1, 6.3.2, 6.4.0, 6.5.0,<br>  6.5.1, 6.6.0.<br><br>* Varnish Cache releases 5.x.x. Notice that the experimental HTTP/2<br>  support in these releases are known to have several issues, and enabling<br>  HTTP/2 is not recommended.<br><br>* Varnish Cache 6.0 LTS by Varnish Software up to and including 6.0.7<br><br><br>Versions not affected<br>---------------------<br><br>* All versions of Varnish Cache prior to version 5.0.0<br><br><br>Fixed in<br>--------<br><br>* Varnish Cache 6.6.1<br><br>* Varnish Cache 6.5.2<br><br>* Varnish Cache 6.0 LTS version 6.0.8<br><br>* GitHub Varnish Cache master branch at commit 450961a019d1c1955ca1851d51940ff2c87bdc98<br><br><br>Mitigation<br>----------<br><br>Mitigation is possible by either disabling the HTTP/2 protocol, or<br>preventing backend connection reuse.<br><br>Turning off support for HTTP/2:<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><br>The problem only affects servers that have HTTP/2 support enabled. This<br>support can be turned off at runtime. To disable HTTP/2 on a server do::<br><br>  sudo varnishadm param.set feature -http2<br><br>To verify that HTTP/2 is disabled on a server, execute this command and<br>make sure the current value does not list `http2`::<br><br>  sudo varnishadm param.show feature<br><br>When using Hitch (or any other TLS termination proxy) in front of Varnish<br>to handle TLS termination, you should also unlist the `h2` token as a<br>possible protocol in the ALPN advertisement sent to connecting clients.<br><br>To unlist `h2` as a supported protocol in Hitch, remove or comment out the<br>line stating `alpn-protos = "h2, http/1.1"` in your Hitch configuration<br>file. Then restart the Hitch service (reload is not sufficient).<br><br>Preventing connection reuse<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><br>On compliant backends it is possible to prevent the execution of smuggled<br>requests by disabling connection reuse of backend requests. Note that for<br>this workaround to be effective, it relies on the backend to refuse any<br>additional requests after seeing a `Connection: close` header.<br><br>To disable backend connection reuse, add a `Connection: close` header on<br>the outgoing backend requests::<br><br>  sub vcl_backend_fetch {<br>set bereq.http.Connection = "close";<br>  }<br><br><br>Credits<br>-------<br><br>Martin Blix Grydeland at Varnish Software for identifying and handling the<br>issue.</font><br></div>