Skip to content
Business logic Audit finding Intermediate

Duplicate LP token could lead to incorrect deposits

The addPool function does not check for duplicate lpToken addresses, allowing two pools to share the same lpToken. When depositAll is called on the first pool, it takes all lpTokens and deposits them under its own pid, leaving no balance for the second pool.

Anurag Jain Follow

Originally disclosed on Code4rena

Submitted by csanuragjain, also found by kirk-baird and unforgiven

It was observed that addPool function is not checking for duplicate lpToken which allows 2 or more pools to have exact same lpToken. This can cause issue with deposits.

In case of duplicate lpToken, the first pool calling depositAll will take away all lpToken and deposit them under there own pid. This leaves no balance for 2nd pool.

Proof of Concept

  1. PoolManager call addPool function and uses lpToken as A
  2. PoolManager again call addPool function and mistakenly provides lpToken as A
  3. Now 2 pools will be created with lpToken as A
  4. depositAll function is called passing first pool.
  5. This takes all balance of lpToken A and depsoit it under first pool pid
  6. This mean no balance is left for second pool now

Recommended Mitigation Steps

Add a global variable keeping track of all lpToken added for pool. In case of duplicate lpToken addPool function should fail.

jetbrain10 (veToken Finance) confirmed and commented:

There is already a validation not allow to add duplicated gauges, pool manager contract, add pool function , but we have to add also a validation for lp token like gauges.

Alex the Entreprenerd (judge) commented:

The warden has shown how, due to a lack of validation, the assumption that each lpToken is used only on one pool can be broken. This will cause accounting issues.

For those reasons, I agree with Medium Severity.


The original report as published on Code4rena, by csanuragjain. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 addPool function lacks a check to prevent the same lpToken from being used in multiple pools.

Impact

The second pool loses its deposited lpTokens, causing accounting issues and incorrect deposits.

What the attacker needed

PoolManager mistakenly adds duplicate lpToken

The fix

The addPool function should be fixed to track all lpTokens and reject duplicates.

How it was found

  1. PoolManager calls addPool with lpToken A.
  2. PoolManager calls addPool again with the same lpToken A.
  3. Two pools are created with lpToken A.
  4. depositAll is called for the first pool.
  5. The first pool takes all lpToken A and deposits under its pid.
  6. No balance remains for the second pool.

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.

A pool is a place where users deposit tokens. The system assumes each token is used by only one pool, but it never checks this. If two pools use the same token, the first one to collect deposits takes everything, so the second pool gets nothing.

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.

More by Anurag Jain

View all

63 more disclosed reports, best first.

More from veToken Finance contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.