[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75K7AD9PQX4PCMQ7ZWBFJ7Q":3,"skill-same:01M75K7AD9PQX4PCMQ7ZWBFJ7Q":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M75K7AD9PQX4PCMQ7ZWBFJ7Q","ton-vulnerability-scanner",null,"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.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fton-vulnerability-scanner\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: ton-vulnerability-scanner\ndescription: 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.\n---\n\n# TON Vulnerability Scanner\n\n## 1. Purpose\n\nSystematically 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.\n\n## 2. When to Use This Skill\n\n- Auditing TON smart contracts (FunC language)\n- Reviewing Jetton token implementations\n- Validating token transfer notification handlers\n- Pre-launch security assessment of TON dApps\n- Reviewing gas forwarding logic\n- Assessing boolean condition handling\n\n## 3. Platform Detection\n\n### File Extensions & Indicators\n- **FunC files**: `.fc`, `.func`\n\n### Language\u002FFramework Markers\n```func\n;; FunC contract indicators\n#include \"imports\u002Fstdlib.fc\";\n\n() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {\n    ;; Contract logic\n}\n\n() recv_external(slice in_msg) impure {\n    ;; External message handler\n}\n\n;; Common patterns\nsend_raw_message()\nload_uint(), load_msg_addr(), load_coins()\nbegin_cell(), end_cell(), store_*()\ntransfer_notification operation\nop::transfer, op::transfer_notification\n.store_uint().store_slice().store_coins()\n```\n\n### Project Structure\n- `contracts\u002F*.fc` - FunC contract source\n- `wrappers\u002F*.ts` - TypeScript wrappers\n- `tests\u002F*.spec.ts` - Contract tests\n- `ton.config.ts` or `wasm.config.ts` - TON project config\n\n### Tool Support\n- **TON Blueprint**: Development framework for TON\n- **toncli**: CLI tool for TON contracts\n- **ton-compiler**: FunC compiler\n- Manual review primarily (limited automated tools)\n\n---\n\n## 4. How This Skill Works\n\nWhen invoked, I will:\n\n1. **Search your codebase** for FunC\u002FTact contracts\n2. **Analyze each contract** for the 3 vulnerability patterns\n3. **Report findings** with file references and severity\n4. **Provide fixes** for each identified issue\n5. **Check replay protection** and sender validation\n\n---\n\n## 5. Example Output\n\nWhen vulnerabilities are found, you'll get a report like this:\n\n```\n=== TON VULNERABILITY SCAN RESULTS ===\n\nProject: my-ton-contract\nFiles Scanned: 3 (.fc, .tact)\nVulnerabilities Found: 2\n\n---\n\n[CRITICAL] Missing Replay Protection\nFile: contracts\u002Fwallet.fc:45\nPattern: No sequence number or nonce validation\n\n\n---\n\n## 5. Vulnerability Patterns (3 Patterns)\n\nI check for 3 critical vulnerability patterns unique to TON. For detailed detection patterns, code examples, mitigations, and testing strategies, see [VULNERABILITY_PATTERNS.md](resources\u002FVULNERABILITY_PATTERNS.md).\n\n### Pattern Summary:\n\n1. **Missing Sender Check** ⚠️ CRITICAL - No sender validation on privileged operations\n2. **Integer Overflow** ⚠️ CRITICAL - Unchecked arithmetic in FunC\n3. **Improper Gas Handling** ⚠️ HIGH - Insufficient gas reservations\n\nFor complete vulnerability patterns with code examples, see [VULNERABILITY_PATTERNS.md](resources\u002FVULNERABILITY_PATTERNS.md).\n## 5. Scanning Workflow\n\n### Step 1: Platform Identification\n1. Verify FunC language (`.fc` or `.func` files)\n2. Check for TON Blueprint or toncli project structure\n3. Locate contract source files\n4. Identify Jetton-related contracts\n\n### Step 2: Boolean Logic Review\n```bash\n# Find boolean-like variables\nrg \"int.*is_|int.*has_|int.*flag|int.*enabled\" contracts\u002F\n\n# Check for positive integers used as booleans\nrg \"= 1;|return 1;\" contracts\u002F | grep -E \"is_|has_|flag|enabled|valid\"\n\n# Look for NOT operations on boolean-like values\nrg \"~.*\\(|~ \" contracts\u002F\n```\n\nFor each boolean:\n- [ ] Uses -1 for true, 0 for false\n- [ ] NOT using 1 or other positive integers\n- [ ] Logic operations work correctly\n\n### Step 3: Jetton Handler Analysis\n```bash\n# Find transfer_notification handlers\nrg \"transfer_notification|op::transfer_notification\" contracts\u002F\n```\n\nFor each Jetton handler:\n- [ ] Validates sender address\n- [ ] Sender checked against stored Jetton wallet address\n- [ ] Cannot trust forward_payload without sender validation\n- [ ] Has admin function to set Jetton wallet address\n\n### Step 4: Gas\u002FForward Amount Review\n```bash\n# Find forward amount usage\nrg \"forward_ton_amount|forward_amount\" contracts\u002F\nrg \"load_coins\\(\\)\" contracts\u002F\n\n# Find send_raw_message calls\nrg \"send_raw_message\" contracts\u002F\n```\n\nFor each outgoing message:\n- [ ] Forward amounts are fixed\u002Fbounded\n- [ ] OR user-provided amounts validated against msg_value\n- [ ] Cannot drain contract balance\n- [ ] Appropriate send_raw_message flags used\n\n### Step 5: Manual Review\nTON contracts require thorough manual review:\n- Boolean logic with `~`, `&`, `|` operators\n- Message parsing and validation\n- Gas economics and fee calculations\n- Storage operations and data serialization\n\n---\n\n## 6. Reporting Format\n\n### Finding Template\n```markdown\n## [CRITICAL] Fake Jetton Contract - Missing Sender Validation\n\n**Location**: `contracts\u002Fstaking.fc:85-95` (recv_internal, transfer_notification handler)\n\n**Description**:\nThe `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.\n\n**Vulnerable Code**:\n```func\n\u002F\u002F staking.fc, line 85\nif (op == op::transfer_notification) {\n    int jetton_amount = in_msg_body~load_coins();\n    slice from_user = in_msg_body~load_msg_addr();\n\n    ;; WRONG: No validation of sender_address!\n    ;; Attacker can claim any jetton_amount\n\n    credit_user(from_user, jetton_amount);\n}\n```\n\n**Attack Scenario**:\n1. Attacker deploys malicious contract\n2. Malicious contract sends `transfer_notification` message to staking contract\n3. Message claims attacker transferred 1,000,000 Jettons\n4. Staking contract credits attacker without checking sender\n5. Attacker can now withdraw from contract or gain benefits without depositing\n\n**Proof of Concept**:\n```typescript\n\u002F\u002F Attacker sends fake transfer_notification\nconst attackerContract = await blockchain.treasury(\"attacker\");\n\nawait stakingContract.sendInternalMessage(attackerContract.getSender(), {\n  op: OP_CODES.TRANSFER_NOTIFICATION,\n  jettonAmount: toNano(\"1000000\"), \u002F\u002F Fake amount\n  fromUser: attackerContract.address,\n});\n\n\u002F\u002F Attacker successfully credited without sending real Jettons\nconst balance = await stakingContract.getUserBalance(attackerContract.address);\nexpect(balance).toEqual(toNano(\"1000000\")); \u002F\u002F Attack succeeded\n```\n\n**Recommendation**:\nStore expected Jetton wallet address and validate sender:\n```func\nglobal slice jetton_wallet_address;\n\n() recv_internal(...) impure {\n    load_data();  ;; Load jetton_wallet_address from storage\n\n    slice cs = in_msg_full.begin_parse();\n    int flags = cs~load_uint(4);\n    slice sender_address = cs~load_msg_addr();\n\n    int op = in_msg_body~load_uint(32);\n\n    if (op == op::transfer_notification) {\n        ;; CRITICAL: Validate sender\n        throw_unless(error::wrong_jetton_wallet,\n            equal_slices(sender_address, jetton_wallet_address));\n\n        int jetton_amount = in_msg_body~load_coins();\n        slice from_user = in_msg_body~load_msg_addr();\n\n        ;; Safe to credit user\n        credit_user(from_user, jetton_amount);\n    }\n}\n```\n\n**References**:\n- building-secure-contracts\u002Fnot-so-smart-contracts\u002Fton\u002Ffake_jetton_contract\n```\n\n---\n\n## 7. Priority Guidelines\n\n### Critical (Immediate Fix Required)\n- Fake Jetton contract (unauthorized minting\u002Fcrediting)\n\n### High (Fix Before Launch)\n- Integer as boolean (logic errors, broken conditions)\n- Forward TON without gas check (balance drainage)\n\n---\n\n## 8. Testing Recommendations\n\n### Unit Tests\n```typescript\nimport { Blockchain } from \"@ton\u002Fsandbox\";\nimport { toNano } from \"ton-core\";\n\ndescribe(\"Security tests\", () => {\n  let blockchain: Blockchain;\n  let contract: Contract;\n\n  beforeEach(async () => {\n    blockchain = await Blockchain.create();\n    contract = blockchain.openContract(await Contract.fromInit());\n  });\n\n  it(\"should use correct boolean values\", async () => {\n    \u002F\u002F Test that TRUE = -1, FALSE = 0\n    const result = await contract.getFlag();\n    expect(result).toEqual(-1n); \u002F\u002F True\n    expect(result).not.toEqual(1n); \u002F\u002F Not 1!\n  });\n\n  it(\"should reject fake jetton transfer\", async () => {\n    const attacker = await blockchain.treasury(\"attacker\");\n\n    const result = await contract.send(\n      attacker.getSender(),\n      { value: toNano(\"0.05\") },\n      {\n        $$type: \"TransferNotification\",\n        query_id: 0n,\n        amount: toNano(\"1000\"),\n        from: attacker.address,\n      }\n    );\n\n    expect(result.transactions).toHaveTransaction({\n      success: false, \u002F\u002F Should reject\n    });\n  });\n\n  it(\"should validate gas for forward amount\", async () => {\n    const result = await contract.send(\n      user.getSender(),\n      { value: toNano(\"0.01\") }, \u002F\u002F Insufficient gas\n      {\n        $$type: \"Transfer\",\n        to: recipient.address,\n        forward_ton_amount: toNano(\"1\"), \u002F\u002F Trying to forward 1 TON\n      }\n    );\n\n    expect(result.transactions).toHaveTransaction({\n      success: false,\n    });\n  });\n});\n```\n\n### Integration Tests\n```typescript\n\u002F\u002F Test with real Jetton wallet\nit(\"should accept transfer from real jetton wallet\", async () => {\n  \u002F\u002F Deploy actual Jetton minter and wallet\n  const jettonMinter = await blockchain.openContract(JettonMinter.create());\n  const userJettonWallet = await jettonMinter.getWalletAddress(user.address);\n\n  \u002F\u002F Set jetton wallet in contract\n  await contract.setJettonWallet(userJettonWallet);\n\n  \u002F\u002F Real transfer from Jetton wallet\n  const result = await userJettonWallet.sendTransfer(\n    user.getSender(),\n    contract.address,\n    toNano(\"100\"),\n    {}\n  );\n\n  expect(result.transactions).toHaveTransaction({\n    to: contract.address,\n    success: true,\n  });\n});\n```\n\n---\n\n## 9. Additional Resources\n\n- **Building Secure Contracts**: `building-secure-contracts\u002Fnot-so-smart-contracts\u002Fton\u002F`\n- **TON Documentation**: https:\u002F\u002Fdocs.ton.org\u002F\n- **FunC Documentation**: https:\u002F\u002Fdocs.ton.org\u002Fdevelop\u002Ffunc\u002Foverview\n- **TON Blueprint**: https:\u002F\u002Fgithub.com\u002Fton-org\u002Fblueprint\n- **Jetton Standard**: https:\u002F\u002Fgithub.com\u002Fton-blockchain\u002FTEPs\u002Fblob\u002Fmaster\u002Ftext\u002F0074-jettons-standard.md\n\n---\n\n## 10. Quick Reference Checklist\n\nBefore completing TON contract audit:\n\n**Boolean Logic (HIGH)**:\n- [ ] All boolean values use -1 (true) and 0 (false)\n- [ ] NO positive integers (1, 2, etc.) used as booleans\n- [ ] Functions returning booleans return -1 for true\n- [ ] Boolean logic with `~`, `&`, `|` uses correct values\n- [ ] Tests verify boolean operations work correctly\n\n**Jetton Security (CRITICAL)**:\n- [ ] `transfer_notification` handler validates sender address\n- [ ] Sender checked against stored Jetton wallet address\n- [ ] Jetton wallet address stored during initialization\n- [ ] Admin function to set\u002Fupdate Jetton wallet\n- [ ] Cannot trust forward_payload without sender validation\n- [ ] Tests with fake Jetton contracts verify rejection\n\n**Gas & Forward Amounts (HIGH)**:\n- [ ] Forward TON amounts are fixed\u002Fbounded\n- [ ] OR user-provided amounts validated: `msg_value >= tx_fee + forward_amount`\n- [ ] Contract balance protected from drainage\n- [ ] Appropriate `send_raw_message` flags used\n- [ ] Tests verify cannot drain contract with excessive forward amounts\n\n**Testing**:\n- [ ] Unit tests for all three vulnerability types\n- [ ] Integration tests with real Jetton contracts\n- [ ] Gas cost analysis for all operations\n- [ ] Testnet deployment before mainnet\n","# TON Vulnerability Scanner\n\n## 1. Purpose\n\nSystematically 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.\n\n## 2. When to Use This Skill\n\n- Auditing TON smart contracts (FunC language)\n- Reviewing Jetton token implementations\n- Validating token transfer notification handlers\n- Pre-launch security assessment of TON dApps\n- Reviewing gas forwarding logic\n- Assessing boolean condition handling\n\n## 3. Platform Detection\n\n### File Extensions & Indicators\n- **FunC files**: `.fc`, `.func`\n\n### Language\u002FFramework Markers\n```func\n;; FunC contract indicators\n#include \"imports\u002Fstdlib.fc\";\n\n() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {\n    ;; Contract logic\n}\n\n() recv_external(slice in_msg) impure {\n    ;; External message handler\n}\n\n;; Common patterns\nsend_raw_message()\nload_uint(), load_msg_addr(), load_coins()\nbegin_cell(), end_cell(), store_*()\ntransfer_notification operation\nop::transfer, op::transfer_notification\n.store_uint().store_slice().store_coins()\n```\n\n### Project Structure\n- `contracts\u002F*.fc` - FunC contract source\n- `wrappers\u002F*.ts` - TypeScript wrappers\n- `tests\u002F*.spec.ts` - Contract tests\n- `ton.config.ts` or `wasm.config.ts` - TON project config\n\n### Tool Support\n- **TON Blueprint**: Development framework for TON\n- **toncli**: CLI tool for TON contracts\n- **ton-compiler**: FunC compiler\n- Manual review primarily (limited automated tools)\n\n---\n\n## 4. How This Skill Works\n\nWhen invoked, I will:\n\n1. **Search your codebase** for FunC\u002FTact contracts\n2. **Analyze each contract** for the 3 vulnerability patterns\n3. **Report findings** with file references and severity\n4. **Provide fixes** for each identified issue\n5. **Check replay protection** and sender validation\n\n---\n\n## 5. Example Output\n\nWhen vulnerabilities are found, you'll get a report like this:\n\n```\n=== TON VULNERABILITY SCAN RESULTS ===\n\nProject: my-ton-contract\nFiles Scanned: 3 (.fc, .tact)\nVulnerabilities Found: 2\n\n---\n\n[CRITICAL] Missing Replay Protection\nFile: contracts\u002Fwallet.fc:45\nPattern: No sequence number or nonce validation\n\n\n---\n\n## 5. Vulnerability Patterns (3 Patterns)\n\nI check for 3 critical vulnerability patterns unique to TON. For detailed detection patterns, code examples, mitigations, and testing strategies, see [VULNERABILITY_PATTERNS.md](resources\u002FVULNERABILITY_PATTERNS.md).\n\n### Pattern Summary:\n\n1. **Missing Sender Check** ⚠️ CRITICAL - No sender validation on privileged operations\n2. **Integer Overflow** ⚠️ CRITICAL - Unchecked arithmetic in FunC\n3. **Improper Gas Handling** ⚠️ HIGH - Insufficient gas reservations\n\nFor complete vulnerability patterns with code examples, see [VULNERABILITY_PATTERNS.md](resources\u002FVULNERABILITY_PATTERNS.md).\n## 5. Scanning Workflow\n\n### Step 1: Platform Identification\n1. Verify FunC language (`.fc` or `.func` files)\n2. Check for TON Blueprint or toncli project structure\n3. Locate contract source files\n4. Identify Jetton-related contracts\n\n### Step 2: Boolean Logic Review\n```bash\n# Find boolean-like variables\nrg \"int.*is_|int.*has_|int.*flag|int.*enabled\" contracts\u002F\n\n# Check for positive integers used as booleans\nrg \"= 1;|return 1;\" contracts\u002F | grep -E \"is_|has_|flag|enabled|valid\"\n\n# Look for NOT operations on boolean-like values\nrg \"~.*\\(|~ \" contracts\u002F\n```\n\nFor each boolean:\n- [ ] Uses -1 for true, 0 for false\n- [ ] NOT using 1 or other positive integers\n- [ ] Logic operations work correctly\n\n### Step 3: Jetton Handler Analysis\n```bash\n# Find transfer_notification handlers\nrg \"transfer_notification|op::transfer_notification\" contracts\u002F\n```\n\nFor each Jetton handler:\n- [ ] Validates sender address\n- [ ] Sender checked against stored Jetton wallet address\n- [ ] Cannot trust forward_payload without sender validation\n- [ ] Has admin function to set Jetton wallet address\n\n### Step 4: Gas\u002FForward Amount Review\n```bash\n# Find forward amount usage\nrg \"forward_ton_amount|forward_amount\" contracts\u002F\nrg \"load_coins\\(\\)\" contracts\u002F\n\n# Find send_raw_message calls\nrg \"send_raw_message\" contracts\u002F\n```\n\nFor each outgoing message:\n- [ ] Forward amounts are fixed\u002Fbounded\n- [ ] OR user-provided amounts validated against msg_value\n- [ ] Cannot drain contract balance\n- [ ] Appropriate send_raw_message flags used\n\n### Step 5: Manual Review\nTON contracts require thorough manual review:\n- Boolean logic with `~`, `&`, `|` operators\n- Message parsing and validation\n- Gas economics and fee calculations\n- Storage operations and data serialization\n\n---\n\n## 6. Reporting Format\n\n### Finding Template\n```markdown\n## [CRITICAL] Fake Jetton Contract - Missing Sender Validation\n\n**Location**: `contracts\u002Fstaking.fc:85-95` (recv_internal, transfer_notification handler)\n\n**Description**:\nThe `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.\n\n**Vulnerable Code**:\n```func\n\u002F\u002F staking.fc, line 85\nif (op == op::transfer_notification) {\n    int jetton_amount = in_msg_body~load_coins();\n    slice from_user = in_msg_body~load_msg_addr();\n\n    ;; WRONG: No validation of sender_address!\n    ;; Attacker can claim any jetton_amount\n\n    credit_user(from_user, jetton_amount);\n}\n```\n\n**Attack Scenario**:\n1. Attacker deploys malicious contract\n2. Malicious contract sends `transfer_notification` message to staking contract\n3. Message claims attacker transferred 1,000,000 Jettons\n4. Staking contract credits attacker without checking sender\n5. Attacker can now withdraw from contract or gain benefits without depositing\n\n**Proof of Concept**:\n```typescript\n\u002F\u002F Attacker sends fake transfer_notification\nconst attackerContract = await blockchain.treasury(\"attacker\");\n\nawait stakingContract.sendInternalMessage(attackerContract.getSender(), {\n  op: OP_CODES.TRANSFER_NOTIFICATION,\n  jettonAmount: toNano(\"1000000\"), \u002F\u002F Fake amount\n  fromUser: attackerContract.address,\n});\n\n\u002F\u002F Attacker successfully credited without sending real Jettons\nconst balance = await stakingContract.getUserBalance(attackerContract.address);\nexpect(balance).toEqual(toNano(\"1000000\")); \u002F\u002F Attack succeeded\n```\n\n**Recommendation**:\nStore expected Jetton wallet address and validate sender:\n```func\nglobal slice jetton_wallet_address;\n\n() recv_internal(...) impure {\n    load_data();  ;; Load jetton_wallet_address from storage\n\n    slice cs = in_msg_full.begin_parse();\n    int flags = cs~load_uint(4);\n    slice sender_address = cs~load_msg_addr();\n\n    int op = in_msg_body~load_uint(32);\n\n    if (op == op::transfer_notification) {\n        ;; CRITICAL: Validate sender\n        throw_unless(error::wrong_jetton_wallet,\n            equal_slices(sender_address, jetton_wallet_address));\n\n        int jetton_amount = in_msg_body~load_coins();\n        slice from_user = in_msg_body~load_msg_addr();\n\n        ;; Safe to credit user\n        credit_user(from_user, jetton_amount);\n    }\n}\n```\n\n**References**:\n- building-secure-contracts\u002Fnot-so-smart-contracts\u002Fton\u002Ffake_jetton_contract\n```\n\n---\n\n## 7. Priority Guidelines\n\n### Critical (Immediate Fix Required)\n- Fake Jetton contract (unauthorized minting\u002Fcrediting)\n\n### High (Fix Before Launch)\n- Integer as boolean (logic errors, broken conditions)\n- Forward TON without gas check (balance drainage)\n\n---\n\n## 8. Testing Recommendations\n\n### Unit Tests\n```typescript\nimport { Blockchain } from \"@ton\u002Fsandbox\";\nimport { toNano } from \"ton-core\";\n\ndescribe(\"Security tests\", () => {\n  let blockchain: Blockchain;\n  let contract: Contract;\n\n  beforeEach(async () => {\n    blockchain = await Blockchain.create();\n    contract = blockchain.openContract(await Contract.fromInit());\n  });\n\n  it(\"should use correct boolean values\", async () => {\n    \u002F\u002F Test that TRUE = -1, FALSE = 0\n    const result = await contract.getFlag();\n    expect(result).toEqual(-1n); \u002F\u002F True\n    expect(result).not.toEqual(1n); \u002F\u002F Not 1!\n  });\n\n  it(\"should reject fake jetton transfer\", async () => {\n    const attacker = await blockchain.treasury(\"attacker\");\n\n    const result = await contract.send(\n      attacker.getSender(),\n      { value: toNano(\"0.05\") },\n      {\n        $$type: \"TransferNotification\",\n        query_id: 0n,\n        amount: toNano(\"1000\"),\n        from: attacker.address,\n      }\n    );\n\n    expect(result.transactions).toHaveTransaction({\n      success: false, \u002F\u002F Should reject\n    });\n  });\n\n  it(\"should validate gas for forward amount\", async () => {\n    const result = await contract.send(\n      user.getSender(),\n      { value: toNano(\"0.01\") }, \u002F\u002F Insufficient gas\n      {\n        $$type: \"Transfer\",\n        to: recipient.address,\n        forward_ton_amount: toNano(\"1\"), \u002F\u002F Trying to forward 1 TON\n      }\n    );\n\n    expect(result.transactions).toHaveTransaction({\n      success: false,\n    });\n  });\n});\n```\n\n### Integration Tests\n```typescript\n\u002F\u002F Test with real Jetton wallet\nit(\"should accept transfer from real jetton wallet\", async () => {\n  \u002F\u002F Deploy actual Jetton minter and wallet\n  const jettonMinter = await blockchain.openContract(JettonMinter.create());\n  const userJettonWallet = await jettonMinter.getWalletAddress(user.address);\n\n  \u002F\u002F Set jetton wallet in contract\n  await contract.setJettonWallet(userJettonWallet);\n\n  \u002F\u002F Real transfer from Jetton wallet\n  const result = await userJettonWallet.sendTransfer(\n    user.getSender(),\n    contract.address,\n    toNano(\"100\"),\n    {}\n  );\n\n  expect(result.transactions).toHaveTransaction({\n    to: contract.address,\n    success: true,\n  });\n});\n```\n\n---\n\n## 9. Additional Resources\n\n- **Building Secure Contracts**: `building-secure-contracts\u002Fnot-so-smart-contracts\u002Fton\u002F`\n- **TON Documentation**: https:\u002F\u002Fdocs.ton.org\u002F\n- **FunC Documentation**: https:\u002F\u002Fdocs.ton.org\u002Fdevelop\u002Ffunc\u002Foverview\n- **TON Blueprint**: https:\u002F\u002Fgithub.com\u002Fton-org\u002Fblueprint\n- **Jetton Standard**: https:\u002F\u002Fgithub.com\u002Fton-blockchain\u002FTEPs\u002Fblob\u002Fmaster\u002Ftext\u002F0074-jettons-standard.md\n\n---\n\n## 10. Quick Reference Checklist\n\nBefore completing TON contract audit:\n\n**Boolean Logic (HIGH)**:\n- [ ] All boolean values use -1 (true) and 0 (false)\n- [ ] NO positive integers (1, 2, etc.) used as booleans\n- [ ] Functions returning booleans return -1 for true\n- [ ] Boolean logic with `~`, `&`, `|` uses correct values\n- [ ] Tests verify boolean operations work correctly\n\n**Jetton Security (CRITICAL)**:\n- [ ] `transfer_notification` handler validates sender address\n- [ ] Sender checked against stored Jetton wallet address\n- [ ] Jetton wallet address stored during initialization\n- [ ] Admin function to set\u002Fupdate Jetton wallet\n- [ ] Cannot trust forward_payload without sender validation\n- [ ] Tests with fake Jetton contracts verify rejection\n\n**Gas & Forward Amounts (HIGH)**:\n- [ ] Forward TON amounts are fixed\u002Fbounded\n- [ ] OR user-provided amounts validated: `msg_value >= tx_fee + forward_amount`\n- [ ] Contract balance protected from drainage\n- [ ] Appropriate `send_raw_message` flags used\n- [ ] Tests verify cannot drain contract with excessive forward amounts\n\n**Testing**:\n- [ ] Unit tests for all three vulnerability types\n- [ ] Integration tests with real Jetton contracts\n- [ ] Gas cost analysis for all operations\n- [ ] Testnet deployment before mainnet\n",{"name":5,"description":7},"main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Fton-vulnerability-scanner",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add agisota\u002Fold-one --skill ton-vulnerability-scanner",{"tool":38,"command":39},"bunx","bunx skills add agisota\u002Fold-one --skill ton-vulnerability-scanner",{"tool":41,"command":42},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill ton-vulnerability-scanner","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fton-vulnerability-scanner\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"resources\u002FVULNERABILITY_PATTERNS.md","REFERENCE","参考文档",18564,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fton-vulnerability-scanner\u002Fresources\u002FVULNERABILITY_PATTERNS.md",[53,60,67,76,83,90],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":71,"licenseFileUrl":72,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]