Bug 73254 - Request body is buffered in memory
Request body is buffered in memory
Status: CLOSED CURRENTRELEASE
Product: Red Hat Public Beta
Classification: Retired
Component: php (Show other bugs)
null
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Copeland
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-09-01 17:29 EDT by Joe Orton
Modified: 2007-04-18 12:46 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-09-02 15:07:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Joe Orton 2002-09-01 17:29:46 EDT
The apache2filter SAPI code buffers the entire request body in memory, so if a
POST request a 1gb body is received, the server will try to grow to 1gb as it
receives it.

This allows some kind of DoS attack, though there are far easier ways to deny
service to an Apache server.  LimitRequestBody would help; may be sensible to
set a default in the <Files *.php> block.
Comment 1 Phil Copeland 2002-09-02 14:43:18 EDT
Hummm
Well actually there is already a limit into php.
We build php with --enable-memory-limit so no single process can do exactly what
you describe here.

the default memory_limit is 8Mb
it's tuneable in /etc/php.ini as the variable 'memory_limit' in the Resource
Limits section.

Are you saying that this is being bypassed?

Oh are you sure about 'LimitRequestBody'? Thats against apache, not php

------
Limit Maximum Size of Request Message Body
Syntax: LimitRequestBody A
Example: LimitRequestBody 512000
Since: Apache 1.3

This directive sets a maximum size (in bytes) for a request message body. The
bytes argument must be an integer between 0 (meaning unlimited) to 2,147,483,647
(2 GB). If the client request exceeds the limit on the allowed size of the HTTP
request message body, the server will return an error response instead of
servicing the request. In this way, the directive gives the server administrator
greater control over abnormal client request behavior, which may help prevent
some forms of denial-of-service attacks.
------

Phil
=--=
Comment 2 Joe Orton 2002-09-02 15:07:37 EDT
Yes, the PHP memory limit is definitely ignored, sapi_apache2.c is using
realloc() directly to do this, I guess the PHP memory limit is only applied if
you use PHPs emalloc() etc wrappers.

LimitRequestBody should apply because Apache should immediately reject a request
with a large Content-Length if a LimitRequestBody is set; I haven't tested this.
As I say, I don't think this is a high priority problem as there are easier ways
to DoS Apache.
Comment 3 Phil Copeland 2002-09-02 22:59:35 EDT
Fixed in 4.2.2-8.0.3

Phil
=--=

Note You need to log in before you can comment on or make changes to this bug.