Closed code423n4 closed 1 year ago
Picodes marked the issue as primary issue
Note that from this comment, it seems that the expiryTime
is just an info but isn't supposed to be a hard limit or to enforce anything
ramenforbreakfast marked the issue as sponsor disputed
Yes this was mentioned both in the README and in the comments that expiryTime
is currently just there as an on-chain reference value, not enforced. So I would not consider this valid.
Picodes marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/prepo-io/prepo-monorepo/blob/3541bc704ab185a969f300e96e2f744a572a3640/apps/smart-contracts/core/contracts/PrePOMarket.sol#L65-L74
Vulnerability details
Impact
Function
mint()
Mints Long and Short tokens in exchange foramount
collateral and according to the comment in the IPrePOMarket: "Minting is not allowed after the market has ended." but there is no check or restriction in the code that to make sure minting is not possible after Market is expired. functionmint()
should have exact modifier which prevented users from depositing afterblock.timestamp
has passed Market'sexpiryTime
. right now after market has expired users still can call mint and deposit tokens.Proof of Concept
This is
mint()
code:As you can see there is no check that makes
mint()
not callable after expiryTime. the only check isfinalLongPayout > MAX_PAYOUT
, but the value offinalLongPayout
is change by owner call tosetFinalLongPayout()
and owner may don't call it even until expiryTime and contract should explicitly restrict access to mint() whenblock.timestamp >= expirtyTime
. it's possible to mint after expirty time which is not the functionality described in docs and comments.Tools Used
VIM
Recommended Mitigation Steps
add a modifier and restrict mint() from getting called after expirtyTime