code-423n4 / 2024-08-wildcat-findings

3 stars 1 forks source link

Role provider permission escalation #86

Closed howlbot-integration[bot] closed 2 months ago

howlbot-integration[bot] commented 2 months ago

Lines of code

https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/FixedTermLoanHooks.sol#L404-L413

Vulnerability details

Proof of Concept

The grantRole function says that:

   *      If the account has an existing credential, it can only be updated if:
   *      - the previous credential's provider is no longer supported, OR
   *      - the caller is the previous role provider, OR
   *      - the new expiry is later than the current expiry

However this is not always true. Consider the following scenario:

This means that a role providers should not be able to reduce a credential set by another role provider. As a consequence they will be able to reduce the credentials when they should not be able to.

Recommended Mitigation Steps

Refactor the function so that's not possible

Assessed type

Other

c4-judge commented 1 month ago

3docSec marked the issue as satisfactory