Rules › Anchor (Rust)

Unchecked account without a /// CHECK: note

highAnchor (Rust)Rule anchor-unchecked-account

AccountInfo and UncheckedAccount skip Anchor's owner and type checks; each needs an explicit reason and manual checks.

Why it matters

AccountInfo and UncheckedAccount tell Anchor to skip its owner, discriminator and type checks. Anchor refuses to build them without a /// CHECK: doc comment, because each one is a place where an attacker can pass any account they like. The comment should say why the account is safe, and the code should actually check it (key, owner or data).

Vulnerable

#[derive(Accounts)]
pub struct Proxy<'info> {
    pub target: UncheckedAccount<'info>,
}

Fixed

#[derive(Accounts)]
pub struct Proxy<'info> {
    /// CHECK: only used as the CPI target; its key is checked against EXPECTED_PROGRAM
    #[account(address = EXPECTED_PROGRAM)]
    pub target: UncheckedAccount<'info>,
}

What other tools call it

ToolDetector or reference
Anchoranchor build error: unsafe field
Sealevel attacks2-owner-checks, 3-type-cosplay

Check your code

Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.

Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.