Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Path traversal in /static responder when running in debug mode #270

Closed
5225225 opened this issue Nov 27, 2021 · 8 comments · Fixed by #274
Closed

Path traversal in /static responder when running in debug mode #270

5225225 opened this issue Nov 27, 2021 · 8 comments · Fixed by #274

Comments

@5225225
Copy link

5225225 commented Nov 27, 2021

Steps to reproduce:

  1. Run agora in debug mode, I used cargo run -- --directory tmp --http-port 1234
  2. curl --path-as-is https://localhost:1234/static/../../../../../../../../etc/passwd
  3. Get back the contents of your /etc/passwd
@5225225
Copy link
Author

5225225 commented Nov 27, 2021

This is best handled upstream, I opened pyrossh/rust-embed#159

Might as well keep this open until the code here is no longer vulnerable, though.

@casey
Copy link
Collaborator

casey commented Nov 27, 2021

Nice find! I'm both surprised and not surprised that they didn't think of this. It's exactly the kind of thing that one should worry about, but also, most user agents normalize .. path segments, so if you don't use something like --path-as-is, you might think that it isn't an issue.

@casey
Copy link
Collaborator

casey commented Nov 27, 2021

I opened #271 with some thoughts for things we could do on our end.

@5225225
Copy link
Author

5225225 commented Nov 28, 2021

By the way, rust-embed fixed this, so you should put out a release that depends on 6.3.0, see the linked issue pyrossh/rust-embed#159

@soenkehahn
Copy link
Collaborator

@5225225: Thanks so much for opening this issue. I just put up a PR bumping the rust-embed version: #274. I also made sure manually that this actually fixes it.

@casey
Copy link
Collaborator

casey commented Nov 29, 2021

Since this is a security issue, reopening until we have a new release with the fix.

@casey casey reopened this Nov 29, 2021
@casey
Copy link
Collaborator

casey commented Nov 29, 2021

Just published v0.1.2 and tested it locally, and this is fixed.

On a vulnerable version, you can get the readme me when serving files out of the example-files directory with:

curl --path-as-is localhost:8080/static/../README.md

On 0.1.2 this returns a 404.

Thanks again, @5225225, for finding this. How did you think to look for it?

@casey casey closed this as completed Nov 29, 2021
@5225225
Copy link
Author

5225225 commented Nov 29, 2021

I was mainly going through reddit posts on /r/rust looking for people who posted about web services

then looked at the router expecting to find either a fun path traversal, or some lack of authentication / denial of service.

I mainly fuzz crates (see: massive list of issues / PRs related to that) but thought i'd try my hand at reviewing a web project.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants