The addBranch
function in the proxy pattern implementation lacks validation to ensure that only trusted or authorized contracts are added as branches. This vulnerability allows an attacker to add a malicious contract as a branch, potentially leading to unauthorized actions and data manipulation within the system.
The addBranch
function is responsible for adding a new branch contract and mapping specific function selectors to it. However, it does not validate whether the provided branch address is a trusted or authorized contract. This oversight breaks the security guarantee of controlled contract delegation, as it permits an attacker to add a malicious contract as a branch.
By mapping specific function selectors to this malicious contract, the attacker can execute arbitrary code when these selectors are invoked, leading to unauthorized actions, data manipulation, or other malicious behaviors within the system.
The affected code in the RootUpgrade library responsible for adding branch contracts without validating trustworthiness:
High – This vulnerability allows an attacker to execute arbitrary code within the system by adding a malicious branch. The attacker can control critical functions, manipulate data, and potentially cause financial loss, undermining the integrity and security of the protocol.
Likelihood
High – The function is accessible within the upgrade process, and in the absence of internal validation, any attacker with sufficient access to the upgrade mechanism can exploit this vulnerability to inject a malicious branch.
An attacker with access to the addBranch function can add a malicious contract as a branch by providing its address and mapping specific function selectors to it. When these selectors are invoked, they execute the attacker's contract code, leading to unauthorized actions and data manipulation.
Ensure only trusted or authorized contracts can be added as branches. This can be achieved by maintaining a whitelist of authorized contracts or implementing a role-based access control mechanism.
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.