KyberSwap’s $47M Reentrancy Attack: A Deep Dive into the Exploit
Let’s take a closer look inside a $47M reentrancy attack on KyberSwap.
🇺🇦 Hacken stands with Ukraine!Learn more
The use cases of blockchain are becoming more prominent over time. However, some weaknesses beset the security of blockchain protocols. A Sybil Attack is a notable example of these weaknesses.
A Sybil Attack is a form of online security violation where an entity has numerous fake identities on a blockchain for malicious reasons.
The origin of the term “Sybil” can be traced back to the 1973 novel by Flora Schreiber. It has a character named Sybil who has an identity-related medical issue. She would always try to operate with multiple identities.
The term crept into tech after John R. Douceur published a short research paper some decades back. Apart from explaining the nature of Sybil Attacks, John also classified them into two categories.
The first is the direct Attack, and the second is the indirect attack.
A Direct Sybil Attack occurs when a malicious node directly interacts with honest nodes in the protocol. This type of attack is particularly effective because the genuine nodes are unable to detect that the fake nodes are not legitimate.
Consequently, the attacker can manipulate the genuine nodes into taking actions that align with the attacker’s self-interests.
A typical indirect Sybil Attack happens when fake nodes come in contact with one or more nodes connected to the authentic nodes.
In contrast to a Direct Sybil Attack, hackers use intermediary/proxy nodes to launch an indirect attack. The intermediary nodes, which are positioned between the Sybil node and the honest ones, represent a single or a few points of failure. By exploiting these intermediary nodes, hackers can launch an attack on the honest nodes that is not as easily detected as a direct Sybil Attack.
The logic is that once a Sybil node has influenced the middle nodes, it would compromise the authentic nodes.
A Sybil Attack is a high-severity security threat that has assailed some blockchains. The question is, “What are the factors that trigger a Sybil Attack?”
First, a weakness in the node creation process can be a trigger. Once it is easy to create and run a node, an adversary can easily set up multiple Sybil nodes and attack anytime. Hence, the reason some blockchain protocols often resort to a financially flamboyant node creation process.
Second, how effective is the node validation system? Sybil Attacks can easily be detected and expunged when the validation system points them out on time. So if the validation system can easily be manipulated, this can trigger a hacker to give it a try.
Most importantly, huge revenues in a blockchain magnetize hackers. Throughout history, hackers have always assaulted high-volume blockchain protocols with Sybil Attacks. Examples include Monero, Verge, and Ethereum Classic.
The Tor attack in 2014 was one of the earliest Sybil Attacks against a P2P network. Tor is a peer-to-peer network that facilitates private conversations.
The attackers assailed it that year to discover the locations and identities of some Tor users. In the unofficial post-mortem report, the Tor team found some facts that the attack was a Sybil Attack.
The attacker-controlled about 115 relays from a single IP address. This means that only one person was in charge of the numerous relays. The attacker was able to get some unduly large influence over the network and access some pieces of information.
A similar and probably deadlier Sybil Attack happened in 2020 on the same Tor network. The hackers behind the 2020 attack focused more on the Bitcoin holders that use Tor.
The attacker who controls a lot of fake Tor relays would intercept the cyber-movements of Bitcoin holders and strip them of their funds.
Sybil Attacks can be disastrous to the integrity of a blockchain. These two major threats they can cause:
Blockchain technology places a premium on security and privacy. But Sybil Attack assaults the core of this tenet. A threat actor can run a malicious node to collect sensitive details that the honest nodes are passing.
Depending on the information that the attacker seeks to get, a Sybil Attack places the blockchain at risk. One of the details can be illegally obtaining the IP addresses of those behind the honest nodes.
Such that the inauthentic or malicious nodes outnumber the honest nodes. This power gives the attacker the upper hand in the protocol’s decision-making processes.
As a result, the former can outvote the latter and hijack such a blockchain. It is a fatal security assault that is bound to happen with a Sybil Attack. This was the exact thing that happened during the Litecoin Cash Attack in 2019.
A Block Withholding Attack can also occur as a result of a Sybil Attack. In this type of attack, a significant number of validators who are acting against the blockchain’s interests refuse to add new blocks to the chain.
This can result in the blockchain becoming stagnant and unusable over time, requiring intervention to restore its functionality for users.
Sybil Attacks can lead to complications on a blockchain and compromise its operation. After careful analysis, blockchains have also come up with some preventive measures.
We shall consider a few of them subsequently:
John Douceur himself recommended this Sybil attack prevention in his research paper. According to him, there are two basic ways to authenticate identities. The first is direct, and the second is indirect.
Direct authentication works so that the central authority checks and verifies every new validator that applies to join the network as a peer. They can require details such as IP address, name in real life, etc.
But in an indirect authentication, some already verified validators attest to the genuineness of the new to-be validator. All the personal information does not matter; only the vouching does.
Each of these validating techniques has its good and bad sides. The direct authentication model is susceptible to the applicant supplying incorrect information.
Similarly, indirect authentication can be centralized because the existing validators will only approve the people they know. This is against the decentralized nature of blockchain.
New nodes or identities on the blockchain are likely to be Sybil nodes. As a result, they should be placed under suspicion for some time till their overall genuineness is confirmed.
Create a structure where the integrity of nodes is in cadets. This is why a hierarchical system is a sure prevention of Sybil Attacks.
Those who have been in the network for a long time should have higher powers than the newbies. Such that the new Sybil nodes cannot carry out a major attack even if they want to.
A social graph is the visual representation of every validator within a network. So trust graphs then classify validators based on their honesty so far.
If the algorithm notices some foul nodes, it will indicate that their trust level is low. This way, the main operators of a blockchain network can quickly detect Sybil nodes.
There are currently several social trust graph techniques, such as SybilRank, SybilGuard, the Advogato Trust Metric, and so on. But note that social trust graphs do not have 100% speed and accuracy.
Thus, it is recommended that they are used with other preventive measures for battle-tested security.
Generic security measures can still be susceptible to attacks. The more specific the defense, the better. This is why some blockchains are incorporating custom defense mechanisms to be more Sybil-resistant.
A similar example is how Invisible Internet Project (I2P), a private p2p protocol, utilizes Kademlia to prevent Sybil Attacks. Kademlia is a form of a distributed hash table on which Sybil Attacks are difficult to happen.
These days, there are also developments of some Sybil-resistant algorithms. They include DSybil, SumUp, and Whānau.
The main intention of attackers during Sybil Attacks is to take over the blockchain to siphon funds. But running a costly consensus mechanism is an effective measure that checkmates such purposes.
On the Ethereum blockchain, for instance, anyone needs to stake 32 ETH to run an Ethereum node. 32 ETH is around $48,000. So to run multiple nodes for a Sybil Attack is not worth it economically.
This is why blockchains that utilize PoW and PoS consensus mechanisms rarely experience Sybil Attacks.
A lot of blockchains are susceptible to Sybil Attacks. A successful Sybil Attack cannot only breach privacy but also lead to the loss of huge funds.
This is the reason each blockchain network should prepare against the possibility of Sybil Attacks. Although the existing preventive measures can be difficult to implement, they can mitigate such attacks to a large extent.
Preferably, blockchains should combine two or more of these measures for maximal safety.
All blockchains are vulnerable to Sybil Attacks. But in reality, most blockchains have set up structures that make Sybil Attacks practically impossible.
You can detect Sybil Attacks with validation models and social trust graphs.
The Bitcoin network prevents Sybil Attacks with its costly and highly distributed consensus mechanism called proof-of-work. A threat actor will need a lot of resources and lobbying to attack effectively.