>>Because the file is then temporarily written to disk, which
>>is a possible security risk.
Michael> Could you elaborate?
Sure! If don't mind my English.
one possible attack to a server is to consume all the temp space on
the server. Maybe the best way is to give the relevant part of perldoc
cgi. This is true for every web server accepting file uploads. So it's
nothing special to struts.
In my eyes it's a good idea to limit the post size a server can
accept, even if the potential risk is theoretical.
Could you reproduce it? I can to reproduce it with resin and
tomcat.
### taken from perldoc cgi
Avoiding Denial of Service Attacks
A potential problem with CGI.pm is that, by default, it
attempts to process form POSTings no matter how large th
are. A wily hacker could attack your site by sending a
CGI script a huge POST of many megabytes. CGI.pm will
attempt to read the entire POST into a variable, growing
hugely in size until it runs out of memory. While the
script attempts to allocate the memory the system may sl
down dramatically. This is a form of denial of service
attack.
Another possible attack is for the remote user to force
CGI.pm to accept a huge file upload. CGI.pm will accept
the upload and store it in a temporary directory even if
your script doesn't expect to receive an uploaded file.
CGI.pm will delete the file automatically when it
terminates, but in the meantime the remote user may have
filled up the server's disk space, causing problems for
other programs.
CGI.pm also has some simple built-in protections against
denial of service attacks, but you must activate them
before you can use them. These take the form of two
global variables in the CGI name space:
$CGI::POST_MAX
If set to a non-negative integer, this variable puts a
ceiling on the size of POSTings, in bytes. If CGI.pm
detects a POST that is greater than the ceiling, it
will immediately exit with an error message. This
value will affect both ordinary POSTs and multipart
POSTs, meaning that it limits the maximum size of file
uploads as well. You should set this to a reasonably
high value, such as 1 megabyte.
$CGI::DISABLE_UPLOADS
If set to a non-zero value, this will disable file
uploads completely. Other fill-out form values will
work as usual.
#### end
Soeren
======================================================================
When I was a boy, I was told that anybody could become president. I'm
beginning to believe it. -Clarence Darrow