code-423n4 / 2023-07-lens-findings

0 stars 0 forks source link

Cannot unwrap token after recovering through wrapping #188

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-07-lens/blob/main/contracts/FollowNFT.sol#L168-L185

Vulnerability details

Impact

Cannot unwrap token after recovering through wrapping.

Proof of Concept

FollowNFT#unwrap checks if followerProfileId for the token is not 0:

if (_followDataByFollowTokenId[followTokenId].followerProfileId == 0) {
    revert NotFollowing();
}

while after recovering token through FollowNFT#wrap, its followerProfileId is not updated.

if (followerProfileId == 0) {
    followerProfileId = _followDataByFollowTokenId[followTokenId].profileIdAllowedToRecover;
    if (followerProfileId == 0) {
        revert FollowTokenDoesNotExist();
    }
    delete _followDataByFollowTokenId[followTokenId].profileIdAllowedToRecover;
}

Recommended Mitigation Steps

Update followerProfileId for the wrapped token if recovering through wrapping it.

Assessed type

Error

c4-pre-sort commented 1 year ago

141345 marked the issue as low quality report

141345 commented 1 year ago

invalid

followerProfileId is not set to 0

c4-judge commented 1 year ago

Picodes marked the issue as unsatisfactory: Invalid