ton-vulnerability-scanner

Scans TON FunC smart contracts for boolean logic, fake Jetton, and gas vulnerabilities.

Updated Apr 3, 2026
One-click install
npx skills add https://github.com/Ayoub-ouederni/SENTINEL --skill ton-vulnerability-scanner-ayoub-ouederni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ton-vulnerability-scanner
Source: https://github.com/Ayoub-ouederni/SENTINEL/tree/main/.claude/skills/ton-vulnerability-scanner
Command: npx skills add https://github.com/Ayoub-ouederni/SENTINEL --skill ton-vulnerability-scanner-ayoub-ouederni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? TON smart contracts written in FunC contain platform-specific vulnerabilities—integer-as-boolean misuse, fake Jetton transfer notifications, and unvalidated forward TON amounts—that generic Solidity-focused audit tools cannot detect, leaving contracts exposed to fund drainage and unauthorized token crediting. ## Core Features & Use Cases - Boolean Logic Detection: Identifies positive integers used as booleans in FunC, where bitwise NOT operations produce unexpected truthy results that break contract conditions. - Fake Jetton Validation: Flags transfer_notification handlers that fail to validate the sender against the stored Jetton wallet address, preventing attackers from crediting themselves tokens they never sent. - Gas & Forward Amount Review: Detects user-controlled forward_ton_amount values that lack msg_value validation, which can drain the contract's TON balance. - Use Case: Before launching a TON staking dApp, run this audit to verify that your transfer_notification handler validates the Jetton wallet sender, all booleans use -1/0, and forward amounts are bounded—then apply the provided FunC fix patterns and TypeScript test templates. ## Quick Start Audit the FunC contracts in my TON project for the three critical vulnerability patterns and report findings with fixes.

Frequently Asked Questions about ton-vulnerability-scanner

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit TON smart contracts for vulnerabilities?

Scan FunC contract files (.fc, .func) for three critical patterns: positive integers used as booleans, transfer_notification handlers without sender validation, and user-controlled forward_ton_amount without gas checks. Each finding includes vulnerable code, attack scenarios, and secure fix patterns.

What is a fake Jetton contract attack on TON?

A fake Jetton attack occurs when a transfer_notification handler fails to validate that the sender is the expected Jetton wallet contract. Any attacker can send a forged notification claiming a token deposit, getting credited without transferring real Jettons.

Why does FunC boolean logic break with positive integers?

FunC uses -1 for true and 0 for false, and the bitwise NOT operator ~ on positive integers produces unexpected results: ~1 equals -2, which is still truthy. Conditions using ~ on value 1 will always execute, breaking contract logic.

Does this scanner work with Tact contracts or only FunC?

The scanner primarily targets FunC contracts identified by .fc and .func file extensions and patterns like recv_internal and send_raw_message. TON projects using TON Blueprint or toncli project structures are supported for platform detection.

How do I prevent TON contract balance drainage from forward amounts?

Validate that msg_value covers the transaction fee plus forward_ton_amount before sending, or use fixed bounded forward amounts instead of user-controlled values. Avoid send_raw_message flag 1 with unvalidated user input, since it pays fees from the contract balance.