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

Malicious(malfunctioning) proxy can manipulate state variable #57

Open
code423n4 opened this issue Nov 11, 2022 · 4 comments
Open

Malicious(malfunctioning) proxy can manipulate state variable #57

code423n4 opened this issue Nov 11, 2022 · 4 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-b Q-11 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-11-looksrare/blob/e3b2c053f722b0ca2dce3a3eb06f64859b8b7a6f/contracts/LooksRareAggregator.sol#L44

Vulnerability details

##Impact

A malicious (or malfunctioning) proxy contract with the same or overlapping storage layout as LooksRareAggregator can manipulate the erc20EnabledLooksRareAggregator address and set a malicious address therefore able to steal users' erc20 funds as approval is granted.

Proof of Concept

The erc20EnabledLooksRareAggregator address is set as a state variable in LooksRareAggregator contract. There is no protection against it being changed by a proxy with the same storage layout.

Tools Used

Manual auditing

Recommended Mitigation Steps

Save erc20EnabledLooksRareAggregator address in memory before delegatecall as this will not be affected

address erc20EnabledLooksRareAggregator_ = erc20EnabledLooksRareAggregator

Then check whether erc20EnabledLooksRareAggregator has not been changed after the external call

if( erc20EnabledLooksRareAggregator_ != erc20EnabledLooksRareAggregator) {
revert()
}

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Nov 11, 2022
code423n4 added a commit that referenced this issue Nov 11, 2022
@c4-judge
Copy link
Contributor

Picodes marked the issue as duplicate of #125

@c4-judge
Copy link
Contributor

Picodes marked the issue as not a duplicate

@c4-judge c4-judge added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Dec 16, 2022
@c4-judge
Copy link
Contributor

Picodes changed the severity to QA (Quality Assurance)

@c4-judge
Copy link
Contributor

Picodes marked the issue as grade-b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-b Q-11 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants