Your TON development partner for agentic engineering.

Security Scanner

50+ Rules Across 21 Categories

Deep-dive into the TVM-native static analysis engine powering ton-dev audit.

  • ❌Critical — Exploitable vulnerabilities that can lead to fund loss or contract takeover. Must fix before deployment.
  • ⚠️High — Serious issues that could cause loss of funds under specific conditions or break core functionality.
  • 🔶Medium — Issues that could lead to unexpected behavior or minor fund loss in edge cases.
  • 🔷Low — Code quality issues, gas inefficiencies, or minor deviations from best practices.
  • ℹ️Info — Informational findings, style suggestions, and documentation recommendations.

1. Access Control

Checks for missing owner/admin validation, unprotected privileged operations, and improper role enforcement.

2. Arithmetic Safety

Detects integer overflow/underflow risks, unsafe division, and unchecked math operations.

3. Bounced Messages

Ensures proper handling of bounced messages, including state rollback and balance recovery.

4. Cell Overflow

Identifies writes that exceed the 1023-bit cell limit or 4-reference maximum.

5. Code Injection

Detects dynamic code loading patterns that could allow arbitrary code execution.

6. Compilation

Catches compilation-level issues including pragma mismatches and deprecated syntax.

7. Cross-Contract Safety

Validates inter-contract message flows, callback handling, and trust assumptions.

8. Data Validation

Checks for missing input validation on message payloads, addresses, and parameters.

9. Denial of Service

Detects unbounded loops, excessive storage operations, and patterns that could halt execution.

10. External Messages

Validates handling of external messages including signature verification and replay protection.

11. Gas & Fees

Identifies insufficient gas reservations, missing value forwarding, and fee calculation errors.

12. Integer Handling

Checks for incorrect integer widths, signed/unsigned mismatches, and truncation issues.

13. Randomness

Detects predictable randomness sources and insecure seed generation patterns.

14. Replay Protection

Ensures transactions cannot be replayed through proper seqno or timestamp validation.

15. Reentrancy

Identifies state modifications after external calls that could allow reentrancy attacks.

16. State Management

Checks for inconsistent state updates, missing initialization, and storage layout issues.

17. Storage

Detects excessive storage usage, missing cleanup, and inefficient data packing.

18. TEP Compliance

Validates adherence to TON Enhancement Proposals (TEP-62, TEP-64, TEP-74, TEP-81, etc.).

19. Timestamp

Identifies unsafe reliance on block timestamps and time-based logic vulnerabilities.

20. TVM Internals

Catches low-level TVM issues including stack manipulation errors and opcode misuse.

21. Upgradeability

Validates upgrade patterns including code replacement safety and migration logic.

The scanner supports four output formats for different workflows:

Terminal (default)

ton-dev audit ./contracts/

Colored, human-readable output with severity icons and line references.

JSON

ton-dev audit ./contracts/ --format json

# Output structure:
{
  "summary": { "critical": 1, "high": 2, "medium": 0, "low": 3, "info": 1 },
  "verdict": "FAIL",
  "findings": [
    {
      "rule": "missing-owner-check",
      "severity": "critical",
      "file": "jetton-wallet.fc",
      "line": 42,
      "message": "Privileged operation lacks owner validation",
      "category": "Access Control"
    }
  ]
}

SARIF

ton-dev audit ./contracts/ --format sarif --output results.sarif

# Upload to GitHub Code Scanning:
# gh api repos/{owner}/{repo}/code-scanning/sarifs \
#   -f "[email protected]"

SARIF (Static Analysis Results Interchange Format) integrates with GitHub Code Scanning, Azure DevOps, and other SARIF-compatible tools.

Markdown

ton-dev audit ./contracts/ --format markdown --output report.md

Generates a formatted Markdown report suitable for PRs, documentation, or sharing with reviewers.

Add a security gate to your CI pipeline:

name: TON Security Audit

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install TON Dev Skills
        run: npm i -g @tesserae/ton-dev-skills

      - name: Run Security Audit
        run: ton-dev audit ./contracts/ --format sarif --output results.sarif

      - name: Upload SARIF to GitHub
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: results.sarif

      - name: Fail on Critical/High
        run: |
          ton-dev audit ./contracts/ --format json | \
            node -e "
              const r = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
              if (r.summary.critical > 0 || r.summary.high > 0) {
                console.error('Audit failed: found critical or high severity issues');
                process.exit(1);
              }
              console.log('Audit passed');
            "
← Back to Docs Hub