# ton-vulnerability-scanner

ton-vulnerability-scanner scans TON smart contracts (FunC) for three critical vulnerabilities: integer-as-boolean misuse, fake Jetton contracts, and forwarding TON without gas checks.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 5700 installs · ★ 8341 repo stars
- Author: trailofbits
- License: CC-BY-SA-4.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/trailofbits/skills/tree/HEAD/plugins/building-secure-contracts/skills/ton-vulnerability-scanner/SKILL.md
- Updated: 2026-10-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/ton-vulnerability-scanner

## What it does

The skill detects three vulnerability types in TON contracts. First: treating positive integers as booleans — FunC true is -1, not 1, and confusion breaks conditional logic. Second: missing sender validation in `transfer_notification` handlers — without checking that the sender matches the trusted Jetton wallet address, an attacker can forge token transfer notifications. Third: forwarding user-supplied `forward_ton_amount` values without balance checks — the contract can be drained.

The skill scans `.fc` and `.func` files, outputs a coverage table for all three patterns (found, verified, or not applicable), and provides detailed reports for each finding with line numbers. Without `ton-compiler` and `toncli` installed, it will not run. Reports include specific fixes for each vulnerability.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill ton-vulnerability-scanner -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/ton-vulnerability-scanner/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/ton-vulnerability-scanner/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill ton-vulnerability-scanner -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/ton-vulnerability-scanner/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill ton-vulnerability-scanner -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/ton-vulnerability-scanner/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install trailofbits/skills plugins/building-secure-contracts/skills/ton-vulnerability-scanner
```

2. **Manually: put the files in place**
- File: `.github/skills/ton-vulnerability-scanner/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill ton-vulnerability-scanner -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/trailofbits/skills --path plugins/building-secure-contracts/skills/ton-vulnerability-scanner
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/ton-vulnerability-scanner/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill ton-vulnerability-scanner -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/trailofbits/skills/tree/HEAD/plugins/building-secure-contracts/skills/ton-vulnerability-scanner/SKILL.md

## When to use it
- detect use of 1 instead of -1 in FunC boolean flags
- verify sender validation in Jetton transfer_notification handlers
- identify user-supplied TON forwarding without balance limits
- run pre-launch security audit on a TON contract

## Example prompts
- Check contracts in `contracts/` for TON vulnerabilities
- Run ton-vulnerability-scanner on all `.fc` files in the project
- Scan Jetton handlers for missing sender validation

## Similar
- [TONNode — TON blockchain access](https://affpapa.org/en/nevibecode/mcp/tonnode-ton-blockchain-access.md) — MCP server · ★ 17 repo stars
- [vulnerability-scanner](https://affpapa.org/en/nevibecode/skills/vulnerability-scanner.md) — skill · 1300 installs
- [goplus-security-token-scanner](https://affpapa.org/en/nevibecode/skills/goplus-security-token-scanner.md) — skill · 235 installs
- [solana-dev](https://affpapa.org/en/nevibecode/skills/solana-dev.md) — skill · 112300 installs
- [solidity-security](https://affpapa.org/en/nevibecode/skills/solidity-security.md) — skill · 15382 installs
- [vulnerability-csv-reporting](https://affpapa.org/en/nevibecode/skills/vulnerability-csv-reporting.md) — skill · 1 install

From the same set: [trailofbits/skills](https://affpapa.org/en/nevibecode/by/trailofbits/skills.md) — 95 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
