mcpField
N
near-contract-audit

near-contract-audit

github.com/nearSecurity1670 installsUpdated 4w ago
Repository

About near-contract-audit

A security-audit skill for NEAR smart contracts written in Rust, intended for auditors and coding agents. It combines automated analysis with manual review and organizes findings by severity, location, and remediation.

Key features

  1. 01Scan common vulnerability patterns
  2. 02Review business logic and access control
  3. 03Assess exploitability of findings
  4. 04Generate severity-based audit reports
  5. 05Consult vulnerability detector references

Use cases

  1. 01Audit NEAR Rust contract security
  2. 02Verify whether scan results are true positives
  3. 03Prepare remediation guidance for findings

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/near/agent-skills --skill near-contract-audit

After installing, type/near-contract-auditin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
high-severity.md
low-severity.md
medium-severity.md

Details

From the project README

NEAR Contract Audit

Security audit skill for NEAR smart contracts in Rust.

Audit Workflow

Phase 1: Automated Analysis

Run your preferred Rust static analysis and NEAR-focused security tools on the contract to:

  • Scan for common vulnerability patterns (reentrancy, unsafe math, unhandled promises, access control issues, etc.)
  • Highlight potentially risky patterns for deeper manual review
Phase 2: Manual Review

After automated analysis, perform manual review for:

  • Business logic vulnerabilities
  • Access control patterns
  • Economic attack vectors
  • Cross-contract interaction safety
Phase 3: Code-Specific Analysis

For each finding, verify:

  1. Is it a true positive?
  2. What is the exploitability?
  3. What is the recommended fix?
Phase 4: Report Generation

Document findings with severity, location, description, and remediation.

Vulnerability Quick Reference

SeverityDetector IDDescription
Highnon-private-callbackCallback missing #[private] macro
HighreentrancyState change after cross-contract call
Highincorrect-argument-or-return-typesUsing native integer types in JSON interfaces
Highunsaved-changesCollection modifications not persisted
Highowner-checkMissing caller/owner verification
Highyocto-attachMissing assert_one_yocto on sensitive functions
Highstorage-collisionSame storage prefix for different collections
Highrequired-initialization-macroMissing #[init] on initialization method
Mediumgas-griefingUnbounded loops causing DoS
Mediuminsecure-randomPredictable randomness from block data
Mediumprepaid-gasInsufficient gas reserved for callbacks
Lowcover-storage-costMissing storage deposit verification
Lowunsafe-mathArithmetic without overflow checks
Lowfloat-mathUsing floating point types for financial math

Reference Files

For detailed vulnerability documentation with code examples:

Comments

Markdown supported