Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulnerability in transferFrom method #2

Open
beillahi opened this issue Feb 11, 2020 · 0 comments
Open

Vulnerability in transferFrom method #2

beillahi opened this issue Feb 11, 2020 · 0 comments

Comments

@beillahi
Copy link

beillahi commented Feb 11, 2020

Hello,

I just want to report what I consider a vulnerability in your ERC20 implementation with regard to the reference specification of ERC20 described here

Description

The methodtransferFrom should have a guard to check that the balance of the address From is bigger or equal to the _value.
Otherwise, a strange behavior is allowed such as described in the following trace:


Initial State : balances[0x2] = balances[0x1] = 0 and allowed[0x2][0x1] = 0

0x2:approve(0x1,1);

State :  balances[0x2] = balances[0x1] = 0 and allowed[0x2][0x1] = 1

0x1:transferFrom(0x2,0x2,1);

State :  balances[0x2] = balances[0x1] = 0 and allowed[0x2][0x1] = 0

The last method invocation should have failed if the method has a guard or if the instructions in lines 30 and 31 are swapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant