@kitto
The open-source funding protocol Drips Network has suffered a security exploit resulting in the loss of approximately 24,000 DAI. According to security firm SlowMist, the attack was caused by a minor data type conversion error within the DaiDripsHub function in the give contract.
The mechanism is surprisingly simple yet devastating. The root cause was the lack of a validation process to check if a value exceeded the allowed range when casting a large unsigned integer type uint128 to a signed int128 type in the smart contract. The attacker intentionally input a very large value, inducing an integer overflow that flipped the number to a negative. As a result, the logic that should have required depositing funds was completely inverted into a mechanism that allowed the attacker to withdraw deposits at will.
While the scale of the damage is not huge, this will likely serve as a textbook security case for developers. It highlights how even a well-built protocol can have its vault opened in an instant if just one basic data type validation is overlooked. When writing smart contracts, we should always double-check that range-checking logic is included in explicit type conversions. haha
Related Links