Skip to content
Access control Audit finding Intermediate

Missing Authorization Check Allows Unauthorized Fund Withdrawal

The withdraw and redeem functions in WERC7575Vault lack a check that the caller is the share owner or an approved spender, so anyone can burn another user's shares and direct the underlying assets to themselves. This allows theft of funds from any user who has approved the vault to spend their shares.

0xSeer Follow with 0rpse, 0x04 and 48 others

Originally disclosed on Code4rena

Submitted by 0xSeer, also found by 0rpse, 0x04, 0xApple, 0xbereket, 0xCrypt0nite, 0xD4n13l, 0xDemon, 0xdice91, 0xG0P1, 0xGutzzz, 0xheartcode, 0xkb, 0xMilenov, 0xnija, 0xpetern, 0xRaz, 0xsai, 0xSecurious, 0xVrka, Aamir, abdelhaq16, aestheticbhai, Ahmerdrarerh, ainta, Albert, aldarion, ameng, anchabadze, anon1one, arunabha003, Audittens, Avalance, axelot, ayushblock, b_void, Bbash, blutorque, Bobai23, boraichodrunkenmaster, boredpukar, c0pp3rscr3w3r, classic-k, cosin3, count-sum, cyberEth, dantehrani, DarkWingCipher, Dest1ny_rs, Diavolo, dimulski, Dinesh11G, djshan_eden, dray, duan, edoscoba, Egbe, Ekene, eloujoe, EtherEngineer, ETHworker, Eurovickk, Falendar, farman1094, fathomhewclaim, freebird0323, fullstop, gabkov, gbrigandi, grigorovv, Guilherme, h2134, happykilling, hark017, hezze, hgrano, hirusha, hrmneffdii, Insomnia, itsravin0x, j3x, jerry0422, jiangling, jo13, johnyfwesh, Josh4324, JuggerNaut63, kimnoic, KKKKK, kmkm, KuwaTakushi, legendweb3, lodelux, LubuSeb, makarov, mbuba666, meshaqRapha, mrdafidi, mrMorningstar, Mrunal2610, nachin, niffylord, nutledger, odeili, osok, Oxhsn, pecata17107, PentestMonkey, phoenixV110, prk0, Psycharis, pv, radev_sw, Ravi, Ravisai, renacoder, richa, Rikka, romans, RotiTelur, rubencrxz, s4bot3ur, Sabit, Samueltroydomi, saraswati, Shiraga94, silver_eth, Smacaud, Sneks, SOPROBRO, soyaya, Spektor, Stador, Supheli, Synthrax, Tarnished, th3_hybrid, TheMilG, TOSHI, trachev, tradingview, Uddercover, Utsav, v2110, VAD37, Valves, vangrim, wafflewizard, Willy_Petrus, wuji, yaioxy, yeahChibyke, Zabid27, and zcai

The withdraw and redeem functions in WERC7575Vault are designed to allow a caller (msg.sender) to withdraw assets on behalf of a share owner, adhering to the ERC4626 standard signature. However, the implementation lacks the critical authorization check to verify that msg.sender is either the owner themselves or an authorized spender of the owner’s shares.

In a standard ERC4626 implementation where the Vault tokenizes the shares (inheriting ERC20), the withdraw function calls _spendAllowance(owner, msg.sender, shares), which verifies and decrements the allowance that the owner has granted to the msg.sender.

In this WERC7575Vault architecture, the Share Token is a separate contract (_shareToken). The _withdraw internal function calls _shareToken.spendSelfAllowance(owner, shares). Given that this is an external call from the Vault, this function presumably checks and consumes the allowance that the owner has granted to the Vault (address(this)), ensuring the Vault has permission to burn the shares.

Crucially, no check exists to verify the relationship between msg.sender and owner.

  1. There is no msg.sender == owner check.
  2. There is no check of allowance[owner][msg.sender] on the Share Token.
  3. Even if the Vault attempted to check allowance[owner][msg.sender], it could not securely decrement it via standard ERC20 functions (as only the spender can decrement their own allowance via transfer/spend).

As a result, if an owner has approved the Vault contract (which is likely a prerequisite for the Vault to burn shares during a legitimate withdrawal), any malicious actor can call withdraw(..., ..., owner) or redeem(..., ..., owner), burn the owner’s shares, and direct the underlying assets to themselves.

Impact

This is a critical vulnerability allowing the theft of user funds. An attacker can drain the assets associated with any user who has authorized the Vault to interact with their shares. If the system is configured such that the Vault has privileged “burn” rights (requiring no user approval), then an attacker can drain the funds of all share owners.

Recommendation

  1. Immediate Mitigation: Enforce that the caller is the owner of the shares.

    function withdraw(uint256 assets, address receiver, address owner) public nonReentrant whenNotPaused returns (uint256 shares) {
        if (msg.sender != owner) revert IERC20Errors.ERC20InvalidSender(msg.sender);
        shares = previewWithdraw(assets);
        _withdraw(assets, shares, receiver, owner);
    }
    

    (Apply similarly to redeem).

  2. Protocol Upgrade: If the business requirement is to support third-party withdrawals (standard ERC4626 allowance functionality), the WERC7575ShareToken interface must be upgraded to support a secure spendAllowance(address owner, address spender, uint256 amount) function that allows a trusted Vault to verify and consume the allowance granted by an owner to a spender (msg.sender).

View detailed Proof of Concept


The original report as published on Code4rena, by 0xSeer. 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 vault's withdraw and redeem functions do not verify that the caller is the share owner or has been granted an allowance by the owner.

Impact

An attacker could steal the assets of any user who has approved the vault to spend their shares, and potentially all share owners if the vault has privileged burn rights.

What the attacker needed

Owner has approved the vault to spend shares

The fix

The withdraw and redeem functions should enforce that the caller is the owner, or the share token should support a secure spendAllowance function to verify and consume allowances.

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 vault, you deposit money and get shares. Normally only you or someone you trust can withdraw your shares. Here, the code forgot to check who is asking, so anyone can take your shares and the money behind them.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 0xSeer

View all

1 more disclosed report, best first.

More from SukukFi

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.