Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: high
Valid

The funds of ask maker order can be locked by wrong settled points

Summary

After call DeliveryPlace contract's settleAskMaker() with settled points which is not same as offer's usedPoints, the funds of ask maker will be locked.

Vulnerability Details

When ask maker calls settleAskMaker(), as you see in the code line(https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L276), if the _settledPoints is not same as offerInfo.usedPoints, the make refund will not set in the userTokenBalance(https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L276-L299). Therefore after this concerned project is settled, the maker couldn't withdraw his token with wrong _settledPoints parameter.

function settleAskMaker(address _offer, uint256 _settledPoints) external {
...
if (_settledPoints == offerInfo.usedPoints) {
...
tokenManager.addTokenBalance(
TokenBalanceType.SalesRevenue,
_msgSender(),
makerInfo.tokenAddress,
makerRefundAmount
);
}
...
}

Tools Used

Manual review

Recommendations

_settledPoints must be same as offer's usedPoints. Update the code line(https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L230) to below.

if (_settledPoints != offerInfo.usedPoints) {
Updates

Lead Judging Commences

0xnevi Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-DeliveryPlace-settleAskTaker-closeBidTaker-wrong-makerinfo-token-address-addToken-balance

Valid high severity, In `settleAskTaker/closeBidTaker`, by assigning collateral token to user balance instead of point token, if collateral token is worth more than point, this can cause stealing of other users collateral tokens within the CapitalPool contract, If the opposite occurs, user loses funds based on the points they are supposed to receive

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.