golemfactory / golem-crowdfunding

Golem token and crowdfunding contracts
GNU General Public License v3.0
78 stars 27 forks source link

stack exhausion attack? #75

Closed paulperegud closed 8 years ago

paulperegud commented 8 years ago

What will happen if attacker will attempt to bump into stack depth limit while being in our code?

Scenario: StackLimit = N

def stack_filler(X):
   if X < N:
     stack_filler(X+1)
   else:
     GolemNetworkToken.send(1000)

Will EVM just do what it does when throw or "out of gas" occurs and restore original state?

chfast commented 8 years ago

.send is performed by EVM CALL instruction. It will get a new stack. In any case, if a call fails with an exception all changes made in the call are reverted (including value transfer) and .send will return false.