A cross-site scripting (XSS) flaw was found in the way modnegotiation (MIME types tracking and arbitration module) of httpd, the Apache HTTP server, performed escaping of filenames arguments in to be created / provided HTML variant list (part of the choice response or HTTP 406 status body). When a site has modnegotiation module enabled and allowed untrusted file uploads to locations with MultiViews enabled, a remote attacker could use this flaw to execute arbitrary HTML or webscript via specially-crafted filename argument provided to the modnegotiation module.
Relevant upstream patch (against 2.2.x branch): http://svn.apache.org/viewvc?view=revision&revision=1374421
Upstream security page (covering also this issue): http://httpd.apache.org/security/vulnerabilities24.html
References: http://mail-archives.apache.org/modmbox/www-announce/201208.mbox/%3C0BFFEA9B-801B-4BAA-9534-56F640268E30@apache.org%3E http://www.apache.org/dist/httpd/CHANGES2.4.3
It was reported [1] that an integer overflow was found in Apache in the appregsub() function called from mod-setenvif. When a header field is mangled using SetEnvIf, the new environment variable data can be multiples of the size of the submitted header field. This would cause appregsub() to overflow the length value in buffer size calculations, leading to the subsequent allocation call of a too-small buffer. Filling this buffer with user-supplied data will lead to a buffer overflow.
Depending on the input data, this can lead to excessive allocation of server memory (resulting in killed processes due to out-of-memory conditions), invalid memory access when copying large amounts of data (which can lead to a termination of the httpd process), or possibly allowing the execution of arbitrary code.
To trigger this flaw, modsetenvif must be enabled (the default) and the attacker needs to be able to place a crafted .htaccess file on the server (which, in most cases, would require local access to the file system or some web interface that allows for writing arbitrary files to the local file system, such as for custom .htaccess files).
There is currently no upstream fix, however to work around the problem, disable modsetenvif.
[1] http://www.halfdog.net/Security/2011/ApacheModSetEnvIfIntegerOverflow/