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

Artificial Inflation of Interest-Bearing Balances #2

Closed
code423n4 opened this issue Feb 20, 2023 · 4 comments
Closed

Artificial Inflation of Interest-Bearing Balances #2

code423n4 opened this issue Feb 20, 2023 · 4 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-3 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-02-kuma/blob/main/src/kuma-protocol/KIBToken.sol#L288-L291

Vulnerability details

Impact

It is possible to artificially inflate one's balance, compromising the integrity of the KIB token entirely. The vulnerability arises from how the balances are updated and utilize "stale" values that were loaded into memory. As such, a self-transfer would load the newFromBalance as the current balance of the user minus the amount and the newToBalance as the current balance of the user plus the amount.

A user can send their entire balance to themselves and cause the final assignments of the _transfer function to assign to _baseBalances[to] the value of newToBalance, enabling them to double their balance on each invocation.

As an additional issue, the totalSupply will remain unchanged thus not only allowing the user to acquire an unfair amount of tokens but also retaining the existing total supply which can have other consequences i.e. during burn operations.

Proof of Concept

Any transfer invocation to self or transferFrom two identical addresses will activate this vulnerability and cause the user to increase their balance by whatever amount was input to the function, up to their current balance.

Tools Used

Manual review of the codebase.

Recommended Mitigation Steps

We advise the prohibition of a self-transfer to avoid this issue entirely. The issue solely arises from self-transfers and as such, preventing them is a sufficient alleviation to this vulnerability.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Feb 20, 2023
code423n4 added a commit that referenced this issue Feb 20, 2023
@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as duplicate of #25

@GalloDaSballo
Copy link

In spit of no POC, I think still fully awarded

@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as duplicate of #3

@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Feb 26, 2023
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-3 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants