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.
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2022-11-sense-judging/issues/46
Found by
minhquanym
Summary
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
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...
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.