Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

mdAutocomplete: XSS vulnerability #2901

Closed
chr22 opened this issue May 19, 2015 · 8 comments
Closed

mdAutocomplete: XSS vulnerability #2901

chr22 opened this issue May 19, 2015 · 8 comments
Assignees
Milestone

Comments

@chr22
Copy link

chr22 commented May 19, 2015

You generate HTML from a string to highlight the matching part of the search string in the result.

https://github.com/angular/material/blob/master/src/components/autocomplete/js/highlightController.js#L11

If the search result is this as a string:
capture

and you search for "x" then the resulting output is this, with a real script-tag that gets executed:
capture1

I cant create a CodePen because it won't let me insert a script tag in a javascript string.

I can see that you have some sort of sanitizing with a RegEx, that i cant decipher.

@ThomasBurleson
Copy link
Contributor

@robertmesserle, @gkalpak - With the commit 33ac259, should this be closed now?

@robertmesserle
Copy link
Contributor

@ThomasBurleson Leave this open, I pushed this fix without any unit tests, so I'd like to leave it open to make sure I don't forget to add that.

@robertmesserle robertmesserle self-assigned this May 19, 2015
@robertmesserle robertmesserle added this to the 0.10.0 milestone May 19, 2015
@gkalpak
Copy link
Member

gkalpak commented May 19, 2015

(BTW, I am not even sure the fix actually fixes the issue. @robertmesserle, did you test it "manually" ?)

@robertmesserle
Copy link
Contributor

@gkalpak Added unit test, confirmed new fix. I had tested it earlier, but I was rushed and it turns out my test wasn't very good. =p This is why I left this open so I could have a non-rushed look at it.

@gkalpak
Copy link
Member

gkalpak commented May 20, 2015

👍 @robertmesserle

@gkalpak
Copy link
Member

gkalpak commented May 20, 2015

And 👍 @chr22 for reporting this 😃

@chr22
Copy link
Author

chr22 commented May 20, 2015

👍

@ThomasBurleson
Copy link
Contributor

@chr22 - can you contact via email: ThomasBurleson@Gmail.com. Thx

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants