News for hackers. Stuff that matters.
Re:An XSS on Facebook via PNGs and Wonky Content Types by comex on Thursday March 17, 2016 @10:22AM (#11304488)
The default scope is the basename, but you can customize it, can't you?

As I said, the text/javascript Content-Type is another one the CDN is willing to serve if you change the extension. I'm silly and didn't think of the fact that unlike HTML, a JS file can't be random binary garbage with a payload embedded somewhere in the middle. However, I am not sure that some allowed image format doesn't allow putting, say, // close enough to the beginning of the file that it will work. It seems like it might be possible with the JPEG header, but of course it depends on the post processing done. (Or maybe there is some way to upload non-images?)

Re:An XSS on Facebook via PNGs and Wonky Content Types by joev_ on Thursday March 17, 2016 @11:36AM (#11304995)
I seem to remember trying this (passing {scope:'/'} in the register call), and it doesn't work. Some googling seems to agree:

"Service Workers are restricted by the path of the Service Worker script unless the Service-Worker-Scope: header is set" [1]

I do wish the spec required a 'Content-type: text/service-worker', as that would effectively eliminate accidental ServiceWorkers as a threat.

[1] https://infrequently.org/2014/12/psa-service-workers-are-com...

Re:An XSS on Facebook via PNGs and Wonky Content Types by comex on Thursday March 17, 2016 @02:00PM (#11306227)
Hmm; I don't see that in the current spec [1], and that link is pretty old. I should test it.

https://slightlyoff.github.io/ServiceWorker/spec/service_wor...