Purchaser of a lien token may not receive payments
The buyoutLien function fails to reset the lien payee, so a purchaser of a lien may not receive future payments if the previous owner had set a different payee. A malicious seller could set the payee to themselves and continue receiving payments after selling.
0xRajeev Follow with rvierdiiev and obront
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/193
Found by
0xRajeev, rvierdiiev, obront
Summary
A purchaser who buys out an existing lien via buyoutLien() will not receive future payments made to that lien holder if the seller had changed the lien payee via setPayee() and if they do not change it themselves after buying.
Vulnerability Detail
buyoutLien() does not reset lienData[lienId].payee to either 0 or to the new owner. While the ownership is transferred, the payments made in _payment() get their payee via getPayee() which returns the owner only if the lienData[lienId].payee is set to the zero address but returns lienData[lienId].payee otherwise. This will still have the value set by the previous owner who will continue to receive the payments.
Impact
The purchaser who buys out an existing lien via buyoutLien() will not receive future payments if the previous owner had set the payee but they do not change it via setPayee() themselves after buying. Given that setPayee() is considered optional (nothing specified in spec/docs/comments) and this reset is not part of the default flow, this will lead to a loss of purchaser's anticipated payments until they realize and reset the lien payee.
Exploit Scenario: A malicious lien seller can use setPayee() to set the payee to their address of choice and continue to receive payments, even after selling, if the buyer does not realize that they have to change the payee address to themselves after buying.
Code Snippet
- https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LienToken.sol#L619-L645
- https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LienToken.sol#L666-L676
- https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LienToken.sol#L678-L698
Tool used
Manual Review
Recommendation
buyoutLien() should reset lienData[lienId].payee to either the zero address or to the new owner.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the buyoutLien function does not reset the lien's payee field to zero or to the new owner, so the previous payee remains and continues to receive payments.
Impact
The purchaser may lose anticipated payments until they manually reset the payee, and a malicious seller could continue to receive payments after selling.
What the attacker needed
Buyer purchases a lien via buyoutLien; seller previously set a different payee
The fix
buyoutLien should reset the lien payee to the zero address or to the new owner.
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.
In a smart contract, a lien is a claim on a loan. When someone buys a lien, they expect to get the loan payments. But if the original owner had set a different address to receive payments, the new owner might not get them unless they update that address. This means the seller could keep getting paid even after selling the lien.
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.