Open code423n4 opened 1 year ago
141345 marked the issue as primary issue
https://github.com/code-423n4/2023-07-arcade-findings/issues/58 talks about the issue with internal accounting of gscAllowance. Another aspect of the issue.
And this report shows some unexpected result due to external erc20 allowance overwrite.
PowVT marked the issue as sponsor confirmed
0xean marked the issue as satisfactory
0xean marked the issue as selected for report
Doesn't it falls under the admin mistake, admin would be aware and can change these to desired values anytime.
Doesn't it falls under the admin mistake, admin would be aware and can change these to desired values anytime.
I don't believe this should be view as input sanitization as the core functionality is written in a way that has unexpected consequences that could affect the functionality of the protocol. I can see arguing for QA, I welcome more comments from other wardens or sponsor ( @c4-sponsor )
Doesn't it falls under the admin mistake, admin would be aware and can change these to desired values anytime.
I don't believe this should be view as input sanitization as the core functionality is written in a way that has unexpected consequences that could affect the functionality of the protocol. I can see arguing for QA, I welcome more comments from other wardens or sponsor ( @c4-sponsor )
Correct me if im wrong, I think it is intended for allowance to be overriden for spender when it is decreased, given changing of approval needs to go through a GSC proposal
But since this report also highlights the potential inability to reduce allowance due to underflow in the gscAllowance mapping, it should be duplicated with #58
Again correct me if im wrong, If the above reasoning is correct, #55, #146 and #535 should be invalidated since they do not mention the possible DoS when decreasing allowance.
Hi Oxean. I don't think the item on qa report 506 is the duplicate of this issue. Tqs
Lines of code
https://github.com/code-423n4/2023-07-arcade/blob/f8ac4e7c4fdea559b73d9dd5606f618d4e6c73cd/contracts/ArcadeTreasury.sol#L391
Vulnerability details
Impact
direct use of
IERC20(token).approve(spender, amount);
causes the samespender
allowances to be overridden by each otherProof of Concept
In the
gscApprove()
method it is possible to givespender
a certain allowanceThe code is as follows:
From the above code we can see that when executed
gscApprove
consumesgscAllowance[]
and ultimately usesIERC20(token).approve();
to give thespender
allowanceSince the direct use is
IERC20.approve(spender, amount)
, the amount of the allowance is overwritten, whichever comes lastIn the other methods
approveSmallSpend
,approveMediumSpend
,approveLargeSpend
also useIERC20(token).approve();
, which causes them to override each other if targeting the samespender
.Even if there is a malicious
GSC_CORE_VOTING_ROLE
, it is possible to executegscApprove(amount=1 wei)
afterapproveLargeSpend()
to reset to an allowance of only1 wei
.The recommendation is to use accumulation to avoid, intentionally or unintentionally, overwriting each other
Tools Used
Recommended Mitigation Steps
Assessed type
Context