You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RocketStorage contract in its current implementation is vulnerable to a Phishing with tx.origin attack. The misuse of the tx.origin property in the onlyLatestRocketNetworkContract modifier exposes critical functionality to potential malicious actors. An attacker can exploit this vulnerability to gain unauthorized access to privileged functions, such as setDeployedStatus() or others, by deceiving the guardian address into interacting with a malicious contract.
Details
Affected Functionality:
The vulnerability resides in the onlyLatestRocketNetworkContract modifier, specifically during the initialization phase (storageInit == false):
modifier onlyLatestRocketNetworkContract() {
if (storageInit ==true) {
require(booleanStorage[keccak256(abi.encodePacked("contract.exists", msg.sender))], "Invalid or outdated network contract");
} else {
require((
booleanStorage[keccak256(abi.encodePacked("contract.exists", msg.sender))] ||tx.origin== guardian
), "Invalid or outdated network contract attempting access during deployment");
}
_;
}
Root Cause:
The use of tx.origin in the condition:
tx.origin== guardian
allows any malicious contract to pass this check if the guardian address interacts with the malicious contract, as tx.origin retains the original sender of the transaction regardless of intermediate calls.
Exploitation:
An attacker can deploy a malicious contract and trick the guardian into calling a function on the malicious contract. The malicious contract then forwards the call to the vulnerable function (e.g., setDeployedStatus()), and since tx.origin matches guardian, the contract treats the call as legitimate.
Proof of Concept
Malicious Contract:
The attacker deploys a contract like the following:
Attack Execution:
The attacker tricks the guardian into calling the attack() function, possibly through social engineering or by embedding the malicious call into a seemingly legitimate interaction.
Result:
The condition tx.origin == guardian evaluates to true, allowing the attacker to execute the setDeployedStatus() function or any other restricted function protected by the onlyLatestRocketNetworkContract modifier.
Impact
The vulnerability allows unauthorized access to critical functionality during the deployment phase. Potential impacts include:
Unauthorized modification of the deployment status.
Execution of privileged functions, which could compromise the security and integrity of the system.
Remediation
Replace the use of tx.origin with msg.sender in the onlyLatestRocketNetworkContract modifier:
require((
booleanStorage[keccak256(abi.encodePacked("contract.exists", msg.sender))] ||msg.sender== guardian
), "Invalid or outdated network contract attempting access during deployment");
This change ensures that only the immediate caller is checked, preventing phishing attacks via intermediate contracts.
Recommendations
Avoid tx.origin: Do not use tx.origin for access control checks or any sensitive logic.
Enhance Access Control: Use msg.sender and implement role-based access control mechanisms.
Conduct Security Audits: Perform regular security reviews to identify and mitigate such vulnerabilities.
Conclusion
The use of tx.origin in the RocketStorage contract introduces a serious vulnerability that can be exploited via phishing attacks. Prompt remediation is required to prevent potential exploitation.
The text was updated successfully, but these errors were encountered:
Phishing via
tx.origin
in RocketStorage ContractSummary
The
RocketStorage
contract in its current implementation is vulnerable to a Phishing withtx.origin
attack. The misuse of thetx.origin
property in theonlyLatestRocketNetworkContract
modifier exposes critical functionality to potential malicious actors. An attacker can exploit this vulnerability to gain unauthorized access to privileged functions, such assetDeployedStatus()
or others, by deceiving theguardian
address into interacting with a malicious contract.Details
Affected Functionality:
The vulnerability resides in the
onlyLatestRocketNetworkContract
modifier, specifically during the initialization phase (storageInit == false
):Root Cause:
The use of
tx.origin
in the condition:allows any malicious contract to pass this check if the
guardian
address interacts with the malicious contract, astx.origin
retains the original sender of the transaction regardless of intermediate calls.Exploitation:
An attacker can deploy a malicious contract and trick the
guardian
into calling a function on the malicious contract. The malicious contract then forwards the call to the vulnerable function (e.g.,setDeployedStatus()
), and sincetx.origin
matchesguardian
, the contract treats the call as legitimate.Proof of Concept
Malicious Contract:
The attacker deploys a contract like the following:
Attack Execution:
The attacker tricks the
guardian
into calling theattack()
function, possibly through social engineering or by embedding the malicious call into a seemingly legitimate interaction.Result:
The condition
tx.origin == guardian
evaluates totrue
, allowing the attacker to execute thesetDeployedStatus()
function or any other restricted function protected by theonlyLatestRocketNetworkContract
modifier.Impact
The vulnerability allows unauthorized access to critical functionality during the deployment phase. Potential impacts include:
Remediation
Replace the use of
tx.origin
withmsg.sender
in theonlyLatestRocketNetworkContract
modifier:This change ensures that only the immediate caller is checked, preventing phishing attacks via intermediate contracts.
Recommendations
tx.origin
: Do not usetx.origin
for access control checks or any sensitive logic.msg.sender
and implement role-based access control mechanisms.Conclusion
The use of
tx.origin
in theRocketStorage
contract introduces a serious vulnerability that can be exploited via phishing attacks. Prompt remediation is required to prevent potential exploitation.The text was updated successfully, but these errors were encountered: