Erc4626 inflation attack vulnerability
The staking contract inherits ERC4626 and is vulnerable to an inflation attack on a freshly deployed vault. An attacker can manipulate the asset-to-share ratio by directly sending tokens to the contract, causing a legitimate depositor to receive zero shares and allowing the attacker to withdraw the victim's funds.
- Disclosed after under an hour
57401 sc critical erc4626 inflation attack vulnerability
Submitted on Oct 25th 2025 at 21:17:11 UTC by @iehnnkta for Audit Comp | Belong
- Report ID: #57401
- Report Type: Smart Contract
- Report severity: Critical
- Target: https://github.com/immunefi-team/audit-comp-belong/blob/main/contracts/v2/periphery/Staking.sol
- Impacts:
- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Brief/Intro
staking contract inherits ERC4626, which by default have inflation attack vulnerability for freshly deployed vaults.
Vulnerability Details
Attacker can manipulate the asset-to-share ratio by directly funding the contract, instead of going through the deposit function. The typical attack scenario was added in the PoC section.
Impact Details
For the above attack to happen, there are a few conditions to be fulfilled:
- Deployed staking contract should not mint any tokens previously - From the script file provided, there is no initial minting happened
- No other user should stake in the vault until attacker withdraws - Which is mostly not possible
Because of the above 2 conditions, the Severity was Medium. And attacker can repeat this process indefinitely to drain all the user LONG tokens that are going to interact with the vault, if the gap between two users is larger than a day, which is likely not possible.
Proof of Concept
{% stepper %} {% step %}
Step
staking vault get deployed. Right after that, attacker deposited 1 wei LONG token to get 1 share of sLONG token.
{% endstep %}
{% step %}
Step
Now sees legit user deposit of 10e18 LONG tokens. {% endstep %}
{% step %}
Step
Attacker front-runs this transaction by sending 10e18 LONG tokens directly to the vault. {% endstep %}
{% step %}
Step
Now when user transaction gets executed, he gets minted with 0 shares, because of (10e18 / (10e18+1)).
{% endstep %}
{% step %}
Step
Now once minimum duration passes, attacker withdraws 20e18+1 LONG tokens from the vault with 1 share itself. {% endstep %} {% endstepper %}
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 vault does not use a virtual offset or dead shares to prevent the first depositor from manipulating the share price by direct token transfers.
Impact
The attacker could steal the victim's deposited tokens, but the attack requires the vault to have no prior minting and no other staking activity until withdrawal, which the author notes is mostly not possible.
What the attacker needed
Freshly deployed vault with no prior minting; No other staking activity until attacker withdraws; Attacker can front-run victim's deposit
How it was found
- The staking vault is deployed and the attacker deposits 1 wei to get 1 share.
- A legitimate user attempts to deposit 10e18 tokens.
- The attacker front-runs by sending 10e18 tokens directly to the vault.
- The user's deposit mints 0 shares due to the inflated ratio.
- After the minimum duration, the attacker withdraws all tokens with their 1 share.
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 vault lets people put in tokens and get shares representing their portion. If the vault is new and empty, an attacker can send tokens directly to it to make each share seem very valuable, so when a normal person deposits, they get zero shares and lose their tokens. The attacker then withdraws everything.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.