Risk
7/31/2012
11:15 AM
50%
50%

HTML Access Control Busted By Security Researchers

Open source HTExploit tool can bypass a standard directory protection technique used to secure many types of Web pages, security experts demonstrated at Black Hat.

Two researchers presenting at last week's Black Hat conference in Las Vegas demonstrated a new technique they've discovered for bypassing .htaccess files. Also known as hypertext access files, they're primarily used for setting directory-level access controls for websites, and are common across multiple types of Web server software--including the open source Apache HTTP Server, which is the most commonly used Web server software in the world.

The two presenters--security researcher Maximiliano Soler, who works for Standard Bank in Argentina, and penetration tester Matias Katz, who founded Mkit Argentina--also released a tool under open source license, written in Python, that they developed to exploit the vulnerability. According to the presenters, the tool, named HTExploit, lets users list the contents of a directory protected this way, bypassing the authentication process.

They emphasized that their tool was designed to be used from within protected directories--run by people who already have access to a Web server--rather than via a publicly accessible site. But the vulnerability they uncovered could be used by outsiders to gain access, via the Internet, to parts of websites that are ostensibly protected by an .htaccess file.

[ Black Hat presenters warn of a possible attack on network-connected hardware. Read more at Mass Router Infection Possible: Black Hat. ]

Why bother attacking .htaccess files? The answer is simple: any directory that someone takes the time to protect is more likely to contain sensitive or secret information. "Today [it] is common to find lazy administrators and/or developers using directories located on the same Web server to save backups files, configurations, their own jobs, outdated versions, or new developments to be implemented in the future," the researchers wrote in a related white paper.

The good news is that with some small HTML and PHP tweaks to fix the exploitable configuration errors, thus restricting the types of access requests that can be made, vulnerable .htaccess pages can be made immune to the exploit outlined by Soler and Katz.

The bad news is that the problem they've uncovered may be quite widespread, and it could be used to compromise not just any directory that contains a misconfigured .htaccess file, but potentially any PHP file on the same site.

"What Katz and Soler described in their session is not some rare 'corner case' hack that could only possibly occur in a lab with billions of automated attempts; this is easily testable in the real world, and the tools to exploit it are freely available," said ESET security researcher Cameron Camp in a blog post.

The vulnerability stems from the fact that Apache "hands off PHP-based requests within .htaccess to PHP itself, which has been working fine on millions and millions of websites for years," said Camp. But if the .htaccess file gets fed some type of nonstandard input--in effect, injected--then "PHP automatically--unless otherwise instructed--treats it as a GET request, and allows the utility to start saving the PHP files on a webserver to your local filesystem," he said.

From there, however, the process continues, and begins combing accessed PHP files for any links they contain to other files on the same Web server, then downloading those to the local file system. In short order, an attacker--or penetration tester--could quickly grab copies of many, if not all, PHP files on a Web server. Such files could contain sensitive information, such as "references to login credentials for databases, passwords, personally identifiable information, and a host of other goodies that [could] be sold on the black market or used to enable further exploits," said Camp.

"Now might be a good time to check your website configuration to make sure you're protected, before the bad guys go scouring around trying to use this type of exploit," said Camp. "If you're not the person in charge of your website, you might want to point out this problem to the person who is. They may thank you, a lot."

Your networks may be under attack as you read this, but unless your security personnel are analyzing logs and leveraging common tools that are well known to your network operations teams, you may not find out until it is too late. In our What's Going On?: Monitor Networks To Thwart Intrusions report, we explain how your security and network teams can cooperate and use common tools to detect threats before your databases are compromised. (Free registration required.)

Comment  | 
Print  | 
More Insights
Register for Dark Reading Newsletters
White Papers
Cartoon
Current Issue
Dark Reading Tech Digest, Dec. 19, 2014
Software-defined networking can be a net plus for security. The key: Work with the network team to implement gradually, test as you go, and take the opportunity to overhaul your security strategy.
Flash Poll
Video
Slideshows
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2014-3971
Published: 2014-12-25
The CmdAuthenticate::_authenticateX509 function in db/commands/authentication_commands.cpp in mongod in MongoDB 2.6.x before 2.6.2 allows remote attackers to cause a denial of service (daemon crash) by attempting authentication with an invalid X.509 client certificate.

CVE-2014-7193
Published: 2014-12-25
The Crumb plugin before 3.0.0 for Node.js does not properly restrict token access in situations where a hapi route handler has CORS enabled, which allows remote attackers to obtain sensitive information, and potentially obtain the ability to spoof requests to non-CORS routes, via a crafted web site ...

CVE-2004-2771
Published: 2014-12-24
The expand function in fio.c in Heirloom mailx 12.5 and earlier and BSD mailx 8.1.2 and earlier allows remote attackers to execute arbitrary commands via shell metacharacters in an email address.

CVE-2014-3569
Published: 2014-12-24
The ssl23_get_client_hello function in s23_srvr.c in OpenSSL 1.0.1j does not properly handle attempts to use unsupported protocols, which allows remote attackers to cause a denial of service (NULL pointer dereference and daemon crash) via an unexpected handshake, as demonstrated by an SSLv3 handshak...

CVE-2014-4322
Published: 2014-12-24
drivers/misc/qseecom.c in the QSEECOM driver for the Linux kernel 3.x, as used in Qualcomm Innovation Center (QuIC) Android contributions for MSM devices and other products, does not validate certain offset, length, and base values within an ioctl call, which allows attackers to gain privileges or c...

Best of the Web
Dark Reading Radio
Archived Dark Reading Radio
Join us Wednesday, Dec. 17 at 1 p.m. Eastern Time to hear what employers are really looking for in a chief information security officer -- it may not be what you think.