Remember the Directory Traversal

It’s a simple flaw — send a web application a URL containing ../ (or ../../../../ as the case may be) and, if it’s set up wrong, it may actually access a directory one or more levels higher than it should be able to access.

Letting an untrusted user get into those directories can be hugely damaging — with that ability, they can scope out what’s on your server, download password files, and so on. In some cases they allow the attacker to change files on the server that should be inaccessible.

Yes, this is an old hole. One of the oldest. To the point that way back when, I stumbled across pages suggesting the practice of appending /%2E%2E on URLs to maybe get a directory listing. Along with the footnote “this is well known enough it mostly doesn’t work anymore.”

Boy have times changed. It seems directory traversal flaws being used in a solid third of Internet attacks.

You’d think this would be something developers would have learned to fix, but it seems many of them don’t understand the risks of it…

“About as simple to fix as they are to exploit, directory traversal vulnerabilities stand as a persistent threat in the application environment. Yet it is one that many developers and even security teams are unaware can lead attackers to gain valuable information about how a system is organized, to get access to sensitive files on the application server, or even to easily leverage to start other attacks on that server or the rest of the network. […]

“What a directory traversal attack is is an attempt to circumvent a URL or a request to a website by trying to get the application to point in the wrong direction,” says Barry Shteiman, senior security strategist for Imperva, explaining that often all it takes is a well-placed “../” expression in a user-input field or, even within URLs in the case of RESTful Web services, for attackers to get a vulnerable app to allow them to climb the directory for unauthorized access. “A ../ to the server means, ‘Let’s go back a directory on the back-end server structure.’ Every time you do that, the application climbs higher to a previous state.” […]

According to Imperva’s most recent “Web Application Attack Report,” released last month, directory traversal attacks against retail Web applications made up 31 percent of the attacks compared to the eight most prevalent types of attacks, and they made up 36 percent of attacks against all other industries’ Web apps. In retail, that number lagged behind a whopping 53 percent of SQL injection attacks, but in other verticals it even led SQLi, which only made 27 percent of attacks. Meanwhile, secure hosting firm FireHost also reported last month in its Superfecta attack statistics about four major attacks it commonly blocks — XSS, directory traversal, cross-site request forgery, and SQL injection — directory traversal ranked second behind XSS, making up 23 percent of the 9.8 million attacks blocked from these four major categories using its IP Reputation Management system.

And according to Chris Wysopal, CTO and co-founder of Veracode, three years of data from more than 20,000 applications the firm has tested have found that applications with one or more directory flaws is at 49 percent and has been steady during those years.

“Directory traversal is actually the vulnerability developers fix the least, even when they know it is in their app,” Wysopal says. “Developers either don’t understand the risks of directory traversal or don’t see much risk in it. On the contrary, directory traversal vulnerabilities that can be used to access files that should remain confidential can also be used to modify files on the application server.” “

%d bloggers like this: