The MarketPlaceLibraries
contract is vulnerable to timestamp manipulation by miners, which can lead to incorrect marketplace status transitions. Additionally, the contract does not validate the tge
(time of generation event) value, which can result in unexpected behavior when tge
is zero.
1.Timestamp Manipulation:
Issue: The contract relies on block.timestamp
to determine the marketplace status. Miners can manipulate block.timestamp
within a small range to influence the status transition.
2.Condition tge
Zero:
Issue: When tge
is zero, the contract returns the marketplace status directly without further validation, potentially leading to unexpected behavior.
forge test --match-path test/MarketPlaceLibrariesTest.t.sol
[⠊] Compiling...
[⠢] Compiling 1 files with Solc 0.8.26
[⠆] Solc 0.8.26 finished in 1.08s
Compiler run successful!
Ran 2 tests for test/MarketPlaceLibrariesTest.t.sol:MarketPlaceLibrariesTest
[PASS] testManipulateBlockTimestamp() (gas: 14735)
[PASS] testTgeZero() (gas: 10471)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.06ms (382.20µs CPU time)
Ran 1 test suite in 8.63ms (1.06ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests)
Miners can manipulate the block.timestamp
to change the marketplace status from AskSettling
to BidSettling
or vice versa, potentially gaining unfair advantages in the marketplace.
If tge
is not properly initialized, the marketplace status may not reflect the actual state, leading to incorrect behavior in the marketplace operations.
Manual Review
Foundry
Add a buffer time to reduce the impact of small timestamp manipulations.
Use a more robust time-check mechanism, such as a combination of block numbers and timestamps, to reduce reliance on block.timestamp
.
Ensure tge
is properly initialized and validated before being used in status determination.
Validate other parameters in MarketPlaceInfo
to ensure they are within expected ranges.
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.