Public Burn Function
On the 2nd of September, 2022, ShadowFi was exploited due to public visibility of the burn function, which allowed any user to burn the tokens.
This created inflation and hence increased the worth of the token.
Steps:
The attacker called burn function with amount of almost 10.3M SDF
Then, the attacker synced the price of the SDF token in the contract, which inflated the price of the SDF tokens.
Then the attacker swapped the SDF token with wBNB at the inflated price. The attacker swapped around 8.4 SDF tokens for 1078 wBNB(approx $301K).
Prevention
In the code above, we have to add simple modifier like onlyOwner
or by making the function internal with correct access control logic.
Last updated