Commit c8a44115 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Pål Hermunn Johansen

Correctly handle bogusly large chunk sizes

This fixes a denial of service attack vector where bogusly large chunk
sizes in requests could be used to force restarts of the Varnish
server.

This is Varnish Security Vulnerability VSV00001

For more information visit: https://varnish-cache.org/security/VSV00001

Fixes: #2379
parent 6ece6958
......@@ -152,7 +152,7 @@ v1f_pull_chunked(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr,
if (q == NULL || *q != '\0')
return (VFP_Error(vc, "chunked header number syntax"));
cl = (ssize_t)cll;
if ((uintmax_t)cl != cll)
if (cl < 0 || (uintmax_t)cl != cll)
return (VFP_Error(vc, "bogusly large chunk size"));
vfe->priv2 = cl;
......
varnishtest "Check that we handle bogusly large chunks correctly"
# Check that the bug has been fixed
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
} -start
client c1 {
send "POST / HTTP/1.1\r\n"
send "Transfer-Encoding: chunked\r\n\r\n"
send "FFFFFFFFFFFFFFED\r\n"
send "0\r\n\r\n"
rxresp
expect resp.status == 503
} -run
# Check that the published workaround does not cause harm
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.transfer-encoding ~ "(?i)chunked") {
return (fail);
}
}
}
client c1 {
send "POST / HTTP/1.1\r\n"
send "Transfer-Encoding: chunked\r\n\r\n"
send "FFFFFFFFFFFFFFED\r\n"
rxresp
expect resp.status == 503
} -run
================================
Varnish Cache 5.1.3 (unreleased)
================================
Bugs fixed
----------
* 2379_ - Correctly handle bogusly large chunk sizes (VSV00001)
.. _2379: https://github.com/varnishcache/varnish-cache/issues/2379
================================
Varnish Cache 5.1.2 (2017-04-07)
================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment