Skip to content

Pre release fix flash attacks#81

Merged
Joeysantoro merged 1 commit intoReleasefrom
Pre-Release-Fix-Flash-Attacks
Feb 25, 2021
Merged

Pre release fix flash attacks#81
Joeysantoro merged 1 commit intoReleasefrom
Pre-Release-Fix-Flash-Attacks

Conversation

@Joeysantoro
Copy link
Contributor

It is possible to execute a flash loan and profit via the following trade:

  1. Flash borrow ETH
  2. Buy on spot market
  3. Buy on bonding curve and execute bonding curve allocation
  4. Sell FEI from 2 and 3
  5. Profit

The end result is the spot price of FEI/ETH is lower than at the beginning, essentially arbing by spiking the price of FEI since it uses the spot price when depositing. The solution has 2 parts:

  1. deposit at oracle price not spot price
  2. Restrict allocate() and other potentially risky flows to EOA only

Spreadsheet detailing attack https://docs.google.com/spreadsheets/d/1PU51ptA8_xxCEJjWqMbobmNZqX5VBToAAwHm3mmDpk8/edit#gid=0

@Joeysantoro Joeysantoro changed the base branch from Release to master February 25, 2021 19:46
@Joeysantoro Joeysantoro changed the base branch from master to Release February 25, 2021 19:46
@Joeysantoro Joeysantoro force-pushed the Pre-Release-Fix-Flash-Attacks branch from aa282bc to f10a43d Compare February 25, 2021 19:48
@Joeysantoro Joeysantoro added the OZ Fix New A PR dedicated to fix an OpenZeppelin issue label Feb 25, 2021
@Joeysantoro Joeysantoro merged commit 5fe848c into Release Feb 25, 2021
@ytrezq
Copy link

ytrezq commented Apr 3, 2021

@Joeysantoro which is the time period used by the Orcale as a result? How does the fix, prevent a big whale using his own funds for doing this?

Joeysantoro added a commit that referenced this pull request Aug 2, 2021
@xklob xklob deleted the Pre-Release-Fix-Flash-Attacks branch September 19, 2021 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OZ Fix New A PR dedicated to fix an OpenZeppelin issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments