DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: medium
Invalid

Missing `deadline` parameter in structHash creation, makes signature to be used forever

Vulnerability Details

In SettlementBranch::fillOffchainOrders function structHash is created using EIP712 standard to create a message Hash to be signed.
But here in the struct Hash creation crucial parameter deadline is missing ie. the message Hash will be generated without the deadline parameter which makes the signature generated from signing it to be used forever.

File : src/perpetuals/branches/SettlementBranch.sol
186: function fillOffchainOrders(
...
...
240: ctx.structHash = keccak256(
241: abi.encode(
242: Constants.CREATE_OFFCHAIN_ORDER_TYPEHASH,
243: ctx.offchainOrder.tradingAccountId,
244: ctx.offchainOrder.marketId,
245: ctx.offchainOrder.sizeDelta,
246: ctx.offchainOrder.targetPrice,
247: ctx.offchainOrder.shouldIncreaseNonce,
248: ctx.offchainOrder.nonce,
249: ctx.offchainOrder.salt
250: )
251: );

SettlementBranch.sol#L240-L251

Signatures signed by users should always have an expiration or timestamp deadline, such that after that time the signature is no longer valid. If there is no signature expiration, a user by signing a message is effectively granting a "lifetime license".
Signature implementations should always include an expiration timestamp and aim to conform to EIP-712.
Similar finding related to deadline missing

Impact

Without signature expiration, a user by signing a message is effectively granting a "lifetime license".

Tools Used

Manual Review

Recommendation

Add a deadline parameter also in the above structHash and encode it with other parameters also add that in CREATE_OFFCHAIN_ORDER_TYPEHASH. After that create to message Hash to be signed.
And add a check to verify that deadline has not been passed ,if passed then revert.

Updates

Lead Judging Commences

inallhonesty Lead Judge
11 months ago
inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.