Smart contracts are the foundation of many Web3 applications, including DeFi protocols, NFT platforms, and decentralized applications. However, unlike traditional software, smart contract vulnerabilities can directly affect user assets and protocol funds.
At PandaSecurity, we review smart contracts from an attacker’s perspective. During security reviews, we often find that many risks are not caused by extremely complex code. Instead, they come from simple mistakes in logic, assumptions, and contract design.
This article explains some of the most common Solidity mistakes that can introduce security risks.
Access control determines who can execute sensitive functions.
Many contracts contain privileged operations such as:
A common mistake is forgetting to restrict these functions.
Example:
function setFee(uint256 newFee) external {
fee = newFee;
}
Without proper authorization, any user could modify important protocol settings.
A safer design should include appropriate permission checks:
function setFee(uint256 newFee) external onlyOwner {
fee = newFee;
}
However, security reviews should not only check whether a modifier exists. Auditors should also verify:
Incorrect access control remains one of the most common causes of smart contract security issues.
Smart contracts frequently interact with external contracts, including tokens, oracles, and other protocols.
External calls should always be treated as potentially dangerous because the called contract can execute unexpected logic.
A classic example is updating state after making an external call:
function withdraw() external {
uint256 amount = balances[msg.sender];
payable(msg.sender).call{value: amount}("");
balances[msg.sender] = 0;
}
The problem is that the user-controlled contract receives execution control before the internal balance is updated.
A safer approach follows the Checks-Effects-Interactions pattern:
function withdraw() external {
uint256 amount = balances[msg.sender];
balances[msg.sender] = 0;
payable(msg.sender).call{value: amount}("");
}
The key security principle is simple:
Do not trust external calls.
Many Solidity developers assume every ERC20 token behaves exactly the same.
In reality, tokens may have different implementations:
For example, a protocol that calculates accounting based only on requested transfer amounts may become inconsistent if the actual received amount is different.
When interacting with ERC20 tokens, developers should carefully handle transfer results and understand token behavior.
Security reviews often focus on whether protocol assumptions match real token behavior.
Many DeFi protocols rely on external price information.
The oracle itself may be secure, but the integration logic can still introduce vulnerabilities.
Common mistakes include:
For lending protocols, exchanges, and derivatives platforms, incorrect price handling can affect:
Oracle security requires reviewing both the data source and how the protocol consumes that data.
Solidity uses integer arithmetic, which means division can lose precision.
Example:
uint256 reward = amount * 5 / 100;
In financial applications, small rounding differences can become important when repeated over many transactions.
Common areas requiring attention include:
Developers should carefully consider rounding direction and ensure accounting remains consistent.
Upgradeable contracts introduce additional complexity.
Proxy-based systems require careful management of:
A secure implementation can still become vulnerable if the upgrade mechanism is poorly designed.
Security reviews should analyze the complete upgrade architecture, not only the implementation logic.
Reading individual functions is not always enough to discover smart contract vulnerabilities.
Auditors often define important rules that should always remain true.
Examples:
These rules are known as invariants.
Testing invariants through fuzzing and manual analysis can reveal unexpected edge cases.
Modern Web3 protocols are highly interconnected.
A contract may interact with:
A function that appears safe alone may become dangerous when combined with another component.
Attackers usually analyze the complete system, not just a single contract.
At PandaSecurity, we combine manual security research with automated analysis tools to identify realistic attack paths.
Our security review approach focuses on:
Security is not only about finding known vulnerability patterns. It is about understanding how a protocol can fail under unexpected conditions.
Most Solidity security issues are not caused by complicated programming mistakes.
They usually come from incorrect assumptions:
Smart contract security should be considered from the beginning of development.
A professional security review provides another perspective before attackers find these weaknesses.
PandaSecurity helps Web3 teams improve contract security through smart contract auditing and security research.
On 4 December 2026, an attacker flash-borrowed 50 million USDC from Morpho, deposited it into the PeakDeFiFund contract through depositUSDC() while registering their own referrer contract, and captured 99.9692% of the current referral cycle's commission weight in the same block — because the fund paid referral commissions based on the balance at redemption time rather than deposits that persisted across a cycle. The fund paid out 33,819.89 USDC, the attacker burned the temporary shares, withdrew the principal, repaid the flash loan, and kept ~15,219 USDC plus ~1.07 ETH.
On 5 December 2026, an attacker used the buyTargetNFT() function in TokenWorks' NFTStrategy contracts to point a strategy vault at Seaport, list the vault's entire NFT inventory as its own seller at 1 wei each — skipping the marketplace signature check because the offerer was the caller — and drain ~418 NFTs across Chimpers, Quirkies and Sweeps in a single block; 343 Chimpers were recovered to the treasury within four hours via an ERC721C blacklist.
On 3 December 2026, an unauthorized Wormhole price message published from the attacker's own Base wallet set SPY's price to $2 billion on Hydration, turning a 0.01 SPY deposit into roughly $20 million of paper collateral and enabling 19 borrows across 17 assets in about 90 seconds; approximately 1,421 ETH (~$2.23M) left the protocol.
On 2 December 2026, an attacker turned 1 APE into 268,435,456 book APE in a single transaction by abusing ApeChain's native yield accounting during SELFDESTRUCT reverts, then bridged 138 million of them through the official LayerZero route and released 138 million real APE from the ApeCoin Staking contract on Ethereum — about $9.87M.