Blog

Web3 security, written by people who audit it

Audit case studies, protocol deep-dives, and security fundamentals. Every article ties back to a hands-on module you can rebuild yourself.

The Build (14)

The BuildMay 21, 20269 min

The Case for Rebuilding Protocols Line by Line (Instead of Forking)

Forking a protocol ships code you don't understand. Rebuilding from scratch with a test suite as forcing function teaches what every defensive choice exists for.

#web3-education#audit-methodology#defi
Read
The BuildMay 20, 20269 min

Why Compound V2's Close Factor Caps Liquidations at 50%

Compound V2 caps single-liquidation seizure at 50% of borrower debt. Why partial liquidations beat one-shot total liquidations, and the trade-offs.

#compound-v2#liquidations#defi
Read
The BuildMay 17, 20268 min

The Compound V2 Jump Rate Model: Why the Kink Is at 80% Utilization

Compound V2's interest rate curve is piecewise linear with a kink at 80% utilization. The math, the parameters, and the economic rationale for each piece.

#compound-v2#defi#interest-rates
Read
The BuildMay 17, 20268 min

Lazy Interest Accrual: How Compound V2 Scales to Millions of Borrowers

Compound V2 accrues interest in O(1) per market, no matter how many borrowers exist. The trick is a global borrowIndex plus per-account snapshots. Walking through the math and what forks get wrong.

#compound-v2#solidity-optimization#lending
Read
The BuildMay 16, 20267 min

accountLiquidity(): Where Compound V2 Audit Findings Cluster

Almost every critical bug in a Compound V2 fork lives in or around accountLiquidity(). Why this single function attracts oracle, exchange-rate, mantissa, and overflow risks all at once.

#compound-v2#smart-contract-security#lending
Read
The BuildMay 16, 20268 min

Why Compound V2's Oracle Returns Zero (and That's a Security Feature)

When the oracle returns zero, every borrow and liquidation in that market reverts. That is not a bug. It is the safest possible failure mode, and the alternative cost Mango $114M and Cream $130M.

#compound-v2#oracle-security#defi
Read
The BuildMay 13, 20268 min

How Uniswap V2's Protocol Fee Works (LP Dilution, Not Per-Swap)

Uniswap V2's protocol fee is 1/6th of K growth, paid as LP token dilution at the next mint or burn. Why this design saves gas, and the math that drives it.

#uniswap-v2#defi#amm
Read
The BuildMay 12, 20269 min

UQ112x112: How Uniswap V2's TWAP Math Actually Works

Uniswap V2's UQ112x112 fixed-point format encodes prices as 224-bit values for the TWAP oracle. Why 112 integer + 112 fractional, and how the math preserves precision.

#uniswap-v2#twap-oracle#fixed-point-math
Read
The BuildMay 11, 202611 min

skim() and sync(): The Uniswap V2 Functions That Look Optional, Aren't

Why Uniswap V2 has skim() and sync() helpers, what donation attacks become possible without them, and why integrators reading reserves directly need to understand both functions.

#uniswap-v2#defi#smart-contract-security
Read
The BuildMay 10, 202610 min

Why Uniswap V2's Timestamp Wraps in 2106 (and Why It's a Feature)

Uniswap V2 packs block.timestamp into uint32, which wraps to zero on January 19, 2106. The TWAP oracle keeps working across the wrap because modular subtraction handles it for free.

#uniswap-v2#twap-oracle#smart-contract-security
Read
The BuildMay 9, 20268 min

Same Function, Opposite Arithmetic: Uniswap V2's _update()

Inside Uniswap V2's _update(), reserve writes must revert on overflow, but the price accumulator math must allow it. Why Solidity 0.8 makes this trickier than it looks.

#uniswap-v2#solidity#smart-contract-security
Read
The BuildMay 8, 202610 min

How Uniswap V2 Saves 2100 Gas Per Swap with Storage Packing

Uniswap V2 packs reserve0, reserve1, and blockTimestampLast into a single 256-bit storage slot. The math, the tradeoffs, and why this is the most consequential gas optimization in DeFi.

#uniswap-v2#solidity-gas-optimization#evm
Read
The BuildMay 7, 20266 min

Uniswap V2's 1000-Wei Minimum Liquidity Lock, Explained

Why Uniswap V2 burns 1000 wei of LP tokens forever on the first mint of any pair. The attack it prevents, the code that implements it, and what happens to forks that strip it.

#uniswap-v2#defi#amm
Read
The BuildMay 7, 20269 min

The _mintFee() Ordering Bug in Uniswap V2 Forks

In Uniswap V2's mint() and burn(), _mintFee() must run before reading totalSupply. Reverse the order and you silently dilute the protocol fee recipient on every liquidity event.

#uniswap-v2#smart-contract-security#defi
Read

Shadow Arena (8)

Shadow ArenaMay 29, 20269 min

Flux Finance's KYC Signature Replay: EIP-712 Without a Nonce

Flux Finance's KYC verification uses EIP-712 signatures but omits the nonce. Once signed, the same KYC approval can be replayed indefinitely.

#shadow-arena#flux-finance#signature-replay
Read
Shadow ArenaMay 28, 20269 min

Canto v2's Oracle Mantissa Confusion: 1 vs 1e18

Canto v2's oracle uses a 1 mantissa where Compound V2 expects 1e18. The result: 18-decimal-place errors in liquidation math. A pattern that recurs in cross-chain forks.

#shadow-arena#canto#oracle
Read
Shadow ArenaMay 27, 20269 min

How Basin's Pump-Encoding Code Produced Four Distinct Bug Classes

Basin's low-level bit-packing produced 4 documented bugs in Shadow Arena: off-by-one, slot confusion, bit-shift, and a missed update. One subsystem, four lessons.

#shadow-arena#basin#bit-packing
Read
Shadow ArenaMay 26, 20269 min

Velodrome's Reward System: Three Permanent-Lock Paths in One Subsystem

Velodrome (Solidly fork on Optimism) has three documented permanent-lock bugs in its bribe-distribution code. Same subsystem, three different mechanisms. Every Solidly descendant inherits them.

#shadow-arena#velodrome#solidly
Read
Shadow ArenaMay 25, 20269 min

33% of Bugs in 6 Real Audit Targets Are 'Missed State Updates'

Across 63 documented findings in Zealynx Academy's Shadow Arena, the dominant bug class isn't reentrancy or oracle manipulation. It's missed state updates in conditional paths.

#shadow-arena#audit-methodology#smart-contract-security
Read
Shadow ArenaMay 24, 20268 min

Fee-on-Transfer Tokens Break 3 of 6 Shadow Arena Audit Targets

How fee-on-transfer tokens silently break accounting in DeFi protocols. Pattern, real findings from Basin and Velodrome, and the one-line fix most teams miss.

#shadow-arena#fee-on-transfer#smart-contract-security
Read
Shadow ArenaMay 23, 20268 min

How Venus Inherited a 5x Interest Inflation Bug When Forking Compound to BSC

Compound V2 hardcodes blocksPerYear = 2,102,400 (15-second blocks). BSC has 3-second blocks. Forking the constant unchanged turns a 5% APR market into a 25% APR one. The Venus H-01 finding, walked through.

#shadow-arena#venus#bsc
Read
Shadow ArenaMay 22, 20268 min

The Compound V2 Fork Donation Attack: 3 of 6 Shadow Arena Targets Have It

Three of six audit targets in the Zealynx Academy Shadow Arena are Compound V2 forks, and all three share the same cToken exchange-rate manipulation. Walking through the attack, the math, and why $7M of Hundred Finance proved the design is fragile under fork.

#shadow-arena#compound-v2#donation-attack
Read

AI Auditor Builder (6)

AI Auditor BuilderJun 4, 20269 min

Why Domain-Tuned AI Auditors Beat Generic Ones (DEX, Lending, Staking, Governance)

Generic AI auditors plateau in precision. Loading domain primers (DEX, lending, staking, governance) with category-specific exploits and checklists is what closes the gap.

#ai-auditing#smart-contract-security#domain-knowledge
Read
AI Auditor BuilderJun 3, 20269 min

The Multi-Mindset Pattern: Attacker, Accountant, Spec Auditor, Edge-Case Hunter

Running 4 specialized AI auditor roles in parallel surfaces bug classes that single-pass auditors miss. How to structure the prompts and synthesize the findings.

#ai-auditing#smart-contract-security#multi-agent
Read
AI Auditor BuilderMay 31, 20269 min

How Krait Achieves 100% Precision Across 50 Blind Code4rena Contests

The single biggest reason teams stop trusting AI security tools is false positives. Krait was built around eight kill gates that filter every candidate finding before it reaches the report.

#ai-auditing#krait#open-source
Read
AI Auditor BuilderMay 31, 20268 min

The AI Auditor Arena: Benchmarking Against 118 Real Code4rena Findings

Most AI auditor benchmarks use toy code with planted bugs. The Arena uses 118 real Code4rena findings (41 High, 77 Medium) across 10 contests and 19,200 lines of Solidity. Submit your auditor and get a precision and recall score.

#ai-auditing#code4rena#benchmarking
Read
AI Auditor BuilderMay 30, 20269 min

27 Open-Source AI Audit Tools, 7 Architectural Patterns, One Choice You Probably Haven't Made

AI smart contract auditing tools cluster into 7 architectural patterns. Each has a different failure mode. Most teams adopt one without knowing which they picked.

#ai-auditing#smart-contract-security#open-source
Read
AI Auditor BuilderMay 30, 20268 min

An AI Auditor Without Exploit Context Is a Security Guard Who's Never Seen a Break-In

Why generic AI security agents plateau and domain-tuned ones keep improving. The specific exploits that turn pattern matching into pattern recognition: DAO, Cream, Curve, Mango, Inverse, Bonq.

#ai-auditing#smart-contract-security#prompt-engineering
Read

eMBA (2)