Skip to content

Code4rena

Union Finance contest

Every publicly disclosed report for Union Finance contest and what kind of bugs they were.

disclosed reports
13
most reported class
Business logic
bug classes found
4
first disclosure
2021
Find Union Finance contest on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Union Finance contest chose to make public.

Access control

UnionToken should check whitelist on from ?

The UnionToken whitelist check in the transfer hook tested the caller rather than the account the tokens were moved from. A single whitelisted account acting as an operator could therefore move tokens for non-whitelisted holders, sidestepping the whitelist.

Union Finance contest

Medium
Business logic

Change in interest rate can disable repay of loan

The interest rate model owner can set an excessively high interest rate that causes the repay function to fail, preventing borrowers from repaying their loans. This could be exploited adversarially to force borrowers to pay more interest later.

Union Finance contest

Medium
Business logic

Duplicate utoken and usermanager can be added which cannot be deleted

The smart contract's addUToken and addUserManager functions allow duplicate entries to be added to their respective lists. If an admin later tries to delete a market, only the first instance is removed, leaving duplicates and meaning the market is not fully deleted.

Union Finance contest

Medium
Business logic

User Fund loss in case of Unsupported Market token deposit

The deposit function accepts tokens from unsupported markets and transfers them into the contract, but the withdraw function cannot process those same tokens, so the funds become stuck. An attacker or user could deposit an unsupported token and then be unable to withdraw it, causing a loss of funds.

Union Finance contest

Medium
DoS

MAX_TRUST_LIMIT might be too high

The smart contracts use an expensive sort function that could run out of gas if the list of stakers becomes too long. An attacker could add themselves as a staker to lengthen the list and cause a denial of service, though a limit of 100 stakers is in place.

Union Finance contest

Medium
Business logic

borrow must accrueInterest first

The borrow function checks the user's borrowed balance and credit limit before accruing interest, so the checks use stale values. In low-activity markets, a borrower could borrow more than the maximum borrow amount and more than their credit limit.

Union Finance contest

High
Business logic

Wrong implementation of CreditLimitByMedian.sol#getLockedAmount() will lock a much bigger total amount of staked tokens than expected

The getLockedAmount function in CreditLimitByMedian.sol locks the full borrowed amount from each staker who vouched for the borrower, rather than proportionally, so a single loan can lock a multiple of the borrowed amount across all stakers. An attacker could borrow a small amount and cause many stakers' funds to be locked, potentially blocking their tokens.

Union Finance contest

Medium
Business logic

Rebalance will fail due to low precision of percentages

The rebalance function requires the contract's token balance to be zero after deposits, but because percentages are expressed in basis points with low precision, small amounts of dust remain and the check reverts. This causes rebalancing to fail when the last market does not support the token.

Union Finance contest

Medium
Business logic

debtWriteOff updates totalFrozen immaturely, thereby losing staker rewards

The debtWriteOff function updates totalFrozen before withdrawing unionToken rewards, which can cause the staker to lose rewards if totalStaked equals totalFrozen. An attacker could exploit this by calling debtWriteOff when overdue, resulting in zero rewards.

Union Finance contest

Medium
Business logic

Rebalance will fail if a market has high utilization

The rebalance function attempts to withdraw all tokens from each money market, but in peer-to-peer lending protocols like Compound or Aave, full withdrawal may be impossible when utilisation is high. An attacker could cause rebalancing to fail by creating a liquidity crunch in a single market.

Union Finance contest

Medium