|
|
|
|
| |
Credit:
The information has been provided by iDEFENSE Labs.
The original article can be found at: http://www.idefense.com/intelligence/vulnerabilities/display.php?id=367
|
| |
Vulnerable Systems:
* mod_auth_pgsql version 2.0.2b1 and prior
Immune Systems:
* mod_auth_pgsql version 2.0.3
The mod_auth_pgsql module for the Apache httpd is a third party authentication module which allows authentication details to be stored in a PostgreSQL database. Although this is a third party module, it is
available as a package for several distributions, including Red Hat Linux, Debian GNU/Linux, FreeBSD and others.
Due to a design error, many of the logging functions in this module take user supplied values as input to the format specifier:
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, pg_errstr);
When part of the error message contains a format string specifier it is processed. For example, for the username "%x%x%x%x%x", output similar to the following may appear in the 'error_log' file for the targetted httpd:
[Tue Sep 23 11:34:38 2005] [error] [client 10.1.10.11] mod_auth_pgsql:
Password for user 406869a083b3c900083b3cb3 not found (PG-Authoritative)
The sequence of hex characters is the result of the ap_log_rerror() function parsing the input string as a format string, and contains values from the stack. When the name supplied causes an invalid memory access, the child process may exit with a logged error similar to:
[Tue Sep 24 11:25:53 2005] [notice] child pid 12345 exit signal
Segmentation fault (11)
Successful exploitation allows remote attackers to gain local access to the vulnerable system in the context of the affected httpd. In order to exploit this vulnerability, the attacker must know the URI of at least one resource on the web server which is configured to use this module for authentication. This module is not installed by default, but is available as a package from some vendors, including Red Hat. Additional configuration is required before the module is active after installing.
While format string exploit techniques are well documented, most discussions of and exploits for vulnerabilities containing them rely on the user supplied string being located on the stack. The reason for this is that it allows the attacker to directly supply pointers to the memory locations they wish to modify via the %n format specifier. As this module does not store the format string on the stack, this may make exploitation more difficult as techniques for exploiting this kind of format string are not as commonly known. However, such information is publicly available.
Successful exploitation would allow a remote unauthenticated user access to an affected system with the permissions of the httpd itself.
Workaround:
Disable the module, and use another form of authentication for the affected resource.
In order to disable the module on Red Hat systems, execute the following commands as root:
cd /etc/httpd/conf.d
mv auth_pgsql.conf auth_pgsql.disabled
If you have any '.htaccess' files, you may also have to disable any authentication with references to mod_auth_pgsql directives. These directives all start with 'Auth_PG_'.
At this point, you should add another authentication method for the resources that were protected by this module. The exact operations to perform are dependent on which authentication method you choose to use.
After performing these steps, restart the httpd by executing the following command as root:
/sbin/service httpd restart
For other distributions, the general steps are the same (disable the module, add another form of authentication, and restart the httpd), however the details may vary slightly.
CVE Information:
CVE-2005-3656
Disclosure Timeline:
11/15/2005 Initial vendor notification
11/22/2005 Initial vendor response
01/09/2006 Coordinated public disclosure
|
|
|
|
|