Closed code423n4 closed 1 year ago
hansfriese marked the issue as satisfactory
hansfriese marked the issue as primary issue
hansfriese marked the issue as duplicate of #16
Judge is correct, indeed duplication. Judge nails the simplest issue as primary, we will do the fix in https://github.com/code-423n4/2023-05-particle-findings/issues/16#issuecomment-1579327687.
wukong-particle marked the issue as sponsor confirmed
hansfriese changed the severity to 2 (Med Risk)
Lines of code
https://github.com/code-423n4/2023-05-particle/blob/1caf678bc20c24c96fc8f6b0046383ff0e9d2a6f/contracts/protocol/ParticleExchange.sol#L534
Vulnerability details
The
ParticleExchange
contract does not store any data about the lien in the contract storage. Instead, users must send the entireLien
struct when interacting with any existing lien, and the contract checks if the hash of the struct is correct. This poses a problem because normal users must know the lien information when it is not stored on-chain.As discussed with the sponsor on Discord, the lien information is stored in a database. A service job listens to on-chain events to update the database every minute on average.
On the other hand, the
addCredit()
function is public and allows anyone to add any amount of ETH to the credit of any active loan. This is where the issue occurs. Since users need to know the lien information when interacting with the protocol, an attacker can simply spam theaddCredit()
function with tiny amounts of credit. The purpose of this is to continuously change the lien information, causing other users' transactions to revert because they submit the wrong lien information. The issue can become a big problem during an auction. Lenders can make borrowers or other users unable to interact with the lien, allowing them to liquidate the loan.Impact
The impact of this issue is a denial-of-service (DoS) attack during an auction. The attacker can keep changing the lien information, making it impossible for other users to interact with the lien.
Proof of Concept
Consider the scenario
startLoanAuction()
as soon as possible to get that 10 ETH. During auction, she keeps callingaddCredit()
to the loan with tiny amount (1, 2 wei).auctionBuyNft()
or torepayWithNft()
since the lien info keeps changing continously. After auction duration, Alice is able to withdraw 10 ETH even.Tools Used
Manual Review
Recommended Mitigation Steps
There are 2 fixes for this issues
addCredit()
function.addCredit()
for their loan.Assessed type
DoS