## 2 Related Works
### The Vulnerabilities of Smart Contracts  
Integer Overflow and Underflow: The Ethereum Virtual Machine (EVM), which is run by the Ethereum network and serves as the main purpose of the protocol, contains a stack that can hold 1024 slots. Each time a function is called, a slot is used up. This can cause all the slots to be used up, depending on the number of functions called, resulting in a stack overflow that could cause problems [25]. The EVM is not the only place in which an integer overflow/underflow occurs. If an arithmetic operation goes outside the range of a data type in Solidity, it can cause the manipulation of a variable. This is due to Solidity not providing data validation on these operations, and neither EVM nor Solidity itself providing any detection for this [4]. An example of this attack can be found when examining the smart contract of BEC, which was an Ethereum ERC20 token that wasvulnerable due to CVE-2018-10299. This allowed an attacker to increase the amount of the token they earned by exploiting an integer overflow issue [26]. The solution to this issue is for developers to include the SafeMath library, which was created to handle this problem as it wraps over Solidity operations to add overflow checks [27].  
The re-entrancy vulnerability allows an attacker to change the state of a contract after a call is completed, which can result in cryptocurrency being stolen depending on the type of transaction being made [9]. The vulnerability is caused by an attacker being able to \"re-enter\" a caller function due to a contract relying on variables that do not update without first calling another contract [4]. An example of this attack is the DAO attack, which was exploited by the attacker creating a smart contract that included a call to the DAO's withdraw function, which then called back, repeating the malicious contract's withdrawal function repeatedly until all the Ethereum was taken from the original smart contract. The DAO attack resulted in an attacker stealing USD 60 million, showing that this is a significant vulnerability [9]. According to [4], this vulnerability can be prevented by either using a mutex lock on a contract so that only the owner of a smart contract can change the state of it, or by using the transfer method of sending money to other contracts.  
Malicious Contracts: A significant problem within the smart contract ecosystem is that malicious actors often create smart contracts with malicious intent. According to Chainalysis, a company that provides intelligence and risk management tools for the blockchain, one in four new tokens of any value is a scam [28]. Many techniques are used by attackers and are investigated in the primary research of this paper; however, researching the literature has led to information about some forms of malicious smart contracts. Some examples of these include tokens that contain a high buy or sell fee and, in some instances, allow the owner of a contract to mint more coins and sell them [29].  
Phishing Attacks are prevalent in the context of blockchains and often target online wallets, with attackers attempting to acquire private keys [30], or in the case of smart contracts, they look for individuals to interact with a malicious contract [31]. One common example of phishing attacks for smart contracts is websites that run a setApprovalForAll function, which allows the malicious actor running the site to steal funds from the wallet [31]. Another example of phishing attacks involving smart contracts is a large OpenSea phishing attack. This attack takes advantage of a recent upcoming migration of listings on their marketplace, as attackers directed their phishing email as an urgent request to migrate their listings quickly, or they would expire [32]. This leads to users who interact with the phishing site effectively giving the attacker a blank cheque to take any tokens they wanted, resulting in an estimated loss of USD 1.7 million [33].