Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

XSS via filename #28

Closed
ivan opened this issue Mar 14, 2015 · 14 comments
Closed

XSS via filename #28

ivan opened this issue Mar 14, 2015 · 14 comments
Assignees
Labels

Comments

@ivan
Copy link

ivan commented Mar 14, 2015

serve-index directory listings are vulnerable to XSS via arbitrary uploader-controlled filenames.

Repro steps:

  1. Run https://github.com/expressjs/serve-index#serve-directory-indexes-with-vanilla-nodejs-http-server
  2. cd public/ftp
  3. touch '<img src="" onerror="alert(0)">'
  4. Load the serve-index server in Chrome 41, see an alert box

I spotted this when testing webpack-dev-server, which is also vulnerable as it uses serve-index.

@dougwilson
Copy link
Contributor

Thanks for the report. I'm going to publish a fix ASAP right now. P.S. if you like, always feel free to email me directly for security issues :) You can always post publicly on the repo if the author (me in this case) does not seem to be responding in a reasonable amount of time :D

@dougwilson dougwilson self-assigned this Mar 14, 2015
@dougwilson dougwilson added the bug label Mar 14, 2015
@ivan
Copy link
Author

ivan commented Mar 14, 2015

Sorry, I'll do that in the future! I looked at http://expressjs.com/ for a security contact, but I should have just tried your email.

@dougwilson
Copy link
Contributor

No problem. We are working on a policy. I was mainly just talking in general :)

@dougwilson
Copy link
Contributor

Oh, I see, it's the title attribute. Doh!

@dougwilson
Copy link
Contributor

...and the content, lol. Basically, only the href seems to be escaped... this is terrible :'(

@dougwilson
Copy link
Contributor

Please feel free to confirm this fix :)

@ivan
Copy link
Author

ivan commented Mar 14, 2015

Thanks, that seems to have fixed the one I reported.

I found another, though: the directory/path indicator at the top of the index page needs escaping as well. Try an mkdir '<img src="" onerror="alert(0)">' and navigate to that directory.

@dougwilson
Copy link
Contributor

Awesome!! Fixing...

@ivan
Copy link
Author

ivan commented Mar 14, 2015

Also, in the title tag.

@dougwilson
Copy link
Contributor

Ok, I think I may have gotten them all now.

dougwilson added a commit that referenced this issue Mar 14, 2015
@dougwilson
Copy link
Contributor

@andrewrk I'm pinging you because of the last serve-static back-port. Do you need this fix back-ported to some older minor line?

@andrewrk
Copy link
Member

I'm ok, thanks. I'd like the option to ask for it later if I have to deal with another bug report asking for the patch earlier, if that's OK.

@dougwilson
Copy link
Contributor

I'd like the option to ask for it later

The option is always available :) I was just checking ahead of time just in case you happened to know :)

@dougwilson
Copy link
Contributor

This has been published to npm as 1.6.3.

bkimminich added a commit to juice-shop/juice-shop that referenced this issue Jun 15, 2015
serve-index 1.6.0 is vulnerable to XSS (see expressjs/serve-index#28)
thaiat pushed a commit to thaiat/serve-index that referenced this issue Nov 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants