The current implementation allows users to deposit funds (tillIn) and create new markets even when the contract is paused. This behavior contradicts the documentation, which states that pausing the contract should halt all market activities. This inconsistency creates a risk where users can inadvertently lock their funds in the contract during a paused state and cannot withdraw them, while new markets can still be created, leading to further complications.
The Readme:
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/TokenManager.sol#L56
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/TokenManager.sol#L137
The root cause of this vulnerability is the inconsistent application of pause functionality across different operations in the contract. Specifically:
The withdraw function in TokenManager has a whenNotPaused modifier.
The tillIn function in TokenManager and the functions that call it (createOffer and createTaker in PreMarkets) do not have any pause checks.
The primary impact of this vulnerability is that it undermines the entire purpose of the pause mechanism. The pause feature is designed to halt all critical contract interactions in case of emergencies or during maintenance. By allowing deposits when the contract is paused:
It bypasses a critical security measure, potentially exacerbating any issues that led to the pause.
It could lead to funds being deposited into a compromised or malfunctioning system.
It creates an inconsistent contract state where some operations are allowed while others are not.
Manual Review
Add the whenNotPaused modifier to the tillIn function in TokenManager
Also, add the whenNotPaused modifier to createOffer and createTaker in PreMarkets for an additional layer of security
I believe this is informational and non-acceptable severity because: - A single pause on withdraw to be sufficient to pause the markets during times of emergencies, given that is the only function where collateral/point tokens/native ETH can be pulled from market transactions. - Every tadle market place can be switched offline by the admin via [`updateMarketPlaceStatus`](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/SystemConfig.sol#L160-L171) and is checked in market actions via [`checkMarketPlaceStatus`](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/libraries/MarketPlaceLibraries.sol#L54-L67) to be online. This prevents many major market actions including the creation, listing and settlement of offers.
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.