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/vyper.md

Vyper Entry Point Detection

Entry Point Identification (State-Changing Only)

Include: State-Changing Functions

@external                    # State-changing entry point
def function_name():
    pass

@external
@payable                     # State-changing, receives ETH
def payable_function():
    pass

@external
@nonreentrant("lock")        # State-changing with reentrancy protection
def protected():
    pass

Exclude: Read-Only Functions

@external
@view                        # EXCLUDE - cannot modify state
def read_only():
    pass

@external
@pure                        # EXCLUDE - no state access
def pure_function():
    pass

Decorator Matrix

| Decorators | Include? | Notes | |------------|----------|-------| | @external | Yes | State-changing entry point | | @external @payable | Yes | State-changing, receives ETH | | @external @nonreentrant | Yes | State-changing with protection | | @external @view | No | Read-only, exclude | | @external @pure | No | No state access, exclude | | @internal | No | Not externally callable | | @deploy | No | Constructor (Vyper 0.4+) |

Special Entry Points

@external
@payable
def __default__():           # Fallback function (receives ETH + unmatched calls)
    pass

Access Control Patterns

Owner Pattern

owner: public(address)

@external
def restricted_function():
    assert msg.sender == self.owner, "Not owner"
    # ...

Role-Based Patterns

# Common patterns
admin: public(address)
governance: public(address)
guardian: public(address)
operator: public(address)

# Mapping-based roles
authorized: public(HashMap[address, bool])
minters: public(HashMap[address, bool])

@external
def mint(to: address, amount: uint256):
    assert self.minters[msg.sender], "Not minter"
    # ...

Access Control Classification

| Pattern | Classification | |---------|----------------| | assert msg.sender == self.owner | Admin/Owner | | assert msg.sender == self.admin | Admin | | assert msg.sender == self.governance | Governance | | assert msg.sender == self.guardian | Guardian | | assert self.authorized[msg.sender] | Review Required | | assert self.whitelist[msg.sender] | Review Required |

Contract-Only Detection

Callback Functions

A callback name does not restrict callers. Classify the body's actual assertions; an unguarded state-changing callback is Public (Unrestricted).

@external
def onERC721Received(...) -> bytes4:
    return method_id("onERC721Received(address,address,uint256,bytes)")

@external
def uniswapV3SwapCallback(amount0: int256, amount1: int256, data: Bytes[...]):
    # Must verify caller is the pool
    pass

Contract-Caller Checks

assert msg.sender == self.pool, "Only pool"
assert msg.sender != tx.origin, "No direct call"  # Call-path condition, not protocol authentication

Extraction Strategy

  1. Parse all .vy files
  2. For each function:
    • Check for @external decorator
    • Skip functions with @view or @pure decorators
    • Record function name and parameters
    • Record line number
    • Check for access control assertions in function body
  3. Classify:
    • No access assertions → Public (Unrestricted)
    • msg.sender == self.X → Check what X is
    • self.mapping[msg.sender] → Review Required
    • Caller pinned to an established integration contract → Contract-Only
    • Caller checked against an unresolved configured address → Review Required
    • Callback name without caller checks → Public (Unrestricted)

Vyper-Specific Considerations

  1. No Modifiers: Vyper doesn't have modifiers—access control is inline assert statements
  2. No Inheritance: Each contract is standalone (interfaces only)
  3. Explicit is Better: All visibility must be declared explicitly
  4. Default Internal: Functions without decorators are internal

Common Gotchas

  1. Initializer Pattern: Look for initialized: bool flag with one-time setup
  2. Raw Calls: raw_call() can delegate to other contracts
  3. Create Functions: create_minimal_proxy_to(), create_copy_of() are factory patterns
  4. Reentrancy: @nonreentrant protects against reentrancy but function is still entry point