Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not initializable SmartAccount implementation contract #98

Closed
code423n4 opened this issue Jan 6, 2023 · 3 comments
Closed

Not initializable SmartAccount implementation contract #98

code423n4 opened this issue Jan 6, 2023 · 3 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-496 satisfactory satisfies C4 submission criteria; eligible for awards sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L0

Vulnerability details

Impact

The SmartAccount implementation contract is open to exploitation because it is not initialized in the deployment process.

Proof of Concept

With the unintializable contract is possible to change the owner and selfdestruct the contract to DoS all proxy contracts, making it impossible to upgrade. To perform this attack the attacker would:

  1. Use the initalize function to get ownership of SmartAccount implementation
  2. Deploy malicous contract with selfdestruct functions
  3. Execute selfdestruct function from malicious contract with delegatecall in implementation contract

Tools Used

Manual Analysis

Recommended Mitigation Steps

The recommendation is to initialize the implementation contract or follow OZ security advice to add _disableInitializers function to constructor of SmartAccount

constructor() {
	_disableInitializers();
}
@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Jan 6, 2023
code423n4 added a commit that referenced this issue Jan 6, 2023
@c4-judge
Copy link
Contributor

gzeon-c4 marked the issue as duplicate of #496

@c4-sponsor
Copy link

livingrockrises marked the issue as sponsor confirmed

@c4-sponsor c4-sponsor added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Jan 25, 2023
@c4-judge
Copy link
Contributor

gzeon-c4 marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-496 satisfactory satisfies C4 submission criteria; eligible for awards sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants