Tadle

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

Collateral token address instead of `PointToken` address in arguments

Summary

Due to incorrect address in the tokenManager.addTokenBalance function invoked the pointTokenAmount will be saved as collateral instead of PointToken. So users can not receive point tokens but can withdraw additional amounts of collateral which can cause inconsistency in the protocol token balances and users virtual balances. There are two instances of the issue.

Vulnerability Details

When sellers settle points the buyers internal point token balances should be also increased by invoking the tokenManager.addTokenBalance function.

function closeBidTaker(address _stock) external {
<...>
tokenManager.addTokenBalance(
TokenBalanceType.PointToken,
_msgSender(),
>> makerInfo.tokenAddress,
pointTokenAmount
);
<...>
function settleAskTaker(address _stock, uint256 _settledPoints) external {
<...>
tokenManager.addTokenBalance(
TokenBalanceType.PointToken,
offerInfo.authority,
>> makerInfo.tokenAddress,
settledPointTokenAmount
);

This call updates the userTokenBalanceMap[_msgSender()][_tokenAddress][_tokenBalanceType] variable which is used to withdraw tokens. Since the makerInfo.tokenAddress variable contains the collateral token address users can not withdraw Point tokens.

Impact

Unexpected behavior, assets loses

Tools used

Manual Review

Recommendations

Consider using MarketPlaceInfo.tokenAddress instead of makerInfo.tokenAddress

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.