Skip to content

Add another example with call to demonstrate Re-Entrancy#3197

Merged
axic merged 2 commits intoargotorg:developfrom
medvedev1088:fix-security-considerations-example
Dec 12, 2017
Merged

Add another example with call to demonstrate Re-Entrancy#3197
axic merged 2 commits intoargotorg:developfrom
medvedev1088:fix-security-considerations-example

Conversation

@medvedev1088
Copy link

@medvedev1088 medvedev1088 commented Nov 13, 2017

Add another example with call to demonstrate Re-Entrancy. Since send explicitly sets gas to 2300 by default according to this commit 9ca7472 which makes it impossible to "get multiple refunds" because a non-zero CALL costs at least 9700 gas. This issue is discussed on Ethereum StackExchange https://ethereum.stackexchange.com/questions/30371/send-ether-reentrancy-attack-in-reality-how-could-fallback-function-make-a-mes/30616#30616


The problem is not too serious here because of the limited gas as part
of ``send``, but it still exposes a weakness: Ether transfer always
of ``call``, but it still exposes a weakness: Ether transfer always
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the first part of this sentence "not too serious here because of the limited gas".

I think it would be a good idea to leave the above sentence as it is and introduce a new example using call and explain that is even more dangerous than send.

What do yo think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I added a new example that uses call. Please review again.

@medvedev1088 medvedev1088 changed the title Use call instead of send in the example demonstrating Re-Entrancy Add another example with call to demonstrate Re-Entrancy Nov 13, 2017
medvedev-evgeny and others added 2 commits December 12, 2017 03:31
Add another contract with call to demonstrate re-entrancy vulnerability as send explicitly sets gas to 2300 by default according to this commit 9ca7472 which makes it impossible to "get multiple refunds" because a non-zero CALL costs at least 9700 gas. This issue is discussed on Ethereum StackExchange https://ethereum.stackexchange.com/questions/30371/send-ether-reentrancy-attack-in-reality-how-could-fallback-function-make-a-mes/30616#30616
@axic
Copy link
Contributor

axic commented Dec 12, 2017

Rebased to have the new indentation rules (and trigger compilation tests).

@axic axic merged commit 40e8716 into argotorg:develop Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants