Submitted by 0xc0ffEE, also found by 0xastronatey, 0xIconart, 0xNirix, 0XRolko, agadzhalov, AshishLach, BenRai, c0pp3rscr3w3r, ChainProof, ChainSentry, CrazyMoose, farismaulana, itsabinashb, IvanAlexandur, montecristo, mrMorningstar, Olami978355, queen, Sabit, safie, Shinobi, the_code_doctor, TheFabled, trailongoswami, X0sauce, zanderbyte, and zzebra83
https://github.com/code-423n4/2024-12-secondswap/blob/214849c3517eb26b31fe194bceae65cb0f52d2c0/contracts/SecondSwap_Marketplace.sol#L459-L471
https://github.com/code-423n4/2024-12-secondswap/blob/214849c3517eb26b31fe194bceae65cb0f52d2c0/contracts/SecondSwap_Marketplace.sol#L413-L422
In the function SecondSwap_Marketplace::spotPurchase(), depending on the listings discount type, the price is computed accordingly:
And then the baseAmount that the buyer needs to pay is calculated from the discounted price. Although there is a check to enforce listing value is not too small with the original price, but it still can be too small with the discounted price because indeed the discounted price is lower than the original price. So in that case, the buyer wont be able to purchase listed sale.
Example with a simple vulnerable path:
Impacts:
Add this test under the describe("Purchase Lot")
Run the test and it succeeded.
It means that the spotPurchase() transaction failed.
Consider updating the check for baseAmount in function listVesting() to take discount into account.
TechticalRAM (SecondSwap) confirmed
