Closed code423n4 closed 1 year ago
There will be multiple PrePOMarket
, and the intent is that the list of PrePOMarket
is in the allowedMsgSenders
list. Safety checks could be added, but this would fall within QA.
Picodes marked the issue as unsatisfactory: Overinflated severity
Lines of code
https://github.com/prepo-io/prepo-monorepo/blob/3541bc704ab185a969f300e96e2f744a572a3640/apps/smart-contracts/core/contracts/RedeemHook.sol#L17 https://github.com/prepo-io/prepo-monorepo/blob/3541bc704ab185a969f300e96e2f744a572a3640/apps/smart-contracts/core/contracts/PrePOMarket.sol#L96
Vulnerability details
Impact
Access control for
hook
function inRedeemHook
Contract is inconsistent with the implementation. Since the function involves a transfer of fees to Treasury, I've marked it as MEDIUM RISKRedeemHook
checks if sender is in a list of pre-approved accounts in_allowedMsgSenders
. Access control modifier for thehook
function (onlyAllowedMsgSenders
) allows any allowed msg sender to access this hook.However, the function wraps a
IPrePOMarket
inteface onmsg.sender
in line 21This ineffect means that the hook is expecting
msg.sender
to bePrePOMarket
address. However, there is no such restriction to accounts added to_allowedMsgSenders
. This behavior is inconsistent with 'access permissions' and the hook will throw an error when it tries to search forcollateral
addressProof of Concept
Bob is in the list of accounts of
_allowedMsgSenders
and henceonlyAllowedMsgSenders
allows Bob to access theredeemHook
.However, Bob's account is not a
PrePOMarket
- it will not return collateral address whengetCollateral
function is called in Line 21 & hencetransferFrom
function can never work when Bob calls this function.Tools Used
Recommended Mitigation Steps
Since
redeemHook
will only be called from within theredeem
function ofPrePOMarket
, appropriate access control is to ONLY allowPrePOMarket
address to access theredeemHook