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

Race condition in approve() 收件箱 #134

Open
code423n4 opened this issue Dec 22, 2021 · 0 comments
Open

Race condition in approve() 收件箱 #134

code423n4 opened this issue Dec 22, 2021 · 0 comments
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

cccz

Vulnerability details

Impact

Using approve() to manage allowances opens yourself and users of the token up to frontrunning.

https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/edit#heading=h.b32yfk54vyg9

Proof of Concept

https://github.com/code-423n4/2021-12-nftx/blob/main/nftx-protocol-v2/contracts/solidity/token/ERC20Upgradeable.sol#L141-L144

Tools Used

Manual analysis

Recommended Mitigation Steps

function approve(address spender, uint256 amount) public virtual override returns (bool) {
  • require((amount == 0) || (_allowances(_msgSender(), spender) == 0));
      _approve(_msgSender(), spender, amount);
      return true;
    
    }
@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Dec 22, 2021
code423n4 added a commit that referenced this issue Dec 22, 2021
@0xKiwi 0xKiwi added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

2 participants