The Ethereum Black Valentine’s Day Attack
ETH Black Valentine's day attack had a loss of over $20 million dollars in total with various types of tokens being stolen, and unlike typical exploits and attacks, this one continued for a few years until today.
This attack first occurred on the 14th February of 2016, which was Valentine's day, hence the name.
Root Cause
The cause of this attack was mainly from ETH ecological defects, as the attackers took advantage of the authentication flaw of Ethereum node's Geth/Parity RPC API to maliciously steal tokens via eth_sendTransaction
.
Vulnerability Analysis
Attacker Address
Exploiter Address:
0x957cd4ff9b3894fc78b5134a8dc72b032ffbc464
Attack Process
- Scan open Ethereum nodes, mainly: - Port 8545 (HTTP JSON RPC API) - Port 8546 (WebSocket JSON RPC API)
- Traverse through block height, wallet addresses and balances through sending: -
eth_getBlockByNumber
-eth_accounts
-eth_getBalance
- Call
eth_sendTransaction
repeatedly to transfer the balance to the attacker's wallet - If the victim/node user executes
unlockAccount
on their wallet, no password is needed during the duration of signing the transaction. This results in the attacker's spam ofeth_sentTransaction
calls being executed properly, transferring funds from the victim to the attacker's wallet.
Update: Another attack process was introduced that build upons the first method above:
- On an open Ethereum node, an attacker constructs a transaction and signs it. The signed amount is set as X, and the nonce as the current nonce + 1.
- The Ethereum node will detect an issue and close the RPC port.
- After closing the port, the Ethereum node will eventually assume it's now safe to transfer ETH to the account.
- The attacker takes the window when the node does so (through automated scripts) and broadcasts the previously signed transaction instantly. Making the attack go through.
Attack Timeline of 2016-2017
Date | Time | |
---|---|---|
2016/02/14 | 03:59:14 PM | First deposit occured on Valentine's day |
2016/02/16 | 06:33:30 PM | 2 days later, another deposit, can be speculated that the attacker's exploit already started scanning and calling eth_sendTransaction
|
2016/05/19 | 07:46:33 PM | First withdrawal occurred, with another 51 deposits made |
2016/07/20 | 06:35:57 PM | Another withdrawal, while 57 deposits done in total. |
2017/05/11 | 06:34:35 PM | Shapeshift, made 7 transactions across 71 days |
2017/06/10 | 02:39:53 AM | Last withdrawal, with around 207 deposits totaled |
2017/06/21 | 07:46:49 AM | f2pool in 36 transactions, across 4 hours |
Impact
Around 4.2 billion IPv4 ports were scanned and detected, with over 10,000 Ethereum nodes being exposed on the public network along with their RPC API being enabled.
These nodes are at risk of direct currency theft attacks like this one.
Since this attack is still ongoing, it's unknown when the proper amount of losses is established, but as of now from the exploiter's account, we can see a theft of around 46,250 ETH, most of it already withdrawn by the exploiter.
Mitigation
There are a few guidelines to follow to prevent such incidents from happening again, mostly through configuration of the RPC API port, as follows:
- Change the default RPC API port
- Change the RPC API listening address to the intranet
- Configure iptables to restrict access to the RPC API port
- Account information (keystore) should not be stored on the node, preventing
unlockAcount
from ever being used. - Ensure every transfer using web3's
sendTransaction
andsendRawTransaction
has to be signed by the private key.
References
- https://slowmist.medium.com/slowmist-data-analysis-of-the-ethereum-black-valentines-day-event-disclosure-of-new-attack-d871265224eb
- https://www.issummit.org/wp-content/uploads/2022/09/SlowMist_How-can-we-protect-ourselves-in-the-dark-forest-of-blockchain-v1-compressed.pdf
- https://mooz.space/eth214/
- https://mp.weixin.qq.com/s?__biz=MzU4ODQ3NTM2OA%3D%3D&mid=2247483658&idx=1&sn=fe823fba88643ec7070d45259150f7d0&chksm=fddd7f8dcaaaf69b9a7a93b7d25c90d12da59a1ec9942a062afdf01d375c60383939b1714965&scene=21#wechat_redirect