Skip to content

Prevent HTML reflection vulnerability in 500 error status handler - #142

Merged
jfhbrook merged 1 commit into
jfhbrook:masterfrom
jre-g:reflection
May 7, 2015
Merged

Prevent HTML reflection vulnerability in 500 error status handler#142
jfhbrook merged 1 commit into
jfhbrook:masterfrom
jre-g:reflection

Conversation

@jre-g

@jre-g jre-g commented Apr 30, 2015

Copy link
Copy Markdown
Contributor

Certain IO errors containing the requested path can be echoed directly back to the user without a Content-Type header. In some cases, browsers' sniffing can result in the document being treated as HTML, allowing XSS. This is resolved by sending a Content-Type header of text/plain.

Includes a test case that can reproduce this behaviour, at least on some Linux systems. (The test should simply pass on other systems.) You can observe this test failing as expected after an intentional regression in this Travis build.

Certain IO errors containing the requested filename could be directly echoed back to the user without a Content-Type header. In some cases, browser sniffing could result in this document being treated as HTML, allowing XSS. This is resolved by sending the Content-Type header of text/plain.

Includes a test case that can reproduce this behaviour on at least some Linux systems.
@jre-g jre-g closed this May 6, 2015
@jre-g
jre-g deleted the reflection branch May 6, 2015 23:16
@jfhbrook

jfhbrook commented May 6, 2015

Copy link
Copy Markdown
Owner

Just because I didn't merge this, doesn't mean I'm disinterested. I just hadn't gotten around to it.

@jre-g
jre-g restored the reflection branch May 6, 2015 23:49
@jre-g

jre-g commented May 6, 2015

Copy link
Copy Markdown
Contributor Author

Oops! I'm very sorry. I didn't intend to close this, or realize that I had. I was trying out a new Git client, and must have done something silly.

@jre-g jre-g reopened this May 6, 2015
@jfhbrook

jfhbrook commented May 6, 2015

Copy link
Copy Markdown
Owner

All good! I'll try to merge this tonight.

@jfhbrook

jfhbrook commented May 7, 2015

Copy link
Copy Markdown
Owner

So I think this is a sane PR and I want to merge it, but I'm really trying to get my browser to throw up an alert and it's just not havin' it. Any hints? I'd love to be able to before/after this before clicking the magic green button.

@jre-g

jre-g commented May 7, 2015

Copy link
Copy Markdown
Contributor Author

I've just emailed you an example that should work. I didn't include one here because, though it probably won't make much of a difference, I didn't want to make things easier for anybody who might try to exploit this.

@jfhbrook

jfhbrook commented May 7, 2015

Copy link
Copy Markdown
Owner

Beautiful. <3

@jfhbrook
jfhbrook merged commit af75502 into jfhbrook:master May 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants