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

The updateAdminsContract(address) function in RandomizerNXT contract doesn't check if the proposed new admin address implements isAdminContract() #129

Closed
c4-submissions opened this issue Nov 2, 2023 · 4 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working edited-by-warden unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@c4-submissions
Copy link
Contributor

c4-submissions commented Nov 2, 2023

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/hardhat/smart-contracts/RandomizerNXT.sol#L45-L46

Vulnerability details

Bug Description

RandomizerRNG and RandomizerVRF contracts execute a check in updateAdminContract(address) function to make sure the newly proposed admin address corresponds to a contract that implements isAdminContract(), which only returns true. As updateAdminContract() uses a one step procedure to update the value of INextGenAdmins private adminsContract variable, this check is important to make sure the address passed to updateAdminContract() indeed corresponds to an implementation of NextGenAdmins contract.

Impact

Here is the check :

require(INextGenAdmins(_newadminsContract).isAdminContract() == true, "Contract is not Admin");

This line isn't present in RandomizerNXT. Therefore, there is no check on the address passed and what contract it corresponds to. Moreover, as all update functions in RandomizerNXT use FunctionAdminRequired modifier, if a wrong address is passed, they will all fail as the modifier execution will revert. In that situation, it will be necessary to redeploy RandomizerNXT contract.

Tools Used

Manual

Recommended Mitigation Steps

Add the same check as in other Randomizer contracts to make sure the new adminsContract variable will be an adminsContract instance and will therefore be callable :

require(INextGenAdmins(_newadminsContract).isAdminContract() == true, "Contract is not Admin");

Assessed type

Access Control

@c4-submissions c4-submissions added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Nov 2, 2023
c4-submissions added a commit that referenced this issue Nov 2, 2023
@code4rena-admin code4rena-admin changed the title updateAdminsContract(address) function in RandomizerNXT contract doesn't check if the proposed new admin address implements isAdminContract() The updateAdminsContract(address) function in RandomizerNXT contract doesn't check if the proposed new admin address implements isAdminContract() Nov 2, 2023
@code4rena-admin code4rena-admin changed the title The updateAdminsContract(address) function in RandomizerNXT contract doesn't check if the proposed new admin address implements isAdminContract() The updateAdminsContract(address) function in RandomizerNXT contract doesn't check if the proposed new admin address implements isAdminContract() Nov 2, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #478

@c4-judge
Copy link

c4-judge commented Dec 1, 2023

alex-ppg marked the issue as not a duplicate

@c4-judge c4-judge reopened this Dec 1, 2023
@alex-ppg
Copy link

alex-ppg commented Dec 5, 2023

Similarly to #123, the isAdminContract is a rudimentary safety check rather than a security check. As such, I deem this submission to be a QA (NC) and thus of overinflated severity.

@c4-judge
Copy link

c4-judge commented Dec 5, 2023

alex-ppg marked the issue as unsatisfactory:
Overinflated severity

@c4-judge c4-judge closed this as completed Dec 5, 2023
@c4-judge c4-judge added the unsatisfactory does not satisfy C4 submission criteria; not eligible for awards label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working edited-by-warden unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

5 participants