selfdestruct() will not be available after EIP-4758
Submitted by tnevler, also found by yixxas, pashov, 0xRobocop, 0xbepresent, Ruhum, Chom, 0xDecorativePineapple, lukris02, Soosh, imare, and yellowBirdy
https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/FixedPrice.sol#L110
https://github.com/code-423n4/2022-12-escher/blob/main/src/minters/OpenEdition.sol#L122
Impact
selfdestruct() will not be available after EIP-4758. This EIP will rename the SELFDESTRUCT opcode and replace its functionality. It will no longer destroy code or storage, so, the contract still will be available.
In this case it will break the logic of the project because it will not work as expected:
FixedPrice.sol
- After calling the cancel() function, the contract still will be available. Users will be able to buy a number of NFTs even if the current sale is cancelled.
OpenEdition.sol
- After calling the cancel() function, the contract still will be available. Users will be able to buy a number of NFTs even if the current sale is cancelled.
Proof of Concept
According to EIP-4758:
- The SELFDESTRUCT opcode is renamed to SENDALL, and now only immediately moves all ETH in the account to the target; it no longer destroys code or storage or alters the nonce.
- All refunds related to SELFDESTRUCT are removed.
Recommended Mitigation Steps
The architecture should be changed to avoid that problem.
stevennevins (Escher) disagreed with severity and commented:
If the storage is still intact, then after this point, the start and end time would prevent buys from occurring. But yeah I agree we should move away from selfdestruct all together.
Suggesting Low
berndartmueller (judge) commented:
This finding demonstrates an issue regarding the
EIP-4758, which makes it impossible tocancelan active sale. Thus, I consider Medium severity to be appropriate as the functionality of the protocol is impacted.
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 Escher contest. Code4rena made it public on 22 February 2023. Found in the 2022-12-escher audit contest (finding M-09), also found by 11 other wardens.
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.