5 ms·
Hmm, I wonder if this could backfire. If it's an <iframe>, couldn't GitHub insert code that framebusts? If it's some other mechanism, couldn't they block by ref
by TazeTSchnitzel 12y ago
Hmm, I wonder if this could backfire. If it's an <iframe>, couldn't GitHub insert code that framebusts? If it's some other mechanism, couldn't they block by referrer? If it's CORS, couldn't GitHub deny CORS requests? If it's a <script> tag, couldn't GitHub do some nasty XSS?
Edit: ooh, take a look at the more detailed look from insight-labs: http://insight-labs.org/?p=1682 http://insight-labs.org/?p=1682
It's XMLHttpRequest ($.ajax), but with dataType: "script". Looking at the jQuery docs (http://api.jquery.com/jquery.ajax/ http://api.jquery.com/jquery.ajax/):
"script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true. Note: This will turn POSTs into GETs for remote-domain requests.
Oh dear. If GitHub can detect this, GitHub can basically XSS all sites using Baidu's analytics.
Edit 2: Oh, the insight-labs article says the attack has stopped.
- Pirate-of-SV 12y agoThat's exactly what they did! At the moment of this writing they are sending back: alert("WARNING: malicious javascript detected on this domain") when you're trying to reach: https://github.com/greatfire/ https://github.com/greatfire/ or https://github.com/cn-nytimes/ https://github.com/cn-nytimes/ That's why other people have started to notice it (as the article describes). Timeline of the attack looks something like this: 1. The Chinese firewall hijacks requests to http://hm.baidu.com/h.js http://hm.baidu.com/h.js and sends back a script that attacks GH instead. 2. Github notices that a huge amount of people are trying to reach https://github.com/greatfire/ https://github.com/greatfire/ and https://github.com/cn-nytimes/ https://github.com/cn-nytimes/ 3. GH figures out what's happening and starts replying with the alert javascript snippet. 4. Users are now getting noticed by the alert every time their browser runs the hijacked javascript. 5. The person that wrote this article writes this article after investigating what the alert message is about.
- TazeTSchnitzel 12y agoOh, I see, gotcha.
- Fuxy 12y agoIf I were Github I would redirect the attacker back at one of their own resources. A attack reflection of sort. Edit: You're technically not attacking you're reflecting if the attack stops there's nothing to reflect. Just like in martial arts you don't just take a beating you defend and return the opponents attack back at them. Seems fair to me.
- TazeTSchnitzel 12y agoThat does not seem wise. China vs. GitHub, China will win.
- GutenYe 12y agoThat is true, even Google can't fight against China.
- zachalexander 12y agoI imagine they have the technical resources to – they just don't because as a public company they are obligated to maximize shareholder value.
- lotu 12y agoI would put it more on the fact that attacking a foreign government is kinda usurping the role US government and they won't take kindly to that.
- natch 12y ago...in China. Outside of China, my money would be on Google.
- jamiesonbecker 12y agoGoogle made a choice. You can always fight, even if you believe you will lose.
- shiggerino 12y ago
- myth_buster 12y agoJust to clarify, did the DDOS stop due to GitHub adding that warning text making the hack reflect poorly on Baidu and hence the perpetrators being subjected to internal pressure? If not, GitHub would still have to serve that JS and hence would still be bombarded by millions of content request.
- Bedon292 12y agoIt looks like what they did was change the url to only serve out the alert in plain text. Which is a lot less resources to use. I would also assume that they are willing to use those resources to fight back.
- lewispb 12y agoEven better, popping up a JS alert stops further JS execution, so this was a clever way for Github to throttle connections (rather than them being made every 2 seconds as per the hijacked Baidu JS)
- be5invis 12y agothey can do something better: they can put some javascript disabling the hijacked JS like alert('......'); r_send = function(){}
- 15155 12y agowindow.top.location = "http://gov.cn"; http://gov.cn";
- myth_buster 12y agoI see; I missed the part where the resource request was executed every 2 seconds. The alert essentially would make the page unusable. From my understanding that Baidu is Google for china, the amount of productivity lost since people not being able to search, would mean the hack backfired spectacularly.
- SiVal 12y ago
- totony 12y agoImo they should have converted the targetted pages to a static cache and just document.body=page it, the users would notice (not able to access anything) and the pages would still be accessible on github.
- fyarebox 12y agoThey already are, inserting a alert(). What would be much more interesting is replacing <body> with a multi-lingual message explaining what's happening and how to block the Baidu script.
- deleted 12y ago[deleted]