Skip to content

Artificial Inflation of Interest-Bearing Balances #2

Closed

Description

@code423n4

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.

Activity

  1. added
    3 (High Risk)Assets can be stolen/lost/compromised directly
    bugSomething isn't working
    on Feb 20, 2023
  2. added a commit that references this issue on Feb 20, 2023
  3. c4-judge commented on Feb 23, 2023

    @c4-judge
    Contributor

    GalloDaSballo marked the issue as duplicate of #25

  4. GalloDaSballo commented on Feb 23, 2023

    @GalloDaSballo

    In spit of no POC, I think still fully awarded

  5. c4-judge commented on Feb 26, 2023

    @c4-judge
    Contributor

    GalloDaSballo marked the issue as duplicate of #3

  6. c4-judge commented on Feb 26, 2023

    @c4-judge
    Contributor

    GalloDaSballo marked the issue as satisfactory

  7. added
    satisfactorysatisfies C4 submission criteria; eligible for awards
    on Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3 (High Risk)Assets can be stolen/lost/compromised directlybugSomething isn't workingduplicate-3satisfactorysatisfies C4 submission criteria; eligible for awards

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions