Security: Unfiltered JSONP callback can be abused to persist malicious JS over an origin via Service Workers
Reported by
anti0...@gmail.com,
May 18 2017
|
||||||
Issue descriptionVULNERABILITY DETAILS Please provide a brief explanation of the security issue. VERSION Chrome Version: 58.0.3029.110 Operating System: OSX (same behavior on other OSses) REPRODUCTION CASE 1. Clone BeEF since the exploit module is already in BeEF from a while: git clone https://github.com/beefproject/beef.git The to start BeEF from a sane Ruby environment: gem install bundler bundle install ruby beef -x 2. Just run the attached Ruby app, it's a simple Sinatra one with an unfiltered JSONP endpoint and also a page vulnerable to Reflected XSS. For demo purposed, to hook the origin I'm using the /xssstored page rather than then /xss?secret=<> endpoint. 3. After hooking the localhost:4567 origin (the Ruby webapp) on BeEF (which origin is 127.0.0.1:3000), login into BeEF with default creds beef/beef, click on the hooked broser, go on command modules, search for "jsonp" and launch the module. You just want to enter "/vulnjsonp?callback=" in the command module input, since that is the same-origin JSONP unfiltered callback that will be used. 4. If everything worked, the origin is backdoored. onFetch is hooked and each response to that affected origin we control via XSS/hook has the body changed and the BeEF hook added to achieve persistence. This is probably expected behavior, however a JSONP callback that filters some characters might be helpful to mitigate the issue (until the whole callback can be rewritten via String.fromCharCode or similars :-) Ruby code and screenshot attached.
,
May 18 2017
In particular, sites should default to rejecting requests with the Service-Worker header, and only respond with an SW script on the specific endpoints/URLs for which they expect to receive SW requests. I'll leave it to an SW friend (CC'd) to decide whether to WontFix this bug and make it public, or if there is something more they'd like to do. If we can make the best practices and recommendations for safe deployment more clear in the FAQ, please let us know. That document is just a start, and I don't expect it's perfect yet. :)
,
May 19 2017
Will WF tomorrow, if not heard back from SW peeps or reporter.
,
May 26 2017
,
May 31 2017
,
Sep 2 2017
This bug has been closed for more than 14 weeks. Removing security view restrictions. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by elawrence@chromium.org
, May 18 2017