Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 102991 - net-www/apache-2 Byterange bug can deplete all memory
Summary: net-www/apache-2 Byterange bug can deplete all memory
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Security
URL:
Whiteboard: A3? [glsa] jaervosz
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-18 12:11 UTC by dswhite42
Modified: 2005-10-15 07:53 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix byterange bug for Apache 2.0.x (byterange.patch,2.87 KB, patch)
2005-08-18 12:11 UTC, dswhite42
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dswhite42 2005-08-18 12:11:00 UTC
There is a bug in Apache 2.0.x that can cause the whole machine to run out of
memory (RAM & swap) under certain circumstances.  The discussion on the Apache
mailing list is here: http://tinyurl.com/7rpzt (there are 8 messages in the
thread).  To summarize:

1) Server owner running Apache 2.0.x sets up a CGI script to transfer a file. 
The script (lets call it http://example.com/download.cgi) can be as simple as a
program that reads a file from the hard drive and outputs it in 1K chunks.

2) User requests http://example.com/download.cgi using a download accelerator
that splits a download into multiple requests to speed up the download.  

3) Apache bug in handling byterange requests causes the apache2 processes to use
up an arbitrary amount of RAM, very likely exhausting all RAM and swap space on
the server.  Note that the amount of memory used can be far greater than the
actual size of the file being download.

This only happens when a download accelerator is used (which makes the byterange
requests) and a CGI program is used on the server side to handle the file transfer.

I'll attach a patch which solves the problem by not allowing byterange requests
under those circumstances.  Once applied, a download accelerator would only be
able to make a single request for the file.  (Byterange requests are still
allowed when the file is downloaded directly, without a CGI script involved - in
which case the download accelerator can still split the request into multiple
requests without impacting the server's memory usage).

This patch is known to work with net-www/apache-2.0.54-r13 .
Comment 1 dswhite42 2005-08-18 12:11:46 UTC
Created attachment 66245 [details, diff]
Patch to fix byterange bug for Apache 2.0.x
Comment 2 dswhite42 2005-08-18 12:20:24 UTC
I should point out that this is Joe Orton's patch for the byterange problem,
fixed in Apache 2.1.5, and backported into the patch file I uploaded so it will
work with Apache 2.0.x .  

See http://issues.apache.org/bugzilla/show_bug.cgi?id=29962 for the bug and
http://svn.apache.org/viewcvs?rev=188797&view=rev for Joe's patch to Apache 2.1.5
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2005-08-18 12:42:56 UTC
security, can this be considered a vulnerability (like DoS)?
Comment 4 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-08-18 12:58:57 UTC
I tend to say yes, apache-bugs please advise. 
Comment 5 Michael Stewart (vericgar) (RETIRED) gentoo-dev 2005-08-18 21:33:40 UTC
If not a vulnerability, definetly something that should be fixed. It seems valid
to me (and in fact I may be experiencing the same issues on my server, I just
haven't gotten around to figuring out what exactly is the issue there). I'll
take another look at this tomorrow evening when I am more awake and have more time.
Comment 6 Michael Stewart (vericgar) (RETIRED) gentoo-dev 2005-08-19 18:36:37 UTC
New ebuilds commited

Stable/old-style: apache-2.0.54-r9
Unstable/new-style: apache-2.0.54-r14

Here's hoping this is the last security bump before new-style becomes stable
(aiming for 11-Sept-2005), as there are several ebuilds in the tree that expect
<-r10 to be old-style and >=-r10 to be new-style and they will all have to be
changed with another bump to old-style.
Comment 7 Stefan Cornelius (RETIRED) gentoo-dev 2005-08-19 23:05:02 UTC
Dear arches, please test+stable apache-2.0.54-r9 - thanks.
Comment 8 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2005-08-20 00:43:24 UTC
Stable on ppc and hppa.
Comment 9 Josh Grebe (RETIRED) gentoo-dev 2005-08-20 07:10:13 UTC
looks good, marked stable on sparc.
Comment 10 Fernando J. Pereda (RETIRED) gentoo-dev 2005-08-21 04:47:18 UTC
You finally get our shiny keyword ! Marked alpha

Cheers,
Ferdy
Comment 11 Markus Rothe (RETIRED) gentoo-dev 2005-08-21 11:09:22 UTC
stable on ppc64
Comment 12 Luis Medinas (RETIRED) gentoo-dev 2005-08-21 12:42:43 UTC
Marked Stable on AMD64.
Comment 13 Stefan Cornelius (RETIRED) gentoo-dev 2005-08-21 12:50:51 UTC
Ok, pretty much ready for GLSA.
Comment 14 Thierry Carrez (RETIRED) gentoo-dev 2005-08-21 13:40:53 UTC
We should confirm it's considered as a vulnerability first. Security, please
vote on this.
Comment 15 Tavis Ormandy (RETIRED) gentoo-dev 2005-08-21 13:56:10 UTC
I would vote YES, it doesnt sound that obscure to me. Even a non-skilled 
attacker could identify a vulnerable script and effectively take the machine 
out, no skill would be required to trigger it.
Comment 16 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-08-21 22:04:56 UTC
I tend to vote YES also. 
Comment 17 Stefan Cornelius (RETIRED) gentoo-dev 2005-08-22 00:26:32 UTC
2 said yes, i would be the third, re-requesting GLSA.
Comment 18 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-08-24 22:16:23 UTC
GLSA 200508-15 
 
mips please remember to mark stable to benifit from GLSA. 
Comment 19 Hardave Riar (RETIRED) gentoo-dev 2005-09-04 04:15:26 UTC
Stable on mips.
Comment 20 Tobias Sager 2005-10-15 07:53:44 UTC
This is CAN-2005-2728.