code-423n4 / 2023-05-maia-findings

24 stars 13 forks source link

Usage of equality comparison instead of assignment Code With No Effects in PartnerManagerFactory file #60

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/maia/factories/PartnerManagerFactory.sol#L57-L73

Vulnerability details

Impact

The lines of affected code are using the equality operator instead of the assignment operator.

e.g. line 61

        partnerIds[newPartnerManager] == id;

e.g line 70

        vaultIds[newVault] == id;

Proof of Concept

    /// @inheritdoc IPartnerManagerFactory
    function addPartner(PartnerManager newPartnerManager) external onlyOwner {
        uint256 id = partners.length;
        partners.push(newPartnerManager);
        partnerIds[newPartnerManager] == id;

        emit AddedPartner(newPartnerManager, id);
    }

    /// @inheritdoc IPartnerManagerFactory
    function addVault(IBaseVault newVault) external onlyOwner {
        uint256 id = vaults.length;
        vaults.push(newVault);
        vaultIds[newVault] == id;

        emit AddedVault(newVault, id);
    }

Tools Used

VS Code + Mythx

Recommended Mitigation Steps

Change the following from "==" to "=": e.g. line 61

        partnerIds[newPartnerManager] = id;

e.g line 70

        vaultIds[newVault] = id;

Assessed type

Invalid Validation

code423n4 commented 1 year ago

Withdrawn by debo