The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Position holder is not set when first pending stakes is registered

Summary

When a holder register his first pending stakes, the positions function returns the zero address as holder.

Vulnerability Details

positions allows to read the position of an holder.
The function adds the pending stakes amount to the existing position of the holder.

If the position holder doesn't have an existing position but has a pending stake,
then the returned position has the zero address set as its holder.

Impact

Incorrect data is returned to the user.

Tools Used

Scope:

  • https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L83-L90

The following test can be added to liquidationPool.js and shows the issue.

describe('LOW - Position holder is not set when first pending stakes is registered', async () => {
it('zigtur - holder address zero', async () => {
const balance = ethers.utils.parseEther('5000');
const tstVal = ethers.utils.parseEther('1000');
const eurosVal = ethers.utils.parseEther('500');
await TST.mint(user1.address, balance);
await EUROs.mint(user1.address, balance);
await TST.approve(LiquidationPool.address, tstVal);
await EUROs.approve(LiquidationPool.address, eurosVal);
increase = LiquidationPool.increasePosition(tstVal, eurosVal);
await expect(increase).not.to.be.reverted;
({_position} = await LiquidationPool.position(user1.address));
// The following expect shows the issue, it should be user1.address
expect(_position.holder).not.equal(user1.address);
console.log("Holder is", _position.holder);
});
});

Recommendations

Consider setting the holder address as _position.holder if none exists.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

informational/invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.