Skip to content

Griefing attack in Lyra V2 #333

@gandu0

Description

@gandu0

Bug Description

Where
permitAndSubmitTransfer and permitAndSubmitTransfers

Expected behavior:

  • The permitAndSubmitTransfers function utilizes the lyra’s permit function so that approve and pull operations can happen in a single transaction instead of two consecutive transactions.

Attack:

  • _Permit () functionality uses the nonces mapping for replay protection. Once a signature is verified and approved, the nonce increases, invalidating the same signature being replayed.
  • permitAndSubmitTransfers expects the holder to sign their tokens and provide the signature to contract as part of permitData
    When a permitAndSubmitTransfers transaction is in the mempool, an attacker can take this signature, call the external permit() function on the token themselves.
  • Since this is a valid signature, the token accepts it and increases the nonce.
  • This makes the spender's transaction fail whenever it gets mined.

Impact

  • Attacker can make sure all calls to permitAndSubmitTransfers fail for the first time.
  • Approve and pull operations can not happen in a single transaction.

Risk Breakdown

  • Difficulty to Exploit: Easy
  • Severity: Medium

Recommendation

  • In permitAndSubmitTransfers fuction, check if it has the approval it needs. If not, then only submit the permit signature.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions