Open code423n4 opened 1 year ago
141345 marked the issue as primary issue
We confirm the issue. However, we are still debating if it is a Medium severity one or if it should be classified as Low
donosonaumczuk marked the issue as disagree with severity
We mark it as we disagree with the severity, so we can discuss it better with the judges.
Picodes marked the issue as selected for report
Picodes changed the severity to QA (Quality Assurance)
This previously downgraded issue has been upgraded by Picodes
Some comments :
approveFollow
and unfollow
are quite clear on the fact that approveFollow
doesn't give approval to unfollowbut the argument that a functionality is broken as the unfollowerProfileOwner
should be able to perform the operation seems valid to me and would be of Med severity under function of the protocol or its availability could be impacted
Overall Medium severity seems appropriate here
Picodes marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2023-07-lens/blob/main/contracts/FollowNFT.sol#L115-L125
Vulnerability details
Bug Description
If the
followTokenId
of a profile is wrapped, users will only be able to unfollow if they are either:This can be seen in the
unfollow()
function ofFollowNFT.sol
:FollowNFT.sol#L115-L125
As seen from above, users that are not the owner or do not have approval for the wrapped follow NFT will not be able to unfollow. This is problematic as users are able to follow with a
followTokenId
without owning the corresponding follow NFT.For example, someone who holds a follow NFT can call
approveFollow()
for a user. The user can then callfollow()
with the correspondingfollowTokenId
, which works as_followWithWrappedToken()
checks for follow approval:FollowNFT.sol#L317-L327
Now, if the user wants to unfollow, he will be unable to do so by himself, and is forced to rely on the follow NFT owner to unfollow for his profile.
Impact
Users that follow using a wrapped
followTokenId
that they do not own will not be unfollow the profile. This is incorrect as a profile owner should have full control over who the profile does/does not follow.Proof of Concept
The Foundry test below demonstrates that
unfollow()
will revert when users do not own the FollowNFT, even when unfollowing with their own profile. It can be run with the following command:Recommended Mitigation
In
unfollow()
, consider allowing the owner ofunfollowerProfileId
to unfollow as well:FollowNFT.sol#L115-L125
Assessed type
Access Control