Skip to content
Business logic Audit finding Intermediate

Cashback on referral

The fee collect modules allow a user to specify any profile as the referrer, so a collector can use a second profile they control to receive part of the fee back. This lets users effectively get a discount on collection fees, leaking value from the protocol.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel, also found by csanuragjain and gzeon

FeeCollectModule.sol#L99

In the fee collect modules like FeeCollectModule there is no prevention of someone submitting a second profile they own as the referrerProfileId in processCollect to receive back part of the fees paid.

The referral system is essentially broken as all rational agents will submit a second profile they control to get back part of the fees. One could even create a referrer smart contract profile that anyone can submit which automatically refunds the fee received. A similar royalties/referral fees issue was judged high-severity recently.

Recommended Mitigation Steps

There’s no way to avoid this except by not allowing any profile as a referrer. Whitelist certain important infrastructure providers, like different frontends, as referrers and only allow these to be used instead of users submitting their alt profiles.

Zer0dot (Aave Lens) commented:

Not sure if this makes sense, using your own referrer as a profile would basically be the equivalent of just having your publication collected directly without referral. In which case, what is the vulnerability?

donosonaumczuk (Aave Lens) commented:

I think they mean the case where Alice posts something and Bob wants to collect it. So Bob instead of just collecting directly from Alice publication, he creates a secondary profile, Bob2, mirrors publication through Bob2 and now Bob collects through Bob2’s mirror, basically using the referral fee as a collecting discount for himself.

Even if we enforce referral profile owner to be different than collecting profile owner (aka comparing ownerOf(profileId) instead of profileId) people can just use different addresses for the purpose.

I saw this before but I assumed most of people will use the frontend, which will handle this automatically. But I believe that in the long term is possible that people learn the trick and, as rational agents, use it.

Awaiting for @Zer0dot thoughts on this.

Zer0dot (Aave Lens) commented:

I see, thanks @donosonaumczuk, at the end of the day this is a social protocol. Just like how on legacy social media, users can spam/abuse things, it’s a given here that we will never have a fully foolproof system. Plus, with the chain history being visible, tools can (and I’d like to see them) be built to filter out nasty behavior. @oneski want to weigh in?

donosonaumczuk (Aave Lens) disputed and commented:

I think there is nothing more to do here.

0xleastwood (judge) decreased severity to Medium and commented:

I think its naive to think that this will be properly handled by the front-end and won’t be abused by users at some point in time. As such, I’m inclined to treat this as a valid medium risk issue because it fits the category of value leakage by the protocol. However, I can understand that there is no easy fix to this because it is impossible to link EOAs as originating from the same person.

Zer0dot (Aave Lens) commented:

Yeah I think that’s fair, since we’re dealing with a social protocol there’s a degree of social “etiquette” expected from users. Since this does not harm the protocol or the original publication creator, I don’t see it as a significant flaw. However, it does of course harm curators. I tend to disagree on the point about frontends @0xleastwood though, it seems to me that if this were to be a problem, it would be fairly straightforward to point fingers at those abusing the system.

0xleastwood (judge) commented:

While I understand an attacker would need to call functions directly to set this up, I’m not fully onboard with the idea that we could punish users who abuse the system in such a way. As per the judging guidelines, any issue that leaks value from the protocol is medium risk.

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 think its perfectly fine if this issue is acknowledged and you guys have decided to handle it through front-end design. However, it does not take away from the fact that it is still somewhat of an exploit.

Zer0dot (Aave Lens) acknowledged and commented:

Fair enough! We can roll with medium.


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 lack of restriction on who can be a referrer, allowing a user to refer themselves via an alternate profile.

Impact

This could leak value from the protocol by letting users pay less in fees, though it does not harm the original publication creator and may be mitigated by front-end design.

What the attacker needed

A profile to collect with; a second profile to act as referrer

The fix

The recommended mitigation is to whitelist certain infrastructure providers as referrers and disallow arbitrary profiles.

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.

When someone pays a fee to collect a publication, part of that fee can go to a referrer. The code lets the payer choose any referrer, including a second account they own, so they get some of the fee back. This means the referral system can be abused to reduce the cost of collecting.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

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.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.