31.md

September 28, 2022 ยท View on GitHub

Hiding Malicious Code with External Contract

Description:

In Solidity any address can be casted into specific contract, even if the contract at the address is not the one being casted. This can be exploited to hide malicious code.

Remediation:

  1. Initialize a new contract inside the constructor
  2. Make the address of external contract public so that the code of the external contract can be reviewed

References:

https://solidity-by-example.org/hacks/hiding-malicious-code-with-external-contract/