MixinTransfer.sol#transferFrom
Wrong implementation can potentially allows attackers to reverse transfer and cause fund loss to the users
#182
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-11-unlock/blob/ec41eada1dd116bcccc5603ce342257584bec783/smart-contracts/contracts/mixins/MixinTransfer.sol#L131-L152
Based on the context, L131-136 seems to be the logic of handling the case of the recipient with no key, and L138-148 is handing the case of the recipient's key expired.
However, in L131-136, the key manager is not being reset.
This allows attackers to keep the role of key manager after the transfer, and transfer the key back or to another recipient.
PoC
Given:
setKeyManagerOf()
, making herself the keyManager;transferFrom()
, transferring the key to Bob; Bob might have paid a certain amount of money to Alice upon receive of the key;transferFrom()
again, transferring the key back from Bob.Recommendation
Consider resetting the key manager regardless of the status of the recipient's key.
The text was updated successfully, but these errors were encountered: