Skip to content
Business logic Audit finding Advanced

flashProof is not flash-proof

The flashProof modifier checked tx.origin to prevent multiple sensitive calls in the same block, but a miner can bypass it by using a proxy contract and a different externally owned account for each call. This allows flash-loan attacks within a single block, defeating the modifier's purpose.

Vader Protocol contest

Originally disclosed on Code4rena

The flashProof modifier is supposed to prevent flash-loan attacks by disallowing performing several sensitive functions in the same block.

However, it performs this check on tx.origin and not on an individual user address basis. This only prevents flash loan attacks from happening within a single transaction.

But flash loan attacks are theoretically not limited to the same transaction but to the same block as miners have full control of the block and include several vulnerable transactions back to back. (Think transaction bundles similar to flashbot bundles that most mining pools currently offer.)

A miner can deploy a proxy smart contract relaying all contract calls and call it from a different EOA each time bypassing the tx.origin restriction.

The flashProof modifier does not serve its purpose.

Recommend trying to apply the modifier to individual addresses that interact with the protocol instead of tx.origin.

Furthermore, attacks possible with flash loans are usually also possible for whales, making it debatable if adding flash-loan prevention logic is a good practice.

strictly-scarce (vader) confirmed:

Flash loans with the help of miners was not intended to be countered, although a check for msg.sender AND tx.origin will be applied.

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

The modifier relied on tx.origin instead of tracking individual user addresses, allowing bypass via proxy contracts and multiple EOAs.

Impact

A miner could bypass the flashProof restriction and perform flash-loan attacks within a single block, so the modifier does not prevent such attacks.

What the attacker needed

Miner control of block; proxy contract; multiple EOAs

The fix

The modifier should be applied to individual addresses that interact with the protocol instead of tx.origin.

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 flash loan is a loan that must be borrowed and repaid in the same transaction. The flashProof modifier tried to stop attacks by checking who started the transaction (tx.origin), but an attacker can use a helper contract and different wallets to hide their identity. This means the protection can be bypassed.

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 from Vader Protocol 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.