161 points · by pgl · 9y ago · 64 comments
* Set up CSP headers
* Somehow, magically, Report URI will tell you things
Wait what? How does that work? I feel like I'm missing a step. Unfortunately https://report-uri.com/ doesn't really explain either, or have integration docs of any kind.I'm not trying to be snarky, I'm considering to become a customer.
Steps:
- User's browser loads your page
- User's browser detects something which would be a violation of your CSP policies
- User's browser blocks that content...
- ...and also checks for a Report-To, Report-URI, or CSP-Report header in the HTTP Headers.
- If any of those headers exist, the user's browser makes an http post to the stated URL,
passing information about the problem.
- If the URL stated in those headers was the Report-URI.com service's URL (i.e. the service which
Troy Hunt's writing about) then their company receives this data, and can use the information
in that to determine that this report relates to your website (i.e. from the info in the
`document-uri` field), and store this information in the metrics they provide for your site.Specifics and examples of what `report-to` looks like here: https://wicg.github.io/reporting/#examples
There's also a nice blog about implementing the old `report-uri` header here: https://gdstechnology.blog.gov.uk/2015/02/12/experimenting-w...
{
"@timestamp": "2016-07-07T12:01:03.044Z",
"csp-report": {
"document-uri": "http://example.com/signup.html",
"referrer": "",
"blocked-uri": "http://example.com/css/style.css",
"violated-directive": "style-src cdn.example.com",
"original-policy": "default-src \u0027none\u0027; style-src cdn.example.com; report-uri /_/csp-reports"
}
}
Ref: https://github.com/seek-oss/csp-server/blob/master/example/c...I don't know what's in place (if anything) to prevent sending fake reports... i.e. presumably a hacker could read these headers from a site, then send HTTP POST messages reporting all kinds of errors from various IPs (e.g. if they have access to compromised machines), flooding your useful metrics with false data, thus hiding any useful information in there...
Better than the current protocol, you'd have your site generate an ID for every legitimate request so that any reports could be tied back to that... but even then any hacker would just need to call your site once per false report to get that ID, so this only offers a small amount of additional protection (though in doing so increases the probability of the site being targeted by a flooding / DoS attack).
For the details, see https://www.w3.org/TR/CSP3/#report-violation
Like error tracking, the tricky bit isn’t always the reporting, it can also be learning to ignore errors caused by extensions, or grouping and alerting on issues in report-only mode such that they can be fixed in a timely fashion. That said, even knowing what to use as a CSP header can be daunting, so there’s plenty of room to make this powerful security feature easier to use.
Why would you consider being a customer if you've no idea what they do?
1: https://tools.ietf.org/html/rfc7469#section-2.1.4
2: https://www.owasp.org/index.php/OWASP_Secure_Headers_Project...
in essence, everytime(+) some massive break occurs, and your e-mail (and probably password) is among them after reaching "darknet" (meaning black market), you will get from haveibeenpwned an e-mail, urging you to some action (password change, account closure/change etc).
(+) Troy amassed over the years huge db of past breakins (so you can check your email presence also in past events) and with current respect/reputation he gots access to new ones pretty fast, informing you instantly in most cases.
Highly recommended.
> with current respect/reputation he gets access to new ones pretty fast, informing you instantly in most cases
So he has the respect of (street cred with?) the dark net/black market folks and that's how he gets them instantly? Or I suspect you meant to say something slightly different?
> I've also never paid for data nor traded any of the breaches I've obtained.
[1] https://www.troyhunt.com/thoughts-on-the-leakedsource-take-d...
So this will only work for sites that use CSP and users who don't have uBlock Origin installed, unless uBlock Origin changes their default policy on CSPs.
ninja edit: I see uBlock Origin has changed their defaults to permit CSP submission [1]
[0] https://www.theregister.co.uk/2017/10/17/ublock_origin_csp_r...
· https://twitter.com/troyhunt/status/920590590223331329
· https://twitter.com/troyhunt/status/920222303849390081
· https://twitter.com/troyhunt/status/920173854835720193
The uBlock Origin dev compromised with an opt-out for CSP reports, even though they can be used for things like IP address leaks to 3rd party servers (similar to the as-seen-in-court Tor-busting captcha mess). Personally I would prefer only same-origin reports.
--
My biggest problem in all of this is that Scott was not careful to always document his not-quite-obvious conflict of interest, and even worse: Troy's association is only now being revealed weeks later. I do appreciate the work being done to improve the effectiveness of CSP reports in default configurations of open source tools, but can't help wondering about the motivation. Disclaimers go a long way toward keeping unsuspecting maintainers informed of both sides of an issue.
· https://github.com/issues?utf8=%E2%9C%93&q=is%3Aissue+author...
· https://twitter.com/Danbo/status/920325189954654208
Scott was also blamed here on HN last week for his part in promoting the death of HKHP (public key pinning) apparently due to ease of misconfiguration.
· https://news.ycombinator.com/item?id=15573076
Looking back now I'm left wondering how HKHP affected Report URI and Scott's other project, Security Headers. I will disclose my bias as I watch highly effective marketing of convenience (top of HN!) triumph over my personal flavor of slightly paranoid privacy yet again.
I have no problem with uBlock blocking requests to the CSP report-uri if the domain in question is on the user's filter list (I'd probably consider it a bug if it didn't do that), but that's not what is happening here (before this was fixed, that is).
The Tor-captcha-thing was about leaking the origin IP of the Hidden Service, so I don't see how it's similar.
Would you mind sharing how long your browser was sending CSP reports to 3rd parties before you knew about it? I personally was unaware [edit]this could happen to me in Chrome with uBlock Origin installed[/edit] until this issue came up, and a free pass through ad blockers to a 3rd party seems like an advertising/tracking company's dream come true.
> JavaScript CDNs to images. No one is suggesting these should be blocked, right?
Many of these [edit](specifically: tracking pixels and just straight up ad images)[/edit] are blocked by ad blockers in the default configuration.
> The Tor-captcha-thing was about leaking the origin IP of the Hidden Service, so I don't see how it's similar.
Thank you for the correction. I apparently imagined this referenced when partial VPN or Tor is insecurely used only to access specific domains, or DNS is not also routed through.
[edit] updated with a bit more detail
If the site only uses first party scripts, CSP reports are very unlikely to be affected by any version of uBlock Origin.
Also, uBlock doesn't block any CSPs. Only some CSP reports.
If CSP reports become a reliable way to gather data, they _will_ be used for tracking. This is why we can't have nice things. And why I have to disable all nice things we do have, in my browser.
But yeah, it seems like they could really use some instructions on how to set this up for people unfamiliar with how the Web Reporting API works. The documentation you're looking for is here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Co...
> This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped.
Ok..
> Though the report-to directive is intended to replace the deprecated report-uri directive, report-to isn’t supported in most browsers yet.
So it's deprecated, but until it's replaced by report-to (which works in a very similar way) report-uri is still the proper way to make this feature work.
I would have linked to report-to instead, but MDN doesn't have good documentation on that yet.
I'm not even mad, that's amazing.
The domain was forfun.net
However it is not specific to this service but I have always wondered why this design(write key public and quota system) works, while it shouldn't.
Without context, this service misrepresents the real security of any given site.
Getting CSP right is quite hard and I have seen many big sites just using it in report only mode ( forever).