Skip to content
Business logic Audit finding Advanced

`PodUnwrapLocker` can be drained due to an arbitrary input

The debondAndLock function in PodUnwrapLocker accepts any address as the pod without validating it, so an attacker can supply a malicious contract that reports the same token twice. This lets the attacker withdraw twice the amount of tokens they deposited, draining tokens other users have locked in the contract.

0xgh0st Follow with X77 and gegul

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/37

Found by

0xgh0st, X77, gegul

Summary

PodUnwrapLocker can be drained due to an arbitrary input

Root Cause

PodUnwrapLocker provides a functionality to debond your pod tokens without paying a fee by locking them for a period of time. The issue is that the function allows an arbitrary pod input which allows for a complete drain of the contract:

Solidity
function debondAndLock(address _pod, uint256 _amount) external nonReentrant {
       // NO CHECK FOR THE POD HERE
}

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

  1. A malicious contract is provided as the pod upon calling debondAndLock()
  2. In the line below, pod returns an array of 2 addresses which are both the same token, token X (token to be drained, deposited by other users who are using the contract functionality):
Solidity
IDecentralizedIndex.IndexAssetInfo[] memory _podTokens = _podContract.getAllAssets();
  1. In the line below, we store the token X balances in both of the array fields, let's say 100 tokens:
Solidity
for (uint256 i = 0; i < _tokens.length; i++) {
            _tokens[i] = _podTokens[i].token;
            _balancesBefore[i] = IERC20(_tokens[i]).balanceOf(address(this));
        }
  1. We then call debond() on our contract which transfers in 100 tokens of X
  2. In the line below, we fill the received amounts array with 100 tokens twice:
Solidity
for (uint256 i = 0; i < _tokens.length; i++) {
            _receivedAmounts[i] = IERC20(_tokens[i]).balanceOf(address(this)) - _balancesBefore[i];
        }
  1. We return our own config with a 0 duration to immediately withdraw and store our received amounts in the locks mapping
  2. We go over our token X twice with 100 amount in both fields, receiving 200 tokens even though we put in 100

Impact

Theft of funds

PoC

No response

Mitigation

Do not allow arbitrary pods

The original report as published on Sherlock, by 0xgh0st. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

Likely the function never checks that the supplied pod address is a legitimate, registered pod, so a malicious contract can return duplicated token entries and inflate the credited amounts.

Impact

An attacker could steal tokens deposited by other users who are using the contract's locking functionality.

What the attacker needed

Attacker can deploy a malicious contract; victim tokens locked in the contract

The fix

The function should reject pod addresses that are not legitimate registered pods.

How it was found

  1. Call debondAndLock() with a malicious contract as the pod.
  2. The malicious pod returns an array of two addresses that are both the same token X.
  3. The contract records token X's balance in both array fields.
  4. The malicious pod's debond() transfers in 100 tokens of X.
  5. The received amounts are filled with 100 tokens twice.
  6. The malicious pod returns a zero-duration config, and the attacker withdraws 200 tokens for 100 deposited.

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 pod is a token that bundles other tokens together. This contract lets people lock their pod tokens for a while to avoid a fee, and it trusts whatever pod address it is given. An attacker can give it a fake pod that lies about which tokens it holds, so the contract counts the same tokens twice and pays out more than was put in.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0xgh0st

View all

2 more disclosed reports, best first.

More from Peapods

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.