Open code423n4 opened 1 year ago
act() -> processPublicationAction() -> _processCollect() this could affect the entire operation.
That's ok, we didn't limit the amount at protocol level because it's already limited by the Gas. Users will decide how many actions to set, and which ones, based on their budget. API and relayers will probably limit the amount of actions they allow, so they don't overspend when executing a meta-tx on behalf ot a user.
We don't see this as an issue.
donosonaumczuk marked the issue as sponsor disputed
Low severity as long as it's Users inputting these values or API and relayers executing job as it's within their job to not overspend
Picodes changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/code-423n4/2023-07-lens/blob/main/contracts/libraries/ValidationLib.sol#L87-L119 https://github.com/code-423n4/2023-07-lens/blob/main/contracts/modules/act/collect/CollectPublicationAction.sol#L109-L127 https://github.com/code-423n4/2023-07-lens/blob/main/contracts/modules/act/collect/base/BaseFeeCollectModule.sol#L262-L295
Vulnerability details
Summary
Publication functions (post/comment/mirror/quote/act) can receive an array of referrals to pass to their modules/actions.
Those modules and actions will iterate and process those referrals on a later stage.
Referral arrays might be big enough that certain modules and actions might fail when they try to process them due to an Out of Gas error, and leading to a DOS of them.
Impact
Publication modules and actions might revert with Out of Gas due to the unbound length of referrals that have to be processed.
Proof of Concept
Publication actions and modules might process referrals on a while loop. If the length of the array is big enough, the function may revert with out of gas during the loop execution.
Here is an example of
CollectPublicationAction
using a collect module. In this case, the module is called viaprocessCollect()
and the internal function_transferToReferrals()
, which makes one external call to transfer tokens for each individual referral.CollectPublicationAction.sol#L109-L127
BaseFeeCollectModule.sol#L262-L295
Referrals are passed to
PublicationLib
andActionLib
functions, and validated viaValidationLib
.The
ValidationLib::validateReferrersAndGetReferrersPubTypes()
function validates thatreferrerProfileIds
andreferrerPubIds
have the same length, but it actually doesn't check that the length of the referrals are below a certain limit:ValidationLib.sol#L87-L119
Tools Used
Manual Review
Recommended Mitigation Steps
Limit the number of
referrerProfileIds
andreferrerPubIds
to a max cap onValidationLib::validateReferrersAndGetReferrersPubTypes()
.Assessed type
Invalid Validation