Reproduced Exploit

EYWA — createLock credits a poisoned vesting wallet that never sends its tokens

createLock accepts any contract whose beneficiary() is the caller. It adds that contract's EYWA balance to the new lock, then calls transfer(). A poisoned wallet implements transfer() as a no-op. Passing the same wallet twice credits 2000 EYWA while the escrow balance stays 0 and the attacker still…

Nov 2024•Other•logic•4 min read

Chain

Other

Category

logic

Date

Nov 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. No backend, no live RPC.

Loading fork state…

Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 44331-missing-validation-of-vesting-wallets-in-escrowmanagercreate. Standalone Foundry PoC and full write-up: 44331-missing-validation-of-vesting-wallets-in-escrowmanagercreate_exp in the evm-hack-registry mirror.


Vulnerability classes: vuln/logic/missing-validation · vuln/access-control/broken-logic · vuln/input-validation/missing

Reproduction: self-contained Foundry PoC, no fork and no cheatcodes in the exploit. Trace: output.txt.

Key info#

ImpactHIGH — 1000 EYWA stays in an attacker wallet while a lock is credited 2000 EYWA and the escrow receives 0
ProtocolEYWA DAO EscrowManager
Vulnerable codeEscrowManager.createLock credits EYWA.balanceOf(wallet) without a factory check
Bug classMissing vesting-wallet validation
FindingMixBytes — EYWA DAO audit · #44331
ReportEYWA DAO Security Audit Report
SourceAuditVault
Audited commiteywa-dao@29465033f28c8d3f09cbc6722e08e44f443bd3b2 contracts/EscrowManager.sol
Compilersolc 0.8.27, cancun, via_ir

TL;DR#

createLock accepts any contract whose beneficiary() is the caller. It adds that contract's EYWA balance to the new lock, then calls transfer(). A poisoned wallet implements transfer() as a no-op. Passing the same wallet twice credits 2000 EYWA while the escrow balance stays 0 and the attacker still holds the original 1000 EYWA.

The vulnerable code#

SOLIDITY
function createLock(
    uint256 lockDuration_,
    address recipient_,
    address[] calldata vestingWallets_
) external {
    // ...
    for (uint256 i = 0; i < vestingWallets_.length; ++i) {
        m_vestingWallet = IVestingWallet(vestingWallets_[i]);
        // Only beneficiary is checked, but not the wallet address itself
        if (m_vestingWallet.beneficiary() != msg.sender) {
            revert InvalidBeneficiary();
        }
        // @> VULN: no factory/whitelist check; balance is credited even when transfer() moves nothing
        m_lockAmount += EYWA.balanceOf(address(m_vestingWallet));
        // FIX: if (!factoryValid[address(m_vestingWallet)]) revert InvalidVestingWallet();
        m_vestingWallet.transfer(address(this));
    }
}

Root cause#

The lock amount is the sum of EYWA.balanceOf reads. The wallet address is not checked against the vesting factory, and the code never checks that transfer() actually moved tokens. A wallet the attacker deployed can report the attacker as beneficiary, sit on a real EYWA balance, and ignore transfer(). Listing it twice adds the same balance twice.

Preconditions#

The caller must be the beneficiary() returned by the wallet. That is the only check. No role beyond a normal locker is required. The poisoned wallet is deployed by the attacker in the same transaction batch as the lock.

Attack walkthrough#

  1. Mint 1000 EYWA (1000000000000000000000) into the poisoned wallet.
  2. Call createLock with that wallet twice.
  3. Each pass adds 1000 EYWA to m_lockAmount and calls transfer(), which does not move tokens.
  4. The escrow records lastLock = 2000 EYWA (2000000000000000000000). Its EYWA balance is 0. The attacker wallet still holds 1000 EYWA.

An honest wallet whose transfer() actually sends tokens escrows exactly 1000 EYWA and is credited 1000. The factory-checked createLockFixed reverts on the poisoned wallet and, for a whitelisted honest wallet, escrows 1000 EYWA.

Diagrams#

flowchart TD A["Attacker mints 1000 EYWA into a poisoned wallet"] --> B["createLock is called with that wallet twice"] B --> C["Only beneficiary equals msg.sender is checked"] C --> D["VULN: lock amount adds balanceOf twice"] D --> E["transfer does nothing so 1000 EYWA stays in the attacker wallet"] E --> F["Escrow records a 2000 EYWA lock and holds 0 EYWA"]

Impact#

The attacker keeps 1000 EYWA and receives a lock credited 2000 EYWA. The escrow, which is supposed to custody the locked tokens, holds 0. Voting power and any later reward paid against that lock are unbacked by 2000 EYWA.

Remediation#

Reject any vestingWallets_ entry that the vesting-wallet factory did not issue, before reading the balance or calling transfer(). Do not credit balanceOf unless the escrow's token balance increased by that amount.

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.