HTTP Response Splitting Vulnerability on reddit.com
nealpoole.com
nealpoole.com
Warning: Header may not contain more than a single header, new line detected.
and drops the header.I'm actually curious about a recent feature addition, in 5.3.4:
"Paths with NULL in them (foo\0bar.txt) are now considered as invalid. (Rasmus)"
If that's really the case, it seems like Rasmus has eliminated a large swath of null byte vulnerabilities in PHP applications (at least those null byte vulnerabilities involving the filesystem, which are the kind I'm used to seeing). I've been meaning to compile 5.3.3 and 5.3.4 locally to test out the different behaviors.
Yes -- this specific change mitigates a lot of simple local file inclusion vulnerabilities. It's not a cure-all, but it does at least prevent many common antipatterns (e.g, include("languages/$_COOKIE['lang'].php")) from being trivially exploited.
Other languages, such as Python, were not designed specifically with web apps in mind. So a web developer using such a language must make sure he's doing all the web-specific stuff properly. Which is tedious and error-prone, and that's one reason why nobody should use Python on the web without a decent framework.
Your last sentence =~ s/Python/any language/
Even PHP is horrible and insecure to use without a framework today.
Oh, wait.
goodsite.com/login?redirect=http://www.mybadsite.com
User logs in to Goodsite, and is redirected to a similar-looking page on Badsite.
One safer alternative would be to store the redirect URL in the session (presuming one is available) and read it back later.
The vulnerability in response-splitting is passing attacker-controlled newlines unmolested through HTTP header content. Newlines terminate headers. Attacker-controlled content in a redirect that is allowed to contain newlines enables attackers to inject new headers or to terminate the header portion of the request.
Here, Neal's using the attack to inject a false end-of-headers newline and then a fake request body containing Javascript.
The attack is trivial to prevent; just don't allow newlines (and, ideally, active HTML characters) in redirect content.
† The goal of an attacker is to coerce a server into sending her own Javascript; the same-origin rules governing browser security allow that Javascript access to the server's cookies, even though the code is under the control of an attacker.
Surely the more correct solution is to escape them properly.
eg in the example:
Location: javascript:
<script>alert(document.cookie)</script>
occurs because something unescaped the %0D%0A%0D%0A. If however you just leave it as it was originally, or alternatively encode it properly after you've decoded it. Location: javascript:%0D%0A%0D%0A<script>alert(document.cookie)</script>
and everything works as it should.Had the XSS vulnerabilities failed, I would have spent more time investigating the cache poisoning possibilities.
(2) Reddit isn't a customer.
(3) Suffice it to say that the market for software security is such that we don't really have to do do much other than excel at our work to acquire new customers.
HttpOnly isn't evil, but it's not a solution to the problem.
The HTTP Response Splitting vulnerability can have many implications, XSS and CSRF attacks are just some examples.