The sponsor mentioned in Main invariants that PT and its YT should have an equal supply at all times, but YieldToken.sol#burn can be called by the user, which can obviously cause the supply of YieldToken to be reduced.
Proof of Concept
When PT is minted, an equal amount of YT is minted. This ensures that PT and its YT have an equal supply.
PT does not provide a burn function, which ensures that users cannot reduce the supply of PT by themselves.
function burn(uint256 amount) public override {
IPrincipalToken(pt).updateYield(msg.sender);
_burn(msg.sender, amount);
}
But in YT, there is a burn function, which any user can call to reduce the supply of YT owned by themselves. Although this will cause a loss of their own profits, it does break the invariant.
Lines of code
https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/YieldToken.sol#L57-L61
Vulnerability details
Impact
The sponsor mentioned in
Main invariants
that PT and its YT should have an equal supply at all times, butYieldToken.sol#burn
can be called by the user, which can obviously cause the supply ofYieldToken
to be reduced.Proof of Concept
When PT is minted, an equal amount of YT is minted. This ensures that PT and its YT have an equal supply.
PT does not provide a
burn
function, which ensures that users cannot reduce the supply of PT by themselves.But in YT, there is a
burn
function, which any user can call to reduce the supply of YT owned by themselves. Although this will cause a loss of their own profits, it does break the invariant.Tools Used
Manual Review
Recommended Mitigation Steps
Delete the
burn
function in YT.Assessed type
Other