solidity-security-scanner
v1.0.1
Published
CLI tool that scans Solidity contracts for common vulnerabilities. Reentrancy, overflow, access control, gas optimization.
Maintainers
Readme
solidity-security-scanner
CLI tool that scans Solidity smart contracts for common vulnerabilities. Zero external dependencies -- pure regex-based static analysis.
Install & Usage
Scan a single file:
npx solidity-security-scanner ./src/MyContract.solScan a directory (recursively finds all .sol files):
npx sol-scan ./src/Output as JSON:
npx sol-scan ./src/ --jsonWhat It Scans
15 vulnerability patterns across 5 severity levels:
Critical
- Reentrancy -- External calls (
.call{,.transfer(,.send() before state changes - Unchecked call --
.call{without checking the return value - tx.origin -- Use of
tx.originfor authorization
High
- Delegatecall -- Use of
delegatecall(dangerous if target is user-controlled) - Selfdestruct -- Use of
selfdestruct(can be weaponized) - Arbitrary send --
.call{value:with potentially user-controlled destination - Unprotected function -- Public/external state-changing functions without access control
Medium
- Floating pragma --
pragma solidity ^instead of fixed version - Missing zero check -- Constructor or setter without
address(0)validation - Timestamp dependence -- Use of
block.timestampin comparisons - Unsafe ERC20 -- Direct
.transfer()or.transferFrom()on IERC20 without SafeERC20
Low
- Missing events -- State-changing functions without
emitstatements - Gas in loop -- External calls inside for/while loops
- Magic numbers -- Hardcoded numbers that should be named constants
Info
- Missing NatSpec -- Functions without
///or/**documentation comments
Output
Terminal output with colored severity levels:
Scanning MyContract.sol...
[CRITICAL] Reentrancy vulnerability (line 42)
External call before state update: .call{value: amount}
[HIGH] Unprotected function (line 78)
Public function modifyBalance() has no access control
Summary: 1 critical, 1 high, 3 medium, 2 low, 0 infoNo External Dependencies
Pure Node.js with regex-based pattern matching. No AST parser needed, no native modules, installs in seconds.
License
MIT
Built by THRYXAGI
