Hunt prep
Before you test Union Finance contest
What 13 disclosed reports say about Union Finance contest: what was found and paid, what was fixed, and where it may be worth looking next.
- with a public bounty
- 0
- median public bounty
- –
- highest public bounty
- –
Gaps worth testing
Not written yet for this program. The numbers below are up to date.
What was found and what it paid
Public bounties only; many reports disclose without the amount.
| Class | Reports | Paid | Median | Highest | In all |
|---|---|---|---|---|---|
| Business logic lesson | 10 | 0 | – | – | $0 |
| Access control lesson | 1 | 0 | – | – | $0 |
| DoS lesson | 1 | 0 | – | – | $0 |
| Smart contracts lesson | 1 | 0 | – | – | $0 |
What was fixed
All reportsThe newest fixes, in our words. A fixed bug is not worth re-reporting, but a sibling feature, an older API version or a regression may be.
-
Wrong implementation of CreditLimitByMedian.sol#getLockedAmount() makes it unable to unlock lockedAmount in CreditLimitByMedian model
The code should be changed to subtract the amount parameter instead of 1.
Disclosed
-
UnionToken should check whitelist on from ?
The whitelist check should be applied to the account the tokens are moved from rather than the caller.
Disclosed
-
Change in interest rate can disable repay of loan
The fix is to add a check in FixedInterestRateModel::setInterestRate() to disallow setting the interest rate too high.
Disclosed
-
Comptroller rewards can be artificially inflated and drained by manipulating [totalStaked - totalFrozen] (or: wrong rewards calculation)
The line should be changed to not deduct totalFrozen, i.e., set totalStaked to userManagerContract.totalStaked() without subtracting totalFrozen.
Disclosed
-
Duplicate utoken and usermanager can be added which cannot be deleted
The addUToken and addUserManager functions should be modified to check if the utoken or usermanager already exists before adding.
Disclosed
-
User Fund loss in case of Unsupported Market token deposit
The deposit function should revert or stop execution if the token is not supported.
Disclosed
-
MAX_TRUST_LIMIT might be too high
The maximum number of stakers should be set to a value that keeps the sort within gas limits, with a margin for future gas cost changes, and tested with that many stakers.
Disclosed
-
borrow must accrueInterest first
The accrueInterest call should be moved to the beginning of the borrow function.
Disclosed
-
Wrong implementation of CreditLimitByMedian.sol#getLockedAmount() will lock a much bigger total amount of staked tokens than expected
The sponsor mitigated by removing CreditLimitByMedian from the codebase, and the judge recommended adding a cap on the locked amount.
Disclosed
-
Rebalance will fail due to low precision of percentages
Remove the final zero balance check, or make sure that the last market that is actually deposited to receives all remaining tokens.
Disclosed
-
debtWriteOff updates totalFrozen immaturely, thereby losing staker rewards
The withdrawRewards call should be moved before updateTotalFrozen in debtWriteOff.
Disclosed
-
UserManager : totalStaked ≥ totalFrozen should be checked before and after totalFrozen is updated
An additional require statement should be added after the update to ensure the invariant holds.
Disclosed
-
Rebalance will fail if a market has high utilization
The rebalance function should be rewritten to withdraw only what is available and rebalance based on that, rather than trying to pull all tokens from each market first.
Disclosed