Platform: Code4rena
Start Date: 16/12/2022
Pot Size: $60,500 USDC
Total HM: 12
Participants: 58
Period: 5 days
Judge: Trust
Total Solo HM: 4
Id: 196
League: ETH
Rank: 42/58
Findings: 1
Award: $43.54
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: yixxas
Also found by: 0x52, 0xAgro, 0xSmartContract, 0xhacksmithh, Aymen0909, Bnke0x0, Bobface, Breeje, Diana, Franfran, HE1M, HollaDieWaldfee, IllIllI, Jeiwan, RaymondFam, Rolezn, SaharDevep, Secureverse, SmartSek, ak1, bin2chen, brgltd, chrisdior4, gz627, imare, ladboy233, lukris02, oyc_109, rvierdiiev, shark, tnevler, unforgiven, wait
43.5439 USDC - $43.54
Issue Information: L001
src\PaprController.sol::101 => collateralArr[i].addr.transferFrom(msg.sender, address(this), collateralArr[i].id); src\PaprController.sol::202 => underlying.transfer(params.swapFeeTo, fee); src\PaprController.sol::203 => underlying.transfer(proceedsTo, amountOut - fee); src\PaprController.sol::226 => underlying.transfer(params.swapFeeTo, amountIn * params.swapFeeBips / BIPS_ONE); src\PaprController.sol::514 => underlying.transfer(params.swapFeeTo, fee); src\PaprController.sol::515 => underlying.transfer(proceedsTo, amountOut - fee); src\PaprController.sol::546 => papr.transfer(auction.nftOwner, totalOwed - debtCached);
Issue Information: L003
src\EDAPrice.sol::2 => pragma solidity >=0.8.0; src\NFTEDAStarterIncentive.sol::2 => pragma solidity >=0.8.0; src\OracleLibrary.sol::2 => pragma solidity >=0.8.0; src\PaprController.sol::2 => pragma solidity ^0.8.17; src\PaprToken.sol::2 => pragma solidity ^0.8.17; src\PoolAddress.sol::4 => pragma solidity >=0.8.0; src\ReservoirOracleUnderwriter.sol::2 => pragma solidity ^0.8.17; src\UniswapHelpers.sol::2 => pragma solidity >=0.8.0; src\UniswapOracleFundingRateController.sol::2 => pragma solidity ^0.8.17;
[L004]
src\ReservoirOracleUnderwriter.sol::68 => address signerAddress = ecrecover(
Use the Openzeppelin contracts. Their ECDSA implementation solves all three problems and they have an EIP-712 implementation (still a draft but usable IMO).
[L005] Low-level calls return success if there is no code present at the specified address. In addition to the zero-address checks, add a check to verify that <address>.code.length > 0
src\ReservoirOracleUnderwriter.sol::68 => address signerAddress = ecrecover(
[L006]
src\PaprToken.sol::25 => _mint(to, amount);
[L007]
src\PaprController.sol::202 => underlying.transfer(params.swapFeeTo, fee); src\PaprController.sol::203 => underlying.transfer(proceedsTo, amountOut - fee); src\PaprController.sol::514 => underlying.transfer(params.swapFeeTo, fee); src\PaprController.sol::515 => underlying.transfer(proceedsTo, amountOut - fee); src\PaprController.sol::546 => papr.transfer(auction.nftOwner, totalOwed - debtCached);
[N001]
src\NFTEDAStarterIncentive.sol::21 => event SetAuctionCreatorDiscount(uint256 discount);
#0 - c4-judge
2022-12-25T16:38:26Z
trust1995 marked the issue as grade-b
#1 - wilsoncusack
2023-01-11T14:58:46Z
@trust1995 @Jeiwan I'm curious if you have thoughts on the suggestion to use OZ's ECDSA. As far as I can tell, we are not are risk for the things mentioned?
#2 - trust1995
2023-01-11T15:36:05Z
I believe you are correct, the check below is satisfactory:
if (signerAddress != oracleSigner) { revert IncorrectOracleSigner(); }
#3 - Jeiwan
2023-01-12T01:31:26Z
I agree. As long as oracleSigner
is not set to the zero address the check should be suffice.
The OZ's ECDSA also protects against signature malleability, but the contract is not at risk since it doesn't use signatures as nonces.
#4 - wilsoncusack
2023-01-12T16:34:54Z
thanks both!