US Dept for Homeland Security shafted by trivial web bug
New year resolution: Go back to PHP school
A US government website was broken into by hackers exploiting a directory traversal vulnerability, according to security researchers.
Hacktivist group NullCrew announced it compromised studyinthestates.dhs.gov, a US Department of Homeland Security website, on Friday. The site advises foreigners seeking permission to study at American schools, colleges and universities.
The website was vulnerable to a directory traversal vulnerability, a class of bug that allows visitors to poke around a website server's file system and access sensitive files, according to Paul Ducklin of Sophos.
This particular programming flaw allowed anyone to pull up a configuration file, which included a database password, for the WordPress blogging software used by the Study in the States website. The data was then dumped onto a public Pastebin page.
"In really bad cases, attackers might even be able to hoist themselves out of your web server's directory tree altogether, and into the rest of the filing system," said Ducklin, Sophos's head of technology for Asia Pacific. "This might give them access to password and configuration files for the operating system itself, or for other software running on the same server."
Ducklin went on to detail what is believed to be the vulnerability in the DHS web code:
Poor handling of upward-leading filenames seems to have been what was wrong on the Study in the States website. It looks as though a PHP script responsible for a download repository was incautious in its argument handling. A URL of the sort: http://example.org/known/dir/download.php?file=somename.dat could be abused with a request like this: http://example.org/known/dir/download.php?file=../../private.dat
This, it seems, caused the ill-configured download script to navigate upwards in the web server's directory tree, retrieving from the inside a file that would have been blocked if it had been downloaded directly from the outside.
The fault seems to have been patched now, but if NullCrew are to be believed (and let's assume they are), this hole was used to fetch the WordPress configuration file, apparently including the backend database location and password. This configuration file was then published on a publicly available drop site.
Ducklin added that, although the directory traversal vulnerability that apparently facilitated NullCrew's hack has been plugged, other problems remain: the Study in the States website is running Apache 2.2.3 on Red Hat and PHP 5.3.3. These are not the latest version numbers for the web server and scripting language platform and thus they may need up-to-date patches, plus other sites would do well to learn lessons from the minor DHS website's mistakes, Ducklin added. ®
Re: PHP? Really?
Holy crap - they are using PHP
You can write bad, insecure programs in practically any language.
Re: PHP? Really?
"Modern PHP by a competent developer can be as rock solid as any platform."
Except when it's WP + plugins. There's more holes there than any sieve can handle. Disgraceful track record, past and present.
Re: obligatory xkcd ref
They have a security solution in place:
Everybody accessing their website now has to remove their shoes and outer coat.