1

enter image description here

Recreated the reentrancy exploit (somewhat) successfully on ganache. Unable to drain the target completely owing to out-of-gas error occuring midway. Hence have currently limited the drain.
Though a custom 'gas' value can be passed with 'call', thinking through on that large input gas value that not only provides a +ve ROI but also meets the networks upper limit. Is reentrancy still a vulnerability and is it worth the gas investment?
Thoughts please? Thank you.

1 Answer 1

0

enter image description here

After unsuccessfully playing around with various different gas sizes & after unsuccessfully trying different gas estimations, I focused on the functioning of 'call'. Call returns a true or false based on whether or not it succeeded. I simply removed this check - stopped caring what call returned. Just kept on with the reentrancy. Commented out the check.

//require(success, '*TB.loot.withdraw().FAILED*');

And that did the trick. Even though success was coming as false, after removing the check, the fallback kept on getting triggered and I was able to drain the target contract successfully - just leaving it with 1 ETH.

Looks like call invocations carry forward sufficient gas for iterative executions. Haven't checked with an extremely large ETH amount. Might be a good idea to check the max gas consumption leading to OOG exception.

For now, success!

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