Live data from Hacker News

Hunting for Nginx alias traversals in the wild

labs.hakaioffsec.com

91–100 of 165 posts

Re: Hunting for Nginx alias traversals in the wild

#91
post #23

If I understand correctly, this is a vulnerability in self-hosted Bitwarden only. Is that correct?

This is for the single image self-hosted setup method, which is still in beta. The current supported self-hosted setup is a script that creates a bunch of individual containers for the different services.

Re: Hunting for Nginx alias traversals in the wild

#92
post #16

How is this not seen as a vulnerability in nginx? This behavior is utterly absurd, seems to have no beneficial purpose, and straightforwardly exploitable.

[flagged]

In the immortal words of Michael Bluth, a poor carpenter blames his shoddy tools.

Re: Hunting for Nginx alias traversals in the wild

#93
post #84
post #77

Please excuse the silly question: Would proper directory and file ownerships not prevent this traversal? If nginx does not run as root, how can it read other files than the ones explicitly assigned to the nginx user?

Typical umask is 022 so most things are readable by nginx workers but not writable, they don’t need to be explicitly assigned (e.g. to www-data). If your application generates sensitive data of course you should probably use a 077 umask.

You could make an argument that bitwarden vaults constitute sensitive information.

Re: Hunting for Nginx alias traversals in the wild

#94
post #16

How is this not seen as a vulnerability in nginx? This behavior is utterly absurd, seems to have no beneficial purpose, and straightforwardly exploitable.

It's done for speed. Straightforward text replacement is so much faster than checking to see if a path is properly terminated by a slash. And remember that Nginx became popular due to benchmarks that showed that it was more "web scale" than Apache2.

> And remember that Nginx became popular due to benchmarks that showed that it was more "web scale" than Apache2.

More like because it was much faster out of the box, and came with many batteries included while Apache2 required mods to be separately install.

Re: Hunting for Nginx alias traversals in the wild

#95
post #9

If all you need is a simple way to serve static files that minimizes resource consumption and is reliably secure, what is the state of the art these days? In the past I would probably reach for Nginx, but I wonder if a more focused/less configurable tool would be preferable from a security standpoint.

how is a static site served from S3 considered in these parts of the interweb? i've never done this, but see it as an option, yet i never really hear others using it either.

In my view, it's perfect (okay, maybe slightly less than perfect, and dedicated platforms taking ot to the next level like Netlify, CloudFlare Pages, Firebase Hosting, etc are for their added related services and tools, as well as their generous free tiers). It's pay as you go, scales from zero to infinite, and has zero attack surface or maintenance.

I've run a couple of websites (WordPress or Hugo based, including my personal blog) like that and it's great.

Re: Hunting for Nginx alias traversals in the wild

#96
post #9

If all you need is a simple way to serve static files that minimizes resource consumption and is reliably secure, what is the state of the art these days? In the past I would probably reach for Nginx, but I wonder if a more focused/less configurable tool would be preferable from a security standpoint.

how is a static site served from S3 considered in these parts of the interweb? i've never done this, but see it as an option, yet i never really hear others using it either.

You probably want some kind of CDN to avoid a HN frontpage link from making you go bankrupt, but it's a pretty decent solution.

I personally prefer something like Github Pages, though - it doesn't get much more hands-off than that!

Re: Hunting for Nginx alias traversals in the wild

#97
post #60

Earlier quoted context omitted.

Last release 2016??

OP wanted a simple web server for serving static content. Are you aware of open CVEs? No? It's possible for software to be done you know. Just because something isn't a rolling release of change for the sake of change (like most Google crapware) doesn't mean it isn't fit for purpose.

Considering the vast majority of commit were made after 2016, I don't think it is "done".

And a C program, written by a single developer, with only 27 issues ever being filed? With all due respect, that's guaranteed to have some nasty bugs in there.

Re: Hunting for Nginx alias traversals in the wild

#98
post #65

Earlier quoted context omitted.

no it wouldn't work if the user nginx is running as didn't have read access to the directory or files

Ah then I just realized, it probably does have access to all nginx log directories, because nginx needs write permissions to them anyway, right? Now I really want to go double check all my permission setups...

It depends on how nginx is designed. In theory you could separate log writing into a different process, and drop those permissions from the worker process.

Or just write to stdout and have systemd handle the logging for you, that'd work too.

Re: Hunting for Nginx alias traversals in the wild

#99
post #9

If all you need is a simple way to serve static files that minimizes resource consumption and is reliably secure, what is the state of the art these days? In the past I would probably reach for Nginx, but I wonder if a more focused/less configurable tool would be preferable from a security standpoint.

Shameless plug: Caddy does a great job here. Automatic HTTPS, written in Go so memory safety bugs are not a concern, has a solid file_server module.

Im using caddy, it's great!

Re: Hunting for Nginx alias traversals in the wild

#100

OK hear me out: a Linux capability like option that removes the .. option from the kernels file name parser. Like web apps have been seen various bypasses involving somehow smuggling two dots somewhere since we were on dial up modems. It's time to look for a way to close this once and for all, as the Linux kernel has done with several other classes of user land bugs.

It's something else in the kernel, there we have the permission system which we rely on.

If you are serving files to web from the folder, the web framework should handle not taversing the public root folder it was tasked to serve. If are rolling your own, well now you have to consider all kinds of stuff, including this.

Post reply on HN