Wrong input parameter passed to DSS hook function - msg.sender instead of operator #23
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
insufficient quality report
This report is not of sufficient quality
primary issue
Highest quality submission among a set of duplicates
🤖_62_group
AI based duplicate group recommendation
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2024-07-karak/blob/main/src/interfaces/IDSS.sol#L15
https://github.com/code-423n4/2024-07-karak/blob/main/src/Core.sol#L146
https://github.com/code-423n4/2024-07-karak/blob/main/src/entities/Operator.sol#L126
Vulnerability details
Impact
The protocol defines an interface with optional hook functions for DSSes to implement. These functions take in the Operator as an input parameter. By design anyone can finalize a vault staking request by calling
finalizeUpdateVaultStakeInDSS()
. However, in the function flow, it callsvalidateAndUpdateVaultStakeInDSS()
which passes inmsg.sender
, instead of the operator as the parameter to the low level call to the DSS.This is not in line with the specified DSS interface by the protocol. The severity impact depends on the implementation of the DSS, however issues are certain to happen, as this is a stake update function and the DSS expects the operator as input.
Proof of Concept
The protocol specifies the following DSS interface:
https://github.com/code-423n4/2024-07-karak/blob/main/src/interfaces/IDSS.sol#L15
As we can see, all hooks expect the operator as input. However, by design anyone can finalize a vault stake update request and the
finalizeUpdateVaultStakeInDSS()
function is callable by anyone:https://github.com/code-423n4/2024-07-karak/blob/main/src/Core.sol#L146
This function in turn calls
validateAndUpdateVaultStakeInDSS()
, which makes the low level call tofinishUpdateStakeHook()
withmsg.sender
as parameter, and not the operator:https://github.com/code-423n4/2024-07-karak/blob/main/src/entities/Operator.sol#L126
Tools Used
Manual review
Recommended Mitigation Steps
Apply this correction:
https://github.com/code-423n4/2024-07-karak/blob/main/src/entities/Operator.sol#L126
Assessed type
Error
The text was updated successfully, but these errors were encountered: