Open code423n4 opened 1 year ago
trust1995 marked the issue as satisfactory
Good finding! In the current implementation PaprController
doesn't accumulate fees, so it may not cause a loss of funds.
wilsoncusack marked the issue as sponsor 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?
trust1995 marked the issue as selected for report
trust1995 changed the severity to 2 (Med Risk)
@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.
JeeberC4 marked the issue as primary issue
Lines of code
https://github.com/with-backed/papr/blob/9528f2711ff0c1522076b9f93fba13f88d5bd5e6/src/PaprController.sol#L382-L384
Vulnerability details
Impact
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 misusingsafeTransferFrom
to transfer tokens directly out of the contract instead of usingtransfer
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 tosafeTransferFrom
with a call totransfer(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 ofsafeTrasferFrom
here. Note, it's unnecessary to usesafeTransfer
as the Papr token doesn't behave irregularly.