The withdrawTokens
function in Bridge.sol
allows for the deployment of arbitrary code if collectionL1
does not exist. This could potentially enable malicious actors to introduce harmful code through the contract.
When withdrawTokens
is called with an L1 address that doesn't exist, it triggers the deployment of a new contract using parameters passed to the function. There are no safeguards in place to validate that these parameters do not contain malicious bytecode or scripts. This allows an attacker to inject arbitrary code into the newly deployed contract, potentially compromising the entire bridge system.
A test case was been added to Bridge.t.sol
. This test showcases how an attacker can embed javascript code that could potentially affect either the contract code or the web interface displaying the code.
The string "><script>alert('XSS')</script>"
is a classic example of a Cross-Site Scripting (XSS) attack. XSS allows attackers to inject malicious scripts into web pages viewed by other users.
The severity is critical. This vulnerability can lead to significant financial losses and compromise the integrity of the entire bridge system. Attackers could:
Injection of malware into user wallets or interfaces
Manipulation of bridge logic to favor attackers
Manual code review
Test suites
Thoroughly validate all input parameters, especially those used in contract deployment.
Enforce strict limits on string lengths and content for fields like name and symbol.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.