Unauthorized token relocking in _withdrawExpiredLocksFor
allows fund locking without user consent
#362
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-220
grade-a
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_primary
AI based primary recommendation
🤖_113_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-loopfi/blob/57871f64bdea450c1f04c9a53dc1a78223719164/src/reward/MultiFeeDistribution.sol#L1351-L1381
Vulnerability details
Impact
DOS. The implementation of the
_withdrawExpiredLocksFor
function allows anybody to relock expired tokens on behalf of another user without their explicit permission. This leads to unexpected token locking preventing users from accessing their funds when they intend to.Proof of Concept
Look at the
_withdrawExpiredLocksFor
function: https://github.com/code-423n4/2024-07-loopfi/blob/57871f64bdea450c1f04c9a53dc1a78223719164/src/reward/MultiFeeDistribution.sol#L1351-L1381The condition
(address_ != msg.sender && !autoRelockDisabled[address_])
allows any user to relock tokens for another user if auto-relocking is not disabled. This can happen even ifisRelockAction
is false, which means it wasn't explicitly intended to be a relocking action.An attacker could exploit this by calling the function with
isRelockAction
set to false,doTransfer
set to false, and targeting a user who hasn't disabled auto-relocking. This would cause the tokens to be relocked without the owner's consent.Tools Used
Manual code review
Recommended Mitigation Steps
Modify the condition to only allow relocking if it's an explicit relock action and the caller is either the token owner or the authorized
_lockZap
contract. This is to ensure that relocking can only occur when explicitly requested (isRelockAction
is true) and only by the token owner or the authorized_lockZap
contract thus preventing unauthorized relocking of tokens, protecting users from unexpected fund locking.Assessed type
DoS
The text was updated successfully, but these errors were encountered: