Float Capital contest - hack3r-0m's results

Synthetic assets made simple. No overcollateralization. No liquidation. Not a fork.

General Information

Platform: Code4rena

Start Date: 05/08/2021

Pot Size: $50,000 USDC

Total HM: 9

Participants: 16

Period: 7 days

Judge: 0xean

Total Solo HM: 4

Id: 22

League: ETH

Float Capital

Findings Distribution

Researcher Performance

Rank: 9/16

Findings: 4

Award: $1,217.87

🌟 Selected for report: 1

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: gpersoon

Also found by: 0xImpostor, hack3r-0m, jonah1005, loop, pauliax, shw

Labels

bug
2 (Med Risk)
sponsor confirmed

Awards

139.9465 USDC - $139.95

External Links

Handle

hack3r-0m

Vulnerability details

https://github.com/hack3r-0m/2021-08-floatcapital/blob/main/contracts/contracts/LongShort.sol#L363-L365

initializeMarket can be called with different marketIndex each time while calling IStaker(staker).addNewStakingFund with the same parameters resulting in overriding of mapping in the staker contract and hence removing past staking funds.

latestMarket should be replaced with marketIndex in the above-marked code lines.

#0 - JasoonS

2021-08-12T06:06:02Z

Duplicate #9

Findings Information

🌟 Selected for report: hack3r-0m

Also found by: cmichel

Labels

bug
2 (Med Risk)
sponsor confirmed
disagree with severity

Awards

1053.3363 USDC - $1,053.34

External Links

Handle

hack3r-0m

Vulnerability details

Consider the following state:

long_synth_balace = 300; short_synth_balace = 200;

marketUpdateIndex[1] = x; userNextPrice_currentUpdateIndex = 0; userNextPrice_syntheticToken_toShiftAwayFrom_marketSide[1][true] = 0; batched_amountSyntheticToken_toShiftAwayFrom_marketSide[1][true] = 0;

User calls shiftPositionFromLongNextPrice(marketIndex=1, amountSyntheticTokensToShift=100)

This results in following state changes:

long_synth_balace = 200; short_synth_balace = 200; userNextPrice_syntheticToken_toShiftAwayFrom_marketSide[1][true] = 100; batched_amountSyntheticToken_toShiftAwayFrom_marketSide[1][true] = 100; userNextPrice_currentUpdateIndex = x+1 ;

Due to some other transactions, oracle updates twice, and now the marketUpdateIndex[1] is x+2 and also updating price snapshots.

When User calls getUsersConfirmedButNotSettledSynthBalance(user, 1)

initial condition

if ( userNextPrice_currentUpdateIndex[marketIndex][user] != 0 && userNextPrice_currentUpdateIndex[marketIndex][user] <= currentMarketUpdateIndex )

will be true;

syntheticToken_priceSnapshot[marketIndex][isLong][currentMarketUpdateIndex] (https://github.com/hack3r-0m/2021-08-floatcapital/blob/main/contracts/contracts/LongShort.sol#L532)

this uses price of current x+2 th update while it should balance of accounting for price of x+1 th update.

#0 - JasoonS

2021-08-12T05:53:26Z

Yes good spot.

This function is view only, and is only used for view only purposes. The rest of the system will always operate correctly because it rather uses _executeOutstandingNextPriceSettlements than the getUsersConfirmedButNotSettledSynthBalance. Therefore I propose this as a 1 Low Risk vulnerability.

#1 - 0xean

2021-08-24T22:05:25Z

I am going to align with the 2 (Med Risk) severity. Reporting the incorrect position in a UI to a user could definitely lead unexpected loss of funds in a sharp market move where a user is intending on hedging elsewhere.

Findings Information

🌟 Selected for report: hickuphh3

Also found by: bw, hack3r-0m, hrkrshnn, patitonar, pauliax

Labels

bug
duplicate
G (Gas Optimization)
sponsor confirmed

Awards

24.5798 USDC - $24.58

External Links

Handle

hack3r-0m

Vulnerability details

https://github.com/code-423n4/2021-08-floatcapital/blob/main/contracts/contracts/YieldManagerAave.sol

mark longShort,treasury,paymentToken,aToken,lendingPool,aaveIncentivesController and referralCode as immutable since they are only assigned in constructor and never re-assigned.

#0 - JasoonS

2021-08-12T06:07:37Z

Duplicate of #7

#1 - 0xean

2021-08-25T16:57:44Z

dupe of #53

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter