# auth collision possible

AccessControl.sol used 4-byte function selectors as role IDs, so a module function with selector 0x00000000 collided with ROOT and granted full project authorization.

- Payout: Audit contest
- Severity: high
- Program: Yield
- Disclosed: 2021-07-23
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2021-05-yield-findings/issues/5
- Library page: https://bugbountylibrary.com/r/c4%3A2021-05-yield%3AH-02
- Tags: area:web3 domain:web3 impact:privesc kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:auth-bypass

**Target:** Solidity AccessControl.sol role/auth mechanism with _moduleCall module extension
**Root cause:** Roles are defined by 4-byte function selectors (msg.sig), and ROOT is the zero selector; a module function whose selector is 0x00000000 collides with ROOT, so authorizing that innocent function grants root authorization.
**Steps:**
1. Attacker proposes/gets added a new module via `_moduleCall` containing an innocent-looking function `left_branch_block(uint32)` whose selector is `0x00000000`.
2. Attacker obtains authorization for that innocent function.
3. Because the selector equals ROOT, the attacker now holds root authorization for the entire project.
4. Function names for any 4-byte signature can be brute-forced to force a collision.
**How found:** Observed that AccessControl.sol uses `msg.sig` (4-byte selector) as the unique role definition and that `_moduleCall` lets code be extended; reasoned that a module function with selector 0x00000000 equals ROOT, and noted selectors are only 4 bytes so names can be brute-forced.
**Exploitation:** Requires the malicious module to pass governance/review and the attacker to be granted auth on the colliding function; once granted, the zero-selector role equals ROOT, giving control over all auth-gated functions of the Ladle.
**Escalation:** Single colliding selector escalates a narrow per-function grant to project-wide ROOT authorization.
**Insight:** When a protocol keys permissions on 4-byte selectors, check whether the zero selector (or any privileged selector) can be produced by an attacker-chosen function name in an extensible module; 4-byte preimage brute force is cheap.

