Skip to content
SkillModel-led3,520 tokens in use

TON Vulnerability Scanner

Scans TON FunC smart contracts for three platform-specific flaws: integer used as boolean, fake Jetton notifications, and forwarding TON without a gas check.

8,319 stars on the repository CC-BY-SA-4.0trailofbits/skills · plugins/building-secure-contracts/skills/ton-vulnerability-scanner
/plugin marketplace add trailofbits/skills
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing TON Vulnerability Scanner costs

50tokens idle
3,520tokens in use
8,369tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Model-led

Script-ledMixedModel-led

Mostly instructions, so how well it works depends on the model that follows them.

This describes the skill's structure, how much of it is scripts. It does not say how well it works.

Touches

shelldetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Excellent
  • Frontmatter12/15
  • Structure23/25
  • Examples12/15
  • Output15/15
  • Size15/15
  • Resources7/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent
  • Runs shell commands−5

    does this on the machine, and the frontmatter does not say so

    SKILL.md, line 122

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance52
  • Community64
  • Maturity32
  • Momentum40

TON Vulnerability Scanner is a Trail of Bits agent skill for auditing FunC contracts on The Open Network. It looks for three patterns that come from TON’s design: positive integers used as booleans when FunC’s true is -1, transfer_notification handlers that never check the sender is the stored Jetton wallet, and outgoing messages that forward TON without reserving gas.

The agent searches the codebase with ripgrep, walks a checklist per pattern, and writes a report that opens with a coverage table giving every pattern a verdict of found, clear or n/a, followed by findings with file and line references and a fix for each.

What You Get

  • A coverage table with a found, clear or n/a verdict and evidence for each of the three patterns
  • Findings with severity, file and line, vulnerable code, attack scenario and a suggested fix
  • Checklists for boolean handling, Jetton handlers and forward amounts that you can repeat by hand
  • A pattern reference file with code examples, mitigations and testing strategies

Common Use Cases

  • Reviewing a Jetton staking or vault contract before launch
  • Auditing transfer_notification handlers for missing sender validation
  • Checking that forward_ton_amount values are bounded and cannot drain the contract balance
  • Looking for FunC boolean logic that returns 1 where FunC expects -1

What Makes It Unique

Most smart contract scanners target Solidity. This skill covers FunC and TON message semantics, and it requires a verdict for every pattern, so a report that is silent on two of three patterns cannot pass for a clean contract. Its own text says tooling for TON is limited and manual review stays central.

Under The Hood

The skill is a single instruction file with a pattern reference and a sub-agent definition. When used, the agent runs read-only ripgrep searches over your contracts folder for boolean-like variables, transfer_notification handlers, forward amounts and send_raw_message calls, reads the matching files, and writes its report in chat. It does not fetch web pages, call APIs or write files in the examples it gives, and it does not compile or run your contracts.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers