Skip to content
Access control Audit finding Intermediate

Illuminate PT redeeming allows for burning from other accounts

The Illuminate redeem function checked the caller's balance but burned tokens from a user-supplied address, so an attacker could burn other users' shares and redeem the underlying tokens for themselves.

hyh Follow

Originally disclosed on Code4rena

Submitted by hyh, also found by 0x1f8b, 0x29A, cccz, Chom, csanuragjain, hansfriese, itsmeSTYJ, kenzo, pashov, shenwilly, Soosh, and unforgiven

Illuminate PT burns shares from a user supplied address account instead of user’s account. With such a discrepancy a malicious user can burn all other’s user shares by having the necessary shares on her balance, while burning them from everyone else.

Setting the severity to be high as this allows for system-wide stealing of user’s funds.

Proof of Concept

Redeemer’s Illuminate redeem() checks the balance of msg.sender, but burns from the balance of user supplied o address:

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/redeemer/Redeemer.sol#L114-L128

L120:

uint256 amount = token.balanceOf(msg.sender);

L126:

token.burn(o, amount);
        address principal = IMarketPlace(marketPlace).markets(u, m, p);

        if (p == uint8(MarketPlace.Principals.Illuminate)) {
            // Get Illuminate's principal token
            IERC5095 token = IERC5095(principal);
            // Get the amount of tokens to be redeemed from the sender
            uint256 amount = token.balanceOf(msg.sender);
            // Make sure the market has matured
            if (block.timestamp < token.maturity()) {
                revert Invalid('not matured');
            }
            // Burn the prinicipal token from Illuminate
            token.burn(o, amount);
            // Transfer the original underlying token back to the user
            Safe.transferFrom(IERC20(u), lender, address(this), amount);

o address isn’t validated and used as provided.

Burning proceeds as usual, Illuminate PT burns second argument a from the first argument f, i.e. f’s balance to be reduced by a:

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/marketplace/ERC5095.sol#L121-L127

    /// @param f Address to burn from
    /// @param a Amount to burn
    /// @return bool true if successful
    function burn(address f, uint256 a) external onlyAdmin(redeemer) returns (bool) {
        _burn(f, a);
        return true;
    }

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/marketplace/ERC5095.sol#L7

contract ERC5095 is ERC20Permit, IERC5095 {

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/marketplace/ERC20.sol#L187-L196

    function _burn(address src, uint wad) internal virtual returns (bool) {
        unchecked {
            require(_balanceOf[src] >= wad, "ERC20: Insufficient balance");
            _balanceOf[src] = _balanceOf[src] - wad;
            _totalSupply = _totalSupply - wad;
            emit Transfer(src, address(0), wad);
        }

        return true;
    }

This way a malicious user owning some Illuminate PT can burn the same amount of PT as she owns from any another account, that is essentially from all other accounts, obtaining all the underlying tokens from the system. The behavior is somewhat similar to the public burn case.

Recommended Mitigation Steps

o address looks to be not needed in Illuminate PT case.

Consider burning the shares from msg.sender, for example:

https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/redeemer/Redeemer.sol#L125-L126

            // Burn the prinicipal token from Illuminate
-           token.burn(o, amount);
+           token.burn(msg.sender, amount);

sourabhmarathe (Illuminate) confirmed


The original report as published on Code4rena, by hyh. 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 redeem function used a caller-supplied address for the burn instead of the caller's own address, so the balance check and the burn target did not match.

Impact

An attacker could burn other users' shares and obtain the underlying tokens, which the report describes as system-wide stealing of user funds.

What the attacker needed

Attacker holds some Illuminate PT; market has matured

The fix

The burn should use msg.sender instead of the user-supplied address; the report recommends this change and the project confirmed the finding.

How it was found

  1. The attacker holds some Illuminate principal tokens.
  2. The attacker calls redeem and supplies another user's address as the burn target.
  3. The contract checks the attacker's balance but burns the same amount from the victim's balance.
  4. The attacker receives the underlying tokens for the burned amount.

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.

A smart contract let people redeem tokens, but it took the amount to burn from the person asking while taking the tokens from an address they chose. That meant someone with a small balance could destroy someone else's tokens and take 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 hyh

View all

137 more disclosed reports, best first.

More from Illuminate contest

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.