Creator · trailofbits
Last updated · Sep 1, 2026
Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts.
Creator · trailofbits
Last updated · Sep 1, 2026
Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts.
Creator · trailofbits
Last updated · Sep 1, 2026
Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts.
Creator · trailofbits
Last updated · Sep 1, 2026
Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts.
Sandbox only
Install targets
Codex install prompt
Install the "ton-vulnerability-scanner" agent skill from https://github.com/trailofbits/skills/tree/main/plugins/building-secure-contracts/skills/ton-vulnerability-scanner. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"trailofbits-ton-vulnerability-scanner","task":"Install ton-vulnerability-scanner","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Maintenance
fresh
13d since push
Risk
Risky
Dependency or permission surface needs review
GitHub quality
6.8K
85/100 Quality · 72/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
ExcellentHigh-confidence pick with strong adoption and healthy maintenance signals.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
RiskyA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
6.8K GitHub stars
Repo activity
6.8K stars, 586 forks
Maintenance
13d since push
License
CC-BY-SA-4.0
Install
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add trailofbits/skills --skill ton-vulnerability-scannerDo not use when
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
Agent should check
Copy prompt
Task: Use ton-vulnerability-scanner in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install
Install command: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
LLM text format
/api/skills/trailofbits-ton-vulnerability-scanner/install?format=text
Find alternatives
/api/skills/search?q=ton-vulnerability-scanner&limit=3
Agent prompt
Use ton-vulnerability-scanner for this task. Review https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install, then install with: npx skills add trailofbits/skills --skill ton-vulnerability-scannerRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/trailofbits-ton-vulnerability-scanner
LLM text
/api/registry/manifest/trailofbits-ton-vulnerability-scanner?format=text
Install alias
/api/registry/install/trailofbits-ton-vulnerability-scanner
Recommend
/api/registry/recommend?task=Use%20ton-vulnerability-scanner%20in%20an%20agent%20workflow&limit=3
Agent fit
GitHub automation
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Use this as a leading candidate, then validate the README and install path in your own agent stack.
Role in stack
Primary pick
Primary fit
GitHub automation
Trust label
Production-ready
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
PASS6.8K GitHub stars
Stars/forks activity
PASS6.8K stars, 586 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSCC-BY-SA-4.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
High-confidence pick with strong adoption and healthy maintenance signals.
Workflow fit
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Build and ship code
I need a coding agent that can understand a repository, edit code, and review pull requests.
Workflow fit
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Alternative shortlist
Similar skills that may fit this task.
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
Infisical is the open-source platform for secrets, certificates, and privileged access management.
--- name: ton-vulnerability-scanner description: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. ---
# TON Vulnerability Scanner
## 1. Purpose
Systematically scan TON blockchain smart contracts written in FunC for platform-specific security vulnerabilities related to boolean logic, Jetton token handling, and gas management. This skill encodes 3 critical vulnerability patterns unique to TON's architecture.
## 2. When to Use This Skill
- Auditing TON smart contracts (FunC language) - Reviewing Jetton token implementations - Validating token transfer notification handlers - Pre-launch security assessment of TON dApps - Reviewing gas forwarding logic - Assessing boolean condition handling
## 3. Platform Detection
### File Extensions & Indicators - **FunC files**: `.fc`, `.func`
### Language/Framework Markers ```func ;; FunC contract indicators #include "imports/stdlib.fc";
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { ;; Contract logic }
() recv_external(slice in_msg) impure { ;; External message handler }
;; Common patterns send_raw_message() load_uint(), load_msg_addr(), load_coins() begin_cell(), end_cell(), store_*() transfer_notification operation op::transfer, op::transfer_notification .store_uint().store_slice().store_coins() ```
### Project Structure - `contracts/*.fc` - FunC contract source - `wrappers/*.ts` - TypeScript wrappers - `tests/*.spec.ts` - Contract tests - `ton.config.ts` or `wasm.config.ts` - TON project config
### Tool Support - **TON Blueprint**: Development framework for TON - **toncli**: CLI tool for TON contracts - **ton-compiler**: FunC compiler - Manual review primarily (limited automated tools)
---
## 4. How This Skill Works
When invoked, I will:
1. **Search your codebase** for FunC/Tact contracts 2. **Analyze each contract** for the 3 vulnerability patterns 3. **Report findings** with file references and severity 4. **Provide fixes** for each identified issue 5. **Check replay protection** and sender validation
---
## 5. Example Output
When vulnerabilities are found, you'll get a report like this:
``` === TON VULNERABILITY SCAN RESULTS ===
Project: my-ton-contract Files Scanned: 3 (.fc, .tact) Vulnerabilities Found: 2
---
[CRITICAL] Missing Replay Protection File: contracts/wallet.fc:45 Pattern: No sequence number or nonce validation ```
---
## 6. Vulnerability Patterns (3 Patterns)
I check for 3 critical vulnerability patterns unique to TON. For detailed detection patterns, code examples, mitigations, and testing strategies, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
### Pattern Summary:
1. **Missing Sender Check** ⚠️ CRITICAL - No sender validation on privileged operations 2. **Integer Overflow** ⚠️ CRITICAL - Unchecked arithmetic in FunC 3. **Improper Gas Handling** ⚠️ HIGH - Insufficient gas reservations
For complete vulnerability patterns with code examples, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
## 7. Scanning Workflow
### Step 1: Platform Identification 1. Verify FunC language (`.fc` or `.func` files) 2. Check for TON Blueprint or toncli project structure 3. Locate contract source files 4. Identify Jetton-related contracts
### Step 2: Boolean Logic Review ```bash # Find boolean-like variables rg "int.*is_|int.*has_|int.*flag|int.*enabled" contracts/
# Check for positive integers used as booleans rg "= 1;|return 1;" contracts/ | grep -E "is_|has_|flag|enabled|valid"
# Look for NOT operations on boolean-like values rg "~.*\(|~ " contracts/ ```
For each boolean: - [ ] Uses -1 for true, 0 for false - [ ] NOT using 1 or other positive integers - [ ] Logic operations work correctly
### Step 3: Jetton Handler Analysis ```bash # Find transfer_notification handlers rg "transfer_notification|op::transfer_notification" contracts/ ```
For each Jetton handler: - [ ] Validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Cannot trust forward_payload without sender validation - [ ] Has admin function to set Jetton wallet address
### Step 4: Gas/Forward Amount Review ```bash # Find forward amount usage rg "forward_ton_amount|forward_amount" contracts/ rg "load_coins\(\)" contracts/
# Find send_raw_message calls rg "send_raw_message" contracts/ ```
For each outgoing message: - [ ] Forward amounts are fixed/bounded - [ ] OR user-provided amounts validated against msg_value - [ ] Cannot drain contract balance - [ ] Appropriate send_raw_message flags used
### Step 5: Manual Review TON contracts require thorough manual review: - Boolean logic with `~`, `&`, `|` operators - Message parsing and validation - Gas economics and fee calculations - Storage operations and data serialization
---
## 8. Reporting Format
### Finding Template ````markdown ## [CRITICAL] Fake Jetton Contract - Missing Sender Validation
**Location**: `contracts/staking.fc:85-95` (recv_internal, transfer_notification handler)
**Description**: The `transfer_notification` operation handler does not validate that the sender is the expected Jetton wallet contract. Any attacker can send a fake `transfer_notification` message claiming to have transferred tokens, crediting themselves without actually depositing any Jettons.
**Vulnerable Code**: ```func // staking.fc, line 85 if (op == op::transfer_notification) { int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; WRONG: No validation of sender_address! ;; Attacker can claim any jetton_amount
credit_user(from_user, jetton_amount); } ```
**Attack Scenario**: 1. Attacker deploys malicious contract 2. Malicious contract sends `transfer_notification` message to staking contract 3. Message claims attacker transferred 1,000,000 Jettons 4. Staking contract credits attacker without checking sender 5. Attacker can now withdraw from contract or gain benefits without depositing
**Proof of Concept**: ```typescript // Attacker sends fake transfer_notification const attackerContract = await blockchain.treasury("attacker");
await stakingContract.sendInternalMessage(attackerContract.getSender(), { op: OP_CODES.TRANSFER_NOTIFICATION, jettonAmount: toNano("1000000"), // Fake amount fromUser: attackerContract.address, });
// Attacker successfully credited without sending real Jettons const balance = await stakingContract.getUserBalance(attackerContract.address); expect(balance).toEqual(toNano("1000000")); // Attack succeeded ```
**Recommendation**: Store expected Jetton wallet address and validate sender: ```func global slice jetton_wallet_address;
() recv_internal(...) impure { load_data(); ;; Load jetton_wallet_address from storage
slice cs = in_msg_full.begin_parse(); int flags = cs~load_uint(4); slice sender_address = cs~load_msg_addr();
int op = in_msg_body~load_uint(32);
if (op == op::transfer_notification) { ;; CRITICAL: Validate sender throw_unless(error::wrong_jetton_wallet, equal_slices(sender_address, jetton_wallet_address));
int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; Safe to credit user credit_user(from_user, jetton_amount); } } ```
**References**: - building-secure-contracts/not-so-smart-contracts/ton/fake_jetton_contract ````
---
## 9. Priority Guidelines
### Critical (Immediate Fix Required) - Fake Jetton contract (unauthorized minting/crediting)
### High (Fix Before Launch) - Integer as boolean (logic errors, broken conditions) - Forward TON without gas check (balance drainage)
---
## 10. Testing Recommendations
### Unit Tests ```typescript import { Blockchain } from "@ton/sandbox"; import { toNano } from "ton-core";
describe("Security tests", () => { let blockchain: Blockchain; let contract: Contract;
beforeEach(async () => { blockchain = await Blockchain.create(); contract = blockchain.openContract(await Contract.fromInit()); });
it("should use correct boolean values", async () => { // Test that TRUE = -1, FALSE = 0 const result = await contract.getFlag(); expect(result).toEqual(-1n); // True expect(result).not.toEqual(1n); // Not 1! });
it("should reject fake jetton transfer", async () => { const attacker = await blockchain.treasury("attacker");
const result = await contract.send( attacker.getSender(), { value: toNano("0.05") }, { $$type: "TransferNotification", query_id: 0n, amount: toNano("1000"), from: attacker.address, } );
expect(result.transactions).toHaveTransaction({ success: false, // Should reject }); });
it("should validate gas for forward amount", async () => { const result = await contract.send( user.getSender(), { value: toNano("0.01") }, // Insufficient gas { $$type: "Transfer", to: recipient.address, forward_ton_amount: toNano("1"), // Trying to forward 1 TON } );
expect(result.transactions).toHaveTransaction({ success: false, }); }); }); ```
### Integration Tests ```typescript // Test with real Jetton wallet it("should accept transfer from real jetton wallet", async () => { // Deploy actual Jetton minter and wallet const jettonMinter = await blockchain.openContract(JettonMinter.create()); const userJettonWallet = await jettonMinter.getWalletAddress(user.address);
// Set jetton wallet in contract await contract.setJettonWallet(userJettonWallet);
// Real transfer from Jetton wallet const result = await userJettonWallet.sendTransfer( user.getSender(), contract.address, toNano("100"), {} );
expect(result.transactions).toHaveTransaction({ to: contract.address, success: true, }); }); ```
---
## 11. Additional Resources
- **Building Secure Contracts**: `building-secure-contracts/not-so-smart-contracts/ton/` - **TON Documentation**: https://docs.ton.org/ - **FunC Documentation**: https://docs.ton.org/develop/func/overview - **TON Blueprint**: https://github.com/ton-org/blueprint - **Jetton Standard**: https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md
---
## 12. Quick Reference Checklist
Before completing TON contract audit:
**Boolean Logic (HIGH)**: - [ ] All boolean values use -1 (true) and 0 (false) - [ ] NO positive integers (1, 2, etc.) used as booleans - [ ] Functions returning booleans return -1 for true - [ ] Boolean logic with `~`, `&`, `|` uses correct values - [ ] Tests verify boolean operations work correctly
**Jetton Security (CRITICAL)**: - [ ] `transfer_notification` handler validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Jetton wallet address stored during initialization - [ ] Admin function to set/update Jetton wallet - [ ] Cannot trust forward_payload without sender validation - [ ] Tests with fake Jetton contracts verify rejection
**Gas & Forward Amounts (HIGH)**: - [ ] Forward TON amounts are fixed/bounded - [ ] OR user-provided amounts validated: `msg_value >= tx_fee + forward_amount` - [ ] Contract balance protected from drainage - [ ] Appropriate `send_raw_message` flags used - [ ] Tests verify cannot drain contract with excessive forward amounts
**Testing**: - [ ] Unit tests for all three vulnerability types - [ ] Integration tests with real Jetton contracts - [ ] Gas cost analysis for all operations - [ ] Testnet deployment before mainnet
Decision snapshot
6,844 GitHub stars
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for ton-vulnerability-scanner, ready for a manual X post.
ton-vulnerability-scanner: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer... 6.8K stars https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x
Listing + install path for ton-vulnerability-scanner: https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x Install: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to trailofbits but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner/audit)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)trailofbits
@trailofbits
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Wazuh
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
16.3K StarsMaigret
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
32.9K StarsNuclei
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
29.2K StarsInfisical
Infisical is the open-source platform for secrets, certificates, and privileged access management.
27.4K StarsSandbox only
Install targets
Codex install prompt
Install the "ton-vulnerability-scanner" agent skill from https://github.com/trailofbits/skills/tree/main/plugins/building-secure-contracts/skills/ton-vulnerability-scanner. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"trailofbits-ton-vulnerability-scanner","task":"Install ton-vulnerability-scanner","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Maintenance
fresh
13d since push
Risk
Risky
Dependency or permission surface needs review
GitHub quality
6.8K
85/100 Quality · 72/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
ExcellentHigh-confidence pick with strong adoption and healthy maintenance signals.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
RiskyA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
6.8K GitHub stars
Repo activity
6.8K stars, 586 forks
Maintenance
13d since push
License
CC-BY-SA-4.0
Install
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add trailofbits/skills --skill ton-vulnerability-scannerDo not use when
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
Agent should check
Copy prompt
Task: Use ton-vulnerability-scanner in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install
Install command: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
LLM text format
/api/skills/trailofbits-ton-vulnerability-scanner/install?format=text
Find alternatives
/api/skills/search?q=ton-vulnerability-scanner&limit=3
Agent prompt
Use ton-vulnerability-scanner for this task. Review https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install, then install with: npx skills add trailofbits/skills --skill ton-vulnerability-scannerRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/trailofbits-ton-vulnerability-scanner
LLM text
/api/registry/manifest/trailofbits-ton-vulnerability-scanner?format=text
Install alias
/api/registry/install/trailofbits-ton-vulnerability-scanner
Recommend
/api/registry/recommend?task=Use%20ton-vulnerability-scanner%20in%20an%20agent%20workflow&limit=3
Agent fit
GitHub automation
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Use this as a leading candidate, then validate the README and install path in your own agent stack.
Role in stack
Primary pick
Primary fit
GitHub automation
Trust label
Production-ready
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
PASS6.8K GitHub stars
Stars/forks activity
PASS6.8K stars, 586 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSCC-BY-SA-4.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
High-confidence pick with strong adoption and healthy maintenance signals.
Workflow fit
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Build and ship code
I need a coding agent that can understand a repository, edit code, and review pull requests.
Workflow fit
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Alternative shortlist
Similar skills that may fit this task.
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
Infisical is the open-source platform for secrets, certificates, and privileged access management.
--- name: ton-vulnerability-scanner description: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. ---
# TON Vulnerability Scanner
## 1. Purpose
Systematically scan TON blockchain smart contracts written in FunC for platform-specific security vulnerabilities related to boolean logic, Jetton token handling, and gas management. This skill encodes 3 critical vulnerability patterns unique to TON's architecture.
## 2. When to Use This Skill
- Auditing TON smart contracts (FunC language) - Reviewing Jetton token implementations - Validating token transfer notification handlers - Pre-launch security assessment of TON dApps - Reviewing gas forwarding logic - Assessing boolean condition handling
## 3. Platform Detection
### File Extensions & Indicators - **FunC files**: `.fc`, `.func`
### Language/Framework Markers ```func ;; FunC contract indicators #include "imports/stdlib.fc";
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { ;; Contract logic }
() recv_external(slice in_msg) impure { ;; External message handler }
;; Common patterns send_raw_message() load_uint(), load_msg_addr(), load_coins() begin_cell(), end_cell(), store_*() transfer_notification operation op::transfer, op::transfer_notification .store_uint().store_slice().store_coins() ```
### Project Structure - `contracts/*.fc` - FunC contract source - `wrappers/*.ts` - TypeScript wrappers - `tests/*.spec.ts` - Contract tests - `ton.config.ts` or `wasm.config.ts` - TON project config
### Tool Support - **TON Blueprint**: Development framework for TON - **toncli**: CLI tool for TON contracts - **ton-compiler**: FunC compiler - Manual review primarily (limited automated tools)
---
## 4. How This Skill Works
When invoked, I will:
1. **Search your codebase** for FunC/Tact contracts 2. **Analyze each contract** for the 3 vulnerability patterns 3. **Report findings** with file references and severity 4. **Provide fixes** for each identified issue 5. **Check replay protection** and sender validation
---
## 5. Example Output
When vulnerabilities are found, you'll get a report like this:
``` === TON VULNERABILITY SCAN RESULTS ===
Project: my-ton-contract Files Scanned: 3 (.fc, .tact) Vulnerabilities Found: 2
---
[CRITICAL] Missing Replay Protection File: contracts/wallet.fc:45 Pattern: No sequence number or nonce validation ```
---
## 6. Vulnerability Patterns (3 Patterns)
I check for 3 critical vulnerability patterns unique to TON. For detailed detection patterns, code examples, mitigations, and testing strategies, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
### Pattern Summary:
1. **Missing Sender Check** ⚠️ CRITICAL - No sender validation on privileged operations 2. **Integer Overflow** ⚠️ CRITICAL - Unchecked arithmetic in FunC 3. **Improper Gas Handling** ⚠️ HIGH - Insufficient gas reservations
For complete vulnerability patterns with code examples, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
## 7. Scanning Workflow
### Step 1: Platform Identification 1. Verify FunC language (`.fc` or `.func` files) 2. Check for TON Blueprint or toncli project structure 3. Locate contract source files 4. Identify Jetton-related contracts
### Step 2: Boolean Logic Review ```bash # Find boolean-like variables rg "int.*is_|int.*has_|int.*flag|int.*enabled" contracts/
# Check for positive integers used as booleans rg "= 1;|return 1;" contracts/ | grep -E "is_|has_|flag|enabled|valid"
# Look for NOT operations on boolean-like values rg "~.*\(|~ " contracts/ ```
For each boolean: - [ ] Uses -1 for true, 0 for false - [ ] NOT using 1 or other positive integers - [ ] Logic operations work correctly
### Step 3: Jetton Handler Analysis ```bash # Find transfer_notification handlers rg "transfer_notification|op::transfer_notification" contracts/ ```
For each Jetton handler: - [ ] Validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Cannot trust forward_payload without sender validation - [ ] Has admin function to set Jetton wallet address
### Step 4: Gas/Forward Amount Review ```bash # Find forward amount usage rg "forward_ton_amount|forward_amount" contracts/ rg "load_coins\(\)" contracts/
# Find send_raw_message calls rg "send_raw_message" contracts/ ```
For each outgoing message: - [ ] Forward amounts are fixed/bounded - [ ] OR user-provided amounts validated against msg_value - [ ] Cannot drain contract balance - [ ] Appropriate send_raw_message flags used
### Step 5: Manual Review TON contracts require thorough manual review: - Boolean logic with `~`, `&`, `|` operators - Message parsing and validation - Gas economics and fee calculations - Storage operations and data serialization
---
## 8. Reporting Format
### Finding Template ````markdown ## [CRITICAL] Fake Jetton Contract - Missing Sender Validation
**Location**: `contracts/staking.fc:85-95` (recv_internal, transfer_notification handler)
**Description**: The `transfer_notification` operation handler does not validate that the sender is the expected Jetton wallet contract. Any attacker can send a fake `transfer_notification` message claiming to have transferred tokens, crediting themselves without actually depositing any Jettons.
**Vulnerable Code**: ```func // staking.fc, line 85 if (op == op::transfer_notification) { int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; WRONG: No validation of sender_address! ;; Attacker can claim any jetton_amount
credit_user(from_user, jetton_amount); } ```
**Attack Scenario**: 1. Attacker deploys malicious contract 2. Malicious contract sends `transfer_notification` message to staking contract 3. Message claims attacker transferred 1,000,000 Jettons 4. Staking contract credits attacker without checking sender 5. Attacker can now withdraw from contract or gain benefits without depositing
**Proof of Concept**: ```typescript // Attacker sends fake transfer_notification const attackerContract = await blockchain.treasury("attacker");
await stakingContract.sendInternalMessage(attackerContract.getSender(), { op: OP_CODES.TRANSFER_NOTIFICATION, jettonAmount: toNano("1000000"), // Fake amount fromUser: attackerContract.address, });
// Attacker successfully credited without sending real Jettons const balance = await stakingContract.getUserBalance(attackerContract.address); expect(balance).toEqual(toNano("1000000")); // Attack succeeded ```
**Recommendation**: Store expected Jetton wallet address and validate sender: ```func global slice jetton_wallet_address;
() recv_internal(...) impure { load_data(); ;; Load jetton_wallet_address from storage
slice cs = in_msg_full.begin_parse(); int flags = cs~load_uint(4); slice sender_address = cs~load_msg_addr();
int op = in_msg_body~load_uint(32);
if (op == op::transfer_notification) { ;; CRITICAL: Validate sender throw_unless(error::wrong_jetton_wallet, equal_slices(sender_address, jetton_wallet_address));
int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; Safe to credit user credit_user(from_user, jetton_amount); } } ```
**References**: - building-secure-contracts/not-so-smart-contracts/ton/fake_jetton_contract ````
---
## 9. Priority Guidelines
### Critical (Immediate Fix Required) - Fake Jetton contract (unauthorized minting/crediting)
### High (Fix Before Launch) - Integer as boolean (logic errors, broken conditions) - Forward TON without gas check (balance drainage)
---
## 10. Testing Recommendations
### Unit Tests ```typescript import { Blockchain } from "@ton/sandbox"; import { toNano } from "ton-core";
describe("Security tests", () => { let blockchain: Blockchain; let contract: Contract;
beforeEach(async () => { blockchain = await Blockchain.create(); contract = blockchain.openContract(await Contract.fromInit()); });
it("should use correct boolean values", async () => { // Test that TRUE = -1, FALSE = 0 const result = await contract.getFlag(); expect(result).toEqual(-1n); // True expect(result).not.toEqual(1n); // Not 1! });
it("should reject fake jetton transfer", async () => { const attacker = await blockchain.treasury("attacker");
const result = await contract.send( attacker.getSender(), { value: toNano("0.05") }, { $$type: "TransferNotification", query_id: 0n, amount: toNano("1000"), from: attacker.address, } );
expect(result.transactions).toHaveTransaction({ success: false, // Should reject }); });
it("should validate gas for forward amount", async () => { const result = await contract.send( user.getSender(), { value: toNano("0.01") }, // Insufficient gas { $$type: "Transfer", to: recipient.address, forward_ton_amount: toNano("1"), // Trying to forward 1 TON } );
expect(result.transactions).toHaveTransaction({ success: false, }); }); }); ```
### Integration Tests ```typescript // Test with real Jetton wallet it("should accept transfer from real jetton wallet", async () => { // Deploy actual Jetton minter and wallet const jettonMinter = await blockchain.openContract(JettonMinter.create()); const userJettonWallet = await jettonMinter.getWalletAddress(user.address);
// Set jetton wallet in contract await contract.setJettonWallet(userJettonWallet);
// Real transfer from Jetton wallet const result = await userJettonWallet.sendTransfer( user.getSender(), contract.address, toNano("100"), {} );
expect(result.transactions).toHaveTransaction({ to: contract.address, success: true, }); }); ```
---
## 11. Additional Resources
- **Building Secure Contracts**: `building-secure-contracts/not-so-smart-contracts/ton/` - **TON Documentation**: https://docs.ton.org/ - **FunC Documentation**: https://docs.ton.org/develop/func/overview - **TON Blueprint**: https://github.com/ton-org/blueprint - **Jetton Standard**: https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md
---
## 12. Quick Reference Checklist
Before completing TON contract audit:
**Boolean Logic (HIGH)**: - [ ] All boolean values use -1 (true) and 0 (false) - [ ] NO positive integers (1, 2, etc.) used as booleans - [ ] Functions returning booleans return -1 for true - [ ] Boolean logic with `~`, `&`, `|` uses correct values - [ ] Tests verify boolean operations work correctly
**Jetton Security (CRITICAL)**: - [ ] `transfer_notification` handler validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Jetton wallet address stored during initialization - [ ] Admin function to set/update Jetton wallet - [ ] Cannot trust forward_payload without sender validation - [ ] Tests with fake Jetton contracts verify rejection
**Gas & Forward Amounts (HIGH)**: - [ ] Forward TON amounts are fixed/bounded - [ ] OR user-provided amounts validated: `msg_value >= tx_fee + forward_amount` - [ ] Contract balance protected from drainage - [ ] Appropriate `send_raw_message` flags used - [ ] Tests verify cannot drain contract with excessive forward amounts
**Testing**: - [ ] Unit tests for all three vulnerability types - [ ] Integration tests with real Jetton contracts - [ ] Gas cost analysis for all operations - [ ] Testnet deployment before mainnet
Decision snapshot
6,844 GitHub stars
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for ton-vulnerability-scanner, ready for a manual X post.
ton-vulnerability-scanner: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer... 6.8K stars https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x
Listing + install path for ton-vulnerability-scanner: https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x Install: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to trailofbits but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner/audit)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)trailofbits
@trailofbits
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Wazuh
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
16.3K StarsMaigret
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
32.9K StarsNuclei
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
29.2K StarsInfisical
Infisical is the open-source platform for secrets, certificates, and privileged access management.
27.4K StarsSandbox only
Install targets
Codex install prompt
Install the "ton-vulnerability-scanner" agent skill from https://github.com/trailofbits/skills/tree/main/plugins/building-secure-contracts/skills/ton-vulnerability-scanner. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"trailofbits-ton-vulnerability-scanner","task":"Install ton-vulnerability-scanner","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Maintenance
fresh
13d since push
Risk
Risky
Dependency or permission surface needs review
GitHub quality
6.8K
85/100 Quality · 72/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
ExcellentHigh-confidence pick with strong adoption and healthy maintenance signals.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
RiskyA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
6.8K GitHub stars
Repo activity
6.8K stars, 586 forks
Maintenance
13d since push
License
CC-BY-SA-4.0
Install
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add trailofbits/skills --skill ton-vulnerability-scannerDo not use when
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
Agent should check
Copy prompt
Task: Use ton-vulnerability-scanner in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install
Install command: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
LLM text format
/api/skills/trailofbits-ton-vulnerability-scanner/install?format=text
Find alternatives
/api/skills/search?q=ton-vulnerability-scanner&limit=3
Agent prompt
Use ton-vulnerability-scanner for this task. Review https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install, then install with: npx skills add trailofbits/skills --skill ton-vulnerability-scannerRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/trailofbits-ton-vulnerability-scanner
LLM text
/api/registry/manifest/trailofbits-ton-vulnerability-scanner?format=text
Install alias
/api/registry/install/trailofbits-ton-vulnerability-scanner
Recommend
/api/registry/recommend?task=Use%20ton-vulnerability-scanner%20in%20an%20agent%20workflow&limit=3
Agent fit
GitHub automation
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Use this as a leading candidate, then validate the README and install path in your own agent stack.
Role in stack
Primary pick
Primary fit
GitHub automation
Trust label
Production-ready
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
PASS6.8K GitHub stars
Stars/forks activity
PASS6.8K stars, 586 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSCC-BY-SA-4.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
High-confidence pick with strong adoption and healthy maintenance signals.
Workflow fit
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Build and ship code
I need a coding agent that can understand a repository, edit code, and review pull requests.
Workflow fit
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Alternative shortlist
Similar skills that may fit this task.
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
Infisical is the open-source platform for secrets, certificates, and privileged access management.
--- name: ton-vulnerability-scanner description: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. ---
# TON Vulnerability Scanner
## 1. Purpose
Systematically scan TON blockchain smart contracts written in FunC for platform-specific security vulnerabilities related to boolean logic, Jetton token handling, and gas management. This skill encodes 3 critical vulnerability patterns unique to TON's architecture.
## 2. When to Use This Skill
- Auditing TON smart contracts (FunC language) - Reviewing Jetton token implementations - Validating token transfer notification handlers - Pre-launch security assessment of TON dApps - Reviewing gas forwarding logic - Assessing boolean condition handling
## 3. Platform Detection
### File Extensions & Indicators - **FunC files**: `.fc`, `.func`
### Language/Framework Markers ```func ;; FunC contract indicators #include "imports/stdlib.fc";
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { ;; Contract logic }
() recv_external(slice in_msg) impure { ;; External message handler }
;; Common patterns send_raw_message() load_uint(), load_msg_addr(), load_coins() begin_cell(), end_cell(), store_*() transfer_notification operation op::transfer, op::transfer_notification .store_uint().store_slice().store_coins() ```
### Project Structure - `contracts/*.fc` - FunC contract source - `wrappers/*.ts` - TypeScript wrappers - `tests/*.spec.ts` - Contract tests - `ton.config.ts` or `wasm.config.ts` - TON project config
### Tool Support - **TON Blueprint**: Development framework for TON - **toncli**: CLI tool for TON contracts - **ton-compiler**: FunC compiler - Manual review primarily (limited automated tools)
---
## 4. How This Skill Works
When invoked, I will:
1. **Search your codebase** for FunC/Tact contracts 2. **Analyze each contract** for the 3 vulnerability patterns 3. **Report findings** with file references and severity 4. **Provide fixes** for each identified issue 5. **Check replay protection** and sender validation
---
## 5. Example Output
When vulnerabilities are found, you'll get a report like this:
``` === TON VULNERABILITY SCAN RESULTS ===
Project: my-ton-contract Files Scanned: 3 (.fc, .tact) Vulnerabilities Found: 2
---
[CRITICAL] Missing Replay Protection File: contracts/wallet.fc:45 Pattern: No sequence number or nonce validation ```
---
## 6. Vulnerability Patterns (3 Patterns)
I check for 3 critical vulnerability patterns unique to TON. For detailed detection patterns, code examples, mitigations, and testing strategies, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
### Pattern Summary:
1. **Missing Sender Check** ⚠️ CRITICAL - No sender validation on privileged operations 2. **Integer Overflow** ⚠️ CRITICAL - Unchecked arithmetic in FunC 3. **Improper Gas Handling** ⚠️ HIGH - Insufficient gas reservations
For complete vulnerability patterns with code examples, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
## 7. Scanning Workflow
### Step 1: Platform Identification 1. Verify FunC language (`.fc` or `.func` files) 2. Check for TON Blueprint or toncli project structure 3. Locate contract source files 4. Identify Jetton-related contracts
### Step 2: Boolean Logic Review ```bash # Find boolean-like variables rg "int.*is_|int.*has_|int.*flag|int.*enabled" contracts/
# Check for positive integers used as booleans rg "= 1;|return 1;" contracts/ | grep -E "is_|has_|flag|enabled|valid"
# Look for NOT operations on boolean-like values rg "~.*\(|~ " contracts/ ```
For each boolean: - [ ] Uses -1 for true, 0 for false - [ ] NOT using 1 or other positive integers - [ ] Logic operations work correctly
### Step 3: Jetton Handler Analysis ```bash # Find transfer_notification handlers rg "transfer_notification|op::transfer_notification" contracts/ ```
For each Jetton handler: - [ ] Validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Cannot trust forward_payload without sender validation - [ ] Has admin function to set Jetton wallet address
### Step 4: Gas/Forward Amount Review ```bash # Find forward amount usage rg "forward_ton_amount|forward_amount" contracts/ rg "load_coins\(\)" contracts/
# Find send_raw_message calls rg "send_raw_message" contracts/ ```
For each outgoing message: - [ ] Forward amounts are fixed/bounded - [ ] OR user-provided amounts validated against msg_value - [ ] Cannot drain contract balance - [ ] Appropriate send_raw_message flags used
### Step 5: Manual Review TON contracts require thorough manual review: - Boolean logic with `~`, `&`, `|` operators - Message parsing and validation - Gas economics and fee calculations - Storage operations and data serialization
---
## 8. Reporting Format
### Finding Template ````markdown ## [CRITICAL] Fake Jetton Contract - Missing Sender Validation
**Location**: `contracts/staking.fc:85-95` (recv_internal, transfer_notification handler)
**Description**: The `transfer_notification` operation handler does not validate that the sender is the expected Jetton wallet contract. Any attacker can send a fake `transfer_notification` message claiming to have transferred tokens, crediting themselves without actually depositing any Jettons.
**Vulnerable Code**: ```func // staking.fc, line 85 if (op == op::transfer_notification) { int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; WRONG: No validation of sender_address! ;; Attacker can claim any jetton_amount
credit_user(from_user, jetton_amount); } ```
**Attack Scenario**: 1. Attacker deploys malicious contract 2. Malicious contract sends `transfer_notification` message to staking contract 3. Message claims attacker transferred 1,000,000 Jettons 4. Staking contract credits attacker without checking sender 5. Attacker can now withdraw from contract or gain benefits without depositing
**Proof of Concept**: ```typescript // Attacker sends fake transfer_notification const attackerContract = await blockchain.treasury("attacker");
await stakingContract.sendInternalMessage(attackerContract.getSender(), { op: OP_CODES.TRANSFER_NOTIFICATION, jettonAmount: toNano("1000000"), // Fake amount fromUser: attackerContract.address, });
// Attacker successfully credited without sending real Jettons const balance = await stakingContract.getUserBalance(attackerContract.address); expect(balance).toEqual(toNano("1000000")); // Attack succeeded ```
**Recommendation**: Store expected Jetton wallet address and validate sender: ```func global slice jetton_wallet_address;
() recv_internal(...) impure { load_data(); ;; Load jetton_wallet_address from storage
slice cs = in_msg_full.begin_parse(); int flags = cs~load_uint(4); slice sender_address = cs~load_msg_addr();
int op = in_msg_body~load_uint(32);
if (op == op::transfer_notification) { ;; CRITICAL: Validate sender throw_unless(error::wrong_jetton_wallet, equal_slices(sender_address, jetton_wallet_address));
int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; Safe to credit user credit_user(from_user, jetton_amount); } } ```
**References**: - building-secure-contracts/not-so-smart-contracts/ton/fake_jetton_contract ````
---
## 9. Priority Guidelines
### Critical (Immediate Fix Required) - Fake Jetton contract (unauthorized minting/crediting)
### High (Fix Before Launch) - Integer as boolean (logic errors, broken conditions) - Forward TON without gas check (balance drainage)
---
## 10. Testing Recommendations
### Unit Tests ```typescript import { Blockchain } from "@ton/sandbox"; import { toNano } from "ton-core";
describe("Security tests", () => { let blockchain: Blockchain; let contract: Contract;
beforeEach(async () => { blockchain = await Blockchain.create(); contract = blockchain.openContract(await Contract.fromInit()); });
it("should use correct boolean values", async () => { // Test that TRUE = -1, FALSE = 0 const result = await contract.getFlag(); expect(result).toEqual(-1n); // True expect(result).not.toEqual(1n); // Not 1! });
it("should reject fake jetton transfer", async () => { const attacker = await blockchain.treasury("attacker");
const result = await contract.send( attacker.getSender(), { value: toNano("0.05") }, { $$type: "TransferNotification", query_id: 0n, amount: toNano("1000"), from: attacker.address, } );
expect(result.transactions).toHaveTransaction({ success: false, // Should reject }); });
it("should validate gas for forward amount", async () => { const result = await contract.send( user.getSender(), { value: toNano("0.01") }, // Insufficient gas { $$type: "Transfer", to: recipient.address, forward_ton_amount: toNano("1"), // Trying to forward 1 TON } );
expect(result.transactions).toHaveTransaction({ success: false, }); }); }); ```
### Integration Tests ```typescript // Test with real Jetton wallet it("should accept transfer from real jetton wallet", async () => { // Deploy actual Jetton minter and wallet const jettonMinter = await blockchain.openContract(JettonMinter.create()); const userJettonWallet = await jettonMinter.getWalletAddress(user.address);
// Set jetton wallet in contract await contract.setJettonWallet(userJettonWallet);
// Real transfer from Jetton wallet const result = await userJettonWallet.sendTransfer( user.getSender(), contract.address, toNano("100"), {} );
expect(result.transactions).toHaveTransaction({ to: contract.address, success: true, }); }); ```
---
## 11. Additional Resources
- **Building Secure Contracts**: `building-secure-contracts/not-so-smart-contracts/ton/` - **TON Documentation**: https://docs.ton.org/ - **FunC Documentation**: https://docs.ton.org/develop/func/overview - **TON Blueprint**: https://github.com/ton-org/blueprint - **Jetton Standard**: https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md
---
## 12. Quick Reference Checklist
Before completing TON contract audit:
**Boolean Logic (HIGH)**: - [ ] All boolean values use -1 (true) and 0 (false) - [ ] NO positive integers (1, 2, etc.) used as booleans - [ ] Functions returning booleans return -1 for true - [ ] Boolean logic with `~`, `&`, `|` uses correct values - [ ] Tests verify boolean operations work correctly
**Jetton Security (CRITICAL)**: - [ ] `transfer_notification` handler validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Jetton wallet address stored during initialization - [ ] Admin function to set/update Jetton wallet - [ ] Cannot trust forward_payload without sender validation - [ ] Tests with fake Jetton contracts verify rejection
**Gas & Forward Amounts (HIGH)**: - [ ] Forward TON amounts are fixed/bounded - [ ] OR user-provided amounts validated: `msg_value >= tx_fee + forward_amount` - [ ] Contract balance protected from drainage - [ ] Appropriate `send_raw_message` flags used - [ ] Tests verify cannot drain contract with excessive forward amounts
**Testing**: - [ ] Unit tests for all three vulnerability types - [ ] Integration tests with real Jetton contracts - [ ] Gas cost analysis for all operations - [ ] Testnet deployment before mainnet
Decision snapshot
6,844 GitHub stars
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for ton-vulnerability-scanner, ready for a manual X post.
ton-vulnerability-scanner: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer... 6.8K stars https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x
Listing + install path for ton-vulnerability-scanner: https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x Install: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to trailofbits but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner/audit)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)trailofbits
@trailofbits
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Wazuh
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
16.3K StarsMaigret
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
32.9K StarsNuclei
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
29.2K StarsInfisical
Infisical is the open-source platform for secrets, certificates, and privileged access management.
27.4K StarsSandbox only
Install targets
Codex install prompt
Install the "ton-vulnerability-scanner" agent skill from https://github.com/trailofbits/skills/tree/main/plugins/building-secure-contracts/skills/ton-vulnerability-scanner. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"trailofbits-ton-vulnerability-scanner","task":"Install ton-vulnerability-scanner","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Maintenance
fresh
13d since push
Risk
Risky
Dependency or permission surface needs review
GitHub quality
6.8K
85/100 Quality · 72/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
ExcellentHigh-confidence pick with strong adoption and healthy maintenance signals.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
RiskyA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
6.8K GitHub stars
Repo activity
6.8K stars, 586 forks
Maintenance
13d since push
License
CC-BY-SA-4.0
Install
npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add trailofbits/skills --skill ton-vulnerability-scannerDo not use when
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
Agent should check
Copy prompt
Task: Use ton-vulnerability-scanner in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20ton-vulnerability-scanner%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install
Install command: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/trailofbits-ton-vulnerability-scanner/install
LLM text format
/api/skills/trailofbits-ton-vulnerability-scanner/install?format=text
Find alternatives
/api/skills/search?q=ton-vulnerability-scanner&limit=3
Agent prompt
Use ton-vulnerability-scanner for this task. Review https://www.openagentskill.com/api/skills/trailofbits-ton-vulnerability-scanner/install, then install with: npx skills add trailofbits/skills --skill ton-vulnerability-scannerRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/trailofbits-ton-vulnerability-scanner
LLM text
/api/registry/manifest/trailofbits-ton-vulnerability-scanner?format=text
Install alias
/api/registry/install/trailofbits-ton-vulnerability-scanner
Recommend
/api/registry/recommend?task=Use%20ton-vulnerability-scanner%20in%20an%20agent%20workflow&limit=3
Agent fit
GitHub automation
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Use this as a leading candidate, then validate the README and install path in your own agent stack.
Role in stack
Primary pick
Primary fit
GitHub automation
Trust label
Production-ready
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
PASS6.8K GitHub stars
Stars/forks activity
PASS6.8K stars, 586 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSCC-BY-SA-4.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
High-confidence pick with strong adoption and healthy maintenance signals.
Workflow fit
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Build and ship code
I need a coding agent that can understand a repository, edit code, and review pull requests.
Workflow fit
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Alternative shortlist
Similar skills that may fit this task.
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
Infisical is the open-source platform for secrets, certificates, and privileged access management.
--- name: ton-vulnerability-scanner description: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer-as-boolean misuse, fake Jetton contracts, and forward TON without gas checks. Use when auditing FunC contracts. ---
# TON Vulnerability Scanner
## 1. Purpose
Systematically scan TON blockchain smart contracts written in FunC for platform-specific security vulnerabilities related to boolean logic, Jetton token handling, and gas management. This skill encodes 3 critical vulnerability patterns unique to TON's architecture.
## 2. When to Use This Skill
- Auditing TON smart contracts (FunC language) - Reviewing Jetton token implementations - Validating token transfer notification handlers - Pre-launch security assessment of TON dApps - Reviewing gas forwarding logic - Assessing boolean condition handling
## 3. Platform Detection
### File Extensions & Indicators - **FunC files**: `.fc`, `.func`
### Language/Framework Markers ```func ;; FunC contract indicators #include "imports/stdlib.fc";
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { ;; Contract logic }
() recv_external(slice in_msg) impure { ;; External message handler }
;; Common patterns send_raw_message() load_uint(), load_msg_addr(), load_coins() begin_cell(), end_cell(), store_*() transfer_notification operation op::transfer, op::transfer_notification .store_uint().store_slice().store_coins() ```
### Project Structure - `contracts/*.fc` - FunC contract source - `wrappers/*.ts` - TypeScript wrappers - `tests/*.spec.ts` - Contract tests - `ton.config.ts` or `wasm.config.ts` - TON project config
### Tool Support - **TON Blueprint**: Development framework for TON - **toncli**: CLI tool for TON contracts - **ton-compiler**: FunC compiler - Manual review primarily (limited automated tools)
---
## 4. How This Skill Works
When invoked, I will:
1. **Search your codebase** for FunC/Tact contracts 2. **Analyze each contract** for the 3 vulnerability patterns 3. **Report findings** with file references and severity 4. **Provide fixes** for each identified issue 5. **Check replay protection** and sender validation
---
## 5. Example Output
When vulnerabilities are found, you'll get a report like this:
``` === TON VULNERABILITY SCAN RESULTS ===
Project: my-ton-contract Files Scanned: 3 (.fc, .tact) Vulnerabilities Found: 2
---
[CRITICAL] Missing Replay Protection File: contracts/wallet.fc:45 Pattern: No sequence number or nonce validation ```
---
## 6. Vulnerability Patterns (3 Patterns)
I check for 3 critical vulnerability patterns unique to TON. For detailed detection patterns, code examples, mitigations, and testing strategies, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
### Pattern Summary:
1. **Missing Sender Check** ⚠️ CRITICAL - No sender validation on privileged operations 2. **Integer Overflow** ⚠️ CRITICAL - Unchecked arithmetic in FunC 3. **Improper Gas Handling** ⚠️ HIGH - Insufficient gas reservations
For complete vulnerability patterns with code examples, see [VULNERABILITY_PATTERNS.md](resources/VULNERABILITY_PATTERNS.md).
## 7. Scanning Workflow
### Step 1: Platform Identification 1. Verify FunC language (`.fc` or `.func` files) 2. Check for TON Blueprint or toncli project structure 3. Locate contract source files 4. Identify Jetton-related contracts
### Step 2: Boolean Logic Review ```bash # Find boolean-like variables rg "int.*is_|int.*has_|int.*flag|int.*enabled" contracts/
# Check for positive integers used as booleans rg "= 1;|return 1;" contracts/ | grep -E "is_|has_|flag|enabled|valid"
# Look for NOT operations on boolean-like values rg "~.*\(|~ " contracts/ ```
For each boolean: - [ ] Uses -1 for true, 0 for false - [ ] NOT using 1 or other positive integers - [ ] Logic operations work correctly
### Step 3: Jetton Handler Analysis ```bash # Find transfer_notification handlers rg "transfer_notification|op::transfer_notification" contracts/ ```
For each Jetton handler: - [ ] Validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Cannot trust forward_payload without sender validation - [ ] Has admin function to set Jetton wallet address
### Step 4: Gas/Forward Amount Review ```bash # Find forward amount usage rg "forward_ton_amount|forward_amount" contracts/ rg "load_coins\(\)" contracts/
# Find send_raw_message calls rg "send_raw_message" contracts/ ```
For each outgoing message: - [ ] Forward amounts are fixed/bounded - [ ] OR user-provided amounts validated against msg_value - [ ] Cannot drain contract balance - [ ] Appropriate send_raw_message flags used
### Step 5: Manual Review TON contracts require thorough manual review: - Boolean logic with `~`, `&`, `|` operators - Message parsing and validation - Gas economics and fee calculations - Storage operations and data serialization
---
## 8. Reporting Format
### Finding Template ````markdown ## [CRITICAL] Fake Jetton Contract - Missing Sender Validation
**Location**: `contracts/staking.fc:85-95` (recv_internal, transfer_notification handler)
**Description**: The `transfer_notification` operation handler does not validate that the sender is the expected Jetton wallet contract. Any attacker can send a fake `transfer_notification` message claiming to have transferred tokens, crediting themselves without actually depositing any Jettons.
**Vulnerable Code**: ```func // staking.fc, line 85 if (op == op::transfer_notification) { int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; WRONG: No validation of sender_address! ;; Attacker can claim any jetton_amount
credit_user(from_user, jetton_amount); } ```
**Attack Scenario**: 1. Attacker deploys malicious contract 2. Malicious contract sends `transfer_notification` message to staking contract 3. Message claims attacker transferred 1,000,000 Jettons 4. Staking contract credits attacker without checking sender 5. Attacker can now withdraw from contract or gain benefits without depositing
**Proof of Concept**: ```typescript // Attacker sends fake transfer_notification const attackerContract = await blockchain.treasury("attacker");
await stakingContract.sendInternalMessage(attackerContract.getSender(), { op: OP_CODES.TRANSFER_NOTIFICATION, jettonAmount: toNano("1000000"), // Fake amount fromUser: attackerContract.address, });
// Attacker successfully credited without sending real Jettons const balance = await stakingContract.getUserBalance(attackerContract.address); expect(balance).toEqual(toNano("1000000")); // Attack succeeded ```
**Recommendation**: Store expected Jetton wallet address and validate sender: ```func global slice jetton_wallet_address;
() recv_internal(...) impure { load_data(); ;; Load jetton_wallet_address from storage
slice cs = in_msg_full.begin_parse(); int flags = cs~load_uint(4); slice sender_address = cs~load_msg_addr();
int op = in_msg_body~load_uint(32);
if (op == op::transfer_notification) { ;; CRITICAL: Validate sender throw_unless(error::wrong_jetton_wallet, equal_slices(sender_address, jetton_wallet_address));
int jetton_amount = in_msg_body~load_coins(); slice from_user = in_msg_body~load_msg_addr();
;; Safe to credit user credit_user(from_user, jetton_amount); } } ```
**References**: - building-secure-contracts/not-so-smart-contracts/ton/fake_jetton_contract ````
---
## 9. Priority Guidelines
### Critical (Immediate Fix Required) - Fake Jetton contract (unauthorized minting/crediting)
### High (Fix Before Launch) - Integer as boolean (logic errors, broken conditions) - Forward TON without gas check (balance drainage)
---
## 10. Testing Recommendations
### Unit Tests ```typescript import { Blockchain } from "@ton/sandbox"; import { toNano } from "ton-core";
describe("Security tests", () => { let blockchain: Blockchain; let contract: Contract;
beforeEach(async () => { blockchain = await Blockchain.create(); contract = blockchain.openContract(await Contract.fromInit()); });
it("should use correct boolean values", async () => { // Test that TRUE = -1, FALSE = 0 const result = await contract.getFlag(); expect(result).toEqual(-1n); // True expect(result).not.toEqual(1n); // Not 1! });
it("should reject fake jetton transfer", async () => { const attacker = await blockchain.treasury("attacker");
const result = await contract.send( attacker.getSender(), { value: toNano("0.05") }, { $$type: "TransferNotification", query_id: 0n, amount: toNano("1000"), from: attacker.address, } );
expect(result.transactions).toHaveTransaction({ success: false, // Should reject }); });
it("should validate gas for forward amount", async () => { const result = await contract.send( user.getSender(), { value: toNano("0.01") }, // Insufficient gas { $$type: "Transfer", to: recipient.address, forward_ton_amount: toNano("1"), // Trying to forward 1 TON } );
expect(result.transactions).toHaveTransaction({ success: false, }); }); }); ```
### Integration Tests ```typescript // Test with real Jetton wallet it("should accept transfer from real jetton wallet", async () => { // Deploy actual Jetton minter and wallet const jettonMinter = await blockchain.openContract(JettonMinter.create()); const userJettonWallet = await jettonMinter.getWalletAddress(user.address);
// Set jetton wallet in contract await contract.setJettonWallet(userJettonWallet);
// Real transfer from Jetton wallet const result = await userJettonWallet.sendTransfer( user.getSender(), contract.address, toNano("100"), {} );
expect(result.transactions).toHaveTransaction({ to: contract.address, success: true, }); }); ```
---
## 11. Additional Resources
- **Building Secure Contracts**: `building-secure-contracts/not-so-smart-contracts/ton/` - **TON Documentation**: https://docs.ton.org/ - **FunC Documentation**: https://docs.ton.org/develop/func/overview - **TON Blueprint**: https://github.com/ton-org/blueprint - **Jetton Standard**: https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md
---
## 12. Quick Reference Checklist
Before completing TON contract audit:
**Boolean Logic (HIGH)**: - [ ] All boolean values use -1 (true) and 0 (false) - [ ] NO positive integers (1, 2, etc.) used as booleans - [ ] Functions returning booleans return -1 for true - [ ] Boolean logic with `~`, `&`, `|` uses correct values - [ ] Tests verify boolean operations work correctly
**Jetton Security (CRITICAL)**: - [ ] `transfer_notification` handler validates sender address - [ ] Sender checked against stored Jetton wallet address - [ ] Jetton wallet address stored during initialization - [ ] Admin function to set/update Jetton wallet - [ ] Cannot trust forward_payload without sender validation - [ ] Tests with fake Jetton contracts verify rejection
**Gas & Forward Amounts (HIGH)**: - [ ] Forward TON amounts are fixed/bounded - [ ] OR user-provided amounts validated: `msg_value >= tx_fee + forward_amount` - [ ] Contract balance protected from drainage - [ ] Appropriate `send_raw_message` flags used - [ ] Tests verify cannot drain contract with excessive forward amounts
**Testing**: - [ ] Unit tests for all three vulnerability types - [ ] Integration tests with real Jetton contracts - [ ] Gas cost analysis for all operations - [ ] Testnet deployment before mainnet
Decision snapshot
6,844 GitHub stars
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for ton-vulnerability-scanner, ready for a manual X post.
ton-vulnerability-scanner: Scans TON (The Open Network) smart contracts for 3 critical vulnerabilities including integer... 6.8K stars https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x
Listing + install path for ton-vulnerability-scanner: https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=x Install: npx skills add trailofbits/skills --skill ton-vulnerability-scanner
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to trailofbits but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner/audit)
[](https://www.openagentskill.com/skills/trailofbits-ton-vulnerability-scanner?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)trailofbits
@trailofbits
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Wazuh
Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
16.3K StarsMaigret
🕵️♂️ Collect a dossier on a person by username from 3000+ sites
32.9K StarsNuclei
Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
29.2K StarsInfisical
Infisical is the open-source platform for secrets, certificates, and privileged access management.
27.4K StarsPermission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness
Permission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness
Permission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness
Permission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness