Note that msg.sender is used, which is incorrect since msg.sender here refers to the PrincipalToken contract, and not the actual caller of the deposit function. This is because the PrincipalToken contract is calling the function in the PrincipalTokenUtil contract, so the message sender changes to the PrincipalToken contract.
Even if the user is whitelisted to get a discount when tokenizing their IBT tokens, the discount will not be applicable.
Tools Used
Manual Review
Recommended Mitigation Steps
Recommend adding a recipient parameter and passing the right msg.sender into the _computeTokenizationFee() function
function _depositIBT(
uint256 _ibts,
address _ptReceiver,
address _ytReceiver
) internal notExpired nonReentrant whenNotPaused returns (uint256 shares) {
updateYield(_ytReceiver);
uint256 tokenizationFee = PrincipalTokenUtil._computeTokenizationFee(
_ibts,
address(this),
registry,
//@audit: Here, msg.sender will be the depositor.
+ msg.sender
);
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/383202d0b84985122fe1ba53cfbbb68f18ba3986/src/libraries/PrincipalTokenUtil.sol#L163-L169
Vulnerability details
Impact
Users will not get a fee reduction when tokenizing their IBT tokens.
Proof of Concept
When a user deposits their ASSET token or IBT tokens,
_depositIBT()
will be called.There is a fee for tokenizing their IBT tokens into PT/YT tokens. The fee is calculated through
_computeTokenizationFee()
Note that
msg.sender
is used, which is incorrect sincemsg.sender
here refers to the PrincipalToken contract, and not the actual caller of the deposit function. This is because the PrincipalToken contract is calling the function in the PrincipalTokenUtil contract, so the message sender changes to the PrincipalToken contract.Even if the user is whitelisted to get a discount when tokenizing their IBT tokens, the discount will not be applicable.
Tools Used
Manual Review
Recommended Mitigation Steps
Recommend adding a recipient parameter and passing the right msg.sender into the
_computeTokenizationFee()
functionAssessed type
Context