Per-opcode security analysis covering smart contract exploitation and protocol-level threats. This page has two sections: the basics needed to read the threat models, then the table of opcodes with links to each threat note. For the full opcode reference, gas costs, precompiled contracts, notes, and resources, see EVM Reference.


EVM basics (expand/collapse)

What is the EVM?

The Ethereum Virtual Machine is a stack-based machine that runs contract bytecode. Essentials:

  • Stack: Up to 1024 cells of 32-byte values. Most opcodes pop inputs and push outputs; only PUSH reads from code.
  • Deterministic: Same code and inputs give the same result on every node.
  • Execution: One instruction at a time. JUMP / JUMPI change where execution goes; STOP / RETURN end the call successfully; REVERT aborts and rolls back all state changes for the call. If an opcode cannot run (e.g. stack underflow, out of gas), execution reverts.

Execution context

Each call has a context with these regions. Threat models often refer to which region an opcode reads or writes.

RegionPersistenceAccess opcodesNotes
CodePermanent (on-chain)CODESIZE, CODECOPY, EXTCODESIZE, EXTCODECOPYImmutable bytecode of the contract (or target contract)
StackPer callPUSH, POP, DUP, SWAP, …LIFO; operands and results for opcodes
MemoryPer callMLOAD, MSTORE, MSTORE8, MSIZEByte-addressable, zero-initialized, volatile
StoragePermanent (on-chain)SLOAD, SSTORE32-byte key → 32-byte value, per contract
Transient storagePer transactionTLOAD, TSTORECleared after the transaction (EIP-1153)
CalldataPer callCALLDATALOAD, CALLDATASIZE, CALLDATACOPYImmutable input to the call
Return dataPer callRETURNDATASIZE, RETURNDATACOPYOutput of the last external call

Program counter

The PC is the index of the next instruction in code. It normally steps one byte at a time. PUSHn skips its immediate bytes (the pushed constant). JUMP / JUMPI set the PC to a JUMPDEST; invalid jumps cause a revert. This is where control-flow and reentrancy show up in threat models.


FileDescriptionSecurity risk ratingHuman validated
0x00-STOPHalt executionLow
0x01-ADDAddition modulo 2^256Critical
0x02-MULMultiplication modulo 2^256High
0x03-SUBSubtraction modulo 2^256Critical
0x04-DIVUnsigned integer divisionCritical
0x05-SDIVSigned integer divisionHigh
0x06-MODUnsigned modulusHigh
0x07-SMODSigned modulusHigh
0x08-ADDMODAddition modulo NMedium
0x09-MULMODMultiplication modulo NMedium
0x0A-EXPExponentiation modulo 2^256High
0x0B-SIGNEXTENDSign-extend from (b+1) bytes to 32 bytesMedium
0x10-LTUnsigned less-thanLow
0x11-GTUnsigned greater-thanLow
0x12-SLTSigned less-thanLow
0x13-SGTSigned greater-thanLow
0x14-EQEqualityLow
0x15-ISZEROIs zeroLow
0x16-ANDBitwise ANDLow
0x17-ORBitwise ORLow
0x18-XORBitwise XORLow
0x19-NOTBitwise NOTLow
0x1A-BYTEExtract byte at position iLow
0x1B-SHLShift leftMedium
0x1C-SHRLogical shift rightLow
0x1D-SARArithmetic shift rightLow
0x20-KECCAK256Compute Keccak-256 hashLow
0x30-ADDRESSAddress of executing contractLow
0x31-BALANCEBalance in wei (warm/cold access)Critical
0x32-ORIGINTransaction originator addressHigh
0x33-CALLERDirect caller addressMedium
0x34-CALLVALUEValue sent with call, in weiMedium
0x35-CALLDATALOADRead 32-byte word from calldataHigh
0x36-CALLDATASIZECalldata size in bytesMedium
0x37-CALLDATACOPYCopy calldata to memoryHigh
0x38-CODESIZESize of executing contract codeLow
0x39-CODECOPYCopy contract code to memoryHigh
0x3A-GASPRICEGas price of transactionMedium
0x3B-EXTCODESIZESize of external contract codeHigh
0x3C-EXTCODECOPYCopy external code to memoryHigh
0x3D-RETURNDATASIZESize of last call’s return dataCritical
0x3E-RETURNDATACOPYCopy return data to memoryHigh
0x3F-EXTCODEHASHKeccak-256 of external codeMedium
0x40-BLOCKHASHHash of a recent block (last 256)Medium
0x41-COINBASECurrent block proposer addressLow
0x42-TIMESTAMPCurrent block timestampHigh
0x43-NUMBERCurrent block numberHigh
0x44-PREVRANDAORandomness beacon (post-Merge)High
0x45-GASLIMITCurrent block gas limitMedium
0x46-CHAINIDCurrent chain ID (EIP-155)High
0x47-SELFBALANCEBalance of executing contractCritical
0x48-BASEFEEBase fee of current block (EIP-1559)Medium
0x49-BLOBHASHBlob versioned hash (EIP-4844)Medium
0x4A-BLOBBASEFEEBlob base fee (EIP-7516)Low
0x50-POPRemove top stack itemLow
0x51-MLOADLoad word from memoryMedium
0x52-MSTOREStore word to memoryHigh
0x53-MSTORE8Store single byte to memoryHigh
0x54-SLOADLoad word from storageCritical
0x55-SSTOREStore word to storageCritical
0x56-JUMPSet PC to dst (must be JUMPDEST)High
0x57-JUMPIConditional jumpHigh
0x58-PCCurrent program counterLow
0x59-MSIZESize of active memory in bytesLow
0x5A-GASRemaining gasLow
0x5B-JUMPDESTMark valid jump destinationLow
0x5C-TLOADLoad from transient storage (EIP-1153)Medium
0x5D-TSTOREStore to transient storage (EIP-1153)Medium
0x5E-MCOPYCopy memory area (EIP-5656)Low
0x5F-PUSH0Push zero onto stack (EIP-3855)Low
0x60-PUSHPush 1–32 bytes from code onto stackLow
0x80-DUPClone nth stack item to topLow
0x90-SWAPSwap top with (n+1)th stack itemLow
0xA0-LOGEmit log with 0–4 topicsLow
0xF0-CREATECreate new contract (addr from sender, nonce)Critical
0xF1-CALLCall another contractCritical
0xF2-CALLCODELike DELEGATECALL but doesn’t propagate msg.sender/valueHigh
0xF3-RETURNReturn data from memory (or deployed bytecode in CREATE)Critical
0xF4-DELEGATECALLCall with caller’s contextCritical
0xF5-CREATE2Create with deterministic addressCritical
0xFA-STATICCALLRead-only call (no state modification)Critical
0xFD-REVERTRevert with return data, refund unused gasHigh
0xFE-INVALIDDesignated invalid opcode; consumes all gasHigh
0xFF-SELFDESTRUCTMark contract for destruction, send ETH to addrCritical