Billions of dollars have been lost to smart contract exploits across DeFi, NFTs, and cross-chain protocols. Despite the diversity of incidents, most of these failures are not random. They follow a small set of recurring, identifiable attack patterns.
For auditors, security researchers, and protocol designers, recognizing these patterns is more valuable than memorizing isolated bugs. The same underlying mechanics appear again and again, only wrapped in different implementations.
Understanding these patterns is a force multiplier for smart contract auditing, enabling faster detection, better threat modeling, and more resilient protocol design.
A vulnerability is a specific flaw in code.
An attack pattern is a repeatable strategy used by attackers to exploit one or more vulnerabilities.
Attack patterns abstract away implementation details and focus on attacker behavior.
Reentrancy occurs when an external call allows control flow to return to the calling contract before state changes are finalized.
The DAO hack remains the canonical case, where recursive withdrawals drained funds due to state updates occurring after external calls.
function withdraw(uint amount) public {
require(balances[msg.sender] >= amount);
(bool success, ) = msg.sender.call{value: amount}("");
require(success);
balances[msg.sender] -= amount;
}
Protocols relying on manipulable price sources can be exploited through temporary distortions, often using flash loans.
The Mango Markets exploit used price manipulation of thinly traded assets to inflate collateral value and drain liquidity.
price = dex.getPrice(token);
collateralValue = userBalance * price;
require(collateralValue > borrowAmount);
Incorrect assumptions about balances, invariants, or system state can lead to exploitable inconsistencies.
The Nomad bridge exploit involved a flawed initialization that allowed arbitrary message validation.
function deposit(uint amount) public {
totalSupply += amount;
balances[msg.sender] += amount;
}
Missing invariant checks can allow inconsistencies between totalSupply and actual assets.
Improper authorization allows attackers to execute privileged functions.
Numerous admin key exploits and upgradeability misconfigurations have led to full protocol compromise.
function mint(address to, uint amount) public {
_mint(to, amount);
}
No access control means anyone can mint tokens.
Flash loans allow attackers to access massive capital within a single transaction, amplifying the impact of other vulnerabilities.
The Euler Finance exploit combined flash loans with liquidation logic flaws to extract significant value.
1. Borrow large amount via flash loan
2. Manipulate protocol state
3. Exploit vulnerability
4. Repay loan in same transaction
Effective smart contract auditing requires shifting from line-by-line inspection to adversarial modeling.
Design as if attackers have infinite capital, perfect timing, and deep protocol knowledge.
Most smart contract exploits are not novel. They are variations of a small number of attack patterns applied to new codebases.
For professionals in Web3 security, mastering these patterns is essential. It enables faster identification of risks, more effective smart contract auditing, and stronger protocol design.
The future of Web3 security depends not on reacting to individual DeFi hacks, but on proactively designing systems that are resilient against entire classes of exploits.
Understanding patterns is the difference between patching bugs and preventing breaches.
Stay adversarial.
5 Attack Patterns Behind Most Smart Contract Exploits was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.


