The KittyPool::burnKittyCoin function allows anyone to reduce another user's debt from the kittyCoinMeownted mapping incorrectly while burning the kittycoin from their account, leading to incorrect mapping of accounts to KittyCoins minted.
KittyPool::burnKittyCoin external function has a parameter called _onBehalfOf, which allows the user to burn KittyCoinson behalf of another user. This can be used by an attacker to mint extra KittyCoins without worrying about being liquidated or depositing more collateral , after they convince a victim to burn kittyCoinson attacker's behalf.
When a victim calls the KittyVault::burnKittyCoinwith attacker address as the parameter for onBehalfOf, the KittyCoin of msg.sender is burnt using the ERC20 burn function. But the reduced _ameownt value of kitty coins burnt is subtracted from the attacker's address in the kittyCoinMeowntedmapping instead of victim's address, hence incorrectly handling the amount to address for the protocol.
Person 1 (victim) & Person 2( attacker) both deposit equal amount of collateral into the protocol which is 10 ether.
Both mint equal amount of KittyCoins(5 ether) to begin with .
Person1 (victim) calls the KittyPool::burnKittyCoinfunction with address of Person2 (attacker) as the parameter for _onbehalfOf and 3 ether as the parameter for _ameownt. This burns 3 ether KittyCoins from the Person1(victim) account. It then updates the mapping kittyCoinMeownted subtracting the amount of tokens burnt from Person2(Attacker)'s address instead of person1. ie (5-3) ether.
The ERC20 balanceOf function for person 1 for the KittyCoin is 2 ether (actual balance) < 5 ether, which is recorded for person 1 in kittyCoinMeownted mapping.
The ERC20 balanceOf function for person 2 for the KittyCoin is 5 ether (actual balance) > 2 ether, which is recorded for person 2 in kittyCoinMeownted mapping.
The differnce between the actual balance and the balance is protocol is observed.
The attacker gets to mint extra 3 ether kittyCoinswithout depositing any extra collateral due to this vulnerability.
Paste the following function in the KittyFiTest.t.sol
This vulnerability poses a threat to the protocol . By violating the burnKittyCoin function, an attacker can manipulate a victim to burn on their behalf, hence giving them an option to mint more KittyCoinswithout the need of depositing more collateral into the protocol or worrying about being liquidated. Since this can happen very often, the severity of the vulnerability has been chosen to be a medium one.
manual review
Remove the _onBehalfOf parameter from the KittyPool::burnKittyCoin function and allow users to only burnKittyTokens on their behalf.
By making the below changes, we can ensure that anyone is not able to burn KittyCoinson behalf of someone else.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.