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

addFunds and execute may send tokens twice #32

Closed
code423n4 opened this issue Jul 11, 2021 · 1 comment
Closed

addFunds and execute may send tokens twice #32

code423n4 opened this issue Jul 11, 2021 · 1 comment
Labels
3 (High Risk) bug Something isn't working duplicate This issue or pull request already exists sponsor confirmed Yes, this is a problem and we intend to fix it.

Comments

@code423n4
Copy link
Contributor

Handle

pauliax

Vulnerability details

Impact

Both calls to IFulfillHelper (addFunds and execute) are wrapped in separate try/catch statements so basically if addFunds succeeds but execute fails or both of these functions fail, the catch will still send assets to the receivingAddress. I think these should be wrapped to a single try/catch to avoid the potential double spend.
Also, I think it is pointless having 2 separate calls (addFunds and execute) as both of them are done one immediately after the other and basically pass the same parameters. One call to the IFulfillHelper could be enough. Eliminating this extra external call will reduce gas costs and simplify the code.

Recommended Mitigation Steps

Make execute payable, send the value, and get rid of addFunds.

@code423n4 code423n4 added 3 (High Risk) bug Something isn't working labels Jul 11, 2021
code423n4 added a commit that referenced this issue Jul 11, 2021
@LayneHaber LayneHaber added duplicate This issue or pull request already exists sponsor confirmed Yes, this is a problem and we intend to fix it. labels Jul 12, 2021
@LayneHaber
Copy link
Collaborator

#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) bug Something isn't working duplicate This issue or pull request already exists sponsor confirmed Yes, this is a problem and we intend to fix it.
Projects
None yet
Development

No branches or pull requests

2 participants