28970 - [SC - Medium] Attacker can grief a user by making his supplyW...

Submitted on Mar 3rd 2024 at 19:57:36 UTC by @djxploit for Boost | ZeroLend

Report ID: #28970

Report type: Smart Contract

Report severity: Medium

Target: https://pacific-explorer.manta.network/address/0x8676e39B5D2f0d6E0d78a4208a0cCBc50504972e

Impacts:

  • Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)

Description

Brief/Intro

When a user calls supplyWithPermit function, attacker can make the call revert by front-running. This happens because of a missing try-catch statement in the supplyWithPermit function.

Vulnerability Details

When supplyWithPermit is called, by passing a permit signature, the contract calls the permit function of the asset to get approval to spend on behalf of caller. It then calls the SupplyLogic.executeSupply function to supply the asset.

So an attacker sees the supplyWithPermit call in the mempool, and extracts the permit signature from the call's argument. Attacker then use this permit signature, to directly call the asset's permit function. This will give the approval to the contract address, but along with it will increase the user's nonce, thus making the signature invalid for any further use.

Due to this when the original supplyWithPermit gets mined, it will revert, as the signature has become invalid. Hence the user's transaction will revert.

Impact Details

Attacker can grief users by frontrunning the supplyWithPermit functions, making that functionality unusable by users. Apart from supplyWithPermit the repayWithPermit function is also vulnerable to this issue.

Remediation Details

Implement a try-catch statement. Inside the supplyWithPermit function, call the assets permit statement using a try statement, and catch any revert. That will resolve the issue.

References

https://www.trust-security.xyz/post/permission-denied

Proof of Concept

Here is the test file. The specific test case showing the vulnerability is "Supply with permit test'"

Last updated

Was this helpful?