Closed code423n4 closed 2 years ago
The wmul
function divides by 1e18. See yield-utils.
library WMul {
// Taken from https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol
/// @dev Multiply an amount by a fixed point factor with 18 decimals, rounds down.
function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x * y;
unchecked { z /= 1e18; }
}
}
Disputed, @KenzoAgada explained why.
As mentioned by Kenzo, wmul
does divide/scale down by 1e18
, so the division mentioned by the warden is already in place.
For this reason, I have labelled this issue as invalid.
Lines of code
https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L161-L167 https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L591
Vulnerability details
Impact
Auctioneer fee is calculated in different order of magnitude.
Proof of Concept
As your are defining
auctioneerReward
in 1e18 basis point (being 1e18 100%) you need to divide by 1e18 when calculating percentage.However in this line you are missing that division which makes the transaction revert for underflow in best scenario.
Recommended Mitigation Steps
Replace