Skip to content
Business logic Audit finding Intermediate

Incorrect usage of safeTransferFrom traps fees in Papr Controller

The Papr Controller contract uses safeTransferFrom to move Papr tokens out of itself, but it never approves those transfers, so the calls revert. This traps auction proceeds in the contract and prevents the owner or DAO from collecting fees.

0xalpharush Follow

Originally disclosed on Code4rena

Submitted by 0xalpharush

Because the Papr Controller never gives approval for ERC20 transfers, calls to safeTransferFrom on the Papr token will revert with insufficient approval. This will trap proceeds from auctions in the contract and prevent the owner/ DAO from collecting fees, motivating the rating of high severity. The root cause of this issue is misusing safeTransferFrom to transfer tokens directly out of the contract instead of using transfer directly. The contract will hold the token balance and thus does not need approval to transfer tokens, nor can it approve token transfers in the current implementation.

Proof of Concept

Comment out this token approval as the controller contract does not implement functionality to call approve. It doesn’t make sense to “prank” a contract account in this context because it deviates from the runtime behavior of the deployed contract. That is, it’s impossible for the Papr Controller to approve token transfers. Run forge test -m testSendPaprFromAuctionFeesWorksIfOwner and observe that it fails because of insufficient approvals. Replace the call to safeTransferFrom with a call to transfer(to, amount) and rerun the test. It will now pass and correctly achieve the intended behavior.

Tools Used

Foundry

Recommended Mitigation Steps

Call transfer(to, amount) instead of safeTrasferFrom here. Note, it’s unnecessary to use safeTransfer as the Papr token doesn’t behave irregularly.

Jeiwan (warden) commented:

Good finding! In the current implementation PaprController doesn’t accumulate fees, so it may not cause a loss of funds.

wilsoncusack (Backed) confirmed

trust1995 (judge) commented:

@wilsoncusack, will you agree that in the current iteration of the code, we can consider this a M level find as no funds are at risk?

wilsoncusack (Backed) commented:

@trust1995 it’s a tough call. No funds are at risk because we burn fees. So these functions are not needed or used right now. But if we did not burn fees then all papr fees would be stuck. In the whitepaper we mention the idea of an insurance fund. Tempted to say high?

trust1995 (judge) commented:

I have reviewed this finding along with several other judges, and believe it is ultimately of Med severity. Thank you for your input.


The original report as published on Code4rena, by 0xalpharush. 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 contract used safeTransferFrom (which requires an approval) to move tokens it already owned, instead of using transfer directly.

Impact

Auction fees could be trapped in the contract, but the text notes that in the current implementation fees are burned, so no funds are actually at risk.

What the attacker needed

Contract holds Papr tokens; owner tries to collect fees

The fix

The contract should call transfer(to, amount) instead of safeTransferFrom.

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 holds tokens. To move tokens that belong to someone else, the contract needs that owner's permission (an approval). Here the contract tried to move its own tokens using a method that still checks for permission, so the transfer failed and the tokens stayed stuck.

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

View all

4 more disclosed reports, best first.

More from Papr contest

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.