code-423n4 / 2023-12-ethereumcreditguild-findings

9 stars 5 forks source link

Incorrect constant used in deployment script #1269

Closed c4-bot-3 closed 4 months ago

c4-bot-3 commented 6 months ago

Lines of code

https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/test/proposals/gips/GIP_0.sol#L308

Vulnerability details

Impact

In the deployment script, the constant SDAI_CREDIT_HARDCAP is intended to be used to set the hardcap for SDAI credit in the LendingTermParams struct. However, another constant CREDIT_HARDCAP is being used instead. While these two values are the same and hence this mistake has no effect, it could lead to incorrect behavior of the contract if either of the two values is modified in this or future deployments.

Proof of Concept

In the GIP_0.sol file, the constant SDAI_CREDIT_HARDCAP is declared but not used. Instead, the constant CREDIT_HARDCAP is used in the LendingTermParams function to set the hardcap for SDAI credit.

https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/main/test/proposals/gips/GIP_0.sol#L308

Tools Used

Manual review

Recommended Mitigation Steps

Replace the usage of CREDIT_HARDCAP with SDAI_CREDIT_HARDCAP in the LendingTermParams function to ensure the correct hardcap is set for SDAI credit. This will prevent any unintended consequences of modifying the CREDIT_HARDCAP or SDAI_CREDIT_HARDCAP constants.

Assessed type

Other

c4-pre-sort commented 5 months ago

0xSorryNotSorry marked the issue as sufficient quality report

c4-pre-sort commented 5 months ago

0xSorryNotSorry marked the issue as primary issue

c4-sponsor commented 5 months ago

eswak (sponsor) acknowledged

c4-sponsor commented 5 months ago

eswak marked the issue as disagree with severity

eswak commented 5 months ago

I believe SDAI_CREDIT_HARDCAP is an unused variable that should be removed, thanks for pointing out.

c4-judge commented 5 months ago

Trumpero changed the severity to QA (Quality Assurance)

c4-judge commented 5 months ago

Trumpero marked the issue as grade-b

c4-judge commented 4 months ago

Trumpero marked the issue as grade-c