Platform: Code4rena
Start Date: 07/04/2022
Pot Size: $100,000 USDC
Total HM: 20
Participants: 62
Period: 7 days
Judge: LSDan
Total Solo HM: 11
Id: 107
League: ETH
Rank: 13/62
Findings: 3
Award: $1,241.61
π Selected for report: 1
π Solo Findings: 0
1064.3207 USDC - $1,064.32
Price can be stale and can lead to wrong answer
return value.
Oracle data feed is insufficiently validated. There is no check for stale price and round completeness. Price can be stale and can lead to wrong answer
return value.
function _collateralPriceUsd() internal view returns (uint256) { int256 answer = oracle.latestAnswer(); uint8 decimals = oracle.decimals(); require(answer > 0, "invalid_oracle_answer"); ...
Manual review
Validate data feed
function _collateralPriceUsd() internal view returns (uint256) { (uint80 roundID, int256 answer, , uint256 timestamp, uint80 answeredInRound) = oracle.latestRoundData(); require(answer > 0, "invalid_oracle_answer"); require(answeredInRound >= roundID, "ChainLink: Stale price"); require(timestamp > 0, "ChainLink: Round not complete"); ...
#1 - spaghettieth
2022-04-19T17:23:56Z
Fixed in https://github.com/jpegd/core/pull/9
#2 - dmvt
2022-04-26T14:35:24Z
Agree with sponsor on the medium risk rating. An oracle with a bad value is by definition an external requirement.
25.7805 USDC - $25.78
The Chainlink API (latestAnswer) used in the FungibleAssetVaultForDAO
contract is deprecated.
This function does not error if no answer has been reached but returns 0.
int256 answer = oracle.latestAnswer();
Use the latestRoundData
function to get the price instead.
#0 - spaghettieth
2022-04-12T11:29:01Z
Duplicate of #4
π Selected for report: Dravee
Also found by: 0x1f8b, 0xDjango, 0xkatana, AuditsAreUS, Cityscape, Foundation, Funen, Hawkeye, IllIllI, JC, JMukesh, Jujic, Kthere, PPrieditis, Picodes, Ruhum, TerrierLover, TrungOre, WatchPug, berndartmueller, catchup, cccz, cmichel, delfin454000, dy, ellahi, hickuphh3, horsefacts, hubble, hyh, ilan, jayjonah8, kebabsec, kenta, minhquanym, pauliax, rayn, reassor, rfa, robee, samruna
151.5077 USDC - $151.51
The use of transfer in withdraw()
to send ether is now considered bad practice as gas costs can change which would break the code
if (collateralAsset == ETH) payable(msg.sender).transfer(amount);
https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/
https://chainsecurity.com/istanbul-hardfork-eips-increasing-gas-costs-and-more/
Recommend using call instead, and make sure to check for reentrancy.
#0 - spaghettieth
2022-04-12T11:34:41Z
Duplicate of #39
#1 - dmvt
2022-04-26T14:15:21Z
See comment on #39. This is a QA issue.
#2 - JeeberC4
2022-05-02T19:05:01Z
Generating QA Report for warden as judge downgraded issue. Preserving original title: Transfer is bad practice