/auditsentry:oracle-manipulationfrom auditsentry
Detects oracle manipulation risks in Solidity smart contracts: spot-price reads from AMMs, stale Chainlink data, single-source dependence, TWAP gaming, and price scaling errors.
Ships in auditsentry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Any code that consumes a price feed or derives a price from on-chain state:
latestAnswer, latestRoundData, getRoundDatagetReserves, getAmountsOut, price0Averageslot0, observe, consultget_virtual_price, get_dygetRate(uint112 r0, uint112 r1,) = pair.getReserves();
uint256 price = r1 * 1e18 / r0; // ← flash-loan manipulable in one block
(, int256 answer,,,) = feed.latestRoundData(); // ← ignores updatedAt and answeredInRound
Required checks:
updatedAt != 0block.timestamp - updatedAt <= heartbeat (with chain-specific tolerance)answeredInRound >= roundIdanswer > 0latestAnswer (deprecated, no freshness) (HIGH)int256 p = feed.latestAnswer(); // ← deprecated, prefer latestRoundData
Only one oracle, no fallback, no cross-check against a second source.
slot0 without TWAP (CRITICAL)(uint160 sqrtPriceX96,,,,,,) = pool.slot0(); // ← spot, manipulable
Use observe() for TWAP with sufficient lookback (≥30min for shallow pools).
TWAP < 5 min on volatile assets or low-liquidity pools is gameable across two blocks.
Reading getVirtualPrice / getReserves mid-callback — see [[reentrancy]] §Read-only.
LP token price should use the fair LP price formula (Alpha Homora's method), not reserve / totalSupply.
Chainlink answers come in feed-specific decimals; mixing ETH/USD (8 decimals) with token (18 decimals) without normalizing produces silent off-by-1e10 errors.
On Arbitrum, Optimism, Base — must check SequencerUptimeFeed to avoid stale prices when sequencer is down.
| Pattern | Severity |
|---|---|
| Spot-price from AMM used in liquidation/mint | Critical |
Uniswap V3 slot0 used for collateral pricing | Critical |
LP token priced via raw reserve / totalSupply | Critical |
latestRoundData without freshness/round checks | High |
| Single oracle, no fallback, financial-critical path | High |
| Sequencer uptime check missing on L2 | High |
| Insufficient TWAP window (<5min on shallow pool) | High |
| Stale heartbeat for known-volatile asset | High |
latestAnswer (deprecated) used | Medium |
| Decimal-scaling mistake | High |
(roundId, answer, , updatedAt, answeredInRound) — guard against stale + zero + non-positive + round-mismatch.2 * sqrt(r0 * r1 * p0 * p1) / totalSupply.SequencerUptimeFeed (Arbitrum, Optimism, Base).slot0 and spot-price reads for anything that affects user funds.getReserves used purely for ratio diagnostics with no downstream effect — Info.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentry45 skills in this plugin
/access-controlDetect missing or incorrect access control — missing modifiers, wrong role checks, privileged function exposure, public initializers, and role-escalation paths. Activate on any function that mutates state, transfers funds, mints tokens, sets admin parameters, upgrades implementations, or pauses/unpauses./approval-issuesDetect ERC-20 approval pitfalls — approve race (front-run), missing safeApprove, infinite approvals, approval-without-revoke, Permit2 misuse, max-approval to untrusted contracts. Activate on `approve`, `safeApprove`, `permit`, `forceApprove`, `Permit2`, `IERC20.allowance`./caching-and-incrementalAlways-on meta-skill — cache audit results per file by content hash so unchanged files aren't re-analyzed on subsequent runs. Activate on every /audit, /quick-scan, /audit-changes invocation.Other plugins' skills for the same job