Role providers cannot be EOAs as stated in the documentation. #49
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
M-07
primary issue
Highest quality submission among a set of duplicates
🤖_primary
AI based primary recommendation
🤖_70_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L220
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/FixedTermLoanHooks.sol#L254
Vulnerability details
Impact
The Documentation suggests that a role provider can be a "push" provider (one that "pushes" credentials into the hooks contract by calling
grantRole
) and a "pull" provider (one that the hook calls viagetCredential
orvalidateCredential
).The documentation also states that:
But in fact, only the initial deployer can be an EOA provider, since it is coded in the constructor. Any other EOA provider that the borrower tries to add via
addRoleProvider
will fail because it does not implement the interface.Proof of Concept
PoC will revert because EOA does not implement interface obviously:
PoC:
Tools Used
Manual Review
Recommended Mitigation Steps
Replace the interface call with a low-level call and check if the user implements the interface in order to be a pull provider:
With this code all logic works as expected, for EOA providers
pullProviderIndex
is set totype(uint24).max
, for contracts - depending on the result of callingisPullProvider
:Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: