Skip to content
Business logic Audit finding Intermediate

Zero collection module can be whitelisted and set to a post, which will then revert all collects and mirrors with `PublicationDoesNotExist

If the zero address is whitelisted as a collect module and then set on a post, all collect and mirror attempts revert with PublicationDoesNotExist, and getPubType incorrectly returns Mirror. An attacker with governance privileges could cause this, but the report notes it requires a bad actor in governance.

hyh Follow

Originally disclosed on Code4rena

Submitted by hyh

In case when zero collection module be white listed and then zero collection module set to a post (done by different actors), its functionality will be partially broken: every collecting and mirroring of it will be reverted with Errors.PublicationDoesNotExist, while getPubType will return its type as a Mirror.

Setting severity to Medium per ‘function of the protocol or its availability could be impacted’, as either the behavior of rejecting collects/mirrors is desired and to be implemented explicitly, or such a scenario shouldn’t exist in a system, i.e. now zero address absence in white list cannot be guaranteed as its setting is manual and possible

Proof of Concept

Collect module isn’t checked additionally on init, any white listed address can be set:

PublishingLogic.sol#L308-309

While zero address also can be white listed:

LensHub.sol#L128-135

If zero address is white listed and then set as collectModule for a post, a getPointedIfMirror helper function called on it will revert with Errors.PublicationDoesNotExist:

Helpers.sol#L47

This way all attempts to collect and mirror this post will also revert:

InteractionLogic.sol#L108

PublishingLogic.sol#L258

Also, getContentURI view will fail with the same error:

LensHub.sol#L785

And getPubType will return Mirror as a publication type:

LensHub.sol#L829

Recommended Mitigation Steps

Consider prohibiting zero collection module to be white listed.

If rejecting collects/mirrors is desired for a special post type, the corresponding error path can be implemented

Zer0dot (Aave Lens) acknowledged and commented:

This implies governance is a bad actor, and despite it being a side effect, reverting on a zero collect module is acceptable. IMO this is not relevant, though technically the report is valid, we won’t be changing anything.

Zer0dot (Aave Lens) commented:

In consistency with some other comments I made, I wonder if marking this as “low” severity makes more sense. Governance being compromised is within acceptable risk parameters.

0xleastwood (judge) commented:

I think this is inline with C4’s guidelines for a medium severity issue. As such, I’d keep this as is.

This is consistent with other governance related issues.

Zer0dot (Aave Lens) commented:

Sounds fair!


The original report as published on Code4rena, by hyh. 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 whitelist allows the zero address to be added as a collect module, and the system does not check for this when setting a module on a post, leading to reverts in helper functions that expect a valid publication.

Impact

Collecting and mirroring the affected post is blocked, and some view functions return errors or incorrect data; the report notes this requires governance to be a bad actor, and the project considers reverting on a zero collect module acceptable.

What the attacker needed

Governance whitelists zero address; governance sets zero address as module

The fix

The report recommends prohibiting the zero address from being whitelisted as a collect module, or explicitly implementing the error path if rejecting collects/mirrors is desired; the project chose not to change anything.

How it was found

  1. Whitelist the zero address as a collect module.
  2. Set the zero address as the collect module for a post.
  3. Attempt to collect or mirror the post, which reverts with PublicationDoesNotExist.
  4. Call getContentURI, which also fails with the same error.
  5. Call getPubType, which returns Mirror instead of the correct type.

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.

A collect module is a smart contract that handles how posts are collected. If the zero address (a special address with no code) is allowed as a module and then assigned to a post, any attempt to collect or mirror that post fails with an error. The report says this only happens if governance (the group that manages whitelisting) makes a mistake or acts maliciously.

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 hyh

View all

137 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.