economic-attack-vectors

economic-attack-vectors is a skill for Claude Code, Codex from ccashwell/evm-cortex. It costs 60 tokens per session (1,619 once invoked), scanned A, original, MIT.

A guide to attacks that exploit how decentralised finance systems calculate shares, prices, and liquidity. It covers vaults, lending pools, automated market makers, and flash loans.

In plain words
What is it for?
Use it to review financial contract designs and add defences against first-depositor inflation, sandwich attacks, just-in-time liquidity, and flash-loan attacks.
Why use it?
It helps you find ways attackers could take value from users through manipulated deposits, donations, trades, or borrowed funds.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to review financial contract designs and add defences against first-depositor inflation, sandwich attacks, just-in-time liquidity, and flash-loan attacks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ccashwell/evm-cortex/economic-attack-vectors
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ccashwell/evm-cortex --skill economic-attack-vectors
Clone the repo
git clone --depth 1 https://github.com/ccashwell/evm-cortex

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for economic-attack-vectors

README.md
[![agentmods](https://agentmods.dev/badge/skills/ccashwell/evm-cortex/economic-attack-vectors/github.svg)](https://agentmods.dev/skills/ccashwell/evm-cortex/economic-attack-vectors)
Your own site
<a href="https://agentmods.dev/skills/ccashwell/evm-cortex/economic-attack-vectors"><img src="https://agentmods.dev/badge/skills/ccashwell/evm-cortex/economic-attack-vectors/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for economic-attack-vectors

Your own site · 80×15
<a href="https://agentmods.dev/skills/ccashwell/evm-cortex/economic-attack-vectors"><img src="https://agentmods.dev/badge/skills/ccashwell/evm-cortex/economic-attack-vectors.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,619 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.01619
Opus 5.5 $0.00024 $0.00648
Sonnet 5.5 $0.00012 $0.00324
Haiku 4.5 $0.00006 $0.00162

Measured 1mo ago against content hash 31216f4cb7fa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

economic-attack-vectors scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/economic-attack-vectors/SKILL.md · 211 lines

How it starts

The opening of the file, as written. The whole thing — 211 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Economic Attack Vectors

First Depositor Inflation Attack (ERC-4626)

The most common vault attack. The first depositor can manipulate the share price to steal from subsequent depositors.

Attack Steps

1. Attacker deposits 1 wei → receives 1 share
2. Attacker donates 1e18 tokens directly to vault (not via deposit)
3. Vault state: 1 share, (1 + 1e18) assets
4. Victim deposits 1.5e18 tokens
5. Shares minted = 1.5e18 * 1 / (1 + 1e18) = 0 shares (rounds to 0)
6. Attacker redeems 1 share → gets all 2.5e18 tokens
7. Victim loses ~1.5e18 tokens

Defense: Virtual Shares and Assets

contract SafeVault is ERC4626 {
    uint256 private constant VIRTUAL_SHARES = 1e3;   // 1000 virtual shares
    uint256 private constant VIRTUAL_ASSETS = 1;     // 1 virtual asset

    function totalAssets() public view override returns (uint256) {
        return IERC20(asset()).balanceOf(address(this)) + VIRTUAL_ASSETS;
    }

    function _decimalsOffset() internal pure override returns (uint8) {
        return 3; // adds 1e3 virtual shares
    }
}

Defense: Minimum Initial Deposit

uint256 public constant MIN_INITIAL_DEPOSIT = 1e6; // 1 USDC or equivalent

function deposit(uint256 assets, address receiver) public override returns (uint256 shares) {
    if (totalSupply() == 0 && assets < MIN_INITIAL_DEPOSIT) {
        revert InitialDepositTooSmall();
    }
    return super.deposit(assets, receiver);
}

Defense: Dead Shares

Lock a small amount of shares on first deposit to establish a non-manipulable base.

function _afterDeposit(uint256 assets, uint256 shares) internal override {
    if (totalSupply() == shares) {
        // First deposit — burn some shares to dead address
        uint256 deadShares = 1e3;
        _mint(address(0xdead), deadShares);
    }
}

Donation Attack

An attacker sends tokens directly to a contract (via transfer, not deposit) to manipulate internal accounting.

// VULNERABLE: relies on balanceOf for accounting
function getExchangeRate() public view returns (uint256) {
    return IERC20(asset).balanceOf(address(this)) / totalShares;
    // Attacker can inflate by donating tokens
}

// SAFE: track deposits explicitly
uint256 public totalManagedAssets;

function deposit(uint256 amount) external {
    totalManagedAssets += amount;
    IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);
}

function getExchangeRate() public view returns (uint256) {
    return totalManagedAssets / totalShares; // not manipulable via donation
}

Read the full file on GitHub · 211 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 211 lines · 60 tokens per session scan A 31216f4cb7fa

Subscribe to this mod's changes

economic-attack-vectors is a skill published in the GitHub repository ccashwell/evm-cortex (131 stars, last pushed 17d ago), licensed MIT. It adds 60 tokens to every session and 1,619 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.