Underflow
The vulnerability in lines 13 to 16 is related to the function burnMsgSenderDebt
. The function burns the debt of the message sender without checking if the sender has enough balance to cover the debt. This could potentially lead to an underflow error if the sender's balance is less than the debt. The function does check if the wallet balance is less than the debt and reverts if true, but it does not prevent the function from being called in the first place. This could be exploited by an attacker to cause unexpected behavior in the contract.
vscode
The issue can be resolved by adding a require statement at the beginning of the burnMsgSenderDebt
function to ensure that the function can only be called if the sender's balance is greater than or equal to the debt. This will prevent the function from being called if the sender does not have enough balance to cover the debt, thus preventing potential underflow errors. Here is the recommended code:
This code will ensure that the function can only be called if the sender has enough balance to cover the debt, thus preventing potential underflow errors.
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.