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

Incorrect Error Handling #70

Closed
howlbot-integration bot opened this issue Aug 10, 2024 · 2 comments
Closed

Incorrect Error Handling #70

howlbot-integration bot opened this issue Aug 10, 2024 · 2 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-17 🤖_09_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality upgraded by judge Original issue severity upgraded from QA/Gas by judge

Comments

@howlbot-integration
Copy link

Lines of code

https://github.com/code-423n4/2024-07-basin/blob/7d5aacbb144d0ba0bc358dfde6e0cc913d25310e/src/functions/Stable2.sol#L314
https://github.com/code-423n4/2024-07-basin/blob/7d5aacbb144d0ba0bc358dfde6e0cc913d25310e/src/functions/Stable2.sol#L315

Vulnerability details

InvalidTokenDecimals Error:
In decodeWellData, the code checks decimal0 == 0 twice
The second check should be for decimal1, not decimal0.

if (decimal1 == 0) {
decimal1 = 18;
}

Explanation:
The second if condition incorrectly checks decimal0 instead of decimal1. This means if decimal0 is 0, it will set both decimal0 and decimal1 to 18, even if decimal1 should be checked.

Example Exploitation:
If decimal0 is 0 but decimal1 is not set correctly, it could cause incorrect scaling of reserves. This misconfiguration could lead to erroneous calculations, impacting pricing or liquidity management.

Impacts:

Incorrect token decimal handling might result in unexpected contract behavior.
Financial calculations and interactions might be misrepresented, leading to incorrect balances or transactions.

Mitigations:

Correct the condition to check decimal1 in the second if statement like this:

if (decimal1 == 0) {
decimal1 = 18;
}

Assessed type

Other

@howlbot-integration howlbot-integration bot added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value 🤖_09_group AI based duplicate group recommendation bug Something isn't working duplicate-17 sufficient quality report This report is of sufficient quality labels Aug 10, 2024
howlbot-integration bot added a commit that referenced this issue Aug 10, 2024
@c4-judge c4-judge added 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Aug 21, 2024
@c4-judge
Copy link
Contributor

alex-ppg changed the severity to 3 (High Risk)

@c4-judge
Copy link
Contributor

alex-ppg marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-17 🤖_09_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality upgraded by judge Original issue severity upgraded from QA/Gas by judge
Projects
None yet
Development

No branches or pull requests

1 participant