Skip to content
Business logic Audit finding Intermediate

Migration.join() and Migration.leave() can still work after unsucessful migration.

hansfriese Follow

Originally disclosed on Code4rena

Submitted by hansfriese, also found by 0x52 and codexploder

https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L105

https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L141

Impact

Migration.join() and Migration.leave() can still work after unsucessful migration. As I submitted with my high-risk finding “Migration.withdrawContribution() might work unexpectedly after unsuccessful migration.”, withdraw logic after unsuccessful migration is different from the initial leave() logic and the withdrawal logic would be messy if users call join() and leave() after unsuccessful migration.

Proof of Concept

According to the explanation, join() and leave() functions must be called for 7 days before commition.

Currently, such a scenario is possible.

  • Alice creates a new migration and commits after some joins.
  • The migration ended unsuccessfully after 4 days.
  • Then users can call leave() or withdrawContribution() to withdraw their deposits but it wouldn’t work properly because we should recalculate eth/fractional amounts with returned amounts after unsuccessful migration.

Tools Used

Solidity Visual Developer of VSCode

Recommended Mitigation Steps

We should add some restrictions to join() and leave() functions so that users can call these functions for 7 days before the migration is committed.

We should add these conditions to join() and leave().

require(!migrationInfo[_vault][_proposalId].isCommited, "committed already");
require(block.timestamp <= proposal.startTime + PROPOSAL_PERIOD, "proposal over");

Ferret-san (Fractional) confirmed


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

What is known

A medium-severity business logic bug in Fractional v2 contest. Code4rena made it public on 27 September 2022. Found in the 2022-07-fractional audit contest (finding M-08).

About Business logic

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

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

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 hansfriese

View all

65 more disclosed reports, best first.

More from Fractional v2 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.