Audit Algorand contracts
Audit the behavior an attacker can reach, then explain each issue through a
violated invariant and a reproducible path. A checklist is coverage support;
it is not evidence that a vulnerability exists.
This skill covers Algorand TypeScript and PuyaTs. Do not introduce Python,
PyTEAL, Beaker, or raw-TEAL implementation guidance. Load build-on-algorand
when the user also asks to implement fixes or needs broader PuyaTs application
guidance. Load use-vibekit before any deployment, signing, network, account,
LocalNet, or on-chain action.
Establish scope before judging safety
Read the repository instructions, package manifests, lockfile, compiler
configuration, contract source, generated ARC-56 and TEAL artifacts, clients,
and tests that are in scope. Use the project's pinned commands and
dependencies. Do not add a dependency or change production code during an
audit unless the user explicitly asks for remediation.
Record:
- the reviewed commit or working-tree state;
- included contracts, LogicSigs, clients, artifacts, and tests;
- target network and active or assumed consensus protocol;
- compiler and optimization settings;
- excluded components and assumptions;
- whether generated artifacts match the reviewed source;
- commands that ran, failed, or could not run.
Treat missing source, stale artifacts, failing tests, and unverified deployment
bytecode as limitations. Do not silently fill those gaps with assumptions.
Load the audit guides
Read Methodology and reporting for
every audit. Then load every guide whose feature appears in the system:
| Surface |
Guide |
| ABI methods, privileges, lifecycle handlers, upgrades, deletion, pausing |
Applications and authorization |
| Payments, asset transfers, inner transactions, fees, atomic groups, ASA control |
Transactions and assets |
| Local/global/box state, clear state, MBR, state machines, accounting, numeric formulas |
State and arithmetic |
| Contract-account or delegated smart signatures |
Logic Signatures |
| Randomness, oracles, compiler and artifact verification, clients, keys, monitoring |
External systems and release |
For a full audit, load every applicable guide. For a focused review, state
which surfaces were intentionally excluded. If the code reveals a new surface,
load its guide before completing the review.
Build the security model
Before searching for bugs:
- Identify assets that can be stolen, frozen, minted, destroyed, redirected,
or permanently locked.
- Identify principals and authorities: arbitrary callers, users, admins,
creators, multisigs, application accounts, LogicSig delegates, oracles, and
off-chain operators.
- Map every public entry point, lifecycle action, inner transaction, external
application call, and state transition.
- State the invariants that must hold across calls and atomic groups.
- Separate intended trust assumptions from accidental privileges.
Assume an attacker can create accounts and assets, choose every unvalidated
argument and transaction field, arrange and pad atomic groups, repeat calls,
clear their local state, observe public values, copy pending transactions,
choose boundary values, and exploit unavailable external services. Treat a
compromised privileged key as a separate scenario unless the design claims to
tolerate it.
Trace reachable behavior
For each entry point, trace:
- who can call it and how authorization is established;
- which arguments and transaction fields are attacker-controlled;
- state and asset reads before the call;
- state, balance, asset, authority, and lifecycle changes after the call;
- behavior when the call is repeated, reordered, grouped, interrupted, or
supplied boundary values;
- assumptions enforced only by a client, deployment script, or operator.
Follow value across the entire path. A receiver check without an asset-ID
check, an admin check around unsafe arithmetic configuration, or a timelock
that never binds the proposed program bytes still leaves the relevant
invariant unproven.
Corroborate findings
A confirmed finding needs all four elements:
- an attacker capability or failed trusted component;
- a reachable path through the reviewed system;
- a specific violated invariant;
- a concrete security impact.
Use source locations, existing tests, generated TEAL, simulation traces, or a
minimal reproducer as evidence. Prefer a focused negative test when the
project's harness supports one. Never execute an exploit against a public or
shared network. On-chain verification or writes require use-vibekit and the
user's authorization.
Do not report a missing best practice as a vulnerability without showing how
it changes reachable behavior. Put unexploitable hardening opportunities,
centralization assumptions, and incomplete evidence in their own sections.
Finish with an auditable report
Use the report and severity model in
Methodology and reporting. Sort
findings by severity, keep confidence separate from impact, and include a
regression-test idea with every remediation.
End with:
- coverage achieved and surfaces not reviewed;
- commands and artifacts used as evidence;
- unresolved questions and residual risks;
- an explicit statement when no confirmed findings were identified.
Avoid claiming that a review proves the absence of vulnerabilities or replaces
an independent professional audit for a high-value deployment.
1---2name: audit-algorand3description: Perform structured security audits and adversarial reviews of TypeScript Algorand applications and LogicSigs compiled with PuyaTs. Use for vulnerability assessments, threat models, exploit analysis, mainnet-readiness reviews, security findings, and remediation guidance involving AVM contracts, generated TEAL or ARC-56 artifacts, transaction groups, assets, state, upgrades, or external dependencies. Excludes Python, deployment execution, generic implementation work, and non-security code review.4---56# Audit Algorand contracts78Audit the behavior an attacker can reach, then explain each issue through a9violated invariant and a reproducible path. A checklist is coverage support;10it is not evidence that a vulnerability exists.1112This skill covers Algorand TypeScript and PuyaTs. Do not introduce Python,13PyTEAL, Beaker, or raw-TEAL implementation guidance. Load `build-on-algorand`14when the user also asks to implement fixes or needs broader PuyaTs application15guidance. Load `use-vibekit` before any deployment, signing, network, account,16LocalNet, or on-chain action.1718## Establish scope before judging safety1920Read the repository instructions, package manifests, lockfile, compiler21configuration, contract source, generated ARC-56 and TEAL artifacts, clients,22and tests that are in scope. Use the project's pinned commands and23dependencies. Do not add a dependency or change production code during an24audit unless the user explicitly asks for remediation.2526Record:2728- the reviewed commit or working-tree state;29- included contracts, LogicSigs, clients, artifacts, and tests;30- target network and active or assumed consensus protocol;31- compiler and optimization settings;32- excluded components and assumptions;33- whether generated artifacts match the reviewed source;34- commands that ran, failed, or could not run.3536Treat missing source, stale artifacts, failing tests, and unverified deployment37bytecode as limitations. Do not silently fill those gaps with assumptions.3839## Load the audit guides4041Read [Methodology and reporting](references/methodology-and-reporting.md) for42every audit. Then load every guide whose feature appears in the system:4344| Surface | Guide |45| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |46| ABI methods, privileges, lifecycle handlers, upgrades, deletion, pausing | [Applications and authorization](references/applications-and-authorization.md) |47| Payments, asset transfers, inner transactions, fees, atomic groups, ASA control | [Transactions and assets](references/transactions-and-assets.md) |48| Local/global/box state, clear state, MBR, state machines, accounting, numeric formulas | [State and arithmetic](references/state-and-arithmetic.md) |49| Contract-account or delegated smart signatures | [Logic Signatures](references/logic-signatures.md) |50| Randomness, oracles, compiler and artifact verification, clients, keys, monitoring | [External systems and release](references/external-systems-and-release.md) |5152For a full audit, load every applicable guide. For a focused review, state53which surfaces were intentionally excluded. If the code reveals a new surface,54load its guide before completing the review.5556## Build the security model5758Before searching for bugs:59601. Identify assets that can be stolen, frozen, minted, destroyed, redirected,61 or permanently locked.622. Identify principals and authorities: arbitrary callers, users, admins,63 creators, multisigs, application accounts, LogicSig delegates, oracles, and64 off-chain operators.653. Map every public entry point, lifecycle action, inner transaction, external66 application call, and state transition.674. State the invariants that must hold across calls and atomic groups.685. Separate intended trust assumptions from accidental privileges.6970Assume an attacker can create accounts and assets, choose every unvalidated71argument and transaction field, arrange and pad atomic groups, repeat calls,72clear their local state, observe public values, copy pending transactions,73choose boundary values, and exploit unavailable external services. Treat a74compromised privileged key as a separate scenario unless the design claims to75tolerate it.7677## Trace reachable behavior7879For each entry point, trace:8081- who can call it and how authorization is established;82- which arguments and transaction fields are attacker-controlled;83- state and asset reads before the call;84- state, balance, asset, authority, and lifecycle changes after the call;85- behavior when the call is repeated, reordered, grouped, interrupted, or86 supplied boundary values;87- assumptions enforced only by a client, deployment script, or operator.8889Follow value across the entire path. A receiver check without an asset-ID90check, an admin check around unsafe arithmetic configuration, or a timelock91that never binds the proposed program bytes still leaves the relevant92invariant unproven.9394## Corroborate findings9596A confirmed finding needs all four elements:97981. an attacker capability or failed trusted component;992. a reachable path through the reviewed system;1003. a specific violated invariant;1014. a concrete security impact.102103Use source locations, existing tests, generated TEAL, simulation traces, or a104minimal reproducer as evidence. Prefer a focused negative test when the105project's harness supports one. Never execute an exploit against a public or106shared network. On-chain verification or writes require `use-vibekit` and the107user's authorization.108109Do not report a missing best practice as a vulnerability without showing how110it changes reachable behavior. Put unexploitable hardening opportunities,111centralization assumptions, and incomplete evidence in their own sections.112113## Finish with an auditable report114115Use the report and severity model in116[Methodology and reporting](references/methodology-and-reporting.md). Sort117findings by severity, keep confidence separate from impact, and include a118regression-test idea with every remediation.119120End with:121122- coverage achieved and surfaces not reviewed;123- commands and artifacts used as evidence;124- unresolved questions and residual risks;125- an explicit statement when no confirmed findings were identified.126127Avoid claiming that a review proves the absence of vulnerabilities or replaces128an independent professional audit for a high-value deployment.