# Emptied target still trusted

Calls to destroyed or unset contracts succeed and trap value or skip auth

_Area: Smart contract access control and control flow. Seen in 2 disclosed reports; latest 2023-02-22. Updated 2026-11-17._

## How it works
Code assumes that a call to a contract address either reaches live logic or reverts. Two assumptions break. First, the EVM does not check `extcodesize` on top-level calls: after `selfdestruct`, calls to the empty address still succeed, accept `msg.value`, and do nothing. Second, a mapping lookup for an unregistered key returns a default-zero struct, so a branch keyed on that value silently takes the wrong path instead of failing. In both cases the caller's value or authorization is consumed by code that no longer exists or was never configured.

## Where it shows up
- `selfdestruct` used to end a sale, auction, or lifecycle, especially with payable entry points still open [E1](https://bugbountylibrary.com/r/c4%3A2022-12-escher%3AH-01.md)
- Payable functions with no check that the target has code or is still active [E1](https://bugbountylibrary.com/r/c4%3A2022-12-escher%3AH-01.md)
- Functions branching on a config flag to decode different tuple shapes [E2](https://bugbountylibrary.com/r/sherlock%3A2023-09-Gitcoin%3AM-5.md)
- Downstream variables used without being assigned in every branch [E2](https://bugbountylibrary.com/r/sherlock%3A2023-09-Gitcoin%3AM-5.md)
- Mapping lookups (`settings[x]`, `claimFunction`, `ownerSplit`) used without verifying the key was registered [E3](https://bugbountylibrary.com/r/c4%3A2022-11-debtdao%3AH-02.md)
- Default-zero struct fields feeding arithmetic or routing decisions [E3](https://bugbountylibrary.com/r/c4%3A2022-11-debtdao%3AH-02.md)

## How to review
For each external call, ask: what guarantees the callee has code and is live? The invariant: any path that moves value or grants authority must fail closed when the target is empty, unregistered, or misconfigured. Check that (a) payable entry points verify the recipient is active, not just non-zero; (b) every variable read after a branch is assigned in all branches; (c) mapping reads are preceded by an explicit registration/existence check, and default-zero values cannot select a privileged or fund-routing path.

## How finders spotted it
- Read the sale-ending logic, saw `selfdestruct` in `_end()`, and reasoned about pending `buy()` calls after code removal; confirmed on Goerli via Remix that a second call to a destroyed contract succeeds and keeps value [E1](https://bugbountylibrary.com/r/c4%3A2022-12-escher%3AH-01.md)
- Compared the two decode branches in `_registerRecipient` and noticed the `useRegistryAnchor=true` branch never sets `recipientAddress`; confirmed with a Foundry test [E2](https://bugbountylibrary.com/r/sherlock%3A2023-09-Gitcoin%3AM-5.md)
- Read `_claimRevenue`, saw the push-payment branch keyed on `claimFunction==0` and `ownerSplit` read from settings with no registration check, and inferred default-zero settings misroute funds [E3](https://bugbountylibrary.com/r/c4%3A2022-11-debtdao%3AH-02.md)

## Variants seen
- Destroyed minter still accepts ETH and locks it [E1](https://bugbountylibrary.com/r/c4%3A2022-12-escher%3AH-01.md)
- Config-flag branch leaves a variable zero, reverting all registrations and trapping pool funds [E2](https://bugbountylibrary.com/r/sherlock%3A2023-09-Gitcoin%3AM-5.md)
- Unregistered key defaults to zero split, routing all revenue to treasury and starving escrow [E3](https://bugbountylibrary.com/r/c4%3A2022-11-debtdao%3AH-02.md)

## Impact and severity
Permanent loss of user funds (ETH locked in a dead address) [E1](https://bugbountylibrary.com/r/c4%3A2022-12-escher%3AH-01.md); complete denial of registration trapping pool funds [E2](https://bugbountylibrary.com/r/sherlock%3A2023-09-Gitcoin%3AM-5.md); full misrouting of claimed revenue away from lenders [E3](https://bugbountylibrary.com/r/c4%3A2022-11-debtdao%3AH-02.md). Severity is raised because the failure is silent: calls succeed, so neither caller nor protocol notices until funds are gone.

## Evidence
- E1: https://bugbountylibrary.com/r/c4%3A2022-12-escher%3AH-01.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2023-09-Gitcoin%3AM-5.md
- E3: https://bugbountylibrary.com/r/c4%3A2022-11-debtdao%3AH-02.md
