Hunt prep
Before you test Union Finance
What 23 disclosed reports say about Union Finance: 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 | 14 | 0 | – | – | $0 |
| DoS lesson | 6 | 0 | – | – | $0 |
| Smart contracts lesson | 2 | 0 | – | – | $0 |
| Access control 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.
-
Loan can be written off by anybody before overdue delay expires
Reset the borrower's lastRepay to zero when the debt is fully written off.
Disclosed
-
repayBorrow is inaccessible by overdue borrowers
The updateFrozenInfo function should be callable by both UToken and the comptroller, for example by checking that the caller is either address.
Disclosed
-
Stakers will lose their rewards as updateLocked() updates only the first active vouches until there is a prepayment
The updateLocked() function should update lastUpdated for all active vouches regardless of prepayment amount, or reward calculation should use the borrower's lastRepay instead of vouch.lastUpdated.
Disclosed
-
Stakers can have their funds locked for an extended period not related to the performance of their borrowers
The cancelVouch function should be modified to preserve the FIFO order, for example by rebuilding the array without the removed vouch or by maintaining a separate order array.
Disclosed
-
UNION rewards issuance can be maximized without providing credit
Reward accounting should be updated on member registration and on changes to locked stake and debt write-offs, so that the multiplier reflects the state at the time rewards were earned.
Disclosed
-
A stake that has just been locked gets full reward multiplier
The rewards calculation should account for the duration of the lock, giving the full multiplier only to locks that are as old as the stake itself.
Disclosed
-
UserManager.sol#L438-L466 : getFrozenInfo could revert due to out of gas when the vouchees array size is large
The recommendation is to cap the number of vouchees processed or process the array in smaller batches to avoid out-of-gas reverts.
Disclosed
-
Unsafe downcasting arithmetic operation in UserManager related contract and in UToken.sol
The code should use uint256 throughout or apply OpenZeppelin's safe casting, and the team said it will likely fix with a safecast library.
Disclosed
-
Partial withdrawals by AssetManager lead to user funds freeze
The withdraw function should either return the actual amount withdrawn and callers should use that amount in their accounting, or it should revert if the full requested amount cannot be retrieved.
Disclosed
-
`AssetManager::withdraw` will not return false, when fail to send the withdraw amount
The function should check the remaining amount and return false when it is greater than zero, so callers do not treat a partial transfer as complete.
Disclosed
-
Maximal approvals remain for the AssetManager's adapters and tokens after removal
The report recommends adding a function to clear approvals (set allowance to zero) when removing an adapter or token, and calling it from the removal functions.
Disclosed
-
`Comptroller::withdrawRewards` accounting error results in incorrect inflation index
The code should use userManagerState.totalStaked directly without subtracting totalFrozen again.
Disclosed
-
Staker rewards can be gathered with maximal multiplier no matter how borrowers are overdue
The lastUpdated timestamp should only be refreshed on initial borrowing from a vouch and on notional repayment, not on repetitive borrowing; the report also suggests basing frozen totals on the borrower's lastRepay instead.
Disclosed
-
It's impossible to writing off any vouch fully for an outside actor
The fix should update cancelVouch to allow calls from the contract itself and have debtWriteOff call it via an external self-call.
Disclosed
-
getUserInfo() returns incorrect values for locked and stakedAmount
The order of return values in getUserInfo() should be reversed to match the Staker struct fields.
Disclosed