Skip to content
Smart contracts Audit finding Beginner

Missing totalSupply reduction in burnFrom allows supply manipulation (ERC20 Violation)

The burnFrom function in the FERC20 contract reduces a user's balance and emits a burn event but does not reduce the total supply. This allows the owner to manipulate the reported total supply, affecting market cap calculations and DeFi protocols that rely on it.

Agrawain Follow with 0x60scs, bareli and 9 others

Originally disclosed on Code4rena

Submitted by Agrawain, also found by 0x60scs, bareli, cerweb10, CompetSlayer, DanielTan_MetaTrust, edoscoba, EPSec, Rorschach, Silverwind, unique, and X-Tray03

https://github.com/code-423n4/2025-04-virtuals-protocol/blob/main/contracts/fun/FERC20.sol#L136

Finding description

The burnFrom (address user, uint256 amount) function in the FERC20 contract allows the owner to decrease a user’s balance and emit a Transfer (user, address(0), amount) event — simulating a burn. However, it fails to reduce the _totalSupply variable. This violates the ERC20 standard and creates an inconsistency between on-chain total supply and actual circulating tokens.

Impact

This vulnerability has significant consequences:

  • ERC20 Standard Violation: Tools, protocols, and dApps relying on totalSupply() will receive incorrect data.
  • Market Cap Manipulation: Since market cap is often calculated as price * totalSupply, an attacker can make the market cap appear larger than reality, misleading investors and platforms.
  • DeFi Exploits: Protocols that distribute rewards or voting power proportionally to totalSupply or balance/totalSupply ratios may be gamed.
  • False Burn Signals: The Transfer event to the zero address signals a burn, while the tokens still exist in the totalSupply, creating a false narrative of scarcity.
  • Centralization Risk: The owner can arbitrarily remove user balances (burn) while keeping totalSupply unchanged, retaining apparent token value but harming users.

This combination creates both economic manipulation risk and false transparency, which can impact DeFi, governance, analytics, and user trust.

Proof of Concept

// Run Test
npx hardhat test test/exploits/FERC20.js
// POC
const { expect } = require("chai");
const { ethers } = require("hardhat");

describe("FERC20", function () {
  let token;
  let owner;
  let addr1;

  beforeEach(async function () {
    [owner, addr1] = await ethers.getSigners();

    const FERC20 = await ethers.getContractFactory("FERC20");
    token = await FERC20.deploy("FunToken", "FUN", ethers.parseEther("1000"), 5);
    await token.waitForDeployment();

    await token.transfer(addr1.address, ethers.parseEther("100"));
  });

  it("should not reduce totalSupply when using burnFrom (BUG)", async function () {
    const initialTotalSupply = await token.totalSupply();

    // Burn tokens from addr1
    await token.burnFrom(addr1.address, ethers.parseEther("50"));

    const finalTotalSupply = await token.totalSupply();

    // Esto debería fallar porque totalSupply no cambió
    expect(finalTotalSupply).to.be.lt(initialTotalSupply); // <- test para detectar el bug
  });
});
// output

FERC20
  1) should not reduce totalSupply when using burnFrom (BUG)

0 passing (2s)
1 failing

1) FERC20
     should not reduce totalSupply when using burnFrom (BUG):

  AssertionError: expected 1000000000000000000000000000000000000000 to be below 1000000000000000000000000000000000000000

Explanation

This test checks if the burnFrom function correctly reduces the total supply when the owner burns tokens from another user (addr1). In a properly implemented ERC20 token, burning tokens should reduce both the user’s balance and the total supply.

What this means

The test expected finalTotalSupply to be less than initialTotalSupply, but both values were exactly the same: 1000000000000000000000000000000000000000

The core issue

  • Both initialTotalSupply and finalTotalSupply remain unchanged after burning.
  • Although burnFrom decreases the user’s balance and emits a Transfer (user, address(0), amount) event (mimicking a burn), the _totalSupply is never updated.
  • This is a major inconsistency that breaks the expected behavior of a burn function and introduces risk.

The original report as published on Code4rena, by Agrawain. 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

The burnFrom function does not update the _totalSupply variable when burning tokens.

Impact

The incorrect total supply could mislead investors and be exploited in DeFi protocols that rely on totalSupply for rewards or voting power.

What the attacker needed

Owner privileges

How it was found

  1. Deploy the FERC20 contract with an initial supply.
  2. Transfer some tokens to another user.
  3. Call burnFrom to burn tokens from that user.
  4. Check that totalSupply remains unchanged.

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.

In a standard token, burning tokens should reduce both the user's balance and the total number of tokens in existence. Here, the burn only reduces the user's balance, so the total supply stays the same, making the token appear more valuable than it is.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More from Virtuals Protocol

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.