Closed howlbot-integration[bot] closed 2 months ago
https://github.com/code-423n4/2024-07-munchables/blob/94cf468aaabf526b7a8319f7eba34014ccebe7b9/src/managers/LandManager.sol#L199-L226
DOS of any user trying to stake to the same LandLord of the attacker -> DOS for that LandLord for earning taxRate from those users
LandLord
taxRate
The problem arises from the fact that there is no timeLock on transferToUnoccupiedPlot
transferToUnoccupiedPlot
This open up the ability to malicious actor to frontrun any txn to make it revert, Here is why.
in stakeMunchable
stakeMunchable
File: LandManager.sol 131: function stakeMunchable( 132: address landlord, 133: uint256 tokenId, 134: uint256 plotId 135: ) external override forceFarmPlots(msg.sender) notPaused //////////Ommit 138: if (plotOccupied[landlord][plotId].occupied)
We check if that plotId is occupied or not. Now this check is good and works as intended BUT
plotId
occupied
Since there is no timeLock on transferToUnoccupiedPlot This check can be weaponized
Example:
PlotId
stake
if (plotOccupied[landlord][plotId].occupied) revert OccupiedPlotError(landlord, plotId);
The above example can be repeated to multiple users that are willing to stake on this specific LandLord in the same Txn with the same tokenId.
tokenId
Manual Review
Put a time lock on transferToUnoccupiedPlot.
DoS
alex-ppg changed the severity to QA (Quality Assurance)
alex-ppg marked the issue as grade-c
Lines of code
https://github.com/code-423n4/2024-07-munchables/blob/94cf468aaabf526b7a8319f7eba34014ccebe7b9/src/managers/LandManager.sol#L199-L226
Vulnerability details
Impact
DOS of any user trying to stake to the same
LandLord
of the attacker -> DOS for thatLandLord
for earningtaxRate
from those usersProof of Concept
The problem arises from the fact that there is no timeLock on
transferToUnoccupiedPlot
This open up the ability to malicious actor to frontrun any txn to make it revert, Here is why.
in
stakeMunchable
We check if that
plotId
isoccupied
or not. Now this check is good and works as intended BUTSince there is no timeLock on
transferToUnoccupiedPlot
This check can be weaponizedExample:
PlotId
of specific landlord is emptystakeMunchable
stake
transferToUnoccupiedPlot
with sameplotId
to mark that Plot to be occupiedif (plotOccupied[landlord][plotId].occupied) revert OccupiedPlotError(landlord, plotId);
transferToUnoccupiedPlot
to the original Plot he was onThe above example can be repeated to multiple users that are willing to stake on this specific
LandLord
in the same Txn with the sametokenId
.Tools Used
Manual Review
Recommended Mitigation Steps
Put a time lock on
transferToUnoccupiedPlot
.Assessed type
DoS