At around 20:50 Beijing time on August 27, 2021 (block height 13107518), Ethereum suddenly forked. We analyzed the code version modification of Geth and the transaction that caused the fork (0x1cb6fb36633d270edefc04d048145b4298e67b8aa82a9e5ec4aa1435dd770ce4) to clarify the root cause of the Ethereum fork: the old version of Geth did not consider the processing of parameter values under special circumstances (corner case) when processing precompiled contract calls, which caused overlapping copies and abnormal return values. The vulnerability (CVE-2021-39137) has been submitted to Geth officials. The details have not been disclosed yet, but the attacker has already exploited the vulnerability to carry out the attack. We believe that timely analysis and disclosure are necessary, and we hope that our analysis can provide the community with the necessary understanding and help. Attack AnalysisUsing our online analysis tool, we can see that: Figure 1 This transaction executed a carefully constructed STATICCALL. The attacker set addr to 0x04 (precompiled contract dataCopy), inOffset to 0, inSize to 32, retOffset to 7, and retSize to 32. Figure 2 Since the target address of STATICCALL is a precompiled contract, RunPrecompiledContract in Figure 2 will be executed. Figure 3 Figure 4 According to the code in Figures 3 and 4, we can see that the actual logic executed by the precompiled contract 0x04 is simply to return in (pointer). Figure 5 Figure 6 Figure 5 shows the execution process of STATICCALL. Line 753 is the entry point for executing the precompiled contract. Line 751’s args points to the pointer of the inOffset ~ inOffset + inSize area in the EVM’s Memory, which means that args points to Mem[0:32]. According to Figure 6 and the previous analysis of precompiled contract 0x04 (dataCopy), we can know that the return value ret of line 753 is exactly the same pointer as args, and also points to Mem[0:32].
SummarizeThrough the analysis of the entire attack process and the Geth source code, we believe that the root cause is that the old version of Geth did not consider the handling of abnormal values when processing the call of the precompiled contract, which led to the attacker using the vulnerability to implement overlapping copies, affecting the return value and eventually leading to the fork. Since Geth is the basis of public chains such as BSC, HECO, and Polygon, the impact of this vulnerability is very wide. At present, various public chains have also launched upgrades and patches. We also call on all relevant nodes to upgrade and patch as soon as possible to ensure the security of the infrastructure. |
<<: VeryHash August 4th Week Mining Machine Market Release
>>: Malaysian police crush thousands of Bitcoin mining machines to crack down on electricity theft
(To provide you with exclusive, objective and in-...
A good man is the standard for people to choose a...
Each of us should have our own goals and ideals, ...
1. Personality analysis: In physiognomy, men with...
The distribution of each person's facial feat...
He has a rebellious streak in his hands, never ac...
Some people vividly compare the BCH fork to a bat...
The weather is changeable. It may be sunny one se...
Forehead wrinkles are a very common type of wrink...
In less than a year, Bitcoin has increased 95 tim...
What does a mole on the chest mean? Does having a...
1. Brow bone In physiognomy, if a man has a relat...
In certain historical periods, there will be many...
How can you tell whether a woman is a good woman ...
With the strengthening of spiritual civilization ...