inline-assembly

Solid

Detect bugs in inline Yul / assembly — manual memory mismanagement, free-memory-pointer corruption, return-data manipulation, missing return-data-size checks, dirty-bits in narrow types. Activate on any `assembly { … }` block, Yul code, Solady-style assembly usage.

AI & Automation 38 stars 5 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
53
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Inline assembly / Yul auditor ## When this applies - Any `assembly { … }` block - Pure Yul contracts - Solady's heavy use of optimized assembly - Custom delegatecall wrappers, manual memory copy, custom signature verifiers - Gas-optimization-driven assembly substitutions of Solidity primitives ## Detection patterns ### Free-memory-pointer not updated after allocation (HIGH) ```solidity assembly { let ptr := mload(0x40) mstore(ptr, value) // ← didn't bump 0x40, next allocation corrupts } ``` After writing memory, update `mload(0x40)` to past the write. ### Memory clobbering via reused scratch space (HIGH) Yul scratch is `0x00-0x3F`. External calls / Solidity assignments may overwrite. Don't store across foreign-code boundaries. ### Return data not size-checked (HIGH) ```solidity assembly { let ok := call(gas(), target, 0, in, insz, 0, 32) returndatacopy(0, 0, 32) let r := mload(0) // ← if target returned < 32 bytes, r has trailing memory garbage } ``` Check `returndatasize()` before copying. ### Dirty high bits in narrow types (HIGH) A `uint8` read from calldata via `calldataload` has the high 248 bits unmasked. Mask with `and(..., 0xff)` before comparing. ### Returning attacker-controlled memory (HIGH) ```solidity assembly { return(0, calldatasize()) } // ← returns calldata; if function spec says bytes32, parsers blow up ``` ### Mishandling 0x40 / 0x60 (FMP and zero slot) (HIGH) Writing to `0x60` (zero slot) is a known footgun — that slo...

Details

Author
iktok90-design
Repository
iktok90-design/ai-smart-contract-auditor
Created
1 weeks ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

assembly-systems-crypto-and-inline

Use when writing systems-level assembly (interrupt handlers, context switches, syscall stubs, boot code, privileged instructions), cryptographic or constant-time assembly (the three rules, the hardware contract and why it changed, going beyond hand-writing), inline assembly and compiler intrinsics (GCC/Clang extended asm constraints and clobbers, when to prefer intrinsics), or debugging, testing, and verifying hand-written assembly with GDB, sanitizers, and differential testing.

1 Updated today
adammatthewsteinberger
AI & Automation Listed

assembly-reference

Use when reviewing assembly for known anti-patterns, weighing contested questions (hand-written asm vs compilers, CISC vs RISC, fixed-width SIMD vs scalable vectors, AVX-512's design, whether and which ISA to learn first), checking whether an ISA or microarchitecture claim is still current (snapshot verified August 2026), finding the authoritative vendor manuals, performance references, books, and people, or needing the quick-reference numbers, first moves, and hand-written-assembly review checklist. Companion to the other assembly-programming skills.

1 Updated today
adammatthewsteinberger
AI & Automation Solid

storage-layout

Detect storage-layout issues in upgradeable contracts — slot collisions, slot reuse, packing changes, missing gap. Activate when reviewing UUPS/Transparent proxies, OZ Upgradeable contracts, diamonds (EIP-2535), libraries with structs, or any contract using assembly to read storage slots.

38 Updated 2 days ago
iktok90-design