## attacks via code injection with `DELEGATECALL`
### tl; dr
1. Call to untrusted contracts may introduce unexpected risks and errors. 2. External calls controlled by an attacker may force a contract to transition into an undefined state. 3. Types of external calls: `STATICCALL` and `DELEGATECALL`. 4. Using `DELEGATECALL`, contract can preserve the storage state while using the logic of the contract. This introduces the concept of Proxies. 5. The proxy contract redirects all the calls it receives to an "logic contract", whose address is stored in its "proxy contract". The proxy runs the "logic contract"'s code as its own (modifying its storage and the balance of the "proxy contract").


* bt3gl's diagram:


--- ### cool resources
* **[SWC docs on DELEGATECALL](https://swcregistry.io/docs/SWC-112)** * **[sigma prime post on DELEGATECALL](https://blog.sigmaprime.io/solidity-security.html#delegatecall)** * **[understanding DELEGATECALL, by d. arends](https://www.derekarends.com/solidity-vulnerability-understanding-delegatecall/)**