Skip to content
Business logic Audit finding Beginner

Protocol won't work with `USDC` even though it is a token specifically mentioned in the docs

The protocol enforces minimum token amounts (1e18 for minting, 1e12 for pool seeding) that are impractical for tokens with fewer decimals like USDC (6 decimals), making the protocol unusable with such tokens. An attacker could not exploit this directly, but legitimate users would be unable to use the protocol with USDC.

pashov Follow with ctf_sec and 0x52

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-float-capital-judging/issues/21

Found by

pashov, ctf_sec, 0x52

Summary

The protocol has requirements for values (for example 1e18) that would be too big if used with a 6 decimals token like USDC - USDC is mentioned as a token that will be used in the docs

Vulnerability Detail

For the mint functionality, a user has to transfer at least 1e18 tokens so that he can mint pool tokens - if (amount < 1e18) revert InvalidActionAmount(amount);. If the paymentToken used was USDC (as pointed out in docs), this would mean he would have to contribute at least 1e12 USDC tokens (more than a billion) which would be pretty much impossible to do. There is also another such check in MarketExtended::addPoolToExistingMarket with require(initialActualLiquidityForNewPool >= 1e12, "Insufficient market seed"); - both need huge amounts when using a low decimals token like USDC that has 6 decimals.

Impact

The protocol just wouldn't work at all in its current state when using a lower decimals token. Since such a token was mentioned in the docs I set this as a High severity issue.

Code Snippet

https://github.com/sherlock-audit/2022-11-float-capital/blob/main/contracts/market/template/MarketExtended.sol#L125 https://github.com/sherlock-audit/2022-11-float-capital/blob/main/contracts/market/template/MarketCore.sol#L265

Tool used

Manual Review

Recommendation

Drastically lower the require checks so they can work with tokens with a low decimals count like USDC

Discussion

JasoonS

I feel really silly that I didn't think of that when I wrote the readme - we have spoken about it came up many times in the alpha version audit that we did last year. We have no intention of using USDC anytime soon. We have been using DAI exclusively. My mistake - I thought why not just have the option for insurance sake and mention USDC (since it is the only other token remotely likely that we might use).

This most certainly isn't high - it is in the constructor that we'd immediately notice that (of course as I mentioned we have been aware of this for a long time). The rest of the mechanism works with USDC - just those minimums will need to be adjusted.

So, "Bug in the readme?" I'd say this isn't a vulnerability at all!

We could fetch the decimals from the payment token on initialization, but honestly don't think the extra complexity is justified in our situation.

Evert0x

As USDC was explicitly mentioned by the protocol we would like to reward this finding.

JasoonS

Fix PR: https://github.com/Float-Capital/monorepo/pull/3812 and relevant comment

Relevant comment: https://github.com/sherlock-audit/2022-11-float-capital/pull/10#discussion_r1035993867

jacksanford1

Note: Fix accepted by WatchPug

The original report as published on Sherlock, by pashov. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the minimum amount checks are hardcoded assuming 18-decimal tokens, without accounting for tokens with fewer decimals.

What the attacker needed

Protocol uses USDC as payment token

The fix

The minimum amount checks should be drastically lowered to accommodate tokens with low decimals like USDC.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a bug report about a cryptocurrency protocol that only works with tokens that have many decimal places. Tokens like USDC have fewer decimals, so the minimum amounts required become impossibly large. The protocol would not function for users with USDC.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by pashov

View all

7 more disclosed reports, best first.

More from Float Capital

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.