Bible Network Crypto DeFi Onchain RWA AI Agent Stablecoin CryptoTax DeFAI Chain SAFU AGI Claude Me Claude Skill Claude Design Claude Cowork
Independent Media
Not affiliated with any project
DeFi Protocol Mechanics, Decoded
defi-bible.com
LATEST
Stablecoin Supply Just Shed $15 Billion in Three Months, the Biggest Drop Since Terra — But It's Not a Depeg  ·  You Don't Even Need to Own Bitcoin to Bet on It: What a Perpetual DEX Is Actually Trading With You  ·  When Your Position Gets Liquidated, It's Not Just "Sold": Dissecting Dutch Auctions vs. Fixed-Discount Liquidation  ·  No Code Was Broken: How a Governance Exploit Drained $8.5M From Term Labs' Vaults Despite a Seven-Day Timelock  ·  The Same ETH, Used Twice: What Restaking Actually Re-Stakes, and Where the Risk Stacks Up  ·  What Are You Actually Mining in Liquidity Mining? A Guide for People Who've Never Touched DeFi
developers

Five Common Smart Contract Vulnerability Types, Explained Without Requiring You to Code

30-Second Version · For the impatient
Reentrancy is sneaking in before the door closes. Integer overflow is a number maxing out and wrapping back to zero. Access control flaws are a door that needed a lock but never got one — every vulnerability is a mundane logic error underneath, only the consequences are anything but mundane.

Full Explanation +
01 · Why did this happen?

Among these five vulnerability types, which has become relatively rarer under modern auditing techniques?

Reentrancy and access control flaws — two relatively basic vulnerability types — now have mature automated static analysis tools that can quickly scan and detect them, plus the industry has accumulated a large body of known cases forming standard checklists. Most protocols that went through a formal audit process should, in theory, be able to rule out these 'textbook-level' vulnerabilities before launch, and in practice, major incidents caused by these two types have genuinely shown a declining trend in recent years.

By contrast, complex logic design flaws and problems caused by cross-protocol interaction remain hard to fully eradicate even as auditing technology keeps improving — because this kind of problem often isn't an error within a single contract, but an unexpected behavior that only surfaces once multiple independent systems, each looking correct on its own, get combined together. Detecting this kind of problem depends heavily on an auditor's depth of understanding of the entire protocol ecosystem, not something pure code scanning can solve — which is also why major attack incidents in recent years are actually more commonly seen from this kind of complex interaction, rather than basic vulnerability types.

02 · What is the mechanism?

If a vulnerability is theoretically basic and should be easy to catch, why do protocols still get attacked because of it?

A few practical reasons: time and budget pressure — some projects, racing to be first to market, compress their audit process, or only audit core contracts while neglecting peripheral modules; no re-audit after an upgrade or modification — many attacks happen during the phase when a protocol adds new features or modifies parameters after launch, and the original audit report only covers the initial launch version — if a subsequent change doesn't get audited alongside it, the new code ends up completely exposed with no verification at all; variance in audit quality itself — not every protocol touting 'audited' hired an auditing firm of the same caliber, and some audits are inconsistent in quality, potentially failing to genuinely catch even basic vulnerability types.

This is also why, when checking an audit report, beyond simply confirming 'was it audited,' you need to further verify whether the code version the audit covers matches the currently deployed version, and what the auditing firm's track record and reputation look like — these details often carry more reference value than the surface-level information of 'is there an audit badge.'

03 · How does it affect me?

Can an everyday user use a blockchain explorer themselves to do a simple check for obvious access control risk in a protocol's contract?

To some degree, yes — while you don't need to understand the full code, you can do some basic checks: look at the blockchain explorer to see whether the contract is 'open-sourced and verified,' meaning the contract's source code is publicly readable rather than just compiled machine code; if the contract is open-source, you can search the code for functions marked with permission modifiers like onlyOwner or onlyAdmin, and note what actual function each of these corresponds to (such as whether it includes sensitive operations like minting, withdrawing from the pool, or modifying key parameters); also check whether the 'owner' or 'admin' address itself is a regular external account or a multi-sig wallet — if key permissions are concentrated in a single regular account rather than a multi-sig mechanism requiring multiple parties to jointly sign off, that indicates a single-point-of-failure or insider-malfeasance risk in the protocol.

These checks don't require understanding logic flaws or complex reentrancy-type issues (that genuinely requires specialized expertise), but can help you catch 'is permission design overly concentrated' — a risk indicator that's relatively understandable and relatively checkable.

04 · What should I do?

Do these vulnerability types share a common defensive philosophy, or does each require an entirely different solution?

While the technical details of the five types differ, there's a common defensive philosophy underlying them: don't trust that any single component will 'definitely' behave as expected — pre-design a buffer for the case where it doesn't. Defending against reentrancy means updating state before making an external call (so no matter what unexpected thing happens during the external call, the state is already correct); defending against integer overflow means using a safe math library that automatically checks bounds and can't wrap around; defending against access control issues means handing sensitive permissions to a multi-sig mechanism rather than a single account (not trusting that a single holder definitely won't make a mistake or act maliciously); defending against Oracle Manipulation means not relying on a single price source (not trusting that any one data source is definitely accurate); and defending against logic flaws requires testing that simulates various extreme scenarios, proactively assuming 'users might combine these features in ways I never thought of.'

This shared philosophy can be summed up in one sentence: good smart contract design doesn't assume everything will run smoothly — it assumes something is bound to go wrong somewhere, and pre-designs a stop-loss mechanism for when it does.

Full Content +

When a protocol announces it 'suffered an attack due to a smart contract vulnerability,' most non-engineering users can only understand it at the level of 'the contract broke, money got stolen' — it's hard to further judge whether this incident reflects a one-off fluke or a structural problem with the protocol's overall engineering quality. Understanding the logic behind a few of the most common vulnerability types, without needing to read the actual code, can build a basic framework for assessing protocol safety.

Reentrancy: Sneaking Back In Before the Door Closes

Reentrancy is the earliest and most classic vulnerability type in DeFi history. Picture a withdrawal process: a contract should first deduct your balance record, then transfer the money to you. But if the code has the order reversed — transferring the money out first, then updating the balance record afterward — an attacker can exploit the gap where 'the money has already left, but the balance record hasn't updated yet' to call the withdrawal function again, since the system hasn't zeroed out the balance yet, effectively letting the attacker withdraw the same deposit repeatedly. It's like an ATM not yet writing the transaction back to the database before you rush in and repeatedly hit the withdraw button several more times. The 2016 DAO incident is exactly this attack pattern, resulting in roughly $60 million worth of ether being drained.

Integer Overflow: A Number 'Maxes Out' and Wraps Into a Completely Different Number

A computer's space for storing numbers is limited — if a variable can only store up to a certain maximum value, when a calculation result exceeds that ceiling, the system might not display an 'error,' but instead 'wrap around' into a very small number, even zero (or in reverse, subtracting too much from a small number wraps into an enormous one). Picture a counter that can only display three digits: after counting up to 999 and adding 1 more, the screen doesn't show 1000, it wraps around back to 000. If an attacker can deliberately create this kind of 'number wraparound' situation, they might trick the contract into believing it still has a huge balance available to use, when that balance doesn't actually exist at all.

Access Control Flaws: A Door That Should Be Locked, But the Lock Was Never Installed

Most contracts design sensitive functions meant to be 'admin-only' — like emergency-pausing trading, modifying key parameters, or even minting new tokens directly. An access control flaw means these functions, originally meant to restrict who can call them, end up callable by anyone because the code is missing an identity verification check. It's like a door labeled 'employees only' inside a building, but the doorknob never had a lock installed — anyone passing by can simply push it open and walk in. This type of vulnerability usually stems from a simple oversight rather than a complex logic design problem — theoretically a relatively easy type to catch during code review, but it still happens from time to time in practice.

Price Oracle Manipulation: Tricking the Contract Into Believing a Fake Price

If a contract's judgment of whether collateral is sufficient, or whether to trigger liquidation, relies entirely on a single price source that an attacker can instantly push up or down through a massive trade, the attacker can manufacture a fake price 'temporary but sufficient to trigger a chain reaction.' This is like a store using only a single easily-adjustable scale to determine how much a customer pays based on how much something weighs — if someone can quietly nudge the scale's needle, they can make the checkout system charge based on a fake weight. The usual defense is not relying on a single, instant price source alone, instead cross-referencing multiple sources, or using a price averaged over a period of time rather than a single instantaneous moment.

Logic Design Flaws: Each Piece Is Legitimate, But the Combination Doesn't Make Sense

This is the hardest vulnerability type for automated tools to catch, since the code itself might have no syntax error at all — each function looks fine working in isolation, but the problem lies in the overall business logic design: several features combined in a particular sequence produce a result the designers never anticipated at all. It's like a rulebook where every single rule makes sense read on its own, but chaining several of them together lets you derive an exploit path nobody ever conceived of. This kind of problem usually can only be caught through manual review by someone who deeply understands the protocol's business logic — the segment of audit work that most tests experience and imagination.

What This Means for Your Money

Next time you see a protocol's vulnerability incident announcement, try to judge which of these types the attack more closely resembles: if it's a relatively basic vulnerability like reentrancy or integer overflow, it might reflect an obvious gap in the team's own engineering review process; if it's a complex logic design flaw or a problem caused by cross-protocol interaction, it suggests that even with relatively rigorous engineering practices, DeFi's highly composable nature still brings risk that's hard to fully eliminate. This judgment won't turn you into a security expert, but it can help you pick up more meaningful information when reading a Post-Mortem Report, rather than staying at the surface-level understanding of 'this protocol had an incident.'

Diagram
五種常見智能合約漏洞類型重入攻擊、整數溢位、存取控制疏漏、預言機操縱、邏輯設計缺陷,五種類型底下共通的防範哲學是不信任單一環節必然正確運作。Five Common Smart Contract Vulnerability TypesReentrancyRe-enter before state updatese.g. The DAO, 2016Integer OverflowNumber wraps past its limitAccess Control FlawAdmin-only function left openOracle ManipulationPrice source distortedLogic Design FlawLegit parts, illogical comboShared Defense PhilosophyNever trust a single point to work as expected — always design a buffer for failureDeFi Bible · defi-bible.com
Feel free to share. Please credit the source.
Ask a Question
Please enter at least 10 characters
Related Articles
Why 'Waiting to Check the Price' Is Actually Safer: How TWAP Neutralizes Flash Loan Attacks
risk · Jul 25
How Flash Loan Attacks Work: A Multi-Million Dollar Heist in One Transaction
risk · Jul 22
That Extra 2% Yield Might Be Bought With Your Principal: Slashing Conditions You Should Check Before Restaking
developers · Jul 29
What Does a Smart Contract Audit Actually Check? What to Know Before Reading a Report
developers · Jul 23
Related News
More Related Topics
$60 Million, One Hard Fork, and a Mistake Still Being Made a Decade Later: The Full Story of Reentrancy Attacks
SAFU Bible
Reentrancy's share of losses has dropped nearly twenty percentage points over a decade, but that doesn't mean the vulnerability vanished — it just stopped being attackers' first choice, while remaining an old landmine any new protocol can still step on.
#reentrancy-attack#ethereum-classic#smart-contract-audit
Why a Major Consensus Overhaul Isn't Always a "Hard Fork": What Solana's Alpenglow Reveals About How Forks Are Actually Classified
Chain Bible
Fork classification was never about how big the change is — it's about whether a mechanism ensures the overwhelming majority lands on the same side at the same moment. Alpenglow changes more than most hard forks do, yet it's never once been called one.
#the-dao#ethereum-classic
Smart Contract Audit Reports Aren't a Safety Stamp: How to Actually Read Scope, Severity, and Findings
SAFU Bible
The most dangerous part of an audit report is often not the bug that got missed — it's the one marked Acknowledged that nobody ever went back to fix.
#smart-contract-audit#access-control
The Audit Passed, and You Still Got Hacked: What $444 Million in H1 2026 Taught the Industry
SAFU Bible
An audit proves the code was written correctly. It can't prove the outside world the code trusts is correct too — H1 2026's $444 million lesson was learned the hard way, on exactly that second point.
#smart-contract-audit#oracle-manipulation