There is an incorrect permission check in the DeliveryPlace::settleAskTaker() function, where the caller's address is mistakenly validated against the wrong authority.
The issue arises during the transaction process that begins with UserA creating a Bid.offer. The process is as follows:
UserA creates a Bid.offer by calling PreMarkets::createOffer().
UserB calls PreMarkets::createTaker() using the Bid.offer.offerAddr and a specified amount.
The administrator updates the market by calling SystemConfig::updateMarket.
UserB then calls DeliveryPlace::settleAskTaker() to settle the transaction. During this step, UserB transfers mockPointToken to the contract, fulfilling the amount promised in step 2, and updates the balance information in userTokenBalanceMap.
Let's review the relevant section of the DeliveryPlace::settleAskTaker() function:
The permission check marked by the @> symbol verifies that the caller's address is equal to offerInfo.authority, which is the address of UserA, the creator of the Bid.offer. However, this check is incorrect because it should be verifying against stockInfo.authority, which is more appropriate given the context of the function.
To demonstrate the issue, add the following test code to test/PreMarkets.t.sol and run it:
There is an incorrect permission check in the DeliveryPlace::settleAskTaker() function, where the caller's address is mistakenly validated against the wrong authority.
Manual Review
Consider updating your code as follows to correct the permission check:
Valid high severity, when taker offers are created pointing to a `offer`, the relevant `stockInfoMap` offers are created with the owner of the offer aka `authority`, set as the creater of the offer, as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L245). Because of the wrong check within settleAskTaker, it will permanently DoS the final settlement functionality for taker offers for the maker that listed the original offer, essentially bricking the whole functionality of the market i.e. maker will always get refunded the original collateral, and takers will never be able to transact the original points put up by the maker. This occurs regardless of market mode.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.