Open code423n4 opened 1 year ago
0xScotch marked the issue as sponsor confirmed
Downgrading to low as this would be an error from the governance. The only risk would be to have an incorrect return in getContract
.
Picodes changed the severity to QA (Quality Assurance)
Picodes marked the issue as grade-a
Lines of code
https://github.com/code-423n4/2023-02-malt/blob/main/contracts/Repository.sol#L236-L242
Vulnerability details
Impact
Repository._updateContract()
is used to change the contract name.But if this function is called using the
_name
that doesn't have a trader contract yet, the_name
will have a valid contract without adding tocontracts
array.Proof of Concept
Repository._updateContract()
changes the contract for_name
.But it doesn't check if
_name
has a non-zero contract already and it will work unexpectedly if the function is called with a new_name
param.In this case, the
_name
will have a valid contract but the contract won't be added tocontracts
array.Tools Used
Manual Review
Recommended Mitigation Steps
We should revert if
_name
doesn't have a valid contract.