The Apache webserver is vulnerable to exploits that expose internal servers to remote attackers who embed special commands in website addresses.
The weakness in 1.3 and all 2.x versions of the Apache HTTP Server can undergo exploitation only under certain conditions. For one, they must be running in reverse proxy mode, a setting often used to perform load balancing or to separate static content from dynamic content. And even then, internal systems are susceptible to unauthorized access only when certain types of reverse proxy rewrite rules are used.
Nonetheless, the vulnerable reverse proxy configurations are common enough that Apache maintainers issued an advisory recommending users examine their systems to make sure they are not at risk.
“When using the RewriteRule or ProxyPassMatch directives to configure a reverse proxy using a pattern match, it is possible to inadvertently expose internal servers to remote users who send carefully crafted requests,” the advisory stated. “The server did not validate that the input to the pattern match was a valid path string, so a pattern could expand to an unintended target URL.”
The vulnerability came from Context Information Security, an information security consultancy with offices in London. Researchers said attackers can exploit the weakness to gain unauthorized access to a highly sensitive DMZ, or “demilitarized zone” resources inside an organization that should be available only to validated users.
“We can access any internal/DMZ system which the proxy can access including administration interfaces on firewalls, routers, web servers, databases etc.,” the researchers said. “Context has had plenty of success with this attack where credentials are weak on the internal systems allowing for full network compromise e.g. uploading Trojan WAR files on to JBoss servers.”
Context said the researchers believe other webservers and proxies may be susceptible to similar exploits.
Apache issued a patch for those who compile their own installations of the webserver. Apache’s advisory also contains suggestions for writing proxy rules that prevent the attack from working.
Adding a simple forward slash to certain configurations, for example, will go a long way to protecting sensitive systems. The line is “RewriteRule (.*)\.(jpg|gif|png)” could expose internal servers, while the line “RewriteRule /(.*)\.(jpg|gif|png)” (note the extra “/”) will ensure they remain protected.