Closed c4-bot-4 closed 7 months ago
saxenism (sponsor) disputed
We consider this issue invalid because the amount is read from the legacy L1ERC20 bridge for these legacy transactions ( or sometimes even double checked).
The PoC bypasses the access control imposed by the L1SharedBridge::claimFailedDepositLegacyErc20Bridge
function which ensures it is in turn invoked by the legacy bridge that validates the arguments the Warden specifies are unsanitized. As such, this exhibit is considered invalid given that the variables are properly sanitized by the legacy bridge and cannot be arbitrarily supplied to the function referenced above.
alex-ppg marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/contracts/ethereum/contracts/bridge/L1SharedBridge.sol#L329-L345 https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/contracts/ethereum/contracts/bridge/L1SharedBridge.sol#L644-L666
Vulnerability details
When initiating a refund request from the Legacy Bridge contract using
claimFailedDepositLegacyErc20Bridge
.https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/contracts/ethereum/contracts/bridge/L1SharedBridge.sol#L644-L666
It calls the internal function
_claimFailedDeposit
._isEraLegacyWithdrawal
as true,weCanCheckDepositHere
as false,notCheckedInLegacyBridgeOrWeCanCheckDeposit
as false. According to the logic, this pathway does not verify the deposit details (who initiated the deposit, what token was deposited, and the amount of the deposit).https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/contracts/ethereum/contracts/bridge/L1SharedBridge.sol#L329-L345
Impact
Proof of Concept
Attack scenario:
claimFailedDepositLegacyErc20Bridge
.Test code
Added the
test_excessiveRefundAttack
function inL1ShardBridgeLegacy.t.sol
You should get the following output:
In addition to this, If an attacker can get a genuinely failed L2 deposit transaction, he can initiate a refund.
Tools Used
Manual
Recommended Mitigation Steps
Enhanced Verification: Increase the verification of key information such as the depositor, amount, and token type when processing refund requests.
Assessed type
Invalid Validation