Skip to content

Sherlock

Flat Money

Every publicly disclosed report for Flat Money and what kind of bugs they were.

disclosed reports
16
most reported class
Business logic
bug classes found
3
first disclosure
2024
Find Flat Money on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Flat Money chose to make public.

Business logic

Long traders unable to withdraw their assets

The protocol's invariant check reverts when the actual collateral balance is less than the tracked collateral balance, which can happen when a long trader's profit exceeds the LP's stable collateral total. This bricks the protocol, preventing both long traders and LPs from withdrawing their assets.

Flat Money

Medium
Business logic

Trade fees can be avoided in limit orders

The trade fee for a limit order to close a leveraged position is calculated and stored when the order is announced, based on the position's size at that time. An attacker can announce a limit order with a small position size, then increase the position size before execution, so the trade fee paid is based on the smaller size, allowing them to avoid fees on the additional size at the expense of liquidity providers.

Flat Money

High
Business logic

Incorrect price used when updating the global position data

During liquidation, the code passed the position's last price instead of the current price to update global position data, causing incorrect profit and loss calculation. This could inflate long traders' gains and lead to losses for liquidity providers.

Flat Money

High
Race condition

A malicious user can bypass limit order trading fees via cross-function re-entrancy

The LeverageModule contract mints an NFT via _safeMint, which makes an external call to the receiver before updating the position state in the vault. An attacker can re-enter LimitOrder::announceLimitOrder() during that call and create a limit order with a zero trading fee because the position's additionalSize is still zero.

Flat Money

High
Business logic

Incorrect handling of PnL during liquidation

The liquidation logic incorrectly accounted for profit and loss (PnL) when updating the stable collateral total and margin deposited total, leading to inflated LP collateral totals and potential loss of assets. An attacker could exploit this to withdraw more tokens than they are entitled to.

Flat Money

High
Business logic

Asymmetry in profit and loss (PnL) calculations

The PnL calculation uses relative price changes, causing asymmetric outcomes when positions are adjusted. An attacker could exploit this to cause a loss of assets for the protocol or traders.

Flat Money

High
Audit finding

Malicious keepers can manipulate the price when executing an order

A keeper could execute an order without updating the Pyth price by passing an empty price update array, allowing them to choose an older on-chain price that benefits either LPs or traders. This could cause a loss to the opposing party.

Flat Money

High
Business logic

Long trader's deposited margin can be wiped out

A logic error in the funding fee settlement function can set the total deposited margin to zero when the accrued funding fees exceed the deposited margin, wiping out all long traders' collateral. Additionally, the same condition can cause an underflow revert when the sum of margin and funding fees is negative.

Flat Money

High
Business logic

Losses of some long traders can eat into the margins of others

The global margin accounting incorrectly deducts the total loss of all long traders from the shared margin pool, so one trader's loss can consume another trader's margin. This leaves the affected trader unable to withdraw their remaining margin and profits.

Flat Money

Medium
Smart contracts

Vault Inflation Attack

A malicious user can perform an inflation attack on the FlatCoin vault by minting a tiny share and then inflating the assets per share, causing subsequent depositors to receive zero shares due to rounding. The attacker can then withdraw the victim's deposit.

Flat Money

Medium
Business logic

The transfer lock for leveraged position orders can be bypassed

The transfer lock for leveraged position orders can be bypassed by announcing a limit order and then cancelling it, which unlocks the position while a delayed close order remains active. An attacker could sell the position to a third party and then execute the close order to steal the underlying collateral.

Flat Money

High
Smart contracts

Oracle can return different prices in same transaction

The Pyth oracle integration lets a caller submit and read two different price updates within a single transaction, so two orders can settle at different prices. An attacker could open and adjust a leveraged position and close it at a favourable second price, taking profit from the other side of the trade.

Flat Money

Medium