Reproduced Exploit

InterPol: reward tokens leave through withdrawLPToken and skip the fee

withdrawERC20 charges HoneyQueen.computeFees. With protocolFees of 1000, that is 10 percent, rounded up: 1000 tokens cost 100. withdrawLPToken is supposed to reject reward tokens. Both checks, isRewardToken and expirations == 0, are commented out. The owner calls withdrawLPToken on a registered rew…

Dec 2024•Ethereum•defi•3 min read

Loss

1000 reward tokens withdrawn. The 10 percent fee, 100 tokens, is not paid

Chain

Ethereum

Category

defi

Date

Dec 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: 45074-h-01-reward-tokens-can-be-withdrawn-without-fee-pashov-audit. Standalone Foundry PoC and full write-up: 45074-h-01-reward-tokens-can-be-withdrawn-without-fee-pashov-audit_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/defi/fee-manipulation · vuln/logic/missing-check

Key info#

FieldValue
Loss1000 reward tokens withdrawn. The 10 percent fee, 100 tokens, is not paid
Vulnerable contractHoneyLocker.withdrawLPToken
Attacker EOA0x1111111111111111111111111111111111111111
Attack contractExploit
Attack txExploit.run()
Chain / block / dateEthereum model · block 0 · 2024-12
Compilersolc 0.8.27, cancun, via IR
Bug classCommented-out reward-token check on the LP withdraw path

TL;DR#

withdrawERC20 charges HoneyQueen.computeFees. With protocolFees of 1000, that is 10 percent, rounded up: 1000 tokens cost 100. withdrawLPToken is supposed to reject reward tokens. Both checks, isRewardToken and expirations == 0, are commented out. The owner calls withdrawLPToken on a registered reward token and receives all 1000. The beekeeper receives 0. withdrawERC20 on the same balance pays the owner 900 and the beekeeper 100.

Background#

Pashov Audit Group's InterPol review of 24 December 2024, finding H-01. The locker stakes LP tokens and takes a cut of reward tokens on the way out. The reward-token lines in withdrawLPToken were left commented, so that cut can be skipped.

The vulnerable code#

SOLIDITY
function withdrawLPToken(address _LPToken, uint256 _amountOrId) external onlyUnblockedTokens(_LPToken) onlyOwnerOrOperator {
    // if (honeyQueen.isRewardToken(_LPToken)) revert HoneyLocker__HasToBeLPToken();
    // if (expirations[_LPToken] == 0) revert HoneyLocker__HasToBeLPToken();
    if (block.timestamp < expirations[_LPToken]) revert HoneyLocker__NotExpiredYet();
    Token(_LPToken).transferFrom(address(this), recipient(), _amountOrId); // @> VULN
}

computeFees is solady mulDivUp(amount, protocolFees, 10000). At 1000 bps and 1000 tokens the fee is exactly 100.

The fix is to restore the isRewardToken revert so reward tokens must use withdrawERC20.

Root cause#

The fee lives on one withdraw function. The other withdraw function transfers the same ERC20 and the guard that would have forced the fee path is commented out.

Preconditions#

  • The token is flagged isRewardToken. protocolFees is 1000.
  • The locker holds 1000 of it. expirations is 0, the unlocked-locker value, so the remaining timestamp check does not revert.
  • The caller is the owner.

Attack walkthrough#

  1. The owner confirms isRewardToken is true.
  2. withdrawLPToken evaluates the timestamp check. Expiration 0 does not revert. The commented reward check never runs.
  3. The locker approves itself and transferFrom sends all 1000 tokens to the owner.
  4. The beekeeper's balance is 0.
  5. The control calls withdrawERC20. The owner receives 900 and the beekeeper receives 100.

Diagrams#

flowchart TD A["Reward token is registered and the locker holds 1000"] --> B["Owner calls withdrawLPToken"] B --> C["VULN the isRewardToken revert is commented out"] C --> D["transferFrom sends the full 1000"] D --> E["Beekeeper fee is 0"] E --> F["withdrawERC20 would have paid 100 of the 1000"]

Impact#

The owner keeps 100 tokens that withdrawERC20 would have sent to the beekeeper. On this balance that is the entire 10 percent protocol fee. The beekeeper's balance stays 0, and distributeFees is never called.

How to reproduce#

BASH
cd 45074-h-01-reward-tokens-can-be-withdrawn-without-fee-pashov-audit_exp
forge test -vv

test_exploit_reward_leaves_with_no_fee asserts the owner received 1000 and the beekeeper received 0. test_control_withdrawERC20_pays_10_percent asserts a 900 and 100 split. Output is output.txt.

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.