Skip to content
DoS Audit finding Intermediate

Possible DOS in RollerPeriphery `approve()` function

The approve function on the RollerPeriphery contract was public and callable by anyone, so an attacker could call it with a zero amount and reset an existing allowance. This could block deposits and minting through the vault.

minhquanym Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-sense-judging/issues/46

Found by

minhquanym

Summary

https://github.com/sherlock-audit/2022-11-sense/blob/main/contracts/src/RollerPeriphery.sol#L100-L102

Vulnerability Detail

Function approve(...) is public and can be called by anyone, so attacker can simply call this function with amount = 0. This will effectively prevent depositing/minting in vault.

Impact

DOS minting and depositing functionalities in RollerPeriphery

Code Snippet

Solidity
function approve(ERC20 token, address to, uint256 amount) public payable {
    token.safeApprove(to, amount); // @audit front-run DOS  
}

Tool used

Manual Review

Recommendation

Consider only allowing authorized actors to call approve() function. Or only allowing approve to type(uint).max value.

Discussion

aktech297

Fix is done such that the approve function can be called by trusted caller. I see changes like importing the Trust from sense-v1 and setting the trusted address during contract creation.

jparklev

Fix: https://github.com/sense-finance/auto-roller/pull/15

aktech297

Fixes are confirmed...

The original report as published on Sherlock, by minhquanym. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The approve function had no access control, so any caller could overwrite the token allowance used by the vault.

Impact

An attacker could deny minting and depositing functionality in RollerPeriphery.

What the attacker needed

No privileges needed; attacker can send a transaction

The fix

The approve function was fixed so that only a trusted caller can invoke it.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract is a program on a blockchain that anyone can call. This one had a helper that sets how much of a token another address is allowed to spend, and it had no check on who could call it. Anyone could reset that permission to zero, which broke the normal deposit and minting flow.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by minhquanym

View all

28 more disclosed reports, best first.

More from Sense Update #1

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.