Submitted by 0xCiphky, also found by MrPotatoMagic, pep7siup, aldarion, hgrano, McToady, TECHFUND-inc (1, 2), pipidu83, 13u9, typicalHuman (1, 2), 0xc0ffEE (1, 2), DanielArmstrong (1, 2), Fitro, th3l1ghtd3m0n, ironside, farismaulana (1, 2), smaul, eLSeR17, federodes, robertodf99, CAUsr (1, 2), OpaBatyo (1, 2), kn0t, 0xNirix, avoloder, DigiSafe, jesusrod15, hail_the_lord, pfapostol, 0xAkira, KupiaSec, 0xrex (1, 2), and rbserver (1, 2)
The _processClaim internal function is responsible for calling the claimFromFactory function in the art contract, transferring the protocol fees to the protocolFeeDestination, and handling any applicable refunds.
When a user sends excess funds (msg.value) over the required mintFee, the difference is intended to be refunded to the user. This works as expected when the signatureClaim or merkleClaim functions are called directly in the PhiFactory contract by the user since msg.sender is the correct address (User). However, in some cases refunds are sent to the wrong address.
In the batchClaim function, multiple claims are processed by calling the claim function with this (the current contract) as the caller, resulting in the msg.sender being the PhiFactory contract rather than the actual user.
Similarly, the claim function also uses this when calling either the signatureClaim or merkleClaim functions, further propagating the incorrect msg.sender value. Consequently, any refunds are sent to the PhiFactory contract instead of the actual user, causing an incorrect refund.
The signatureClaim and merkleClaim functions are also callable through the Claimable contract, which is part of the PhiNFT1155 contract. However, like in the previous case, the msg.sender will be incorrect being the PhiNFT1155 contract itself, rather than the actual user who initiated the call. This results in refunds being directed to the PhiNFT1155 contract rather than the user. In this case, funds are also not able to be pulled out by the owner, effectively locking them in the contract.
Modify the affected functions (batchClaim, claim, signatureClaim, and merkleClaim) to pass the original user address as a parameter. This way, the function can handle refunds correctly by transferring excess funds to the correct user.
ZaK3939 (Phi) confirmed and commented:
For this audit, 42 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by MrPotatoMagic received the top score from the judge.
The following wardens also submitted reports: CAUsr, petarP1998, Tigerfrake, Rhaydden, PolarizedLight, pep7siup, McToady, kuprum, DigiSafe, Sparrow, bronze_pickaxe, bareli, VulnViper, DanielArmstrong, Jorgect, KupiaSec, 0xNirix, iamcarllosjr, Agontuk, Fitro, sam, Eurovickk, aldarion, th3l1ghtd3m0n, pro_king, kn0t, bhavya0911, K42, hail_the_lord, Taiger, hgrano, 0xAkira, Inspecktor, lu1gi, Evo, 0xBeastBoy, TECHFUND-inc, Trooper, rbserver, 0xCiphky, and Beosin.
The report consists of low-severity risk issues, governance risk issues arising from centralization vectors and a few non-critical issues in the end. The governance risks section describes scenarios in which the actors could misuse their powers.
