Closed sherlock-admin4 closed 8 months ago
2 comment(s) were left on this issue during the judging contest.
WangAudit commented:
low under sherlock’s rules; future issues
takarez commented:
invalid; admin has the responsibility to change and will keep that in mind prior to the change.
Escalate
The logic here is consistent with #26, and is therefore a valid finding.
The contest README specifically states that external protocol changes resulting in degraded functionality are not acceptable.
Escalate
The logic here is consistent with #26, and is therefore a valid finding.
The contest README specifically states that external protocol changes resulting in degraded functionality are not acceptable.
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
Yeah, you're right, my mistake for overlooking.
Appreciate you @WangSecurity!
@WangSecurity @cawfree double cheking, this is a duplicate of #26, right?
If yes, planning to accept the escalation and apply.
That is, if #26 stays valid. If it's considered low/invalid due to an escalation on it, I'll reject this escalation as it doesn't change the reward distribution.
@Czar102 Correct, this should be the duplicate of #26
Result: Medium Duplicate of #26
cawfree
medium
External protocol changes to the
RootChainManager
can invalidate hardcodedPREDICATE_ADDRESS
.Summary
The
BridgeRelay
makes a fixed assumption about thePREDICATE_ADDRESS
to use when bridging ERC-20s, but the associated predicate for a giventokenType
is subject to change.Vulnerability Detail
During a call to
transferERCToBridge(address)
, theBridgeRelay
approves thePREDICATE_ADDRESS
to spend the current token balance of the contract:The assumption here is that the execution flow of
depositFor
will invoke the associated predicate contract totransferFrom
and lock the specifiedtoken
amount. However, if we take a look at theRootChainManager
we can that the selected predicate contract for a giventokenType
is not immutable:This means that in the event of a change in the resolved predicate address, tokens queued for bridging will be approved to spend for a contract which is no longer invoked, resulting in stuck tokens on the
BridgeRelay
which cannot be rescued via the understandably-constrainederc20Rescue(address)
function.In such instances, the call to
transferERCToBridge
will terminate successfully, leaving the assets stuck on the contract.Impact
Bridged assets can become stuck in the
BridgeRelay
if the predicate address is changed in future due to a protocol improvement or hack.Code Snippet
Tool used
Manual Review
Recommendation
Do not use a hardcoded
PREDICATE_ADDRESS
, and instead compute the appropriate address dynamically:However, we cannot rule out that using a fixed predicate address may be a desirable immutable property from the perspective of the sponsor, though this will not protect against external protocol changes.
In this scenario, we recommend that calls to
transferERCToBridge
shouldrevert
if the full token allowance has not been spent:This will ensure the caller's tokens do not get stuck.
Duplicate of #26