minaminao/ctf-blockchain

A summary and solutions for 200+ CTF blockchain challenges

Solidity

1,103

322 commits

updated Oct 9, 2025

See the code

README

CTF Blockchain Challenges

This repository collects blockchain challenges in CTFs and wargames.

These challenges are categorized by topic, not by difficulty or recommendation. Some of them include personal writeups and solutions (e.g., Paradigm CTF 2022). Please be aware that these contain spoilers.


Table of Contents


CTF List

πŸ”—: External link

Always-on CTFs / Practice CTFs

Scheduled CTFs

CTF NameEvent Month
COMPFEST CTF 20252025-10
ImaginaryCTF 2025 πŸ”—2025-09
corCTF 2025 πŸ”—2025-08
Full Weak Engineer CTF2025-08
HITCON CTF 20252025-08
SekaiCTF 2025 πŸ”—2025-08
justCTF 2025 πŸ”—2025-08
smileyCTF 20252025-06
Hack The Box: Global Cyber Skills Benchmark CTF 2025 πŸ”—2025-05
DiceCTF 2025 Quals2025-03
Hack The Box: Cyber Apocalypse CTF 2025 πŸ”—2025-03
Remedy CTF 2025 πŸ”—2025-01
Hack The Box: University CTF 2024 πŸ”—2024-12
SECCON CTF 13 Quals2024-11
SCAN 2024 CTF2024-10
BlazCTF 20242024-09
The Flare-On Challenge 112024-09
SekaiCTF 20242024-08
Wintermute Alpha Challenge πŸ”—2024-08
corCTF20242024-07
HITCON CTF 2024 Quals2024-07
SECCON Beginners CTF 20242024-06
Hack The Box: HTB Business CTF 2024 πŸ”—2024-03
osu!gaming CTF 20242024-03
Hack The Box: Cyber Apocalypse 2024 πŸ”—2024-03
DiceCTF 2024 Quals2024-02
LA CTF 20242024-02
BlazCTF 20232023-12
Paradigm CTF 20232023-10
MetaTrust Web3 Security CTF2023-09
SECCON CTF 2023 Quals2023-09
MEV-Share CTF2023-08
SekaiCTF 20232023-08
corCTF 20232023-07
SEETF 20232023-06
NumenCTF2023-03
EKOPARTY CTF 20222022-11
N1CTF 20222022-11
SekaiCTF 20222022-10
0CTF/TCTF 20222022-09
Balsn CTF 20222022-09
DownUnderCTF 20222022-09
DeFi-Security-Summit-Stanford2022-08
MapleCTF 20222022-08
Paradigm CTF 20222022-08
TJCTF 2022 πŸ”—2022-05
ALLES! CTF 2021 πŸ”—2021-09
Paradigm CTF 20212021-02
0x41414141 CTF2021-01
DarkCTF2020-09
CurtaOccasional, Inactive
EthernautDAOOccasional, Inactive
HuffChallengeOccasional, Inactive
QuillCTFOccasional, Inactive

Ethereum

Note:

  • If an attack is only valid for a particular version of Solidity and not for the latest version, the version is noted at the end of the heading.
  • To avoid notation fluctuations, EVM terms are avoided as much as possible and Solidity terms are used.

Smart contract basics

EVM puzzles

  • Puzzle challenges that can be solved by understanding the EVM specifications.
  • No vulnerabilities are used to solve these challenges.
ChallengeNote, Keywords
Capture The Ether: Guess the new numberblock.number, block.timestamp
Capture The Ether: Predict the block hashblockhash
Ethernaut: 13. Gatekeeper Onemsg.sender != tx.origin, gasleft().mod(8191) == 0, type conversion
Ethernaut: 14. Gatekeeper Twomsg.sender != tx.origin, extcodesize is 0
Cipher Shastra: Minionmsg.sender != tx.origin, extcodesize is 0, block.timestamp
SECCON Beginners CTF 2020: C4Bblock.number
Paradigm CTF 2021: Babysandboxstaticcall, call, delegatecall, extcodesize is 0
Paradigm CTF 2021: Lockboxecrecover, abi.encodePacked, msg.data.length
EthernautDAO: 6. (No Name)block.number, gas price war
fvictorio's EVM Puzzles
Huff Challenge: Challenge #3
Paradigm CTF 2022: LOCKBOX2
Paradigm CTF 2022: SOURCECODEquine
Numen Cyber CTF 2023: LittleMoneyfunction pointer
Numen Cyber CTF 2023: ASSLOTstaticcall that return different values
Paradigm CTF 2023: Black SheepHuff

Misuse of tx.origin

  • tx.origin refers to the address of the transaction publisher and should not be used as the address of the contract caller msg.sender.
ChallengeNote, Keywords
Ethernaut: 4. Telephone

Weak sources of randomness from chain attributes

  • Since contract bytecodes are publicly available, it is easy to predict pseudorandom numbers whose generation is completed on-chain (using only states, not off-chain data).
  • It is equivalent to having all the parameters of a pseudorandom number generator exposed.
  • If you want to use random numbers that are unpredictable to anyone, use a decentralized oracle with a random number function.
    • For example, Chainlink VRF, which implements Verifiable Random Function (VRF).

ERC-20 basics

Storage overwrite by delegatecall

  • delegatecall is a potential source of vulnerability because the storage of the delegatecall caller contract can be overwritten by the called contract.

Context mismatch in delegatecall

  • Contracts called by delegatecall are executed in the context of the delegatecall caller contract.
  • If the function does not carefully consider the context, a bug will be created.
ChallengeNote, Keywords
EthernautDAO: 3. CarMarketNon-use of address(this)

Integer overflow

  • For example, subtracting 1 from the value of a variable of uint type when the value is 0 causes an arithmetic overflow.
  • Arithmetic overflow has been detected and reverted state since Solidity v0.8.0.
  • Contracts written in earlier versions can be checked by using the SafeMath library.
ChallengeNote, Keywords
Capture The Ether: Token salemultiplication
Capture The Ether: Token whalesubtraction
Ethernaut: 5. Tokensubtraction

Ether transfer failures for non-payable contracts

  • Do not create a contract on the assumption that normal Ether transfer (.send() or .transfer()) can always be executed.
  • If a destination is a contract and there is no receive Ether function or payable fallback function, Ether cannot be transferred.
  • However, instead of the normal transfer functions, the selfdestruct described in the next section can be used to force such a contract to transfer Ether.
ChallengeNote, Keywords
Ethernaut: 9. King
SekaiCTF 2022: Random SongChainlink VRF

Forced Ether transfers to non-payable contracts via selfdestruct

  • If a contract does not have a receive Ether function and a payable fallback function, it is not guaranteed that Ether will not be received.
  • When a contract executes selfdestruct, it can transfer its Ether to another contract or EOA, and this selfdestruct transfer can be forced even if the destination contract does not have the receive Ether function and the payable fallback function.
  • If the application is built on the assumption that the Ether is 0, it could be a bug.
ChallengeNote, Keywords
Capture The Ether: Retirement fundinteger overflow
Ethernaut: 7. Force

Large gas consumption by contract callees

  • A large amount of gas can be consumed by loops and recursion in call, and there may not be enough gas for the rest of the process.
  • Until Solidity v0.8.0, zero division and assert(false) could consume a lot of gas.
ChallengeNote, Keywords
Ethernaut: 20. Denial

Forgetting to set view/pure to interface and abstract contract functions

  • If you forget to set view or pure for a function and design your application under the assumption that the state will not change, it will be a bug.
ChallengeNote, Keywords
Ethernaut: 11. Elevatorinterface

Missing success flag checks in low-level calls

  • If a contract performs low-level calls (such as call, delegatecall, or staticcall) without checking the returned success flag, it may mistakenly assume the call succeeded, potentially leading to vulnerabilities.
ChallengeNote, Keywords
Ethernaut: 31. Stake

view functions that do not always return same values

  • Since view functions can read state, they can be conditionally branched based on state and do not necessarily return the same value.
ChallengeNote, Keywords
Ethernaut: 21. Shop

Mistakes in setting storage and memory

  • If storage and memory are not set properly, old values may be referenced, or overwriting may not occur, resulting in vulnerability.
ChallengeNote, Keywords
N1CTF 2021: BabyDefiCover Protocol infinite minting + flash loan

Tracing transactions

  • Various information can be obtained just by following the flow of transaction processing.
  • Blockchain explorers such as Etherscan are useful.
ChallengeNote, Keywords
Ethernaut: 17. Recoveryloss of deployed contract address

Reversing states

  • Since the state and the bytecodes of contracts are public, all variables, including private variables, are readable.
  • Private variables are only guaranteed not to be directly readable by other contracts, but we, as an entity outside the blockchain, can read them.

Reversing transactions

  • Reversing the contents of a transaction or how the state has been changed by the transaction.

Reversing EVM bytecodes

ChallengeNote, Keywords
Incognito 2.0: Ezkeep in plain text
0x41414141 CTF: crackme.soldecompile
0x41414141 CTF: Crypto Casinobypass condition check
Paradigm CTF 2021: Babyrev
34C3 CTF: Chaingang
Blaze CTF 2018: Smart? Contract
DEF CON CTF Qualifier 2018: SAG?
pbctf 2020: pbcoin
Paradigm CTF 2022: STEALING-SATS
Paradigm CTF 2022: ELECTRIC-SHEEP
Paradigm CTF 2022: FUN-REVERSING-CHALLENGE
DownUnderCTF 2022: EVM Vault Mechanism
EKOPARTY CTF 2022: Bytestack tracing
EKOPARTY CTF 2022: SmartRevmemory tracing
Numen Cyber CTF 2023: HEXPprevious block hash == gas price % 2^24
BlazCTF 2023: Maze
BlazCTF 2023: Jambo
BlazCTF 2023: Ghost
Curta: LanaLLVM
Ethernaut: 30. HigherOrdercalldata
COMPFEST CTF 2025: Synthetic Manipulation

EVM assembly logic bugs

  • Logic bugs in assemblies such as Yul
ChallengeNote, Keywords
SekaiCTF 2024: ZooPausable

EVM bytecode golf

  • These challenges have a limit on the length of the bytecode to be created.
ChallengeNote, Keywords
Ethernaut: 18. MagicNumber
Paradigm CTF 2021: ReverPalindrome detection. In addition, the code that inverts the bytecode must also be able to detect palindromes.
Huff Challenge: Challenge #1

Jump-oriented programming

  • Jump-Oriented Programming (JOP)
ChallengeNote, Keywords
SECCON CTF 2023 Quals: Tokyo Payload
Paradigm CTF 2021: JOP
Real World CTF 3rd: Re:Montagy

Gas optimization

  • These challenges have a limit on the gas to be consumed.
ChallengeNote, Keywords
Huff Challenge: Challenge #2

Collisions when using abi.encodePacked with variable length arguments

Bypassing verifications with zero iteration loops

ChallengeNote, Keywords
SEETF 2023: Murky SEEPassarray length, Merkle proof

Reentrancy attacks

  • In case a function of contract A contains interaction with another contract B or Ether transfer to B, the control is temporarily transferred to B.
  • Since B can call A in this control, it will be a bug if the design is based on the assumption that A is not called in the middle of the execution of that function.
  • For example, when B executes the withdraw function to withdraw Ether deposited in A, the Ether transfer triggers a control shift to B, and during the withdraw function, B executes A's withdraw function again. Even if the withdraw function is designed to prevent withdrawal of more than the limit if it is simply called twice, if the withdraw function is executed in the middle of the withdraw function, it may be designed to bypass the limit check.
  • To prevent reentrancy attacks, use the Checks-Effects-Interactions pattern.

Flash loan basics

  • Flash loans are uncollateralized loans that allow the borrowing of an asset, as long as the borrowed assets are returned before the end of the transaction. The borrower can deal with the borrowed assets any way they want within the transaction.
  • By making large asset moves, attacks can be made to snatch funds from DeFi applications or to gain large amounts of votes for participation in governance.
  • A solution to attacks that use flash loans to corrupt oracle values is to use a decentralized oracle.
ChallengeNote, Keywords
Damn Vulnerable DeFi: 1. UnstoppableSimple flash loan with a single token. Failure to send the token directly.
Damn Vulnerable DeFi: 2. NaivereceiverThe flashLoan function can specify a borrower, but the receiver side does not authenticate the TX sender, so the receiver's funds can be drained as a fee
Damn Vulnerable DeFi: 3. TrusterThe target of a call is made into the token and the token can be taken by approving it to oneself
Damn Vulnerable DeFi: 4. SideentranceFlash loan that allows each user to make a deposit and a withdrawal. The deposit can be executed at no cost at the time of the flash loan.

Governance attacks by executing flash loans during snapshots

  • If the algorithm distributes some kind of rights using the token balance at the time of a snapshot, and if a malicious user transaction can trigger a snapshot, a flash loan can be used to obtain massive rights.
  • A period of time to lock the token will avoid this attack.
ChallengeNote, Keywords
Damn Vulnerable DeFi: 5. TherewarderGet reward tokens based on the deposited token balance.
Damn Vulnerable DeFi: 6. SelfieGet voting power in governance based on the deposited token balance.

Bypassing repayments of push architecture flash loans

  • There are two architectures of flash loans: push and pull, with push architectures represented by Uniswap and Aave v1 and pull architectures by Aave v2 and dYdX.
  • The proposed flash loan in EIP-3156: Flash Loans is a pull architecture.
ChallengeNote, Keywords
Paradigm CTF 2021: UpgradeBypass using the lending functionality implemented in the token

Bugs in AMM price calculation algorithm

  • A bug in the Automated Market Maker (AMM) price calculation algorithm allows a simple combination of trades to drain funds.
ChallengeNote, Keywords
Ethernaut: 22. Dex

Attacks using custom tokens

  • The ability of a protocol to use arbitrary tokens is not in itself a bad thing, but it can be an attack vector.
  • In addition, bugs in the whitelist design, which assumes that arbitrary tokens are not available, could cause funds to drain.
ChallengeNote, Keywords
Ethernaut: 23. Dex Two

Oracle manipulation attacks without flash loans

  • It corrupts the value of the oracle and drains the funds of applications that refer to that oracle.
ChallengeNote, Keywords
Paradigm CTF 2021: BrokerDistort Uniswap prices and liquidate positions on lending platforms that reference those prices
Damn Vulnerable DeFi: 7. CompromisedOff-chain private key leak & oracle manipulation

Oracle manipulation attacks with flash loans

  • The use of flash loans distorts the value of the oracle and drains the funds of the protocols that reference that oracle.
  • The ability to move large amounts of funds through a flash loan makes it easy to distort the oracle and cause more damage.
ChallengeNote, Keywords
Damn Vulnerable DeFi: 8. PuppetDistort the price of Uniswap V1 and leak tokens from a lending platform that references that price
DeFi-Security-Summit-Stanford: BorrowSystemInsecureOraclelending protocol

Sandwich attacks

  • For example, if there is a transaction by another party to sell token A and buy B, the attacker can put in a transaction to sell A and buy B before the transaction, and later put in a transaction to sell the same amount of B and buy A, thereby ultimately increasing the amount of A at a profit.
  • In general, such "revenue earned by selecting, inserting, and reordering transactions contained in a block generated by a miner" is referred to as Miner Extractable Value (MEV). Recently, it is also called Maximal Extractable Value.
ChallengeNote, Keywords
Paradigm CTF 2021: FarmerSandwich the trade from COMP to WETH to DAI

Recoveries of private keys by same-nonce attacks

  • In general, a same-nonce attack is possible when the same nonce is used for different messages in the elliptic curve DSA (ECDSA), and the secret key can be calculated.
  • In Ethereum, if nonces used to sign transactions are the same, this attack is feasible.

ECDSA signature malleability attacks

  • ECDSA signatures have a property called malleability, where for a given message and signature (v, r, s), there exists another valid signature (v', r, -s mod n) for the same message.
  • This can be exploited in systems that track used signatures, as the alternative signature may not be recognized as already used.
  • In Ethereum's secp256k1 curve, this property can be used to bypass signature verification mechanisms.
ChallengeNote, Keywords
SmileyCTF: MultisigWalletECDSA, signature malleability, secp256k1
COMPFEST CTF 2025: snake_inceptionVyper

Brute-forcing addresses

  • Brute force can make a part of an address a specific value.
ChallengeNote, Keywords
Capture The Ether: Fuzzy identity28 bits, CREATE2
Numen Cyber CTF 2023: Exist16 bits

Recoveries of public keys

  • The address is the public key applied to a keccak256 hash, and the public key cannot be recovered from the address.
  • If even one transaction has been sent, the public key can be back-calculated from it.
  • Specifically, it can be recovered from the Recursive Length Prefix (RLP)-encoded data [nonce, gas_price, gas, to, value, data, chain_id, 0, 0] and the signature (v,r,s).
ChallengeNote, Keywords
Capture The Ether: Public KeyRLP, ECDSA

ecrecover returns address(0) for invalid signatures

  • The ecrecover precompile returns address(0) when the signature is invalid or malformed.
  • This behavior can be exploited if contracts don't properly validate the return value of ecrecover.
ChallengeNote, Keywords
SekaiCTF 2024: Play to EarnBurn

Encryption and decryption in secp256k1

ChallengeNote, Keywords
0x41414141 CTF: Rich ClubDEX, flash loan

Bypassing bots and taking ERC-20 tokens owned by wallets with known private keys

  • If a wallet with a known private key has an ERC-20 token but no Ether, it is usually necessary to first send Ether to the wallet and then transfer the ERC-20 token to get the ERC-20 token.
  • However, if a bot that immediately takes the Ether sent at this time is running, the Ether will be stolen when the Ether is simply sent.
  • In this situation, we can use Flashbots bundled transactions or just permit and transferFrom if the token is EIP-2612 permit friendly.
ChallengeNote, Keywords
EthernautDAO: 5. EthernautDaoToken

Claimable intermediate nodes of Merkle trees

ChallengeNote, Keywords
Paradigm CTF 2022: MERKLEDROP

Precompiled contracts

ChallengeNote, Keywords
Paradigm CTF 2022: VANITY

Faking errors

ChallengeNote, Keywords
Ethernaut: 27. Good Samaritan

Foundry cheatcodes

ChallengeNote, Keywords
Paradigm CTF 2022: TRAPDOOOR
Paradigm CTF 2022: TRAPDOOOOR

Front-running

Back-running

  • MEV-Share can be used to create bundled transactions to back-run.

EIP-7702

Head overflow bugs in calldata tuple ABI-reencoding (< Solidity 0.8.16)

ChallengeNote, Keywords
0CTF 2022: TCTF NFT Market
Numen Cyber CTF 2023: Walletillegal v in ecrecover

Overwriting storage slots via local storage variables (< Solidity 0.8.1)

  • In Foo storage foo;, the local variable foo points to slot 0.
ChallengeNote, Keywords
Capture The Ether: Donation

Overwriting arbitrary storage slots by setting array lengths to 2^256-1 (< Solidity 0.6.0)

  • For example, any storage variable can be overwritten by negatively arithmetic overflowing the length of an array to 2^256-1.
  • It need not be due to overflow.
  • The length property has been read-only since v0.6.0.
ChallengeNote, Keywords
Capture The Ether: Mapping
Ethernaut: 19. Alien Codex
Paradigm CTF 2021: Bank

Constructors that is just functions by typos (< Solidity 0.5.0)

  • In versions before v0.4.22, the constructor is defined as a function with the same name as the contract, so a typo of the constructor name could cause it to become just a function, resulting in a bug.
  • Since v0.5.0, this specification is removed and the constructor keyword must be used.

Overwriting storage slots via uninitialized storage pointer (< Solidity 0.5.0)

  • Since v0.5.0, uninitialized storage variables are forbidden, so this bug cannot occur.
ChallengeNote, Keywords
Capture The Ether: Fifty years
Ethernaut: Lockeddeleted

Other ad-hoc vulnerabilities and methods

ChallengeNote, Keywords
Paradigm CTF 2021: BouncerThe funds required for batch processing are the same as for single processing.
Paradigm CTF 2021: MarketMake the value of one field be recognized as the value of another field by using key misalignment in the Eternal Storage pattern.
EthernautDAO: 2. WalletLibrarym and n of m-of-n multisig wallet can be changed.
Paradigm CTF 2022: RESCUE
Paradigm CTF 2022: JUST-IN-TIME
Paradigm CTF 2022: 0XMONACO
BalsnCTF 2022: NFT Marketplaceinitialize, _safeTransferFrom, CREATE2
Numen Cyber CTF 2023: LenderPoolflash loan
Numen Cyber CTF 2023: GOATFinancecheck sum address
SEETF 2023: Pigeon VaultEIP-2535: Diamonds, Multi-Facet Proxy
corCTF 2023: baby-walletmissing from != to check

Bitcoin

Note

  • This section includes challenges of Bitcoin variants whose transaction model is Unspent Transaction Output (UTXO).

Bitcoin basics

ChallengeNote, Keywords
TsukuCTF 2021: genesisgenesis block
WORMCON 0x01: What's My Wallet AddressBitcoin address, RIPEMD-160

Recoveries of private keys by same-nonce attacks

ChallengeNote, Keywords
darkCTF: Duplicacy Within

Bypassing PoW of other applications using Bitcoin's PoW database

  • Bitcoin uses a series of leading zeros in the SHA-256 hash value as a Proof of Work (PoW), but if other applications are designed in the same way, its PoW time can be significantly reduced by choosing one that matches the conditions from Bitcoin's past PoW results
ChallengeNote, Keywords
Dragon CTF 2020: Bit Flip 264-bit PoW

Solana

ChallengeNote, Keywords
ALLES! CTF 2021: Secret Storesolana,spl-token
ALLES! CTF 2021: Legit Bank
ALLES! CTF 2021: Bugchain
ALLES! CTF 2021: eBPFreversing eBPF
Paradigm CTF 2022: OTTERWORLD
Paradigm CTF 2022: OTTERSWAP
Paradigm CTF 2022: POOL
Paradigm CTF 2022: SOLHANA-1
Paradigm CTF 2022: SOLHANA-2
Paradigm CTF 2022: SOLHANA-3
corCTF 2023: tribunal
SekaiCTF 2023: The Bidding
SekaiCTF 2023: Play for Free

Cosmos

CosmWasm

ChallengeNote, Keywords
Oak Security CosmWasm CTF: 1. Mjolnirlogic bug
Oak Security CosmWasm CTF: 2. Gungnirinteger overflow
Oak Security CosmWasm CTF: 3. Laevateinnaddress validation, uppercase
Oak Security CosmWasm CTF: 4. Graminvariant, rounding error
Oak Security CosmWasm CTF: 5. Draupnirmissing return
Oak Security CosmWasm CTF: 6. Hofundflash loan, governance
Oak Security CosmWasm CTF: 7. Tyrfingstorage collision
Oak Security CosmWasm CTF: 8. Gjallarhorn
Oak Security CosmWasm CTF: 9. Brisingamen
Oak Security CosmWasm CTF: 10. Mistilteinn

Application-specific blockchain

ChallengeNote, Keywords
RealWorld CTF 3rd Finals: Billboard

Move

ChallengeNote, Keywords
Numen Cyber CTF 2023: Move to Checkincontract call in Sui
Numen Cyber CTF 2023: ChatGPT tell me where is the vulnerabilityOSINT
Numen Cyber CTF 2023: Move to Crackmereversing Move code and Linux executable
justCTF 2024 teaser: The Otter Scrolls
justCTF 2024 teaser: Dark BrOTTERhood
justCTF 2024 teaser: World of Ottercraft

Cairo

  • Things that are not directly related to blockchains but are part of the ecosystems.
ChallengeNote, Keywords
TsukuCTF 2021: InterPlanetary ProtocolIPFS address, Base32 in lowercase
blockchain
ctf
ethereum
evm
solidity

minaminao/ctf-blockchain

A summary and solutions for 200+ CTF blockchain challenges

Solidity

1,103

322 commits

updated Oct 9, 2025

See the code

README

CTF Blockchain Challenges

This repository collects blockchain challenges in CTFs and wargames.

These challenges are categorized by topic, not by difficulty or recommendation. Some of them include personal writeups and solutions (e.g., Paradigm CTF 2022). Please be aware that these contain spoilers.


Table of Contents


CTF List

πŸ”—: External link

Always-on CTFs / Practice CTFs

Scheduled CTFs

CTF NameEvent Month
COMPFEST CTF 20252025-10
ImaginaryCTF 2025 πŸ”—2025-09
corCTF 2025 πŸ”—2025-08
Full Weak Engineer CTF2025-08
HITCON CTF 20252025-08
SekaiCTF 2025 πŸ”—2025-08
justCTF 2025 πŸ”—2025-08
smileyCTF 20252025-06
Hack The Box: Global Cyber Skills Benchmark CTF 2025 πŸ”—2025-05
DiceCTF 2025 Quals2025-03
Hack The Box: Cyber Apocalypse CTF 2025 πŸ”—2025-03
Remedy CTF 2025 πŸ”—2025-01
Hack The Box: University CTF 2024 πŸ”—2024-12
SECCON CTF 13 Quals2024-11
SCAN 2024 CTF2024-10
BlazCTF 20242024-09
The Flare-On Challenge 112024-09
SekaiCTF 20242024-08
Wintermute Alpha Challenge πŸ”—2024-08
corCTF20242024-07
HITCON CTF 2024 Quals2024-07
SECCON Beginners CTF 20242024-06
Hack The Box: HTB Business CTF 2024 πŸ”—2024-03
osu!gaming CTF 20242024-03
Hack The Box: Cyber Apocalypse 2024 πŸ”—2024-03
DiceCTF 2024 Quals2024-02
LA CTF 20242024-02
BlazCTF 20232023-12
Paradigm CTF 20232023-10
MetaTrust Web3 Security CTF2023-09
SECCON CTF 2023 Quals2023-09
MEV-Share CTF2023-08
SekaiCTF 20232023-08
corCTF 20232023-07
SEETF 20232023-06
NumenCTF2023-03
EKOPARTY CTF 20222022-11
N1CTF 20222022-11
SekaiCTF 20222022-10
0CTF/TCTF 20222022-09
Balsn CTF 20222022-09
DownUnderCTF 20222022-09
DeFi-Security-Summit-Stanford2022-08
MapleCTF 20222022-08
Paradigm CTF 20222022-08
TJCTF 2022 πŸ”—2022-05
ALLES! CTF 2021 πŸ”—2021-09
Paradigm CTF 20212021-02
0x41414141 CTF2021-01
DarkCTF2020-09
CurtaOccasional, Inactive
EthernautDAOOccasional, Inactive
HuffChallengeOccasional, Inactive
QuillCTFOccasional, Inactive

Ethereum

Note:

  • If an attack is only valid for a particular version of Solidity and not for the latest version, the version is noted at the end of the heading.
  • To avoid notation fluctuations, EVM terms are avoided as much as possible and Solidity terms are used.

Smart contract basics

EVM puzzles

  • Puzzle challenges that can be solved by understanding the EVM specifications.
  • No vulnerabilities are used to solve these challenges.
ChallengeNote, Keywords
Capture The Ether: Guess the new numberblock.number, block.timestamp
Capture The Ether: Predict the block hashblockhash
Ethernaut: 13. Gatekeeper Onemsg.sender != tx.origin, gasleft().mod(8191) == 0, type conversion
Ethernaut: 14. Gatekeeper Twomsg.sender != tx.origin, extcodesize is 0
Cipher Shastra: Minionmsg.sender != tx.origin, extcodesize is 0, block.timestamp
SECCON Beginners CTF 2020: C4Bblock.number
Paradigm CTF 2021: Babysandboxstaticcall, call, delegatecall, extcodesize is 0
Paradigm CTF 2021: Lockboxecrecover, abi.encodePacked, msg.data.length
EthernautDAO: 6. (No Name)block.number, gas price war
fvictorio's EVM Puzzles
Huff Challenge: Challenge #3
Paradigm CTF 2022: LOCKBOX2
Paradigm CTF 2022: SOURCECODEquine
Numen Cyber CTF 2023: LittleMoneyfunction pointer
Numen Cyber CTF 2023: ASSLOTstaticcall that return different values
Paradigm CTF 2023: Black SheepHuff

Misuse of tx.origin

  • tx.origin refers to the address of the transaction publisher and should not be used as the address of the contract caller msg.sender.
ChallengeNote, Keywords
Ethernaut: 4. Telephone

Weak sources of randomness from chain attributes

  • Since contract bytecodes are publicly available, it is easy to predict pseudorandom numbers whose generation is completed on-chain (using only states, not off-chain data).
  • It is equivalent to having all the parameters of a pseudorandom number generator exposed.
  • If you want to use random numbers that are unpredictable to anyone, use a decentralized oracle with a random number function.
    • For example, Chainlink VRF, which implements Verifiable Random Function (VRF).

ERC-20 basics

Storage overwrite by delegatecall

  • delegatecall is a potential source of vulnerability because the storage of the delegatecall caller contract can be overwritten by the called contract.

Context mismatch in delegatecall

  • Contracts called by delegatecall are executed in the context of the delegatecall caller contract.
  • If the function does not carefully consider the context, a bug will be created.
ChallengeNote, Keywords
EthernautDAO: 3. CarMarketNon-use of address(this)

Integer overflow

  • For example, subtracting 1 from the value of a variable of uint type when the value is 0 causes an arithmetic overflow.
  • Arithmetic overflow has been detected and reverted state since Solidity v0.8.0.
  • Contracts written in earlier versions can be checked by using the SafeMath library.
ChallengeNote, Keywords
Capture The Ether: Token salemultiplication
Capture The Ether: Token whalesubtraction
Ethernaut: 5. Tokensubtraction

Ether transfer failures for non-payable contracts

  • Do not create a contract on the assumption that normal Ether transfer (.send() or .transfer()) can always be executed.
  • If a destination is a contract and there is no receive Ether function or payable fallback function, Ether cannot be transferred.
  • However, instead of the normal transfer functions, the selfdestruct described in the next section can be used to force such a contract to transfer Ether.
ChallengeNote, Keywords
Ethernaut: 9. King
SekaiCTF 2022: Random SongChainlink VRF

Forced Ether transfers to non-payable contracts via selfdestruct

  • If a contract does not have a receive Ether function and a payable fallback function, it is not guaranteed that Ether will not be received.
  • When a contract executes selfdestruct, it can transfer its Ether to another contract or EOA, and this selfdestruct transfer can be forced even if the destination contract does not have the receive Ether function and the payable fallback function.
  • If the application is built on the assumption that the Ether is 0, it could be a bug.
ChallengeNote, Keywords
Capture The Ether: Retirement fundinteger overflow
Ethernaut: 7. Force

Large gas consumption by contract callees

  • A large amount of gas can be consumed by loops and recursion in call, and there may not be enough gas for the rest of the process.
  • Until Solidity v0.8.0, zero division and assert(false) could consume a lot of gas.
ChallengeNote, Keywords
Ethernaut: 20. Denial

Forgetting to set view/pure to interface and abstract contract functions

  • If you forget to set view or pure for a function and design your application under the assumption that the state will not change, it will be a bug.
ChallengeNote, Keywords
Ethernaut: 11. Elevatorinterface

Missing success flag checks in low-level calls

  • If a contract performs low-level calls (such as call, delegatecall, or staticcall) without checking the returned success flag, it may mistakenly assume the call succeeded, potentially leading to vulnerabilities.
ChallengeNote, Keywords
Ethernaut: 31. Stake

view functions that do not always return same values

  • Since view functions can read state, they can be conditionally branched based on state and do not necessarily return the same value.
ChallengeNote, Keywords
Ethernaut: 21. Shop

Mistakes in setting storage and memory

  • If storage and memory are not set properly, old values may be referenced, or overwriting may not occur, resulting in vulnerability.
ChallengeNote, Keywords
N1CTF 2021: BabyDefiCover Protocol infinite minting + flash loan

Tracing transactions

  • Various information can be obtained just by following the flow of transaction processing.
  • Blockchain explorers such as Etherscan are useful.
ChallengeNote, Keywords
Ethernaut: 17. Recoveryloss of deployed contract address

Reversing states

  • Since the state and the bytecodes of contracts are public, all variables, including private variables, are readable.
  • Private variables are only guaranteed not to be directly readable by other contracts, but we, as an entity outside the blockchain, can read them.

Reversing transactions

  • Reversing the contents of a transaction or how the state has been changed by the transaction.

Reversing EVM bytecodes

ChallengeNote, Keywords
Incognito 2.0: Ezkeep in plain text
0x41414141 CTF: crackme.soldecompile
0x41414141 CTF: Crypto Casinobypass condition check
Paradigm CTF 2021: Babyrev
34C3 CTF: Chaingang
Blaze CTF 2018: Smart? Contract
DEF CON CTF Qualifier 2018: SAG?
pbctf 2020: pbcoin
Paradigm CTF 2022: STEALING-SATS
Paradigm CTF 2022: ELECTRIC-SHEEP
Paradigm CTF 2022: FUN-REVERSING-CHALLENGE
DownUnderCTF 2022: EVM Vault Mechanism
EKOPARTY CTF 2022: Bytestack tracing
EKOPARTY CTF 2022: SmartRevmemory tracing
Numen Cyber CTF 2023: HEXPprevious block hash == gas price % 2^24
BlazCTF 2023: Maze
BlazCTF 2023: Jambo
BlazCTF 2023: Ghost
Curta: LanaLLVM
Ethernaut: 30. HigherOrdercalldata
COMPFEST CTF 2025: Synthetic Manipulation

EVM assembly logic bugs

  • Logic bugs in assemblies such as Yul
ChallengeNote, Keywords
SekaiCTF 2024: ZooPausable

EVM bytecode golf

  • These challenges have a limit on the length of the bytecode to be created.
ChallengeNote, Keywords
Ethernaut: 18. MagicNumber
Paradigm CTF 2021: ReverPalindrome detection. In addition, the code that inverts the bytecode must also be able to detect palindromes.
Huff Challenge: Challenge #1

Jump-oriented programming

  • Jump-Oriented Programming (JOP)
ChallengeNote, Keywords
SECCON CTF 2023 Quals: Tokyo Payload
Paradigm CTF 2021: JOP
Real World CTF 3rd: Re:Montagy

Gas optimization

  • These challenges have a limit on the gas to be consumed.
ChallengeNote, Keywords
Huff Challenge: Challenge #2

Collisions when using abi.encodePacked with variable length arguments

Bypassing verifications with zero iteration loops

ChallengeNote, Keywords
SEETF 2023: Murky SEEPassarray length, Merkle proof

Reentrancy attacks

  • In case a function of contract A contains interaction with another contract B or Ether transfer to B, the control is temporarily transferred to B.
  • Since B can call A in this control, it will be a bug if the design is based on the assumption that A is not called in the middle of the execution of that function.
  • For example, when B executes the withdraw function to withdraw Ether deposited in A, the Ether transfer triggers a control shift to B, and during the withdraw function, B executes A's withdraw function again. Even if the withdraw function is designed to prevent withdrawal of more than the limit if it is simply called twice, if the withdraw function is executed in the middle of the withdraw function, it may be designed to bypass the limit check.
  • To prevent reentrancy attacks, use the Checks-Effects-Interactions pattern.

Flash loan basics

  • Flash loans are uncollateralized loans that allow the borrowing of an asset, as long as the borrowed assets are returned before the end of the transaction. The borrower can deal with the borrowed assets any way they want within the transaction.
  • By making large asset moves, attacks can be made to snatch funds from DeFi applications or to gain large amounts of votes for participation in governance.
  • A solution to attacks that use flash loans to corrupt oracle values is to use a decentralized oracle.
ChallengeNote, Keywords
Damn Vulnerable DeFi: 1. UnstoppableSimple flash loan with a single token. Failure to send the token directly.
Damn Vulnerable DeFi: 2. NaivereceiverThe flashLoan function can specify a borrower, but the receiver side does not authenticate the TX sender, so the receiver's funds can be drained as a fee
Damn Vulnerable DeFi: 3. TrusterThe target of a call is made into the token and the token can be taken by approving it to oneself
Damn Vulnerable DeFi: 4. SideentranceFlash loan that allows each user to make a deposit and a withdrawal. The deposit can be executed at no cost at the time of the flash loan.

Governance attacks by executing flash loans during snapshots

  • If the algorithm distributes some kind of rights using the token balance at the time of a snapshot, and if a malicious user transaction can trigger a snapshot, a flash loan can be used to obtain massive rights.
  • A period of time to lock the token will avoid this attack.
ChallengeNote, Keywords
Damn Vulnerable DeFi: 5. TherewarderGet reward tokens based on the deposited token balance.
Damn Vulnerable DeFi: 6. SelfieGet voting power in governance based on the deposited token balance.

Bypassing repayments of push architecture flash loans

  • There are two architectures of flash loans: push and pull, with push architectures represented by Uniswap and Aave v1 and pull architectures by Aave v2 and dYdX.
  • The proposed flash loan in EIP-3156: Flash Loans is a pull architecture.
ChallengeNote, Keywords
Paradigm CTF 2021: UpgradeBypass using the lending functionality implemented in the token

Bugs in AMM price calculation algorithm

  • A bug in the Automated Market Maker (AMM) price calculation algorithm allows a simple combination of trades to drain funds.
ChallengeNote, Keywords
Ethernaut: 22. Dex

Attacks using custom tokens

  • The ability of a protocol to use arbitrary tokens is not in itself a bad thing, but it can be an attack vector.
  • In addition, bugs in the whitelist design, which assumes that arbitrary tokens are not available, could cause funds to drain.
ChallengeNote, Keywords
Ethernaut: 23. Dex Two

Oracle manipulation attacks without flash loans

  • It corrupts the value of the oracle and drains the funds of applications that refer to that oracle.
ChallengeNote, Keywords
Paradigm CTF 2021: BrokerDistort Uniswap prices and liquidate positions on lending platforms that reference those prices
Damn Vulnerable DeFi: 7. CompromisedOff-chain private key leak & oracle manipulation

Oracle manipulation attacks with flash loans

  • The use of flash loans distorts the value of the oracle and drains the funds of the protocols that reference that oracle.
  • The ability to move large amounts of funds through a flash loan makes it easy to distort the oracle and cause more damage.
ChallengeNote, Keywords
Damn Vulnerable DeFi: 8. PuppetDistort the price of Uniswap V1 and leak tokens from a lending platform that references that price
DeFi-Security-Summit-Stanford: BorrowSystemInsecureOraclelending protocol

Sandwich attacks

  • For example, if there is a transaction by another party to sell token A and buy B, the attacker can put in a transaction to sell A and buy B before the transaction, and later put in a transaction to sell the same amount of B and buy A, thereby ultimately increasing the amount of A at a profit.
  • In general, such "revenue earned by selecting, inserting, and reordering transactions contained in a block generated by a miner" is referred to as Miner Extractable Value (MEV). Recently, it is also called Maximal Extractable Value.
ChallengeNote, Keywords
Paradigm CTF 2021: FarmerSandwich the trade from COMP to WETH to DAI

Recoveries of private keys by same-nonce attacks

  • In general, a same-nonce attack is possible when the same nonce is used for different messages in the elliptic curve DSA (ECDSA), and the secret key can be calculated.
  • In Ethereum, if nonces used to sign transactions are the same, this attack is feasible.

ECDSA signature malleability attacks

  • ECDSA signatures have a property called malleability, where for a given message and signature (v, r, s), there exists another valid signature (v', r, -s mod n) for the same message.
  • This can be exploited in systems that track used signatures, as the alternative signature may not be recognized as already used.
  • In Ethereum's secp256k1 curve, this property can be used to bypass signature verification mechanisms.
ChallengeNote, Keywords
SmileyCTF: MultisigWalletECDSA, signature malleability, secp256k1
COMPFEST CTF 2025: snake_inceptionVyper

Brute-forcing addresses

  • Brute force can make a part of an address a specific value.
ChallengeNote, Keywords
Capture The Ether: Fuzzy identity28 bits, CREATE2
Numen Cyber CTF 2023: Exist16 bits

Recoveries of public keys

  • The address is the public key applied to a keccak256 hash, and the public key cannot be recovered from the address.
  • If even one transaction has been sent, the public key can be back-calculated from it.
  • Specifically, it can be recovered from the Recursive Length Prefix (RLP)-encoded data [nonce, gas_price, gas, to, value, data, chain_id, 0, 0] and the signature (v,r,s).
ChallengeNote, Keywords
Capture The Ether: Public KeyRLP, ECDSA

ecrecover returns address(0) for invalid signatures

  • The ecrecover precompile returns address(0) when the signature is invalid or malformed.
  • This behavior can be exploited if contracts don't properly validate the return value of ecrecover.
ChallengeNote, Keywords
SekaiCTF 2024: Play to EarnBurn

Encryption and decryption in secp256k1

ChallengeNote, Keywords
0x41414141 CTF: Rich ClubDEX, flash loan

Bypassing bots and taking ERC-20 tokens owned by wallets with known private keys

  • If a wallet with a known private key has an ERC-20 token but no Ether, it is usually necessary to first send Ether to the wallet and then transfer the ERC-20 token to get the ERC-20 token.
  • However, if a bot that immediately takes the Ether sent at this time is running, the Ether will be stolen when the Ether is simply sent.
  • In this situation, we can use Flashbots bundled transactions or just permit and transferFrom if the token is EIP-2612 permit friendly.
ChallengeNote, Keywords
EthernautDAO: 5. EthernautDaoToken

Claimable intermediate nodes of Merkle trees

ChallengeNote, Keywords
Paradigm CTF 2022: MERKLEDROP

Precompiled contracts

ChallengeNote, Keywords
Paradigm CTF 2022: VANITY

Faking errors

ChallengeNote, Keywords
Ethernaut: 27. Good Samaritan

Foundry cheatcodes

ChallengeNote, Keywords
Paradigm CTF 2022: TRAPDOOOR
Paradigm CTF 2022: TRAPDOOOOR

Front-running

Back-running

  • MEV-Share can be used to create bundled transactions to back-run.

EIP-7702

Head overflow bugs in calldata tuple ABI-reencoding (< Solidity 0.8.16)

ChallengeNote, Keywords
0CTF 2022: TCTF NFT Market
Numen Cyber CTF 2023: Walletillegal v in ecrecover

Overwriting storage slots via local storage variables (< Solidity 0.8.1)

  • In Foo storage foo;, the local variable foo points to slot 0.
ChallengeNote, Keywords
Capture The Ether: Donation

Overwriting arbitrary storage slots by setting array lengths to 2^256-1 (< Solidity 0.6.0)

  • For example, any storage variable can be overwritten by negatively arithmetic overflowing the length of an array to 2^256-1.
  • It need not be due to overflow.
  • The length property has been read-only since v0.6.0.
ChallengeNote, Keywords
Capture The Ether: Mapping
Ethernaut: 19. Alien Codex
Paradigm CTF 2021: Bank

Constructors that is just functions by typos (< Solidity 0.5.0)

  • In versions before v0.4.22, the constructor is defined as a function with the same name as the contract, so a typo of the constructor name could cause it to become just a function, resulting in a bug.
  • Since v0.5.0, this specification is removed and the constructor keyword must be used.

Overwriting storage slots via uninitialized storage pointer (< Solidity 0.5.0)

  • Since v0.5.0, uninitialized storage variables are forbidden, so this bug cannot occur.
ChallengeNote, Keywords
Capture The Ether: Fifty years
Ethernaut: Lockeddeleted

Other ad-hoc vulnerabilities and methods

ChallengeNote, Keywords
Paradigm CTF 2021: BouncerThe funds required for batch processing are the same as for single processing.
Paradigm CTF 2021: MarketMake the value of one field be recognized as the value of another field by using key misalignment in the Eternal Storage pattern.
EthernautDAO: 2. WalletLibrarym and n of m-of-n multisig wallet can be changed.
Paradigm CTF 2022: RESCUE
Paradigm CTF 2022: JUST-IN-TIME
Paradigm CTF 2022: 0XMONACO
BalsnCTF 2022: NFT Marketplaceinitialize, _safeTransferFrom, CREATE2
Numen Cyber CTF 2023: LenderPoolflash loan
Numen Cyber CTF 2023: GOATFinancecheck sum address
SEETF 2023: Pigeon VaultEIP-2535: Diamonds, Multi-Facet Proxy
corCTF 2023: baby-walletmissing from != to check

Bitcoin

Note

  • This section includes challenges of Bitcoin variants whose transaction model is Unspent Transaction Output (UTXO).

Bitcoin basics

ChallengeNote, Keywords
TsukuCTF 2021: genesisgenesis block
WORMCON 0x01: What's My Wallet AddressBitcoin address, RIPEMD-160

Recoveries of private keys by same-nonce attacks

ChallengeNote, Keywords
darkCTF: Duplicacy Within

Bypassing PoW of other applications using Bitcoin's PoW database

  • Bitcoin uses a series of leading zeros in the SHA-256 hash value as a Proof of Work (PoW), but if other applications are designed in the same way, its PoW time can be significantly reduced by choosing one that matches the conditions from Bitcoin's past PoW results
ChallengeNote, Keywords
Dragon CTF 2020: Bit Flip 264-bit PoW

Solana

ChallengeNote, Keywords
ALLES! CTF 2021: Secret Storesolana,spl-token
ALLES! CTF 2021: Legit Bank
ALLES! CTF 2021: Bugchain
ALLES! CTF 2021: eBPFreversing eBPF
Paradigm CTF 2022: OTTERWORLD
Paradigm CTF 2022: OTTERSWAP
Paradigm CTF 2022: POOL
Paradigm CTF 2022: SOLHANA-1
Paradigm CTF 2022: SOLHANA-2
Paradigm CTF 2022: SOLHANA-3
corCTF 2023: tribunal
SekaiCTF 2023: The Bidding
SekaiCTF 2023: Play for Free

Cosmos

CosmWasm

ChallengeNote, Keywords
Oak Security CosmWasm CTF: 1. Mjolnirlogic bug
Oak Security CosmWasm CTF: 2. Gungnirinteger overflow
Oak Security CosmWasm CTF: 3. Laevateinnaddress validation, uppercase
Oak Security CosmWasm CTF: 4. Graminvariant, rounding error
Oak Security CosmWasm CTF: 5. Draupnirmissing return
Oak Security CosmWasm CTF: 6. Hofundflash loan, governance
Oak Security CosmWasm CTF: 7. Tyrfingstorage collision
Oak Security CosmWasm CTF: 8. Gjallarhorn
Oak Security CosmWasm CTF: 9. Brisingamen
Oak Security CosmWasm CTF: 10. Mistilteinn

Application-specific blockchain

ChallengeNote, Keywords
RealWorld CTF 3rd Finals: Billboard

Move

ChallengeNote, Keywords
Numen Cyber CTF 2023: Move to Checkincontract call in Sui
Numen Cyber CTF 2023: ChatGPT tell me where is the vulnerabilityOSINT
Numen Cyber CTF 2023: Move to Crackmereversing Move code and Linux executable
justCTF 2024 teaser: The Otter Scrolls
justCTF 2024 teaser: Dark BrOTTERhood
justCTF 2024 teaser: World of Ottercraft

Cairo

  • Things that are not directly related to blockchains but are part of the ecosystems.
ChallengeNote, Keywords
TsukuCTF 2021: InterPlanetary ProtocolIPFS address, Base32 in lowercase
blockchain
ctf
ethereum
evm
solidity

Significant stargazers

Matthias Seitz

2,030 followers Β· starred Aug 2023

Chaoshuai Lyu

128 followers Β· starred Aug 2022

0xRaiden

51 followers Β· starred Nov 2022

Karl Yu

34 followers Β· starred Jan 2023