AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

entry-point-analyzer

Analyzes smart contract codebases to identify state-changing entry points for security auditing. Detects externally callable functions that modify state, categorizes them by access level (public, admin, role-restricted, contract-only), and generates structured audit reports. Excludes view/pure/read-only functions. Use when auditing smart contracts (Solidity, Vyper, Solana/Rust, Move, TON, CosmWasm) or when asked to find entry points, audit flows, external functions, access control patterns, or privileged operations.

Original source
trailofbits
License
CC-BY-SA-4.0
Pinned revision
2be6433b39e009cd2b6fd3be1895f6b1faa5af9a

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

This skill also requires local files or dependencies. Remote reading alone may not be enough.

Ask your assistant

Use Agentic Memory skills to read trailofbits--entry-point-analyzer at revision 2be6433b39e009cd2b6fd3be1895f6b1faa5af9a, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 8

references/move-aptos.md

Move Entry Point Detection (Aptos)

Entry Point Identification (State-Changing Only)

Include state-changing public fun, public entry fun, and entry fun functions. Aptos transaction scripts can call public functions without the entry modifier. Inspect bodies and callees for state effects rather than assuming visibility implies mutation. Private non-entry, public(package), and public(friend) functions are not independent transaction entry points; trace them when reachable from an included function.

Aptos Move

// Public entry functions are entry points
public entry fun transfer(from: &signer, to: address, amount: u64) { }

// Public functions callable by modules and transaction scripts
public fun read_value(): u64 { 0 } // Read-only body: exclude from this inventory

// Entry-only functions (can't be called by other modules)
entry fun private_entry(account: &signer) { }

Visibility Rules

| Visibility | Include? | Notes | |------------|----------|-------| | public entry fun | Yes | Transaction entry point (state-changing) | | entry fun | Yes | Transaction-only entry point | | public fun | Yes, if state-changing | Callable through transaction scripts or other modules | | fun (private) | No | Not externally callable | | public(friend) fun | No | Friend modules only |

Access Control Patterns

Signer-Based Control (Aptos)

// Admin check via signer
public entry fun admin_action(admin: &signer) {
    assert!(signer::address_of(admin) == @admin_address, E_NOT_ADMIN);
}

// Owner check via resource
public entry fun owner_action(owner: &signer) acquires Config {
    let config = borrow_global<Config>(@module_addr);
    assert!(signer::address_of(owner) == config.owner, E_NOT_OWNER);
}

Capability Pattern (Aptos)

// Capability resource
struct AdminCap has key, store {}

// Requires capability
public entry fun admin_action(admin: &signer) acquires AdminCap {
    assert!(exists<AdminCap>(signer::address_of(admin)), E_NO_CAP);
}

Access Control Classification

| Pattern | Classification | |---------|----------------| | signer::address_of(s) == @admin | Admin | | signer::address_of(s) == config.owner | Owner | | exists<AdminCap>(addr) | Admin (capability) | | exists<GovernanceCap>(addr) | Governance | | exists<GuardianCap>(addr) | Guardian | | &signer with no role checks | Public; record which signer's resources it can access |

Contract-Only Detection

Friend Functions

// Only callable by friend modules
public(friend) fun internal_callback() { }

// Friend declaration
friend other_module;

Module-to-Module Patterns

// Functions designed for other modules
public fun on_transfer_hook(amount: u64): bool {
    // Intended for token modules, but public visibility also permits scripts
}

Extraction Strategy

Aptos

  1. Parse all .move files
  2. Find module declarations
  3. Extract public fun, public entry fun, and entry fun; exclude read-only bodies
  4. Check function body for:
    • signer::address_of comparisons → Role-based
    • exists<*Cap> checks → Capability-based
    • No caller-role checks → Public (Unrestricted); a signer argument alone is not an admin check
  5. Record capability and signer requirements, including whether callers can obtain the required values

Move-Specific Considerations

  1. Resource Model: Access control often through resource ownership
  2. Capabilities: Cap suffix typically indicates capability pattern
  3. Acquires: acquires Resource shows what global resources are accessed
  4. Generic Types: Type parameters may carry capability constraints
  5. Friend Visibility: public(friend) limits callers to declared friends

Common Gotchas

  1. Init Functions: init or initialize often create initial capabilities
  2. Module Upgrades: Check upgrade capability ownership
  3. Phantom Types: Type parameters with phantom don't affect runtime