addCalldataCheck()
will always revert when more than 1 parameter is whitelisted for the callDatas.
#35
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-17
edited-by-warden
🤖_10_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-10-kleidi/blob/ab89bcb443249e1524496b694ddb19e298dca799/src/Timelock.sol#L1119-L1124
Vulnerability details
Proof of Concept
Due to an invalid check of
startIndex
andendIndex
, parameters for the functionSelectors cannot be added to thecallDataCheck.dataHash
correctly.lets say , safe wants to whiteList
mul2numbers(bytes2 x,bytes2 y)
from a contractMultiply
so that hot signers can execute mul operations fromtimelock
.safe will schedule an operation to add this
callDatacheck
so that when the operation is ready to execute,timeLock
can executeaddCallDataCheck
(a user will be callling execute() to execute this operation).timelock.addCalldataCheck( contractAddress, selector, startIndex, endIndex, datas );
Now to whitelist a
bytes2
value(hex("1234"))
for the parameterx
, the inputs datas passed would beand then safe decided to whitelist another bytes2 value (hex("1234")) for the parameter
y
, here the inputs datas passed would beThis should efficiently store both these parameters inside the callDataChecks since
hex(1234)
will occupy thecallDatas
's4th index
and5th index
(total occupying 2 bytes spaces) andhex(3456)
will occupy thecallDatas
's6th index
and8th index
(total occupying 2 bytes spaces)But,
due to the check in the
_addCalldataCheck()
It will always revert.
POC
forge test --match-test testDCantAddDatastoCallDataCheck -vvv
when adding the datasY , the addCalldataCheck will revert.
Impact
The safe cannot whitelist callDatachecks for functions with more than 1 parameters.
Recommended Mitigation Steps
Assessed type
Other
The text was updated successfully, but these errors were encountered: