Closed code423n4 closed 1 year ago
https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L309-L316
Due to the wrong iteration code, the contract can not restructure the system.
In this line of the contract https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L313
address current = addressesToWipe[0];
the code won't work as intended due to code is getting addressesToWipe variable's first index in every iteration.
function restructureCapTable(address[] calldata helpers, address[] calldata addressesToWipe) public { require(zchf.equity() < MINIMUM_EQUITY); checkQualified(msg.sender, helpers); for (uint256 i = 0; i<addressesToWipe.length; i++){ address current = addressesToWipe[0]; _burn(current, balanceOf(current)); } }
Manual
The correct code for this line: https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L313
Would be:
address current = addressesToWipe[i];
function restructureCapTable(address[] calldata helpers, address[] calldata addressesToWipe) public { require(zchf.equity() < MINIMUM_EQUITY); checkQualified(msg.sender, helpers); for (uint256 i = 0; i<addressesToWipe.length; i++){ address current = addressesToWipe[i]; _burn(current, balanceOf(current)); } }
0xA5DF marked the issue as duplicate of #941
hansfriese changed the severity to 2 (Med Risk)
hansfriese marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L309-L316
Vulnerability details
Impact
Due to the wrong iteration code, the contract can not restructure the system.
Proof of Concept
In this line of the contract https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L313
the code won't work as intended due to code is getting addressesToWipe variable's first index in every iteration.
Tools Used
Manual
Recommended Mitigation Steps
The correct code for this line: https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L313
Would be: