0x-shashi/web3-audit-skills/ton-scanner

Claude Code and agent skill by 0x-shashi/web3-audit-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when the user wants to audit TON smart contracts for security vulnerabilities, scan FunC or Tact contracts for message chain replay, bounce handling, or gas issues, review TON DeFi protocols for actor-model concurrency flaws, or analyze asynchronous message passing security.

Install

npx vskill@latest install 0x-shashi/web3-audit-skills/ton-scanner

SKILL.md

The same SKILL.md was published earlier as 0x-shashi/web3-audit-skills/ton-scanner.

TON Scanner Skill

Purpose

Analyze TON (The Open Network) smart contracts written in FunC or Tact for security vulnerabilities. TON's actor-model architecture, asynchronous message passing, and TVM (TON Virtual Machine) create a fundamentally different security model from EVM-based chains.

TON Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│ TON Network │
│ │
│ ┌──────────────┐ async messages ┌──────────────┐ │
│ │ Contract A │ ──────────────────► │ Contract B │ │
│ │ (Shard 1) │ ◄────────────────── │ (Shard 2) │ │
│ │ │ bounce/reply │ │ │
│ │ FunC / Tact │ │ FunC / Tact │ │
│ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Storage │ │ Storage │ │
│ │ (Cells/BoC) │ │ (Cells/BoC) │ │
│ │ pays rent │ │ pays rent │ │
│ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────┘
Key Differences from EVM
AspectEVM (Solidity)TON (FunC/Tact)
Execution ModelSynchronous, atomicAsynchronous, actor-based messages
Cross-Contract CallsAtomic within transactionNon-atomic, separate transactions
Storage CostOne-time gasOngoing rent (storage fees)
Data StructureKey-value mappingCell trees (max 1023 bits, 4 refs)
ReentrancyWithin same transactionNot possible (async messages)
Failure HandlingRevert entire txBounce messages, partial failure
LanguagesSolidity, VyperFunC (low-level), Tact (high-level)
Address Format20-byte, single chainWorkchain ID + 256-bit hash
Languages
LanguageLevelUsageSecurity Characteristics
FunCLow-levelCore contracts, jettons, NFTsDirect TVM access, manual cell serialization, easy to misuse
TactHigh-levelModern contractsType-safe, auto-serialization, safer defaults but newer
FiftAssembly-levelDeployment scriptsDirect TVM opcodes, used for contract deployment

Detection Capabilities

Critical Vulnerabilities
  • Message chain gas exhaustion: Multi-hop messages run out of gas before completing all operations
  • Missing bounce handling: Bounced messages not processed → permanent fund loss
  • Unbounded storage growth: Attacker-controlled data storage drains contract balance via rent
  • Missing replay protection: Same message processed multiple times
High Vulnerabilities
  • Carry-value attacks: Incoming message value used to fund outgoing messages without accounting
  • Cell overflow/underflow: Exceeding 1023-bit or 4-reference cell limits during serialization
  • Workchain ID confusion: Not validating workchain in address leads to cross-chain issues
  • Incorrect message mode flags: Wrong send mode causes unintended gas forwarding or balance drain
Medium Vulnerabilities
  • Storage fee drain: Contract balance slowly depleted by rent payments on stored data
  • Sharded message ordering: Assuming message order across shards causes race conditions
  • Tick-tock contract abuse: Automatic execution contracts with expensive operations
  • Missing `accept_message()` in external handlers: External messages silently dropped without gas acceptance

Real-World TON Incidents

IncidentVulnerabilityImpact
Early Jetton implementationsMissing bounce handlingToken loss on failed transfers
DNS auction contractsGas exhaustion in multi-message chainsAuctions stuck irrecoverably
Various NFT marketplacesReplay attacks (no seqno)Duplicate sales/purchases
Storage-based attacksUnbounded storage growthContract balance drained by rent

Resources

Related Scanners

Error Code Reference

Common TON/FunC error codes encountered during audits. TON uses numeric exit codes in throw() / throw_if() / throw_unless() statements.

Standard TVM Exit Codes
Exit CodeNameMeaning
0SuccessNormal successful execution
2Stack underflowToo few arguments on the stack — FunC function signature mismatch
3Stack overflowStack exceeded limits
4Integer overflowInteger does not fit into 257-bit signed range
5Integer out of rangeValue outside expected range for operation
6Invalid opcodeUnknown TVM instruction — possible code corruption
7Type check errorWrong type on stack — e.g., expected cell, got integer
8Cell overflowCell data exceeds 1023 bits or 4 references
9Cell underflowAttempted to read more data than cell contains
10Dictionary errorInvalid dictionary (hashmap) operation
11Unknown errorGeneral "most common" error
13Out of gasComputation exceeded gas limit
-14Out of gas (credit)Gas credit depleted before accept_message()
Common Application Exit Codes (Convention)
Exit Code RangeConventionMeaning
30-39Auth errorsUnauthorized sender (throw_unless(33, ...))
40-49State errorsInvalid contract state for operation
50-59Balance errorsInsufficient balance for operation
60-69Validation errorsInvalid input parameters
100-199Jetton StandardJetton (token) specific errors
200-299NFT StandardNFT specific errors
300-399DEX errorsLiquidity pool / AMM errors
400+Application-specificCustom application logic errors
Jetton Standard Error Codes
Exit CodeMeaning
73Insufficient jetton balance for transfer
74Not enough TON for gas fees attached to transfer
75Invalid sender — not the jetton wallet owner
76Discovery: unknown jetton wallet

Troubleshooting

IssueLikely CauseSolution
Bounce handler vulnerabilities missedScanner doesn't analyze bounced<> message handlersAudit all recv_internal branches that handle bounced messages — check for state rollback correctness
Message chain replay not detectedScanner analyzes single messages, not chainsTrace full message chains: initial message → internal messages → bounces; check seqno/query_id uniqueness
Gas estimation issues not flaggedScanner doesn't model TON gas economicsFlag messages without accept_message() or with insufficient gas forwarding via msg_value
Actor model concurrency bugs missedScanner uses synchronous mental modelMap all async message flows; check for time-of-check/time-of-use between separate messages
FunC vs Tact pattern mismatchScanner patterns written for FunC, code is in TactVerify Tact's auto-generated FunC output; Tact handles some safety checks automatically
Storage fee drain not caughtScanner doesn't model TON storage costsCheck that contracts handle storage_fee deductions; verify minimum balance maintenance

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
62
Repository forks
10
7-day trend score
19

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 8 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/0x-shashi/web3-audit-skills/ton-scanner/badge)](https://verified-skill.com/skills/0x-shashi/web3-audit-skills/ton-scanner)

Something wrong with this skill or its page? Tell us.