Securence of ERC20 transferFrom
See original GitHub issuePlease explain, what prevents such kind of attack ?
Imagine Alice calls approve(Contract.address, amount)
to invoke Contract’ method()
which withdraws from her address.
Then imagine Bob has accidentally found it out, and he wants to prevent Alice invokes method()
.
So he waits until Alice’ approve
transaction is mined, then calls transferFrom(Alice.address, Contract.address, amount)
and pushes it faster then Alice pushes method()
. In the end, Contract receives money, but method
cannot be invoked because allowance
now is zero. And so money is lost for Alice.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Security Pitfalls & Best Practices 201 - Secureum | Substack
ERC20 transfer and transferFrom: Should return a boolean. Several tokens do not return a boolean on these functions.
Read more >ERC-20's approve/transferFrom security concerns for the ...
Hi everyone, Yesterday during the Ledger&Tokenization Working Group we discussed ERC-20 the approve/transferFrom flow and its issues.
Read more >Navigating the pitfalls of securely interacting with ERC20 tokens
Our solution to fix the code example is obviously to just check the return value. A simple require(token.transferFrom(msg.sender, address(this), sendAmount), " ...
Read more >What is the use case of transferFrom function in ERC20 token ...
The use-case is that you give permission for someone else to transfer from your account. That someone else can be either an externally-owned ......
Read more >Transfer, Approve, TransferFrom methods in ERC20 - YouTube
How are ERC20 tokens transferred?1. transfer2. approve and transferFromGiving unlimited approvals is risky.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@roleengineer I have asked the same question yesterday, I think someone made a mistake in a pr, at least at the original version, it will check
at first.
By the way, For support questions (rather than Feature Requests or Bug Reports), as @abcoathup 's suggestion that you can ask in the : OpenZeppelin Community Forum that way the entire community can help answer your question.