Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: high
Valid

Incorrect Token Address Usage in closeBidTaker Function

Summary

The DeliveryPlace::closeBidTaker() function use wrong token address token balance updates. The function incorrectly uses makerInfo.tokenAddress, which represents the sale token address, instead of the point token address.

Vulnerability Details

In the closeBidTaker function, when updating point token balance for the user, the function uses makerInfo.tokenAddress as the token address. However, makerInfo.tokenAddress represents the sale token address, not the correct point token address that should be used. Point token address should be retrieved from marketplace data.

tokenManager.addTokenBalance(
TokenBalanceType.PointToken,
_msgSender(),
makerInfo.tokenAddress,
pointTokenAmount
);

https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L198

Impact

The incorrect use of token addresses can result in broken token balances, leading to the allocation of wrong tokens to users. This can cause the protocol or users to lose funds

Tools Used

manual

Recommendations

Replace the usage of makerInfo.tokenAddress with the correct marketplace token address obtained from the marketplace data.

+ (,,MarketPlaceInfo memory marketPlaceInfo,) = getOfferInfo(_offer);
tokenManager.addTokenBalance(
TokenBalanceType.PointToken,
_msgSender(),
- makerInfo.tokenAddress,
+ marketPlaceInfo.tokenAddress
pointTokenAmount
);
Updates

Lead Judging Commences

0xnevi Lead Judge 11 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.