Skip to content
Business logic Audit finding Intermediate

Changing engine.nft contract breaks vaults

Governance can change the engine.nft address used by vaults, and when minting a new vault the returned ID can overwrite an existing debt position and set its status to Idle. This allows overwriting existing collateralized debt positions.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

Governance can change the engine.nft address which is used by vaults to represent collateralized debt positions (CDP). When minting a vault using MochiVault.mint the address returned ID will be used and overwrite the state of an existing debt position and set its status to Idle.

Impact

Changing the NFT address will allow overwriting existing CDPs.

Recommended Mitigation Steps

Disallow setting a new NFT address. or ensure that the new NFT’s IDs start at the old NFT’s IDs.

ryuheimat (Mochi) confirmed

The original report as published on Code4rena, by cmichel. 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

Root cause

Likely the vault contract assumes NFT IDs are unique across NFT contract changes, so a new NFT contract with overlapping IDs can overwrite existing vault state.

What the attacker needed

Governance changes engine.nft address

The fix

The NFT address should not be changeable, or the new NFT's IDs should start after the old NFT's IDs to avoid collisions.

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 vault is a record of debt backed by collateral. The system uses NFT IDs to identify each vault. If the NFT contract is swapped, new IDs may collide with old ones, so creating a new vault can overwrite an existing one.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by cmichel

View all

196 more disclosed reports, best first.

More from Mochi contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.