Reconnaissance is the first phase of any penetration test. In Web3, the transparent nature of public blockchains gives us extraordinary visibility — every transaction, every contract interaction, every token transfer is permanently recorded. This module teaches you how to systematically extract intelligence from on-chain and off-chain sources before touching a single line of Solidity.
2.1 On-Chain OSINT
Etherscan Deep Dive
Etherscan is far more than a block explorer. For a pentester, it’s the primary intelligence platform.
Trace back to deployer wallet, find related contracts
Similar contracts
“Contract Diff” feature
Compare against known-vulnerable versions
1
2
3
4
5
6
7
8
9
10
11
# Using Etherscan API for automated reconexport ETHERSCAN_API_KEY="YOUR_KEY"# Get contract source code
curl "https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0xCONTRACT&apikey=$ETHERSCAN_API_KEY"# Get all transactions for an address
curl "https://api.etherscan.io/api?module=account&action=txlist&address=0xADDRESS&startblock=0&endblock=99999999&sort=asc&apikey=$ETHERSCAN_API_KEY"# Get contract ABI
curl "https://api.etherscan.io/api?module=contract&action=getabi&address=0xCONTRACT&apikey=$ETHERSCAN_API_KEY"
Tenderly — Transaction Debugging
Tenderly provides step-by-step transaction execution traces, including state changes, gas usage per opcode, and call stack visualization.
Key features for recon:
Transaction Simulator — Simulate transactions against live or forked state
State Diff — See exactly which storage slots changed and their before/after values
Call Trace — Visual call graph showing all internal calls, delegatecalls, and external calls
Gas Profiler — Identify gas-heavy operations (potential DoS vectors)
1
2
3
4
5
# Tenderly CLI — export project for simulation
tenderly export--project YOUR_PROJECT 0xTransactionHash
# Fork a network state at a specific block
tenderly fork --network mainnet --block-number 18500000
Dune Analytics — Custom On-Chain Queries
Dune lets you write SQL queries against decoded blockchain data. For auditors, this is invaluable for:
-- Find all admin function calls on a contractSELECTblock_time,tx_hash,"from"AScaller,function_nameFROMethereum.decoded_contractsWHEREcontract_address=0xTARGETANDfunction_nameIN('setOwner','transferOwnership','pause','upgradeTo')ORDERBYblock_timeDESCLIMIT100;-- Track token distribution concentrationSELECT"to"ASholder,SUM(value)/1e18ASbalanceFROMerc20_ethereum.evt_TransferWHEREcontract_address=0xTOKEN_ADDRESSGROUPBY"to"ORDERBYbalanceDESCLIMIT50;
Phalcon (BlockSec) — Attack Transaction Analysis
Phalcon specializes in dissecting exploit transactions. When analyzing a hack:
Phalcon shows the invocation flow — every call, with decoded function names, arguments, and return values
Balance changes — which addresses gained/lost which tokens
Fund flow — visual diagram of token movements
Practical Tip: When studying past exploits for CTF preparation or research, Phalcon is faster than reading Tenderly traces because it pre-labels known contracts and protocols.
2.2 Contract Verification Analysis
Verified vs. Unverified Contracts
Aspect
Verified
Unverified
Source code
Available on Etherscan
Only bytecode
Audit ability
Full Solidity review
Must decompile
Trust level
Higher (but compiler bugs exist)
Suspicious by default
Analysis tools
Slither, Mythril, manual review
Heimdall-rs, Dedaub, EtherVM
Analyzing Unverified Contracts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Step 1: Get the bytecode
cast code 0xUnverifiedContract --rpc-url$ETH_RPC# Step 2: Try Dedaub online decompiler# Upload bytecode at https://app.dedaub.com/decompile# Step 3: Use heimdall-rs for advanced decompilation
heimdall decompile 0xUnverifiedContract --rpc-url$ETH_RPC--output ./decompiled/
# Step 4: Look for known selectors
heimdall decode 0xUnverifiedContract --rpc-url$ETH_RPC# Step 5: Check Sourcify for partial verification
curl "https://sourcify.dev/server/check-all-by-addresses?addresses=0xCONTRACT&chainIds=1"
Compiler Version Analysis
1
2
3
4
5
6
7
# Extract compiler version from metadata
cast code 0xContract | tail-c 86
# Last bytes contain CBOR-encoded metadata including Solidity version# Check for known compiler bugs# https://docs.soliditylang.org/en/latest/bugs.html# Critical: Solidity 0.8.13-0.8.15 had optimizer bugs affecting ABI encoding
2.3 Proxy Pattern Detection
Identifying proxy patterns is critical — the code you see on Etherscan might not be the code actually executing.
# Clone the repository
git clone https://github.com/protocol/contracts
# Check for audit reports
find .-name"*.pdf"-o-name"*audit*"-o-name"*security*" | head-20# Look for TODO/FIXME/HACK comments — often mark incomplete security measuresgrep-rn"TODO\|FIXME\|HACK\|XXX\|BUG\|SECURITY\|VULNERABLE" contracts/ --include="*.sol"# Review recent changes to critical files
git log --oneline-20 contracts/core/
# Check for changes since last audit
git log --since="2024-01-01"--oneline contracts/
# Diff between audited commit and current deployment
git diff AUDITED_COMMIT..HEAD -- contracts/
# Find large recent commits (potential feature additions not yet audited)
git log --since="2024-06-01"--stat--diff-filter=M --"*.sol" | head-100
Audit History Analysis
Checkpoint
What to Look For
Audit report findings
Were all findings addressed? Check the fix commits
Time since audit
Code deployed long after audit may have unaudited changes
Scope coverage
Was the full codebase audited, or only specific contracts?
Known limitations
Auditors often list “out of scope” assumptions
Multiple audits
Consensus across auditors increases confidence
2.8 Token Distribution & Whale Analysis
Why It Matters
Token distribution affects governance security, liquidity depth, and rug pull risk.
1
2
3
4
5
6
7
8
9
10
# Using Etherscan Token Holder page# https://etherscan.io/token/0xTOKEN#balances# Top holder concentration# If top 10 holders control >50% of supply → governance/dump risk# Check if team tokens are locked# Look for vesting contracts in top holders
cast call 0xVestingContract "beneficiary()(address)"
cast call 0xVestingContract "releaseTime()(uint256)"
Red Flags in Token Distribution
Signal
Risk
Single address holds >20%
Centralization / dump risk
Unlocked team tokens > circulating supply
Potential rug pull
Large tokens in exchange hot wallets
Imminent sell pressure
Recent large transfers to new wallets
Possible pre-dump distribution
No liquidity locks
LP can be pulled at any time
2.9 Social Engineering Vectors in Web3
Attack Surfaces Specific to Web3
Vector
Description
Example
Discord compromise
Hijacked admin accounts post phishing links
Bored Ape Yacht Club Discord hack
Fake governance proposals
Malicious proposals disguised as benign
Beanstalk governance attack
Compromised npm packages
Malicious dependencies in project repos
event-stream supply chain attack
Fake verified contracts
Uploading misleading source code to Etherscan
Honeypot tokens
Impersonation
Fake team members in Telegram/Discord
Social engineering validator keys
Phishing dApps
Cloning legitimate frontends
Fake Uniswap sites
DNS hijacking
Redirecting protocol domains to malicious dApps
Curve Finance DNS hijack
Recon on Social Channels
Monitor Discord announcement channels for sudden permission changes
Track Telegram group admin additions/removals
Watch governance forums for unusual proposal activity
Monitor Twitter/X for compromised team accounts
2.10 Subgraph Analysis (The Graph Protocol)
Querying Subgraphs for Recon
The Graph indexes blockchain data into queryable subgraphs. Many DeFi protocols expose their state via subgraphs.
# Query a Uniswap V3 subgraph for large swaps (potential whale activity){swaps(first:10,orderBy:amountUSD,orderDirection:desc,where:{pool:"0xPoolAddress"}){idtimestampamountUSDsenderrecipientamount0amount1}}# Query governance proposals{proposals(first:10,orderBy:startBlock,orderDirection:desc){idproposerdescriptionforVotesagainstVotesstatus}}
Subgraph recon targets:
Large recent transactions (whale activity, potential attack setup)
Social channels — Discord/Telegram admin security, governance activity?
Transaction patterns — Any suspicious recent activity?
Key Takeaway: In Web3 pentesting, recon is disproportionately valuable compared to traditional web pentesting. Because blockchains are public, you can often identify vulnerabilities entirely through on-chain analysis before reading a single line of source code. Develop the habit of doing thorough recon — it saves hours of manual code review and often reveals attack vectors that pure code auditing misses.