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

transferCard should be done after treasury is updated. #35

Open
code423n4 opened this issue Aug 24, 2021 · 1 comment
Open

transferCard should be done after treasury is updated. #35

code423n4 opened this issue Aug 24, 2021 · 1 comment
Labels
1 (Low Risk) bug Something isn't working Resolved Used when a fix has been implemented. sponsor confirmed

Comments

@code423n4
Copy link
Contributor

Handle

0xImpostor

Vulnerability details

Impact

When the current owner of the card is still the new owner of the card, transferCard is called before the treasury is updated. While this does not currently pose a risk, it is not aligned with best practices of check-effect-interations and opens your code to a potential re-entrancy attack in the future.

Tools Used

Manual analysis

Recommended Mitigation Steps

// line 381
treasury.updateRentalRate(
    _oldOwner,
    _user,
    user[_oldOwner][index[_oldOwner][_market][_card]].price,
    _price,
    block.timestamp
);
transferCard(_market, _card, _oldOwner, _user, _price);
...
// line 449
treasury.updateRentalRate(
    _user,
    _user,
    _price,
    _currUser.price,
    block.timestamp
);
transferCard(_market, _card, _user, _user, _currUser.price);
@code423n4 code423n4 added 1 (Low Risk) bug Something isn't working labels Aug 24, 2021
code423n4 added a commit that referenced this issue Aug 24, 2021
@Splidge Splidge added Resolved Used when a fix has been implemented. sponsor confirmed labels Aug 26, 2021
@Splidge
Copy link
Collaborator

Splidge commented Sep 7, 2021

Fixed here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) bug Something isn't working Resolved Used when a fix has been implemented. sponsor confirmed
Projects
None yet
Development

No branches or pull requests

2 participants