Skip to content

Lesson 14: Sublesson 'Reentrancy attacks' question #3021

Discussion options

You must be logged in to vote

@polar0 No we do not need payable with withdraw function because it is not using a global variable msg.value and the attack function needs a value of at least 1 ether in order to pass the revert statement, that could be the one reason why your attack function is reverting.

And our withdraw function is still vulnerable because we are changing the state at the end of it and because it uses external contract function calls that will call the fallback function of the attack contract that will again call the withdraw function and that loops go on until the balance will be greater than 0.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@0xpolarzero
Comment options

@alymurtazamemon
Comment options

Answer selected by alymurtazamemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants