Skip to content
Business logic Audit finding Intermediate

Inaccurate share calculation in emitted event for non bridge deposits

For non-bridge deposits, the contract emits a Deposit event with a computed share amount rather than the actual shares minted by the teller. Off-chain systems relying on these events may record incorrect share balances, though no funds are lost.

Ambitious_DyDx Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

51001 sc insight inaccurate share calculation in emitted event for non bridge deposits

Submitted on Jul 30th 2025 at 10:52:15 UTC by @Ambitious_DyDx for Attackathon | Plume Network

Description

Brief/Intro

For non-bridge deposits, the Deposit event typically emits a "computed share" value rather than the actual shares minted. Different teller implementations can produce different actual minted share values (e.g., due to fees or adjustments), so emitting the computed value may produce discrepancies in off-chain tracking.

Vulnerability Details

In non-bridge functions such as depositOneInch and depositOkxUniversal:

  • The contract calls teller.deposit, which mints and returns the actual shares that were minted and transferred via ERC20(vaultAddress).safeTransfer.
  • A Deposit event is emitted by _calcSharesAndEmitEvent, which uses a computed shareAmount like this:
Solidity
shares = supportedAssetAmount.mulDivDown(10 ** teller.vault().decimals(), AccountantWithRateProviders(teller.accountant()).getRateInQuoteSafe(supportedAsset))
  • That computed share value may differ from the actual shares returned by teller.deposit (for example if the vault applies fees or other adjustments).
  • Bridge functions use computed shares as an estimate (minting may occur on another chain), but for non-bridge functions the event should use the actual shares for accuracy.

Impact Details

  • Off-chain systems (analytics, UIs, accounting) that rely on emitted share amounts may record incorrect share balances, causing confusion and mismatches between logs and actual holdings.
  • No funds are lost, but event logs may not accurately reflect promised returns.
  • Matches the in-scope impact: "Contract fails to deliver promised returns, but doesn't lose value."

Proof of Concept

{% stepper %} {% step %}

Deposit flow mismatch — step 1

A user calls depositOneInch to deposit assets. The teller.deposit call mints (for example) 95 shares (after fees) and returns this value. {% endstep %}

{% step %}

Deposit flow mismatch — step 2

_calcSharesAndEmitEvent computes 100 shares and emits that value in the Deposit event.

Expected Behavior: The event emits the actual 95 shares minted.

Actual Behavior: The event emits the computed 100 shares, causing a discrepancy between emitted logs and actual minted shares. {% endstep %} {% endstepper %}

{% hint style="info" %} Recommendation: For non-bridge deposit functions, use the actual shares value returned by teller.deposit when emitting the Deposit event instead of using the computed estimate. {% endhint %}

References


PS: This report assumes that the value returned by teller.deposit and the value computed by _calcSharesAndEmitEvent might not always match.

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

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

Impact

Off-chain analytics, UIs and accounting systems that rely on the emitted share amounts may record incorrect balances, causing mismatches between logs and actual holdings; no funds are lost.

What the attacker needed

None

The fix

For non-bridge deposit functions, the actual shares value returned by teller.deposit should be used when emitting the Deposit event instead of the computed estimate.

How it was found

  1. A user calls depositOneInch to deposit assets.
  2. The teller.deposit call mints and returns the actual shares (for example 95 after fees).
  3. The helper _calcSharesAndEmitEvent computes a different share amount (for example 100) and emits it in the Deposit event.

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.

When you deposit money into a vault, the vault gives you 'shares' that represent your portion. The contract here calculates an expected number of shares and writes that number into a public log (an event), but the vault might actually give you a different number because of fees. Anyone reading the log would think you have more or fewer shares than you really do.

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 Ambitious_DyDx

View all

5 more disclosed reports, best first.

More from Plume Network

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.