# MSmart: Smart Contract Vulnerability Analysis and Improved Strategies Based on Smartcheck
## 5 Experiment
### MSmart vs. Smartcheck on Large Data Sets  
As of August 2022, the source codes of 6000 contracts downloaded from Etherscan were filtered and verified [38], and MSmart runs on this data set. MSmart has lowered the number of false negatives and false positives when compared to the outcomes of Smartcheck. Table 2 displays the data after the same outcomes were eliminated:  
From Table 2, we can find that:  
(1) Integer overflow vulnerability: Smartcheck did not protect against this vulnerability, and MSmart reported 2115 vulnerabilities. A total of 72% of the integer overflow vulnerabilities were discovered to be true positives after manual verification. Because the protection against integer overflows is building a function, it is difficult to implement unified protection because the function name is not fixed. This is the main reason why contracts reporting integer overflow vulnerabilities greater than 4 frequently reported false positives.  
(2) Timestamp dependence: Smartcheck reported 44 vulnerabilities, and MSmart reported 1175 vulnerabilities. A total of 80% of the timestamp dependence vulnerabilities were discovered to be true positives after manual verification. It is risky to use the block timestamp as a pseudo-random number, if it is used as a trigger condition to carry out certain significant operations, even if it is altered, the result will not be affected, and MSmart still identifies it as a vulnerability.  
It is mentioned in Section 4.2 when miners can obtain results in their favor by freely manipulating the block timestamps. Therefore, there is a high risk of timestamp-dependent vulnerabilities. In the timestamp-dependent vulnerability detection, MSmart detected 1175 vulnerabilities in total, and Smartcheck detected only 44 vulnerabilities. For the relatively large difference between the results of the two tools, we randomly selected six contracts from the vulnerability detection reports for validation, and the final validation results are shown in Table 3.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Smart Contract Vulnerability** & **Number of Smartcheck** & **Smart Contract Vulnerability** & **Number of MSmart** \\
**Categories** & **Vulnerability Analysis** & **Categories** & **Vulnerability Analysis** \\ \hline integer overflow & 0 & integer overflow & 2115 \\ timestamp dependence & 44 & timestamp dependence & 1175 \\ DOS & 0 & DOS & 1102 \\ self-destruct & 330 & self-destruct & 154 \\ delegatecall & 0 & delegatecall & 7 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Comparison of MSmart and Smartcheck on large data sets.  
(3) DOS: SmartCheck did not protect against this vulnerability and MSmart reported 1102 vulnerabilities. Analysis of this issue is more challenging since MSmart is a static smart contract analysis tool. As a result, there are some false positives in detecting this vulnerability. MSmart will notify users if a smart contract has this vulnerability.  
(4) Self-destruct: Smartcheck reported 330 vulnerabilities, and MSmart reported 154 vulnerabilities. In the manual verification of detected self-destruct vulnerabilities, it was discovered that this vulnerability had a low false positive rate. The self-destruct vulnerability's fixed format is the primary cause. MSmart is thus more effective at guarding against this vulnerability.  
(5) Delegatecall: SmartCheck did not protect against this vulnerability and MSmart reported seven vulnerabilities. These seven vulnerabilities are false positives, but if the situation changes, they become real vulnerabilities.  
It is clear from the data above that MSmart can effectively analyze timestamp and integer overflow vulnerabilities. Due to the high mistake frequency of timestamp dependencevulnerabilities and integer overflow vulnerabilities, this enhancement may provide more effective protection. MSmart can also analyze DOS and delegatedcall vulnerabilities. If any of these vulnerabilities emerge, they may be reported. As a result, MSmart's vulnerability protection is more effective than Smartcheck's.