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.
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.
Good finding! In the current implementation
PaprControllerdoesn’t accumulate fees, so it may not cause a loss of funds.
wilsoncusack (Backed) confirmed
@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?
I have reviewed this finding along with several other judges, and believe it is ultimately of Med severity. Thank you for your input.
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.