Skip to content
Access control Audit finding Intermediate

Approvals not cleared when transferring profile

The ApprovalFollowModule contract stores approvals keyed by the current owner and profile ID, but does not clear them when the profile NFT is transferred. If the NFT is later transferred back to the original owner, old approvals remain active, potentially allowing previous approved addresses to act unexpectedly.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

ApprovalFollowModule.sol#L32

The ApprovalFollowModule.approve function is indexed by both (owner = IERC721(HUB).ownerOf(profileId), profileId) in case the profileId NFT is transferred. However, upon transfer, the old approvals are not cleared.

This can lead to similar issues as OpenSea not cancelling their sale offers upon NFT transfer. When the NFT is at some point transferred back to the original owner, all the old approvals are still intact which might not be expected by the owner.

Recommended Mitigation Steps

Consider resetting all approvals upon transfer.

Zer0dot (Aave Lens) disputed and commented:

This is known and acceptable, users should be able to check their approvals even if they don’t have the profile.

Paging @oneski if you have any input.

0xleastwood (judge) commented:

I think this issue is entirely valid, it should not be on the users to manage their approvals so much. It would be much safer to wipe approvals on transfers and avoid this issue altogether.

Keeping this issue open and as is.

donosonaumczuk (Aave Lens) commented:

I would say wiping on transfers is a bit annoying as I could be transferring my profile between two addresses I own. It would be a better alternative to wipe on re-initialization by passing a boolean keepPreviousState flag (or something similar).

Zer0dot (Aave Lens) commented:

So after some more discussion, I think the points here are valid, but we were aware of this from the beginning. There are pros and cons to maintaining state. This module will not be present at launch and further iteration can modify it. Unfortunately there is no profile NFT transfer hook in follow modules currently. As this is still in my eyes not a direct vulnerability but more a caveat of how this specific system is designed, I would no longer dispute it but I would mark it as a low severity issue.

0xleastwood (judge) commented:

While I agree with you that giving users the ability to save the previous state on transfer makes sense and understand that the necessary changes to do this can be put in place in the future. I think its best I stay consistent with the judging rulebook as per below: 2 — Med (M): vulns have a risk of 2 and are considered “Medium” severity when assets are not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.

I believe the functionality of the protocol is impacted in this scenario so I think its fair to keep this as medium risk.

Zer0dot (Aave Lens) acknowledged and commented:

Sounds fair, acknowledging. This is something we’re going to look into deeper for newer or updated functionality (we won’t be deploying this module yet).


The original report as published on Code4rena, by cmichel. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the contract does not reset approvals when the profile NFT changes ownership, so approvals persist across transfers.

Impact

Old approvals remain active after a transfer, which could allow previously approved addresses to act on the profile if it is transferred back, though the project considers this a known caveat and the module was not deployed at launch.

What the attacker needed

Profile NFT is transferred; old approvals exist; NFT transferred back to original owner

The fix

The text recommends resetting all approvals upon transfer, but the project stated the module would not be deployed and would be revisited for future functionality.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a smart contract that lets people approve others to follow their profile. When the profile is sold or given away, the old approvals stay in place. If the profile comes back to the original owner later, those old approvals are still active, which could let someone the owner no longer trusts do things with the profile.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by cmichel

View all

196 more disclosed reports, best first.

More from Aave Lens contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.