Closed c4-submissions closed 1 year ago
https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/WildcatMarketController.sol#L346
Cannot deploy market with originationFeeAmount == 0 for ERC20 asset which reverts on zero amount transfers.
originationFeeAmount == 0
In deployMarket() the following is executed:
deployMarket()
if (originationFeeAsset != address(0)) { originationFeeAsset.safeTransferFrom(borrower, parameters.feeRecipient, originationFeeAmount); }
If originationFeeAmount == 0 then safeTransferFrom() reverts](https://github.com/Vectorized/solady/blob/6cce088e69d6e46671f2f622318102bd5db77a65/src/utils/SafeTransferLib.sol#L174) if originationFeeAsset is an ERC20 which reverts on zero amount transfers.
safeTransferFrom()
originationFeeAsset
if (originationFeeAsset != address(0) && originationFeeAmount > 0)
ERC20
minhquanym marked the issue as duplicate of #74
MarioPoneder marked the issue as unsatisfactory: Out of scope
Lines of code
https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/WildcatMarketController.sol#L346
Vulnerability details
Impact
Cannot deploy market with
originationFeeAmount == 0
for ERC20 asset which reverts on zero amount transfers.Proof of concept
In
deployMarket()
the following is executed:If
originationFeeAmount == 0
thensafeTransferFrom()
reverts](https://github.com/Vectorized/solady/blob/6cce088e69d6e46671f2f622318102bd5db77a65/src/utils/SafeTransferLib.sol#L174) iforiginationFeeAsset
is an ERC20 which reverts on zero amount transfers.Recommended mitigation
if (originationFeeAsset != address(0) && originationFeeAmount > 0)
Assessed type
ERC20