惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
B
Blog
aimingoo的专栏
aimingoo的专栏
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
月光博客
月光博客
H
Help Net Security
V
Visual Studio Blog
量子位
A
About on SuperTechFans
博客园 - Franky
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
5 Smart Contract Vulnerabilities Every Developer Should K...
Ahmed Moussa · 2026-05-28 · via DEV Community

Ahmed Moussa

Smart contracts manage over $90 billion in total value locked across DeFi protocols. Yet the vulnerability classes that enabled the 2016 DAO hack remain present in production code today.

1. Reentrancy — The Vulnerability That Wont Die

The pattern is simple: your contract sends ETH before updating its own state, and the recipient calls back into your contract while the state is stale.

\`solidity
// VULNERABLE
function withdraw() external {
uint256 amount = balances[msg.sender];
(bool success, ) = msg.sender.call{value: amount}("");
require(success);
balances[msg.sender] = 0; // Too late!
}

// FIXED: Checks-Effects-Interactions
function withdraw() external nonReentrant {
uint256 amount = balances[msg.sender];
balances[msg.sender] = 0; // State update FIRST
(bool success, ) = msg.sender.call{value: amount}("");
require(success);
}
`\

Detection: Run slither . --detect reentrancy-eth\ on every PR. Use OpenZeppelin ReentrancyGuard.

2. Oracle Manipulation — When Price Feeds Lie

DeFi protocols relying on single-source spot prices are vulnerable to flash loan attacks. The attacker borrows, manipulates the AMM price, triggers liquidation at the wrong price, and repays — all in one transaction.

Fix: Use Chainlink or Uniswap V3 TWAP (30-minute window). Never use getReserves()\ for pricing decisions. Cross-check multiple oracle sources.

Euler Finance lost ~$197M in March 2023 from manipulated collateral values.

3. Access Control Failures

Functions like mint()\, pause()\, or setFee()\ left public without modifiers. Simple oversight, catastrophic impact.

\solidity
// Use OpenZeppelin AccessControl
function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE) {
_mint(to, amount);
}
\
\

Detection: slither . --detect suicidal,unprotected-upgrade\ catches most patterns.

4. Integer Overflow in Unchecked Blocks

Solidity 0.8+ has overflow protection, but unchecked\ blocks bypass it. Developers use it for gas savings, creating the same old bugs.

Rule: Only use unchecked\ for loop counter increments where overflow is provably impossible. Never for user-controlled inputs.

5. Cross-Chain Message Verification

Bridge exploits produced the largest DeFi losses: Ronin ($624M, 2022), Wormhole ($326M, 2022), Nomad ($190M, 2022).

Every cross-chain message receiver needs 5 checks:

  1. Caller is the bridge contract
  2. Source chain is allowed
  3. Sender is trusted on that chain
  4. Replay protection (message hash dedup)
  5. Payload bounds validation

Security Checklist

Check Tool
Reentrancy slither . --detect reentrancy-eth\
Access control slither . --detect suicidal\
Unchecked blocks grep -rn unchecked contracts/\
Oracle usage Search for getReserves\ calls
All detectors slither . --detect all\

The most effective defense combines automated scanning on every commit, formal verification for critical functions, and manual audit before mainnet.

If you are looking for automated security scanning for your codebase, check out our free security audit API — 10 free scans per month, returns structured vulnerability reports with severity and remediation guidance.