Skip to content
Access control Write-up Advanced

Beanstalk Insufficient Input Validation Bug Fix Review

The Beanstalk protocol's convert function failed to validate the Well address provided by the user, allowing an attacker to supply a malicious contract that returns an arbitrary amount of BEANs. This let the attacker deposit BEANs without withdrawing any tokens from the Silo, which could then be withdrawn.

immunefi.com

Published on immunefi.com

Beanstalk is a credit-based stablecoin protocol on Ethereum that aims to reinvent the existing collateralized stablecoin market. Unlike traditional models relying on collateral, Beanstalk uses a credit system to create a decentralized and liquid asset.

The author, on immunefi.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the convert function did not validate that the provided Well address was a legitimate, whitelisted contract, and it trusted the return values from that address.

Impact

An attacker could drain the entire BEAN balance held by the Beanstalk contract.

What the attacker needed

None

How it was found

  1. Attacker deploys a malicious contract that implements the Well interface and returns a large amountOut.
  2. Attacker calls convert with convertData containing the malicious Well address and empty stems and amounts arrays.
  3. The convert function calls the malicious Well, which returns the entire BEAN balance of Beanstalk as amountOut.
  4. The attacker then withdraws the BEANs using withdrawDeposits.

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 write-up has not been written yet. The Original tab links to the source.

Beanstalk is a stablecoin system where users can swap tokens. The convert function lets users exchange BEANs for LP tokens, but it didn't check that the LP token address was legitimate. An attacker could give a fake address that lied about how many BEANs it would return, so the system gave them free BEANs.

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.

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.