A vulnerability was found in the putGunsInTheSuspendedCeiling function of the Laundrette smart contract. The issue arises from using a single mapping to handle deposits for both money and weapons, leading to potential loss of tracking for deposited amounts.
The Laundrette contract allows depositing money and weapons using the depositTheCrimeMoneyInATM and putGunsInTheSuspendedCeiling functions, respectively. Both functions interact with the bank mapping in the Shelf contract to record deposits. Here are the relevant portions of the code:
In Laundrette:
In Shelf:
The problem is that both money and weapon deposits are recorded in the same bank mapping. This can lead to overwriting of values and loss of accurate tracking. If a user first deposits money and then weapons, or vice versa, the previous deposit will be overwritten and lost.
The main impacts of this vulnerability are:
Loss of Funds Tracking: Deposits for money and weapons will overwrite each other, causing loss of accurate tracking for either type of deposit.
Inconsistent State: The contract will maintain an inconsistent state where the balance in the bank mapping does not accurately reflect the actual deposits.
Potential Financial Loss: Users may lose their deposited money or weapons due to overwriting, leading to financial loss and lack of trust in the contract.
Manual code review
To resolve this vulnerability, separate mappings should be used to track deposits for money and weapons. This will ensure that deposits for different asset types do not interfere with each other.
Separate Mappings: Introduce separate mappings in the Shelf contract for money and weapons.
The corrected Shelf contract should look like this:
Update Functions: Modify the Laundrette contract to use these new functions:
And also the depositUSDC function in the MoneyShelf contract should be modified to use the new depositMoney function of the Shelf contract.:
By implementing these changes, the contract will maintain separate records for money and weapon deposits, ensuring accurate tracking and preventing overwriting of values.
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.