Nginx security advisory (CVE-2013-4547)
mailman.nginx.org
mailman.nginx.org
if ($request_uri ~ " ") {
return 403;
}
The issue is the handling of unescaped spaces. These are illegal but nginx accepts them. The workaround is to throw an error any time someone sends the invalid space.Or am I misunderstanding this?
But if you just so happen to run nginx on Windows, you can loose the trailing space requirement as any file is accessible with a space at the end. Also in "/foo /../protected/file" scenario, foo doesn't need to exist.
That would be /mydir%20/ or /%20mydir/ in URL, not literaly a space.
> this only works if you actally have a corresponding directory with a literal trailing space in the name
This won't work event if you have space in name because space would actually be %20. Only a carefully hand crafted HTTP packet would cause the vulnerability
> by using a specially crafted request.
It means you have to manually purposefully make an RFC2616 invalid HTTP request. Period.
Which means, even for a folder name with a trailing space, normal user wouldn't trigger this vulnerability, an attacker must use lower level tools/libraries. For example wget will auto encode URL for you, while cURL won't.
I tried to reply to ams6110, this vulnerability only works if you have dir with a trailing space and the attacker handcraft an http request packet, bypassing encode and sanity checking which is required in most HTTP client implementations.
And the vulnerability is not cause by or about trailing spaces in dirs, we can deal with those dirs fine. It's about how to make nginx config rules apply to obscure invalid URL s. It's a pitfall in nginx rule checking engine. Are we clear now?
> and attacker handcraft an http request packet, bypassing encode and sanity checking which is required in most HTTP client implementations
Well, it's not something hard to do. You don't have to dwell on this. To talk HTTP you don't even need HTTP client (sic!). Telnet or netcat can be easily used instead. I usually use them while configuring web-servers, most admins and devs usually do so.
The Phusion Passenger official APT repository has also been updated with packages for 1.4.4: https://www.phusionpassenger.com/install_debian
I mean, would you want to audit this file? -> http://trac.nginx.org/nginx/browser/nginx/src/http/ngx_http_...
Write Code That Writes Code
Code generators increase your productivity and help avoid duplication.Is this a lame bug?
I have never written formal verifications for code, or had to apply concepts like "Verified Design-by-Contract", but I have written parsers, scanners and lexers. In all honesty, the most important part of the httpd is "parsing" requests. I have had chats with Igor, the main developer of Nginx, related to performance tuning and the kernel TCP/IP stack. I must tell that he's a really nice guy. But, if it was my "main job" to write a software used by millions of people, which has an achilles heel in it's parser, then I'd sit down and teach myself to prove the parser code. I have researched this 2y ago, and found that you can quite professionally write BDD/TDD style tests and mocks in C99 too. The tools available go way beyond that though.
Here's a little list of things I have found useful back then:
http://frama-c.com/ (this was top notch)
http://gulliver.eu.org/free_software_for_formal_verification
I want to name: http://www.eschertech.com/products/index.php and http://research.microsoft.com/en-us/projects/vcc/ too, but I haven't tested any of these tools, because I never worked in an environment where my code had to go through formal verification.
> Is this a lame bug?
Yes, if reliability and security is your goal. But I don't think it is, so no.No errors thrown anywhere, but php5-fpm is dead in the water... Rolling back until I can find anything on how to fix this.
Also, the packaging is done differently by ubuntu and nginx upstream, so I don't think you can just replace it. They are also bundled with different modules. For example, I have to use the package from ubuntu because the one from nginx upstream lacks the geoip module.
Thanks, eh!
* nginx sits in universe rather than main
* There is no mention of a patch for this CVE in the changelogs
* No bug exists in either the Debian bug tracking system nor Launchpad for this particular bug
I'd recommend you download the source (easy: apt-get source nginx), add the patch to quilt and then build it (preferably using pbuilder if you're building a binary package locally).
EDIT: Or use the nginx repository from http://nginx.org/en/linux_packages.html
If you can fix the bug in packaging, why not submit the fix and make it available to all Ubuntu users? As you say, nginx is in universe. This means that it is community supported, and anybody can contribute the fix (in the form of a debdiff with the quilted patch, as you describe) and have it sponsored and the package updated.
Secondly, a package in Debian stable mustn't have any applicable release critical bugs at the time the release is made. If after release a package (in Debian, Ubuntu or any other derivative) is discovered to allow for remote code execution in its default configuration for instance, there's no hiding behind what it says on the tin. The bug doesn't care how it's labeled and you should act on it.
Thirdly, packages in universe and multiverse only get community support, as opposed to support from Canonical for the duration of the support cycle. The entire point of having a repository system (like apt or yum) is that you can mix and match them to your liking and choose which packages may come from which source. So if you can get better support elsewhere, there should be no stopping you from subscribing to that support channel.
Personal package archives I'd generally not recommend because they may not be vetted as well as the more official repositories and the support commitment (when it exists) might not be at the same level. Could be better or worse, but you'll have to evaluate that on a case-by-case basis.
There is one now: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730012
dpkg: error processing /var/cache/apt/archives/nginx_1.4.4-1~precise_i386.deb (--unpack): trying to overwrite '/usr/sbin/nginx', which is also in package nginx-full 1.1.19-1ubuntu0.2 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/nginx_1.4.4-1~precise_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
Any suggestions on how to fix this? Ta.
As I know, 1.2.x actually is obsoleted since May 2013, and there is no more support or bugfixes after this date.
You can either use the Phusion Passenger one: https://www.phusionpassenger.com/install_debian
Or the Nginx.org one: http://nginx.org/en/linux_packages.html
Both support Debian 6 and 7, and both supply the latest Nginx stable version.
Changes with nginx 1.4.4 19 Nov 2013
*) Security: a character following an unescaped space in a request line
was handled incorrectly (CVE-2013-4547); the bug had appeared in
0.8.41.
Thanks to Ivan Fratric of the Google Security Team.
http://comments.gmane.org/gmane.comp.web.nginx.english/41133