How the Internet Founding Fathers Left a Backdoor Open for Themselves

This article continues a series of such about Internet security or rather the lack of it. The previous article Who is Interested in JavaScript, and Why Sun Microsystems was Destroyed touched upon one aspect of such lack of security, namely the arbitrary code injection facility that was built into the CSS language. That and other articles of the series are beneficial for the understanding of this one.

Let us begin by pointing out that, unlike the compiled executable files that reside on the client’s device, the scripting language files that are dynamically downloaded from the Internet every time the browser requests a page will be compiled or executed line-by-line. The JavaScript libraries belong to the latter category as are the CSS style libraries. The former offer extra functionality that the browsers lack, whereas the latter allow the visual appeal of the web pages to be enhanced. Besides that, there is a backdoor in CSS that allows it to subvert their functioning.

The presence of two directives in CSS, namely before and after, allows it to substitute the HTML source code of web pages. They provide the CSS with the opportunity to insert new elements respectively before or after the existing ones. Quite often the web site owners do not store CSS libraries but instruct the client browsers to download them from content delivery networks, to minimize the server traffic. Thus those who store and distribute the libraries gain control of them, instead of the web site owner. They may be anyone because the library vendor does not necessarily strictly control where it is stored or who owns the specific servers or virtual machines, far away, around the globe.

The previous paragraph is not easy to understand for an average Internet user, so I will provide more detail. Let us suppose that, for example, Twitter who developed the popular CSS library Bootstrap that is widely used by many web sites to enhance their visual appeal, contracted Akamai CDN to distribute it. Its servers are situated in many locations around the globe, in many hosting companies and datacenters. Thus, the control over the actual CSS file that will be downloaded by the client’s browser falls into the hands of the actual server’s owner, not Twitter or Akamai.

In order to thwart the introduction of unauthorized changes into the CSS libraries, the sub-resource integrity (SRI) framework was devised. It allows the web site owner to add an integrity check into the link to the CSS library, by using a checksum verification. It is implied that, having downloaded the file, the browser will compute a checksum and compare it with that in the link, before any styles from it are applied to the page, and that this will be done correctly. It seems that the user will receive the correct copy of the file, but that is not guaranteed.

To begin with, not every web page uses SRI, but this can be addressed by their owners. Worse is the fact that in some regions both the web site and the library may end up being stored on and distributed from the servers under control of organized crime (as I wrote in the earlier articles of this series). For its members it is not too difficult to establish that fact and to use it to their advantage, by altering both the CSS file and the checksum in the link to it. The end result is that the unsuspecting users may fall victim to all kinds of attacks, and their confidential information, funds, or other assets may end up in the wrong hands.

How can that be accomplished? Simply! Suppose that the criminal actors waits for a certain user to request the web page (by any attribute: IP address, geographic location, presence of cookies, etc.), substitutes the library and its checksum, and inject their own code into the page, by employing the before or after directives. This means that, having having parsed the altered web page, the user’s browser will add extra elements to it, for example a scrip or an event handler that activate the malicious code. Thus, the user’s credentials, personal information, or other confidential data may be redirected by the malicious actors to their own services.

That could have been avoided, were at least some conditions existed on the Internet, for providing the security of the user, were it possible to control the domain names and IP addresses to which the browsers should be allowed to connect. Unfortunately, organized crime and the Internet monopolies worked very hard to thwart that. For all practical purposes, it is nearly impossible to determine, to which addresses access should be allowed, and to which it should be blocked, because both change randomly and rapidly. Today, the web site itself and the libraries that it uses may be served from one range of addresses, but tomorrow they may change. Forget tomorrow! That may change within one hour, minute, or even within one session, if the CDN decides to rebalance its load due to the fluctuations of the traffic. This happens all the time, for the sake of savings of the legitimate businesses or illicit gains of the criminal actors. And since we touched the topic of savings and gains, the interests of the user are no longer considered.

There are too many ‘but’ and ‘if’, in the functioning of the Internet in good faith. The users have to assume too much, believe the word of too many strangers, and trust too much too broad circles of random entities. At the same time those entities and persons conduct themselves clearly not with the users’ best interests in mind: they conceal their identities, draft agreements with the intent to avoid any responsibility, complicate the process of fact-finding, shift to the gray areas of the law, lie, cheat, and shirk responsibility bordering on committing outright criminal acts.

The Internet is not a safe leisure but a battlefield with all kinds of combatants: states, monopolists, criminals, and a tiny handful of legitimate entrepreneurs or individuals who also compete among themselves. The Internet should not be approached light-heartedly, otherwise many may be bitterly disappointed. All of the known vulnerabilities of it should be exposed and brought up with the web site owners and other relevant organizations. Without your complaints, they will either remain ignorant of them, or being aware they will remain comfortable assuming that everyone is content, which is a pathway to hell.

Leave a Comment