Skip to content
DoS Audit finding Beginner

Basket.sol#mint() Malfunction due to extra nonReentrant modifier

The mint function in Basket.sol is broken because it has a nonReentrant modifier while the mintTo function it calls also has one, causing the call to revert. As a result, no one can mint tokens, impacting protocol availability.

WatchPug Follow

Originally disclosed on Code4rena

Submitted by WatchPug, also found by kenzo, pants, and pauliax.

https://github.com/code-423n4/2021-10-defiprotocol/blob/7ca848f2779e2e64ed0b4756c02f0137ecd73e50/contracts/contracts/Basket.sol#L83-L88

function mint(uint256 amount) public nonReentrant override {
    mintTo(amount, msg.sender);
}

function mintTo(uint256 amount, address to) public nonReentrant override {
    require(auction.auctionOngoing() == false);

The mint() method is malfunction because of the extra nonReentrant modifier, as mintTo already has a nonReentrant modifier.

Recommendation

Change to:

function mint(uint256 amount) public override {
    mintTo(amount, msg.sender);
}

frank-beard (Kuiper) confirmed

Alex the Entreprenerd (judge) commented:

Mint is factually broken, definitely an oversight. I don’t think high severity is correct here though as since no-one can mint, no funds are at risk. I’ll go with medium severity as per the docs:

2 — Med: Assets not at direct risk, but the function of the **protocol or its availability could be impacted**, or leak value with a hypothetical attack path with stated assumptions, but external requirements.

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

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

Impact

The mint function is completely broken, so no one can mint tokens, which impacts the protocol's availability but does not put funds at direct risk.

What the attacker needed

None

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 nonReentrant modifier is a lock that prevents a function from being called again while it is still running. Here, the mint function locks, then calls mintTo which tries to lock again, so the second lock fails and the whole call reverts. This means the mint feature does not work at all.

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 WatchPug

View all

197 more disclosed reports, best first.

More from Kuiper contest

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.