Agent skill

Oracle Manipulation

by ccashwell in ccashwell/evm-cortex

Oracle attack vectors and safe integration patterns for DeFi protocols.

MITAuto-check passedBusiness, Finance & HR

Install Oracle Manipulation

skills CLI
$ npx skills add ccashwell/evm-cortex --skill oracle-manipulation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ccashwell/evm-cortex oracle-manipulation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/oracle-manipulation .claude/skills/oracle-manipulation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
oracle-manipulation
GitHub stars
131
Token cost
~1.5k tokens
SKILL.md length
311 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Oracle attack vectors and safe integration patterns for DeFi protocols.

  • Integrating Chainlink
  • SKILL.md covers Spot Price Manipulation, TWAP Oracle (Time-Weighted…, Multi-Block TWAP Manipulation and Chainlink Integration, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Any price oracle

What it does

Oracle Manipulation is an agent skill from ccashwell/evm-cortex. Oracle attack vectors and safe integration patterns for DeFi protocols. Use when integrating Chainlink, Uniswap TWAP, or any price oracle. Covers staleness checks, L2 sequencer downtime, sandwich oracle updates, and fallback strategies.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR, covering Third-party API integration and Crypto and DeFi analysis. It works with Uniswap. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Integrating Chainlink
  • Any price oracle

Example prompts

  • “/oracle-manipulation”

What it can do on your machine

Read from SKILL.md and the folder at commit f8f3301. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are solidity).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Oracle Manipulation loads about 1.5k tokens when it runs. Until then it costs about 64 tokens; SKILL.md has 311 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~64
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ccashwell/evm-cortex at commit f8f3301, republished under its MIT licence (© ccashwell). 311 words, ~1,518 tokens.

Download SKILL.mdSave it as .claude/skills/oracle-manipulation/SKILL.md (or your agent's skills folder).
name
oracle-manipulation
description
Oracle attack vectors and safe integration patterns for DeFi protocols. Use when integrating Chainlink, Uniswap TWAP, or any price oracle. Covers staleness checks, L2 sequencer downtime, sandwich oracle updates, and fallback strategies.

Oracle Manipulation

Spot Price Manipulation

Spot prices from DEXs (Uniswap V2 reserves, Curve pool balances) can be manipulated within a single transaction via flash loans.

solidity
// VULNERABLE: reads instantaneous reserves
function getPrice(address pair) external view returns (uint256) {
    (uint112 reserve0, uint112 reserve1,) = IUniswapV2Pair(pair).getReserves();
    return uint256(reserve1) * 1e18 / uint256(reserve0); // easily manipulated
}

Never use spot prices for:

  • Collateral valuation
  • Liquidation thresholds
  • Governance decisions
  • Any value-bearing calculation

TWAP Oracle (Time-Weighted Average Price)

TWAPs average prices over a time window, making manipulation expensive (attacker must sustain the manipulated price across blocks).

solidity
import {OracleLibrary} from "@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol";

function getTWAP(
    address pool,
    address baseToken,
    address quoteToken,
    uint128 baseAmount,
    uint32 twapWindow
) internal view returns (uint256 quoteAmount) {
    if (twapWindow == 0) revert InvalidTwapWindow();

    (int24 arithmeticMeanTick,) = OracleLibrary.consult(pool, twapWindow);

    quoteAmount = OracleLibrary.getQuoteAtTick(
        arithmeticMeanTick,
        baseAmount,
        baseToken,
        quoteToken
    );
}
TWAP Window Selection
WindowSecurityLatencyUse Case
1 minLowLowNot recommended
10 minMediumMediumFast-moving markets with monitoring
30 minHighHighLending protocols, collateral valuation
24 hrVery highVery highGovernance, long-term averaging

Shorter windows are cheaper to manipulate. For lending protocols, use 30+ minutes.

Multi-Block TWAP Manipulation

Post-merge, a single validator can propose consecutive blocks. With 2+ consecutive slots, a validator can manipulate a short TWAP without competition.

Defense: Use longer TWAP windows (>30 min) or combine TWAP with Chainlink.

solidity
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

error Oracle_StalePrice(address feed, uint256 updatedAt, uint256 maxAge);
error Oracle_InvalidRound(uint80 roundId, uint80 answeredInRound);
error Oracle_NegativePrice(int256 price);
error Oracle_SequencerDown();
error Oracle_GracePeriod();

uint256 public constant MAX_STALENESS = 3600; // 1 hour

function getChainlinkPrice(AggregatorV3Interface feed) internal view returns (uint256) {
    (
        uint80 roundId,
        int256 answer,
        ,
        uint256 updatedAt,
        uint80 answeredInRound
    ) = feed.latestRoundData();

    if (answer <= 0) revert Oracle_NegativePrice(answer);
    if (updatedAt == 0) revert Oracle_StalePrice(address(feed), 0, MAX_STALENESS);
    if (block.timestamp - updatedAt > MAX_STALENESS) {
        revert Oracle_StalePrice(address(feed), updatedAt, MAX_STALENESS);
    }
    if (answeredInRound < roundId) {
        revert Oracle_InvalidRound(roundId, answeredInRound);
    }

    return uint256(answer);
}

Different feeds have different heartbeats. Match your staleness check to the feed's heartbeat.

FeedHeartbeatSuggested MAX_STALENESS
ETH/USD (mainnet)1 hour3,600s
BTC/USD (mainnet)1 hour3,600s
USDC/USD24 hours86,400s
Low-cap tokensVariesCheck feed docs

L2 Sequencer Downtime

On L2s (Arbitrum, Optimism), if the sequencer goes down and comes back up, stale prices may be used. Check the sequencer uptime feed.

solidity
AggregatorV3Interface public immutable SEQUENCER_UPTIME_FEED;
uint256 public constant GRACE_PERIOD = 3600; // 1 hour

function _checkSequencer() internal view {
    (, int256 answer, , uint256 startedAt,) = SEQUENCER_UPTIME_FEED.latestRoundData();

    // answer == 0: sequencer is up
    // answer == 1: sequencer is down
    if (answer != 0) revert Oracle_SequencerDown();

    uint256 timeSinceUp = block.timestamp - startedAt;
    if (timeSinceUp < GRACE_PERIOD) revert Oracle_GracePeriod();
}

function getPrice(AggregatorV3Interface feed) external view returns (uint256) {
    _checkSequencer();
    return getChainlinkPrice(feed);
}

Sandwich Oracle Updates

Attackers can watch the mempool for Chainlink oracle update transactions and sandwich them.

1. See Chainlink update TX that will change ETH price from $2000 to $2100
2. Front-run: open leveraged long position at $2000 price
3. Oracle update executes: price becomes $2100
4. Back-run: close position at $2100, profit from the price jump

Defense: Use time-delayed oracle consumption or spread oracle updates over multiple blocks.

Multi-Oracle Fallback

solidity
function getPrice() external view returns (uint256 price) {
    // Try Chainlink first
    try this._getChainlinkPrice() returns (uint256 chainlinkPrice) {
        return chainlinkPrice;
    } catch {}

    // Fallback to TWAP
    try this._getTwapPrice() returns (uint256 twapPrice) {
        return twapPrice;
    } catch {}

    revert Oracle_AllFeedsFailed();
}

Oracle Integration Checklist

  • No spot price usage for value calculations
  • Chainlink: staleness check with feed-appropriate threshold
  • Chainlink: negative/zero price check
  • Chainlink: answeredInRound >= roundId check
  • L2: sequencer uptime feed checked with grace period
  • TWAP: window >= 30 minutes for security-critical reads
  • Fallback oracle configured for primary feed failure
  • Oracle decimals handled correctly (Chainlink USD feeds = 8 decimals)
  • Price deviation circuit breaker for sudden large moves

© ccashwell, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/oracle-manipulation of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Oracle Manipulation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Oracle Manipulation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Oracle Manipulation this skillccashwell/evm-cortex131—~1.5kAutomated safety check: PassMIT
Notebook To Strategytradingstrategy-ai/trade-executor160—~1.1kAutomated safety check: PassCustom licence
Building Blocksaustintgriffith/ethskills294—~2.9kAutomated safety check: PassNone
Oracle Flashloan Analysisquillai-network/quillshield_skills129—~2.8kAutomated safety check: PassMIT
Octav APIinternet-court/internet-court-skill6.4k—~3.8kAutomated safety check: PassMIT
Uniswap SwapNethereum/Nethereum2.3k—~2.1kAutomated safety check: PassMIT

Similar skills

  • Notebook To Strategy

    tradingstrategy-ai/trade-executor

    Transfer code from a backtesting Jupyter notebook to a Trade Executor strategy module

    160 GitHub stars~1.1k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Building Blocks

    austintgriffith/ethskills

    DeFi legos and protocol composability on Ethereum and L2s. An agent skill from austintgriffith/ethskills.

    294 GitHub stars~2.9k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Oracle Flashloan Analysis

    quillai-network/quillshield_skills

    Detects price oracle manipulation and flash loan attack vectors in DeFi smart contracts.

    129 GitHub stars~2.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Octav API

    internet-court/internet-court-skill

    Integrate with Octav API for cryptocurrency portfolio tracking, transaction history, and DeFi analytics across 50+ blockchain networks.

    6.4k GitHub stars~3.8k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Uniswap Swap

    Nethereum/Nethereum

    Swap tokens on Uniswap V2/V3/V4 using Nethereum (.NET/C). An agent skill from Nethereum/Nethereum.

    2.3k GitHub stars~2.1k tokensUpdated 3 days ago
    Business, Finance & HRAuto-check passed
  • Addresses

    austintgriffith/ethskills

    Verified contract addresses for major Ethereum protocols across mainnet and L2s.

    294 GitHub stars~7.1k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed

More from ccashwell/evm-cortex

All 89 skills in this repo
  • Xray Pre Audit

    ccashwell/evm-cortex

    A skill your agent uses when preparing for a security audit, performing reconnaissance on a new codebase, or creating a protocol overview.

    131 GitHub stars~25k tokensUpdated 8 days ago
    Auto-check passed
  • Aave Integration

    ccashwell/evm-cortex

    A skill your agent uses when integrating with Aave V3 for lending, borrowing, flash loans, or building on top of Aave markets.

    131 GitHub stars~1.3k tokensUpdated 8 days ago
    Auto-check passed
  • Access Control Patterns

    ccashwell/evm-cortex

    Access control design patterns for Solidity protocols. An agent skill from ccashwell/evm-cortex.

    131 GitHub stars~1.8k tokensUpdated 8 days ago
    Auto-check passed
  • Anvil Patterns

    ccashwell/evm-cortex

    A skill your agent uses when running a local Ethereum node with Anvil.

    131 GitHub stars~1.3k tokensUpdated 8 days ago
    Auto-check passed
  • Audit Breadth Scan

    ccashwell/evm-cortex

    A skill your agent uses when performing systematic breadth-first review of all contracts during a security audit.

    131 GitHub stars~1.4k tokensUpdated 8 days ago
    Auto-check passed
  • Audit Depth Analysis

    ccashwell/evm-cortex

    A skill your agent uses when performing deep analysis of specific findings or high-risk areas during a security audit.

    131 GitHub stars~1.6k tokensUpdated 8 days ago
    Auto-check passed

Works with

Questions about Oracle Manipulation

What does Oracle Manipulation do?

Oracle attack vectors and safe integration patterns for DeFi protocols. Oracle Manipulation is an agent skill from ccashwell/evm-cortex. Oracle attack vectors and safe integration patterns for DeFi protocols.

When should I use Oracle Manipulation?

Oracle Manipulation fits situations like: integrating Chainlink; any price oracle.

How do I install Oracle Manipulation in Claude Code?

Run `npx skills add ccashwell/evm-cortex --skill oracle-manipulation -a claude-code`. Or copy the skill folder (skills/oracle-manipulation in ccashwell/evm-cortex) into .claude/skills/oracle-manipulation in your project. Claude Code loads it when a task matches its description.

How do I install Oracle Manipulation in Codex?

Run `npx skills add ccashwell/evm-cortex --skill oracle-manipulation -a codex`. Or copy the skill folder (skills/oracle-manipulation in ccashwell/evm-cortex) into .agents/skills/oracle-manipulation in your project. Codex loads it when a task matches its description.

Can I use Oracle Manipulation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ccashwell/evm-cortex --skill oracle-manipulation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/oracle-manipulation, .gemini/skills/oracle-manipulation, .github/skills/oracle-manipulation and .opencode/skills/oracle-manipulation in your project.

What does Oracle Manipulation need to run?

SKILL.md names no scripts, command-line tools or credentials: Oracle Manipulation is instructions for the agent only.

Does Oracle Manipulation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Oracle Manipulation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Oracle Manipulation use?

Oracle Manipulation is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Oracle Manipulation use?

About 1.5k tokens (SKILL.md is roughly 6.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Oracle Manipulation?

Skills that share tags, products or a category with Oracle Manipulation: Notebook To Strategy (tradingstrategy-ai/trade-executor, 160 stars), Building Blocks (austintgriffith/ethskills, 294 stars), Oracle Flashloan Analysis (quillai-network/quillshield_skills, 129 stars) and Octav API (internet-court/internet-court-skill, 6.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Oracle Manipulation?

ccashwell (a GitHub user) maintains it in ccashwell/evm-cortex, which has 131 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on September 30, 2026.

Source: ccashwell/evm-cortex on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.