by mmanfrin · 10y ago · 0 comments
Then at some point it terminates itself before emptying the source account (and thereby causing a rollback that would cascade back?)
What made this particularly devastating is that there was a second bug which allowed the attacker to transfer their token that represented that first ether back to the DAO. So instead of 30x return, they could eventually drain the whole DAO (although they stopped after the discussion of a fork began).
I'm largely basing my understanding off this article: http://vessenes.com/deconstructing-thedao-attack-a-brief-cod...
send(theEther, childDao)
deduct(theEther, tokenHolder)
But that you can get it to overflow the stack in between the two so that the send completes but the deduction no longer happens.Do the deduct before the send, and the whole problem goes away.
The send returns false if it fails. So if you check for that, you can throw an exception, which rolls back the whole transaction just like in SQL.
The reason the send doesn't automatically throw is that if you were doing lots of sends in a loop, you'd actually want to ignore the exception, so if one send fails it doesn't block everybody.
http://hackingdistributed.com/2016/06/18/analysis-of-the-dao...