You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
UserManager.updateFrozenInfo cannot be called from UToken
Summary
The new version of the contract doesn't allow UserManager.updateFrozenInfo to be called from UToken. Hence, if a borrower is overdue he will not be able to call UToken._repayBorrowFresh to repay his principal.
Vulnerability Detail
When UToken._repayBorrowFresh is called with an overdue borrower as borrower, the call to UToken._repayBorrowFresh will always revert if repayAmount >= interest because updateFrozenInfo is called on the UserManager contract:
if (isOverdue) {
// For borrowers that are paying back overdue balances we need to update their// frozen balance and the global total frozen balance on the UserManagerIUserManager(userManager).updateFrozenInfo(borrower, 0);
But UserManager.updateFrozenInfo cannot be called from the UToken contract. Only the Comptroller contract can call this function:
seyni
medium
UserManager.updateFrozenInfo
cannot be called fromUToken
Summary
The new version of the contract doesn't allow
UserManager.updateFrozenInfo
to be called fromUToken
. Hence, if a borrower is overdue he will not be able to callUToken._repayBorrowFresh
to repay his principal.Vulnerability Detail
When
UToken._repayBorrowFresh
is called with an overdue borrower asborrower
, the call toUToken._repayBorrowFresh
will always revert ifrepayAmount >= interest
becauseupdateFrozenInfo
is called on theUserManager
contract:But
UserManager.updateFrozenInfo
cannot be called from theUToken
contract. Only theComptroller
contract can call this function:Impact
When a borrower is overdue he will not be able to repay is principal. Any call to
UToken._repayBorrowFresh
withrepayAmount >= interest
will revert.Code Snippet
https://github.com/sherlock-audit/2022-10-union-finance/blob/main/union-v2-contracts/contracts/market/UToken.sol#L624
https://github.com/sherlock-audit/2022-10-union-finance/blob/main/union-v2-contracts/contracts/user/UserManager.sol#L881
Tool used
Manual Review
Recommendation
Add access for the
UToken
contract toUserManager.updateFrozenInfo
by using this modifier:Duplicate of #133
The text was updated successfully, but these errors were encountered: