npx skills add ...
npx skills add trailofbits/skills --skill algorand-vulnerability-scanner
Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing field validations, and access control issues. Use when auditing Algorand projects (TEAL/PyTeal).
npx skills add trailofbits/skills --skill algorand-vulnerability-scanner
Systematically scan Algorand smart contracts (TEAL and PyTeal) for platform-specific security vulnerabilities documented in Trail of Bits' "Not So Smart Contracts" database. This skill encodes 11 critical vulnerability patterns unique to Algorand's transaction model.
.teal.py with PyTeal importsapproval_program.py / clear_program.pycontract.teal / signature.tealuv tool install tealer (ensure uv's tool bin dir is on PATH)tealer contract.teal --detect allWhen invoked, I will:
When vulnerabilities are found, you'll get a report like this:
I check for 11 critical vulnerability patterns unique to Algorand. For detailed detection patterns, code examples, mitigations, and testing strategies, see VULNERABILITY_PATTERNS.md.
Global.group_size() validation on atomic groupsFor complete vulnerability patterns with code examples, see VULNERABILITY_PATTERNS.md.
.teal, .py)For each of the 11 vulnerabilities above:
Create checklist for all transaction types used:
Payment Transactions:
Asset Transfers:
Application Calls:
Inner Transactions:
For atomic transaction groups:
Global.group_size() checksReport on every pattern in §6, whether or not it turned anything up. Emit this table above the findings, with all 11 rows present:
| # | Pattern | Verdict | Evidence |
|---|---|---|---|
| 1 | Rekeying Attack | found | approval.py:45 -- no Txn.rekey_to() assertion on the payment branch |
| 2 | Unchecked Transaction Fee | ||
| 3 | Closing Account (CloseRemainderTo) | ||
| 4 | Closing Asset (AssetCloseTo) | ||
| 5 | Group Size Check | ||
| 6 | Time-Based Replay Attack | ||
| 7 | Access Controls | ||
| 8 | Asset ID Verification | ||
| 9 | Denial of Service (Asset Opt-In) | ||
| 10 | Inner Transaction Fee | ||
| 11 | Clear State Transaction |
Each verdict is one of:
found — cite file:line and write the finding up in full below.clear — the pattern applies to this contract and the contract handles it. Name the field, opcode, or
check you searched for, so a reader can repeat the search.n/a — the pattern cannot apply here. Give the reason in one clause ("no inner transactions in this
contract"). Not having looked is not n/a.A table with fewer than 11 rows is an incomplete scan and must be reported as one. A row whose Verdict cell is empty is incomplete in the same way: row 1 above is filled in to show the shape, and every row is filled in the same way before the report is done. Eleven clear verdicts is
a result a reader can act on. A report that covers four patterns and says nothing about the other seven reads
exactly like a clean contract, and that is the failure this table exists to prevent.
building-secure-contracts/not-so-smart-contracts/algorand/Before completing Algorand audit, verify ALL items checked:
found, clear or n/a with a reasonn/a costs one
clause and makes the judgment reviewable. Silence records nothing, and a reader cannot tell it apart from
not having checked.file:line, and split-program contracts are where these checks go missing.=== ALGORAND VULNERABILITY SCAN RESULTS ===
Project: my-algorand-dapp
Files Scanned: 3 (.teal, .py)
Vulnerabilities Found: 2
Coverage: 11/11 patterns reported
1 Rekeying Attack ................... found approval.py:45
2 Unchecked Transaction Fee ......... n/a stateful app, fees paid by sender
3 Closing Account ................... clear Assert(Txn.close_remainder_to() == Global.zero_address())
... one row per pattern, all 11 present ...
---
[CRITICAL] Rekeying Attack
File: contracts/approval.py:45
Pattern: Missing RekeyTo validation
Code:
If(Txn.type_enum() == TxnType.Payment,
Seq([
# Missing: Assert(Txn.rekey_to() == Global.zero_address())
App.globalPut(Bytes("balance"), balance + Txn.amount()),
Approve()
])
)
Issue: The contract doesn't validate the RekeyTo field, allowing attackers
to change account authorization and bypass restrictions.# Run Tealer on contract
tealer contract.teal --detect all
# Or specific detectors
tealer contract.teal --detect unprotected-rekey,group-size-check,update-application-check# Add to CI/CD pipeline
tealer approval.teal --detect all --json > tealer-report.json
# Fail build on critical findings
tealer approval.teal --detect all --fail-on critical,high