Hiding Malicious Code in Smartcontract Solidity
Intro
What is solidity? Solidity is an object-oriented, high-level language for implementing smart contracts. Smartcontracts are programs which govern the behaviour of accounts within the Ethereum state.
Why did we need to hide our malicious code? this is because anyone can see your smartcontract source code by using etherscan including your malicious code, Since everyone can see your code, so you have to hide your malicious code to prevent someone read your malicious code.
Demo
for this demonstration, I will make a simple smartcontract script below
Token.sol
Now our goal is to change info.print()
function to do evil stuff, then I create another smartcontract file
Mal.sol
in this Post I will just log the evil code
string which will be executed by Token
smartcontract. now we can compile
our smartcontract and passing our Mal
smartcontract address to Token
smartcontract.
now we can just click infoVersion()
function and these function will execute log.print()
function from Mal
smartcontract