Skip to content
Access control Audit finding Intermediate

sellPrincipalToken, buyPrincipalToken, sellUnderlying, buyUnderlying uses pool funds but pays msg.sender

Four unpermissioned functions in the marketplace use pool funds to complete trades but send the resulting tokens to the caller. An attacker could call these functions to steal the resulting funds, though the judge noted it is unclear how funds would end up in the contract during normal operation.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52, also found by datapunk, kenzo, kirk-baird, and pashov

Fund loss from marketplace.

Proof of Concept

sellPrincipalToken, buyPrincipalToken, sellUnderlying, buyUnderlying are all unpermissioned and use marketplace funds to complete the action but send the resulting tokens to msg.sender. This means that any address can call these functions and steal the resulting funds.

Recommended Mitigation Steps

All functions should use safetransfer to get funds from msg.sender not from marketplace.

JTraversa (Illuminate) confirmed, but disagreed with severity and commented:

🤷 Unsure if reasonable to disagree with severity, but in this case none of these methods would work at all lol, so I suppose no value is at risk?

gzeoneth (judge) decreased severity to Medium and commented:

Unclear how fund would end up in the contract and doesn’t seem to be possible during normal operation. Judging as Med Risk.


The original report as published on Code4rena, by 0x52. 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 functions use marketplace funds instead of pulling funds from the caller, and they send the resulting tokens to msg.sender without authorisation.

Impact

An attacker could steal funds from the marketplace, but the judge noted it is unclear how funds would end up in the contract and it does not seem possible during normal operation, so the severity was reduced to Medium.

What the attacker needed

None

The fix

The functions should use safetransfer to get funds from msg.sender rather than from the marketplace.

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.

The marketplace has four functions that let anyone trade using money from the pool, but they send the tokens to whoever called them. This means an attacker could call these functions and take the tokens for themselves. The project said these functions would not work at all in practice, so the risk was limited.

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 0x52

View all

211 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.