Reproduced Exploit

Xyro: withdrawRakeback always reverts and earned XYRO stays in the treasury

withdrawRakeback debits earnedRakeback and calls IERC20Mint.mint, which is declared returns (bool). XyroToken.mint writes the balance and returns no data. The ABI decode reverts, the debit rolls back, and the 1000 XYRO claim stays stuck. A mint that returns true pays the same claim.

Aug 2024•Other•dependency•2 min read

Loss

1000 XYRO of earned rakeback cannot be withdrawn

Chain

Other

Category

dependency

Date

Aug 2024

Source

AuditVault

EVM Playground

Source-level debugger — step opcodes and Solidity in sync

evm-hack-analyzer

The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. Query opens a search over the trace: previous and next writes, balance changes and calls, breakpoints, and a diff of everything that changed between two steps. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 45669-withdrawrakeback-function-will-always-be-failed-zokyo-none-x. Standalone Foundry PoC and full write-up: 45669-withdrawrakeback-function-will-always-be-failed-zokyo-none-x_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/dependency/unsafe-external-call · vuln/dos/frozen-funds

Key info#

FieldValue
Loss1000 XYRO of earned rakeback cannot be withdrawn
Vulnerable contractTreasury.withdrawRakeback
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateLocal synthetic · 2024-08
Compilersolc 0.8.27, cancun, via IR
Bug classMint is called through an interface that expects a bool

TL;DR#

withdrawRakeback debits earnedRakeback and calls IERC20Mint.mint, which is declared returns (bool). XyroToken.mint writes the balance and returns no data. The ABI decode reverts, the debit rolls back, and the 1000 XYRO claim stays stuck. A mint that returns true pays the same claim.

The vulnerable code#

SOLIDITY
function withdrawRakeback(uint256 amount) public {
    require(earnedRakeback[msg.sender] >= amount, "Amount is greated than earned rakeback");
    earnedRakeback[msg.sender] -= amount;
    IERC20Mint(address(token)).mint(msg.sender, amount);
}

Drop returns (bool) from the interface so it matches XyroToken.mint.

Root cause#

The treasury and the token disagree on the mint return type. The high-level call requires 32 bytes of returndata that the token never writes.

Preconditions#

  • The caller has earnedRakeback of 1000 XYRO.
  • The treasury's token is the Xyro token whose mint returns nothing.

Attack walkthrough#

  1. Credit 1000 XYRO of earned rakeback. The credit event logs that stored balance.
  2. withdrawRakeback(1000) debits the mapping and calls mint.
  3. The call reverts because the returndata is empty.
  4. The caller still holds 0 XYRO and earnedRakeback is still 1000.

Diagrams#

flowchart TD A["earnedRakeback is 1000 XYRO"] --> B["withdrawRakeback calls mint"] B --> C["Interface expects a bool"] C --> D["XyroToken.mint returns no data"] D --> E["Call reverts and the 1000 XYRO stays unclaimed"]

Impact#

Every rakeback claim reverts. The 1000 XYRO credited in this run cannot be withdrawn until the interface matches the token.

How to reproduce#

BASH
cd 45669-withdrawrakeback-function-will-always-be-failed-zokyo-none-x_exp
forge test -vv

Sources#


Sources & further analysis#

Reproductions & code

Alerts & third-party analyses

  • Web3Sec X hacked database: search.
  • Rekt leaderboard: search.
  • Solodit incident search: search.

These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.