Skip to content
Access control Write-up Beginner

[web3] Medium bug in Ocean found by Shanmuga Bharathi. N worth 5k

The Ocean Protocol Dispenser contract's ownerWithdraw function lacked an access control check, allowing any user to call it and transfer the contract's data token balance to the payment collector address. This prevented the owner from dispensing data tokens to their intended destination.

mirror.xyz

Published on mirror.xyz

Hello readers! This article showcases the medium-severity bug on the Ocean Protocol Dispenser contract, which allowed any user to call the ownerWithdraw() function and send the funds to the payment collector.

The author, on mirror.xyz

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 ownerWithdraw function lacked an access control modifier or check to ensure only the owner could call it.

Impact

The dispenser contract becomes unable to function, as the owner cannot dispense data tokens to the desired address.

What the attacker needed

None

How it was found

  1. Deploy an exploit contract that references the Dispenser contract.
  2. Call the ownerWithdraw function on the Dispenser with the data token address.

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.

A smart contract is a program on a blockchain that can hold and move digital tokens. The ownerWithdraw function was meant to let only the contract owner withdraw tokens, but it had no check to confirm the caller was the owner. So anyone could call it and move the tokens to a fixed address, breaking the dispenser's normal operation.

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.