Backdoor in Programming

Lecture



Backdoor, secret entrance (from the English back door, literally "rear door") is a defect in an algorithm that is deliberately built into it by the developer and allows unauthorized access to data or remote control of the operating system and of the computer as a whole .

The main purpose of a backdoor is covert and fast access to data, in most cases encrypted and protected data. For example, a backdoor may be built into an encryption algorithm so that an attacker can later eavesdrop on a protected channel.

A backdoor is usually a hidden method of bypassing authentication or encryption in a computer, a product, an embedded device (for example, a home router), or its implementation (for example, part of a cryptosystem, an algorithm, a chipset, or even a "homunculus computer", a tiny computer inside a computer, as in Intel AMT technology). Backdoors are most often used to secure remote access to a computer or to gain access to plaintext in cryptographic systems. From there it can be used to gain access to confidential information such as passwords, to corrupt or delete data on hard drives, and to transfer information over automated networks.

A backdoor can take the form of a hidden part of a program, a separate program (for example, Back Orifice can subvert a system through a rootkit), code in the hardware firmware, or parts of an operating system such as Windows. Trojan horses can be used to create vulnerabilities in a device. A Trojan horse may look like a perfectly legitimate program, but when run it triggers an action that may install a backdoor. Although some are installed secretly, other backdoors are deliberate and widely known. Backdoors of this type are used for "legitimate" purposes, for example, to give the manufacturer the ability to recover users' passwords.

Many systems that store information in the cloud cannot provide precise security measures. If many systems are connected in the cloud, hackers can gain access to all the other platforms through the most vulnerable system.

Default passwords (or other default credentials) can work as backdoors if they are not changed by the user. Some debugging features can also act as backdoors if they are not removed in the release version. [10]

In 1993 the United States government attempted to deploy an encryption system, the Clipper chip, with an explicit backdoor for access by law enforcement and national security agencies. The chip proved to be a failure.

Main Properties of a Backdoor

The Ideal Backdoor

  • hard to detect;
  • can be used repeatedly;
  • easy to deny: it looks like a bug, and if it is discovered, the developer can claim that the mistake was made accidentally and without malicious intent;
  • exploitable only with knowledge of a secret: only someone who knows how the backdoor is activated can use it;
  • protected against compromise by earlier uses: even if the backdoor has been discovered, it is impossible to establish who exploited it before, and what information the attacker obtained;
  • hard to replicate: even if someone has found the backdoor, it cannot be used in other code or on another device.

Common Principles for Creating Backdoors in Algorithms

  • weak resistance of the algorithm to cryptanalysis;
  • specially chosen constants: an algorithm can become vulnerable to cryptanalysis when certain values are chosen for the constants used in its operation;
  • difficulty of secure implementation: this means that a secure implementation of the algorithm runs too slowly, so everyone will use the insecure variant, which benefits the attacker.

Hypothetical Examples of Backdoors in Modern Algorithms

Vulnerability of the DUAL_EC_DRBG Pseudorandom Sequence Generator

This generator was developed at the NSA and standardized as a cryptographically secure pseudorandom number generator by the U.S. National Institute of Standards and Technology (NIST) in 2006. However, as early as 2007 independent researchers suggested that a backdoor might have been built into this algorithm.

Illustration of the algorithm's operation according to the NSA specification:

Backdoor in Programming

This algorithm uses elliptic curves. Backdoor in Programming is the generator of the group of points on the elliptic curve, Backdoor in Programming is a point on the elliptic curve, a constant defined by the standard; how it was chosen is unknown. The parameters of the curve itself are also set by the standard.

Principle of operation:

The equation of the curve

Backdoor in Programming

can be rewritten as Backdoor in Programming and the following expressions can be written for the operation of the algorithm:

Backdoor in Programming , Backdoor in Programming , Backdoor in Programming

Backdoor in Programming is the internal state of the generator at the current step

Backdoor in Programming is the internal state of the generator at the next step

Backdoor in Programming is the output of the generator at the current step

The suspected backdoor:

Since Backdoor in Programming is a prime number, there exists a number Backdoor in Programming such that Backdoor in Programming. Finding Backdoor in Programming is the computationally hard problem of the discrete logarithm on an elliptic curve, for which no efficient algorithms currently exist. But if we assume that the attacker knows Backdoor in Programming , the following attack results: If Backdoor in Programming is the next output of the generator, and if there exists a Backdoor in Programming such that Backdoor in Programming, then the point Backdoor in Programming, lies on the curve and the following equality holds for it: Backdoor in Programming. Knowing the number Backdoor in Programming one can compute: Backdoor in Programming. Thus, an attacker who knows the number Backdoor in Programming can not only compute the next output of the generator, but also quickly enumerate all possible internal states of the generator and recover its initial internal state. According to independent studies , given knowledge of Backdoor in Programming , just 30 bytes of the generator's output sequence are enough to recover its initial internal state by simple brute-force search over Backdoor in Programming values. In the researchers' opinion, such a vulnerability can be regarded as a backdoor.

An Error in Apple's Implementation of the TLS Certificate Verification Protocol

Researchers at Yandex discovered a vulnerability in the implementation of the TLS protocol in one of Apple's software products . In their opinion, this error may well be a backdoor deliberately built into the algorithm by one of the developers.

The section of code containing the error:

static DSStatus SSLVerifySignedServerKeyExchnge(....)
{
     DSStatus err;
     ....
     if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
          goto fail;
          goto fail;
     if ((SSHashSHA1.final(&hashCtx, &hashOut)) != 0)
          goto fail;
     ....
     fail:
          ....
          return err;
}

As can be seen, the first if statement is followed by two goto fail lines, and the second line is always executed, regardless of the result of the if. As a result, the certificate verification procedure is not carried out in full. An attacker who knows about this vulnerability can forge a certificate and pass the authenticity check. This would allow them to carry out a "man-in-the-middle" attack and thereby interfere with the secure connection between the client and the server. The researchers who discovered this implementation error cannot say for certain whether it was made deliberately or by accident. It is quite possible that it is a backdoor built into the algorithm by one of the developers.

Examples of methods for creating backdoors

Specially chosen constants

Very many modern cryptographic algorithms use a certain set of internal constants in their operation. As a rule, these constants are set by the standard and are chosen with a view to cryptographic resistance to the types of cryptanalysis known at the time. But the choice of constants during the standardization of an algorithm can, in theory, also be used by developers with malicious intent: for example, to create particular vulnerabilities and backdoors in the algorithm.

An example of such use of constants is provided by recent research on so-called "malicious hashing" , in which the authors managed to construct collisions for the SHA1 cryptographic hash function by modifying its round constants. Note that the attack proposed by the authors of the study is not an attack on the SHA1 hash function itself; it only makes it possible to find collisions provided that the round constants can be changed, and only for certain types of files.

A brief description of SHA1:

SHA1 is a modern iterated hash function. The hashing algorithm is as follows:

  • The 32-bit values Backdoor in Programming are initialized
  • The input message is split into blocks 512 bits long
  • Each message block is processed and padded in a special way, according to the algorithm defined in the standard
  • The resulting message block is hashed in 4 stages of 20 rounds each, with a separate constant Backdoor in Programming or Backdoor in Programming used for each stage
  • The output of the function for each block will be the new values Backdoor in Programming, which are added to the result: Backdoor in Programming
  • The final result of hashing will be a 160-bit value obtained by concatenating the five 32-bit values Backdoor in Programming after the last message block has been processed.

Constructing collisions:

The goal of the attack under consideration is to find such constants Backdoor in Programming and such messages Backdoor in Programming and Backdoor in Programming , that Backdoor in Programming. This attack modifies only the first 512 bits (the 1st block) of the messages for which a collision must be constructed. The algorithm is based on the already known differential attack on SHA1, proposed in 2005 and having a complexity of the order of Backdoor in Programming operations, which makes it hard to carry out in practice. That is why, to this day, no real collision for SHA1 has been found.

However, if a malicious variant of SHA1 is created, the attacker can vary not only the message blocks Backdoor in Programming and Backdoor in Programming, but also the round constants Backdoor in Programming. According to the research , this greatly reduces the complexity of the attack to the order of Backdoor in Programming operations and makes constructing such collisions a realistic task that can be carried out on a few computers. In this way, the authors of the study managed to construct single-block collisions for many well-known file types.

Single-block collision:

Backdoor in Programming

Backdoor in Programming and Backdoor in Programming are the first message blocks (512 bits), which differ from each other but give the same hash sum

Backdoor in Programming is the remaining content, which is identical for both files

An example of using malicious hashing to create backdoors

Using the described attack, two sh scripts were created which, when Backdoor in Programming is chosen, give the same SHA1 hash sum but behave differently.

Backdoor in Programming

As can be seen, the difference between these two scripts lies only in the first 512-bit blocks, which are commented-out garbage. But the content of these blocks is then used in the if condition, so the scripts behave differently when run. Such files can be used by a creator with malicious intent.

Hardware backdoors

Backdoors can be built not only into software but also into hardware. Such backdoors can be used by hardware manufacturers to embed malicious functions into it at the production stage.

Hardware backdoors have a number of advantages over software ones:

  • They cannot be detected by antivirus programs, code scanners and other protective software.
  • They cannot be eliminated by updating or replacing the software.

An example of a hardware backdoor is malicious BIOS firmware. According to research, such firmware can be built on the basis of the free firmware projects Coreboot[13] and SeaBIOS. Coreboot is not a full-fledged BIOS: it is responsible only for detecting the hardware present on the machine and handing control over to the actual "BIOS payload", for which SeaBIOS, modified by an attacker for their own needs, can be used.

The principle of operation of the malicious firmware can be briefly described as follows: immediately after the infected computer is switched on, even before the operating system loads, it attempts to establish a connection with the attacker's server over the internet. If the attempt succeeds, some bootkit is downloaded remotely, which in turn gives the attacker the ability to carry out malicious actions on the infected computer: data theft or remote control. If the attempt to connect to the internet fails, the operating system boots normally. An undoubted advantage for the attacker is that the modified firmware itself contains no malicious code, while bootkits are hard to detect.

Compiler backdoors

A sophisticated form of black-box backdoor is the compiler backdoor , in which not only is the compiler subverted (to insert a backdoor into some other program, such as a login program), but it is additionally modified to detect when it is compiling itself, and then inserts both the backdoor insertion code (targeting the other program) and the self-compiling code that modifies it, much like the mechanism by which retroviruses infect their host. This can be done by modifying the source code, and the resulting compromised compiler (object code) can compile the original (unmodified) source code and insert itself: the exploit has been bootstrapped.

This attack was originally presented in Karger & Schell (1974 , p. 52, section 3.4.5: "Trap Door Insertion"), which was a security analysis of the US Air Force's Multics , where they described such an attack on a PL/I compiler and called it a "compiler trap door"; they also mention a variant in which the system initialization code is modified to insert a backdoor during booting , as this is complex and poorly understood, and call it an "initialization trap door"; this is now known as a boot sector virus .

This attack was then actually implemented and popularized by Ken Thompson in his Turing Award acceptance speech in 1983 (published in 1984), "Reflections on Trusting Trust" in which he points out that trust is relative, and that the only software one can truly trust is code where every step of the bootstrapping has been inspected. This backdoor mechanism is based on the fact that people only review source (human-written) code, and not compiled machine code ( object code ). A program called a compiler is used to create the second from the first, and the compiler is usually trusted to do an honest job.

Thompson's paper describes a modified version of the Unix C compiler that would:

  • Put an invisible backdoor in the Unix login command when it noticed that the login program was being compiled, and as a twist
  • Also add this feature undetectably to future compiler versions upon their compilation as well.

Because the compiler itself was a compiled program, users would be extremely unlikely to notice the machine code instructions that performed these tasks. (Because of the second task, the compiler's source code would appear "clean".) What is worse, in Thompson's proof of concept implementation , the subverted compiler also subverted the analysis program ( disassembler ), so that anyone who examined the binaries in the usual way would not actually see the real code that was running, but something else instead.

An updated analysis of the original exploit is given in Karger & Schell (2002 , section 3.2.4: Compiler trap doors), and a historical overview and literature survey is given in Wheeler (2009 , section 2: Background and related work ). .

Occurrences

Thompson's version was officially never released into the wild. However, it is believed that the version was distributed to BBN and at least one use of the backdoor was recorded. There are scattered anecdotal reports of such backdoors in subsequent years.

In August 2009, a similar attack was discovered by Sophos labs. The W32/Induc-A virus infected the program compiler for Delphi , a Windows programming language. The virus introduced its own code into the compilation of new Delphi programs, allowing it to infect and propagate to many systems without the knowledge of the software programmer. An attack that propagates by building its own Trojan horse can be especially hard to discover. It is believed that the Induc-A virus had been propagating for at least a year before it was discovered.

Countermeasures

Once a system has been compromised with a backdoor or Trojan horse, such as the Trusting Trust compiler, it is very hard for the "rightful" user to regain control of the system - typically one should rebuild a clean system and transfer data (but not executables) over. However, several practical weaknesses in the Trusting Trust scheme have been suggested. For example, a sufficiently motivated user could painstakingly review the machine code of the untrusted compiler before using it. As mentioned above, there are ways to hide the Trojan horse, such as subverting the disassembler; but there are ways to counter that defense, too, such as writing your own disassembler from scratch.

A generic method to counter trusting trust attacks is called Diverse Double-Compiling (DDC). The method requires a different compiler and the source code of the compiler-under-test. That source, compiled with both compilers, results in two different stage-1 compilers, which, however, should have the same behavior. Thus the same source compiled with both stage-1 compilers must then result in two identical stage-2 compilers. A formal proof is given that the latter comparison guarantees that the purported source code and executable of the compiler-under-test correspond, under some assumptions. This method was applied by its author to verify that the C compiler of the GCC suite (v. 3.0.4) contained no trojan, using icc (v. 11.0) as the different compiler.

In practice such verifications are not done by end users, except in extreme circumstances of intrusion detection and analysis, due to the rarity of such sophisticated attacks, and because programs are typically distributed in binary form. Removing backdoors (including compiler backdoors) is typically done by simply rebuilding a clean system. However, the sophisticated verifications are of interest to operating system vendors, to ensure that they are not distributing a compromised system, and in high-security settings, where such attacks are a realistic concern.

List of known backdoors

  • Back Orifice was created in 1998 by hackers from the Cult of the Dead Cow group as a remote administration tool. It allowed Windows computers to be controlled remotely over a network and parodied the name of Microsoft's BackOffice .
  • In 2013 it was discovered that the cryptographically secure pseudorandom number generator Dual EC DRBG might have a kleptographic backdoor intentionally inserted by the NSA, who also held the private key to the backdoor.
  • In March 2014, several backdoors were discovered in unlicensed copies of WordPress add-ons. They were inserted as obfuscated JavaScript code and covertly created, for example, an admin account in the website database. A similar scheme was later revealed in a Joomla plugin.
  • Borland Interbase versions 4.0 through 6.0 contained a hard-coded backdoor, planted by the developers. The server code contains a compiled-in backdoor account (username: politically , password: correct ), which could be accessed over a network connection; a user logging in with this backdoor account could take full control over all Interbase databases. The backdoor was discovered in 2001 and a patch was released.
  • The Juniper Networks backdoor, inserted in 2008 into the versions of the ScreenOS firmware from 6.2.0r15 to 6.2.0r18 and from 6.3.0r12 to 6.3.0r20 , gives any user administrative access when using a special master password.
  • Several backdoors were discovered in C-DATA Optical Line Termination (OLT) devices. The researchers published their findings without notifying C-DATA because they believe the backdoors were intentionally placed by the vendor.

See also

  • Computer virus
  • [[b8386]]
  • Hacker attack
  • Spoofing
  • Exploit
  • Man-in-the-middle attack
  • DoublePulsar
  • EternalBlue
  • WannaCry
  • Petya (ransomware worm)
  • EternalRocks
  • United States National Security Agency
  • Bug
  • Cheat code
  • Security through obscurity
  • Software backdoor (program implant)
  • Information security and Vulnerability [[b9357]]
  • [[b8478]]
  • [[b12410]]

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Cryptanalysis, Types of Vulnerability and Information Protection"

Terms: Cryptanalysis, Types of Vulnerability and Information Protection