The Notional version of `lend()` can be used to lock iPTs
The Notional version of the lend() function lacks a check that the principal value p corresponds to Notional, allowing an attacker to pass an Illuminate principal value and cause the contract to buy iPTs for itself and then mint additional iPTs to the attacker. This can lock extra iPTs in the Lender contract, reducing the underlying available for other users to redeem.
The Notional version of lend() can be used to lock extra iPTs in the Lender contract
Vulnerability Detail
The Notional version of lend() has no checks to ensure that the principal value, p, passed in is for Notional, and therefore the Illuminate principal value can be passed in and used, which will allow callers to buy iPTs to the Lender contract (rather than Notional PTs), and then mint a second one to themselves when the iPT is minted at the end of the function.
Impact
When the underlying is sold in the marketplace, the resulting iPT is given to the Lender contract, and there is no supported way to have those iPTs redeemed and their underlying released, which means when users try to redeem their own iPTs, there will be less underlying available than there should be, and they will have lost principal.
Code Snippet
In the code block below, there are no checks that p is for notional, and the market-provided token for that p is used directly for depositing, and at the end of the function, more iPTs are minted:
Solidity
// File: src/Lender.sol : Lender.lend() #1
875 function lend(
876 uint8 p,
877 address u,
878 uint256 m,
879 uint256 a,
880 uint256 r
881 ) external nonReentrant unpaused(u, m, p) matured(m) returns (uint256) {
882 // Instantiate Notional princpal token
883 @> address token = IMarketPlace(marketPlace).markets(u, m, p);
884
885 // Transfer funds from user to Illuminate
886 Safe.transferFrom(IERC20(u), msg.sender, address(this), a);
...
894 // Swap on the Notional Token wrapper
895 @> uint256 received = INotional(token).deposit(a - fee, address(this));
896
897 // Convert decimals from principal token to underlying
898 received = convertDecimals(u, token, received);
...
908 // Mint Illuminate zero coupons
909:@> IERC5095(principalToken(u, m)).authMint(msg.sender, received);
NOTE: INotional is an ERC4626 token, and the deposit() function comes from that interface. While the Illuminate PT's deposit() function has a different signature (the argument order is flipped), it's clear that this is a mistake that will be corrected as a part of this audit, since comments within the deposit() function itself refer to the need to be compliant with the ERC4626 standard, and discussions in the prior audit extensively mention that compliance was in fact necessary, and the deposit() function is not a part of the EIP-5095 standard.
Tool used
Manual Review
Recommendation
Revert if p is not MarketPlace.Principals.Notional
function deposit(address r, uint256 a) external override returns (uint256) {
This also means that the vulnerability cannot be exploited directly
Exploiting this vulnerability requires the project to modify the deposit function, which is not a low cost
Look at the Criteria for Issues:
Medium: There is a viable scenario (even if unlikely) that could cause the protocol to enter a state where a material amount of funds can be lost. The attack path is possible with assumptions that either mimic on-chain conditions or reflect conditions that have a reasonable chance of becoming true in the future. The more expensive the attack is for an attacker, the less likely it will be included as a Medium (holding all other factors constant). The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.
High: This vulnerability would result in a material loss of funds and the cost of the attack is low (relative to the amount of funds lost). The attack path is possible with reasonable assumptions that mimic on-chain conditions. The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.
There were assumptions in the report that were not valid at the time, so the report should be medium
function deposit(address r, uint256 a) external override returns (uint256) {
This also means that the vulnerability cannot be exploited directly
Exploiting this vulnerability requires the project to modify the deposit function, which is not a low cost
Look at the Criteria for Issues:
Medium: There is a viable scenario (even if unlikely) that could cause the protocol to enter a state where a material amount of funds can be lost. The attack path is possible with assumptions that either mimic on-chain conditions or reflect conditions that have a reasonable chance of becoming true in the future. The more expensive the attack is for an attacker, the less likely it will be included as a Medium (holding all other factors constant). The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.
High: This vulnerability would result in a material loss of funds and the cost of the attack is low (relative to the amount of funds lost). The attack path is possible with reasonable assumptions that mimic on-chain conditions. The vulnerability must be something that is not considered an acceptable risk by a reasonable protocol team.
There were assumptions in the report that were not valid at the time, so the report should be medium
You've created a valid escalation for 5 USDC!
To remove the escalation from consideration: Delete your comment.
To change the amount you've staked on this escalation: Edit your comment (do not create a new comment).
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
hrishibhat
Escalation rejected
While Sherlock does not intend to award issues submitted based on anticipated code, this particular submission is considered unique for two reasons:
This contest is a fix review contest which required auditors to have context from the previous contest.
The deposit function that requires the code change has been mentioned previously
Watsons who escalated this issue will have their escalation amount deducted from their next payout.
The original report as published on Sherlock, by IllIllI. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely, the lend() function does not validate that the principal value p corresponds to Notional before using it to fetch the market token and deposit.
Impact
When the underlying is sold, the resulting iPT is given to the Lender contract and cannot be redeemed, so users redeeming their own iPTs will receive less underlying and lose principal.
What the attacker needed
Attacker can call lend() with a crafted p value
The fix
The function should revert if p is not MarketPlace.Principals.Notional.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
The lend function is supposed to work only with a specific type of token (Notional principal tokens), but it does not verify that the token type passed in is correct. An attacker can pass a different token type (Illuminate principal tokens) and trick the contract into buying tokens for itself and also minting extra tokens for the attacker. This can lock funds and cause other users to lose money when they try to redeem.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.