China, GitHub and the man-in-the-middle

What happened?

At around 8pm, on January 26, reports appeared on Weibo and Twitter that users in China trying to access GitHub.com were getting warning messages about invalid SSL certificates. The evidence, listed further down in this post, indicates that this was caused by a man-in-the-middle attack.

What is a man-in-the-middle-attack?

Wikipedia defines a man-in-the-middle-attack in the following way:

The man-in-the-middle attack...is a form of active eavesdropping in which the attacker makes independent connections with the victims and relays messages between them, making them believe that they are talking directly to each other over a private connection, when in fact the entire conversation is controlled by the attacker.

We go into detail about what happened later in this post, but first we will explore why we think this happened.

Why?

At the time of writing, there are 5,103,522 repositories of data on GitHub and as many possible theories as to why the Chinese authorities want to block or interfere with access. We will focus on one of these theories however please note that this is pure speculation on our part.

On January 25, the day before the man-in-the-middle attack, the following petition was created on WhiteHouse.gov:

People who help internet censorship, builders of Great Firewall in China for example, should be denied entry to the U.S.

The petition has gathered more than 8,000 signatures in the five days since. To make the idea specific, there is a link to a list of Chinese individuals accused of contributing to the technical infrastructure behind online censorship in China. And this list is hosted on - you guessed it - GitHub. The list has gathered hundreds of comments, the vast majority in Chinese. One of these comments contains the supposed address and ID number of Fang Binxing, the Principal of Beijing University of Posts and Telecommunications and often called the “Father of China's Great Firewall”.

Another comment links to another much longer list of supposed contributors to the Great Firewall, also hosted on GitHub.

About a week prior to this event, GitHub was completely blocked in China. But only a couple of days later, full access to the website was restored. This followed unusually public protest that may have forced the authorities to rethink their decision. It’s clear that a lot of software developers in China rely on GitHub for their code sharing. Completely cutting access affects big business. GitHub may just be too important to block.

That leaves the authorities in a real pickle. They can’t selectively block content on GitHub nor monitor what users are doing there. They also cannot block the website altogether lest they hurt important Chinese companies. This is where man-in-the-middle attacks make their entrance. By faking SSL certificates, the authorities can indeed intercept and track traffic to encrypted websites.

The White House petition has not been blocked. But the GitHub lists are much more interesting because they allow users to freely comment and to collaborate on the content. Because all traffic to GitHub is encrypted, and because it seems that the authorities have backed off from blocking the website completely, the only tool left in the censorship toolbox is man-in-the-middle attacks.

The attack happened on a Saturday night. It was very crude, in that the fake certificate was signed by an unknown authority and bound to be detected quickly. The attack stopped after about an hour. The whole episode seems rather irrational. It’s conceivable that one or several individuals identified on these lists as enemies of a free Internet decided to take action into their own hands. They are the technical people behind the Great Firewall and so they would clearly be capable of implementing this attack. They had a motive in that they were personally being targeted by the people behind the White House petition. And they had no other options since they had been barred from blocking GitHub completely.

While the attack was short-lived, it is possible that passwords of many GitHub users were recorded. It’s also possible that the IP addresses of users accessing certain URLs, such as these lists of GFW contributors, were tracked. The people organizing these initiatives should take great care.

The lists are alive and well. Regardless of whether the White House petition garners the 100,000 signatures necessary to warrant an official response, this is a clear sign of increased pressure on technical people helping the government to censor the Internet. The increasing public anger over censorship and organized efforts such as this one to name and shame collaborators could make it more difficult for the authorities to recruit and maintain talent in the future.

Has it happened before?

This Fat Duck blog post describes a man-in-middle attack on the Skype login page in 2011. Unlike this latest attack, the host appears to have been DNS poisoned at that time. If anything, it was an even more obvious attack, since the IP address returned was supposedly publicly registered by the Public Security Bureau. This surveillence may appear unnecessary since Skype is collaborating with Tom Online for their Chinese users and all data sent through the Tom version is already tracked. If you register and login directly through https://login.skype.com, however, you are accessing the regular Skype version hosted outside of China. It may have been an attempt to compromise users who are not using the Tom Online version of Skype.

Man-in-the-middle attacks have also been deployed in Syria to track activity, presumingly by activists, on Facebook.

Will it happen again?

GitHub is an HTTPS-only website. That means that all communication is encrypted by default. Only the end user and the GitHub server knows what information is being uploaded and downloaded. The Great Firewall, through which all traffic going out of China passes, can only know that the user is accessing data on GitHub’s servers - not what that data is. This in turn means that the authorities cannot block individual pages on GitHub - all they can do is to block the website altogether.

HTTPS effectively disables half of what the Great Firewall can do. We have argued for a long time that the reason that Gmail isn’t fully blocked is that it’s considered too important and that the backlash against closing down access would be too great. The same thing applies to the Apple App Store. It now appears that GitHub has been added to this list. Other major websites that could follow suit include Google Search and Wikipedia. With every website that switches to HTTPS, the authorities’ options are limited to two: completely blocking it, or completely allowing it. The more they fear a public reaction to complete blocks, the fewer their options become. Man-in-the-middle attacks are likely to become increasingly tempting.

As we show in the overview of browsers popular in China, further down in this post, even an invalid SSL certificate is likely to be accepted by a lot of users since the warnings are weak. If man-in-the-middle attacks become more widespread though, more users will likely learn how to understand these messages and hopefully also switch to safer browsers such as Google Chrome and Firefox.

No browser would prevent the authorities from using their ultimate tool though: certificates signed by the China Internet Network Information Center. CNNIC is controlled by the government through the Ministry of Industry and Information Technology. They are recognized by all major browsers as a trusted Certificate Authority. If they sign a fake certificate used in a man-in-the-middle attack, no browser will warn of any usual activity.

Such an attack on Gmail, for example, could mean that you would sign in to Gmail as usual and receive no warning*. However, your password and all your activity could be recorded by the authorities.

Update: Google Chrome would actually warn you, even block access, if you tried to use Gmail and received a certificate signed by a different CA. This applies to a lot of Google sites as well as other websites that "have requested it". The technique is called Public key pinning. Thanks to N.S. (see comment top-right) for the info.

The attack would be detectable by manually reviewing the SSL certificate. While the vast majority of users would not do this, one single report on such an attack would create a huge international scandal that might lead to major browsers removing their trust of CNNIC. So the authorities will likely avoid using this tool, unless they feel it’s absolutely necessary.

At the same time, completely excluding CNNIC would be a further step in isolating China from the global Internet and toward the creation of a separate Chinanet. China is too big to exclude. The international security community is simply hoping that CNNIC will behave. Chinese activists depending on the encryption offered by Gmail and now also GitHub share that hope.

If hope isn’t your thing, you can manually remove CNNIC certificates in your browser or operating system. Lost Laowai has an instructive post on how to do this. At GreatFire.org we are not big fans of trusting Chinese authorities to behave either. Our automatic censorship tests currently do not include recording and validating SSL certificates, but we will work hard to include such functionality as soon as possible.

Evidence of attack

We do not have data ourselves to show how or if this happened. We rely on the sources listed below. Many of these sources were used in this report on Solidot. That GitHub would be targeted is also supported by the fact that the site was completely blocked in China only a few days earlier.

GitHub was not subject to DNS poisoning at the time. Our own tests (of github.com as well as the https version) conducted on the same day all show the same IP address as when accessed from the US, as does the Wireshark capture file listed below. That means that the traffic must have been interfered with somewhere between end users and the GitHub server. Users were apparently communicating with the GitHub IP address, but the traffic was altered along the way and the SSL certificate sent to the user was clearly different.

For further reading, check out this discussion on YCombinator.

1. Screenshot taken by Weibo user

The screenshot shows the user trying to access GitHub using the Chrome browser and receiving a warning about an invalid SSL certificate.

2. Wireshark capture file

Uploaded by unknown user to CloudShark. Copy hosted by us.

3. Reports on Twitter

4. Copy of fake SSL certificate

Uploaded by unknown user to MediaFireCopy hosted by us. See below for a comparison of the current valid certificate and the fake one used during the attack.

The Current GitHub.com SSL CertificateThe Fake GitHub.com SSL Certificate

Does your browser protect you?

Man-in-the-middle attacks are not a new phenomenon. Browser providers have created features to combat them for years. This particular attack was very crude - the fake SSL certificate was not signed by a known certificate authority. Virtually all browsers would produce some sort of error, as can be seen in the screenshots above. For a full overview, we have recreated a GitHub mirror website at https://github.greatfire.org using a certificate formatted in the same way as the one used in the attack. You can visit it to get an idea of the kind of warning that would have been shown during the attack.

For an even more accurate experience, add the following to your hosts file and then browse to https://github.com.

54.235.205.92   github.com

Using the above method, we’ve taken screenshots of the warning messages shown to users in some of the most popular browsers in China as well as Chrome and Firefox which are used by a small minority but are considerably safer.

All browsers display some sort of warning. If you are in a hurry and you do not know of the risk of a man-in-the-middle attack you will likely click “continue”. If your browser is either 360 Safe Browser or Internet Explorer 6, which together make up for about half of all browsers used in China, all you need to do is to click continue once. You will see no subsequent warnings. 360’s so-called “Safe Browser” even shows a green check suggesting that the website is safe, once you’ve approved the initial warning message.

Chrome and Firefox have the highest level of security. As long as you have visited GitHub at least once prior to the attack, they won’t allow you to make security exceptions at all. The risk, of course, is that the user will then just switch to another browser in order to get their work done.

 First visitSubsequent use
360 Safe Browser (27% market share)

Warning. One click to continue.

No warnings. Green check suggesting that the certificate is valid.
 

IE6 (22%)

Warning. One click to continue.

No warnings.

IE8 (21%)Not tested.Not tested.
IE9 (5%)

Warning. One click to continue.

“Certificate error” warning in location bar.

Safari (3%)

Warning. One click to continue.

No warnings. Lock suggesting that the certificate is valid. What’s more, even clicking the lock will display a misleading encryption channel message.

Chrome (2%)

Warning. Impossible to add exception, if you have visited GitHub before with a valid certificate. “You cannot proceed because the website operator has requested heightened security for this domain”. This is because of HSTS.

Possible to continue if you have not visited GitHub prior to the attack.

Impossible if HSTS was enabled. Otherwise possible.

Firefox (1%)

Same as Chrome. If you have not visited GitHub prior to the attack, possible to create a security exception, but many clicks necessary to continue.

Same as Chrome.

Comments

More Blog Posts

Subscribe to our mailing list
Show content from Blog | Google+ | Twitter | All. Subscribe to our blog using RSS.

Thu, Aug 10, 2023

1.4 million people used FreeBrowser to circumvent the Great Firewall of Turkmenistan

Since 2021, the authorities in Turkmenistan have taken exceptional measures to crack down on the use of circumvention tools. Citizens have been forced to swear on the Koran that they will not use a VPN. Circumvention tool websites have been systematically blocked. Arbitrary searches of mobile devices have also taken place and have even targeted school children and teachers.

The government has also blocked servers hosting VPNs which led to “near complete” internet shutdowns on several occasions in 2022. Current reports indicate that 66 hosting providers, 19 social networks and messaging platforms, and 10 leading content delivery networks (CDNs), are blocked in the country. The government presumably is unconcerned about the negative economic impact that such shutdowns can cause.

Fri, Mar 18, 2022

Well-intentioned decisions have just made it easier for Putin to control the Russian Internet

This article is in large part inspired by a recent article from Meduza (in Russian).

Since the beginning of the war in Ukraine, Russian users have had problems accessing government websites and online banking clients. Browsers began to mark these sites as unsafe and drop the connection. The reason is the revocation of digital security certificates by foreign certificate authorities (either as a direct consequence of sanctions or as an independent, good will move); without them, browsers do not trust sites and “protect” their users from them.

However, these actions, caused - or at least triggered by - a desire to punish Russia for their gruesome actions in Ukraine, will have long-lasting consequences for Russian netizens.

Digital certificates are needed to confirm that the site the user wants to visit is not fraudulent. The certificates contain encryption keys to establish a secure connection between the site and the user. It is very easy to understand whether a page on the Internet is protected by a certificate. One need just look at the address bar of the browser. If the address begins with the https:// prefix, and there is a lock symbol next to the address, the page is protected. By clicking on this lock, you can see the status of the connection, the name of the Certification Authority (CA) that issued the certificate, and its validity period.

There are several dozen commercial and non-commercial organizations in the world that have digital root certificates, but 3/4 of all certificates are issued by only five of the largest companies. Four of them are registered in the USA and one is registered in Belgium.

Mon, Aug 03, 2020

Announcing the Release of GreatFire AppMaker

GreatFire (https://en.greatfire.org/), a China-focused censorship monitoring organization, is proud to announce that we have developed and released a new anti-censorship tool that will enable any blocked media outlet, blogger, human rights group, or civil society organization to evade censors and get their content onto the phones of millions of readers and supporters in China and other countries that censor the Internet.

GreatFire has built an Android mobile app creator, called “GreatFire AppMaker”, that can be used by organizations to unblock their content for users in China and other countries. Organizations can visit a website (https://appmaker.greatfire.org/) which will compile an app that is branded with the organization’s own logo and will feature their own, formerly blocked content. The app will also contain a special, censorship-circumventing web browser so that users can access the uncensored World Wide Web. The apps will use multiple strategies, including machine learning, to evade advanced censorship tactics employed by the Chinese authorities.  This project will work equally well in other countries that have China-like censorship restrictions. For both organizations and end users, the apps will be free, fast, and extremely easy to use.

This project was inspired by China-based GreatFire’s first-hand experience with our own FreeBrowser app (https://freebrowser.org/en) and desire to help small NGOs who may not have the in-house expertise to circumvent Chinese censorship. GreatFire’s anti-censorship tools have worked in China when others do not. FreeBrowser directs Chinese internet users to normally censored stories from the app’s start page (http://manyvoices.news/).

Fri, Jul 24, 2020

Apple, anticompetition, and censorship

On July 20, 2020, GreatFire wrote to all 13 members of the Subcommittee on Antitrust, Commercial and Administrative Law of the U.S. House Committee on the Judiciary, requesting a thorough examination into Apple’s practice of censorship of its App Store, and an investigation into how the company collaborates with the Chinese authorities to maintain its unique position as one of the few foreign tech companies operating profitably in the Chinese digital market.  

This letter was sent a week before Apple CEO TIm Cook will be called for questioning in front of the Subcommittee on Antitrust, Commercial and Administrative Law. The CEOs of Amazon, Google and Facebook will also be questioned on July 27, as part of the Committee’s ongoing investigation into competition in the digital marketplace.

This hearing offers an opportunity to detail to the Subcommittee how Apple uses its closed operating ecosystem to not only abuse its market position but also to deprive certain users, most notably those in China, of their right to download and use apps related to privacy, secure communication, and censorship circumvention.

We hope that U.S. House representatives agree with our view that Apple should not be allowed to do elsewhere what would be considered as unacceptable in the U.S. Chinese citizens are not second class citizens. Private companies such as Apple compromise themselves and their self-proclaimed values of freedom and privacy when they collaborate with the Chinese government and its censors.

Mon, Jun 10, 2019

Apple Censoring Tibetan Information in China

Apple has a long history of censorship when it comes to information about Tibet. In 2009, it was revealed that several apps related to the Dalai Lama were not available in the China App Store. The developers of these apps were not notified that their apps were removed. When confronted with these instances of censorship, an Apple spokesperson simply said that the company “continues to comply with local laws”.

In December, 2017, at a conference in China, when asked about working with the Chinese authorities to censor the Apple App Store, Tim Cook proclaimed:

"Your choice is: do you participate, or do you stand on the sideline and yell at how things should be. And my own view very strongly is you show up and you participate, you get in the arena because nothing ever changes from the sideline."

In the ten years since Apple was first criticized for working with the Chinese authorities to silence already marginalized voices, what has changed? Apple continues to strictly follow the censorship orders of the Chinese authorities. When does Tim Cook expect that his company will help to bring about positive change in China?

Based on data generated from https://applecensorship.com, Apple has now censored 29 popular Tibetan mobile applications in the China App Store. Tibetan-themed apps dealing with news, religious study, tourism, and even games are being censored by Apple. A full list of the censored apps appear below.

Subscribe to our blog using RSS.

Comments

Next the best rule of thumb is to stroke the chain at least three times per
side. An electric battery powered chainsaw reviews (http://Qqww.co/exerciseequipment3425) is by far the cheaper model to run. Well, I was pleasantly surprised
with this little guy.

The Ghost Hunting Night Vision Action Cam picks up infrared, visible, and ultraviolet light spectrums.
Then institute must cover a whole range of courses for equipping the students with thorough knowledge of the field.
This isn't just beneficial to any budding wildlife documenters out
there ' how many uses can you think of for a motion-sensitive infrared camera that takes photos or videos which it subsequently
sends in the form of emails or MMS picture texts to your computer
or phone (no flash, of course).

My web page :: https://www.spytechgears.com

This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this.
pagerank backlinks

I must say you have high quality content here.
Your website should go viral. You need initial boost only.
How to get it? Search for; Miftolo's tools go viral

Pages

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.