-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add datacopy test * modify contract * remove debug log * update testdata * add attack bytecode * update datacopy.json * correct code format * remove printStore() in datacopy.sol * update contract test data Co-authored-by: dustinxie <dahuaxie@gmail.com>
- Loading branch information
Showing
7 changed files
with
259 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
action/protocol/execution/testdata-istanbul/CVE-2021-39137-attack-replay.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"initBalances": [{ | ||
"account": "io1mflp9m6hcgm2qcghchsdqj3z3eccrnekx9p0ms", | ||
"rawBalance": "1000000000000000000000000000" | ||
}], | ||
"deployments": [{ | ||
"rawByteCode": "0000000000000000000000008eae784e072e961f76948a785b62c9a950fb17ae62c9a950fb17ae00000000000000000000000000000000000000000000000000", | ||
"rawPrivateKey": "cfa6ef757dee2e50351620dca002d32b9c090cfda55fb81f37f1d26b273743f1", | ||
"rawAmount": "0", | ||
"rawGasLimit": 5000000, | ||
"rawGasPrice": "0", | ||
"rawExpectedGasConsumed": 16400, | ||
"expectedBalances": [], | ||
"comment": "deploy attack contract(https://etherscan.io/address/0x8eae784e072e961f76948a785b62c9a950fb17ae)" | ||
}], | ||
"executions": [{ | ||
"rawPrivateKey": "cfa6ef757dee2e50351620dca002d32b9c090cfda55fb81f37f1d26b273743f1", | ||
"rawByteCode": "3034526020600760203460045afa602034343e604034f3", | ||
"rawAmount": "0", | ||
"rawGasLimit": 1000000, | ||
"rawGasPrice": "0", | ||
"rawExpectedGasConsumed": 12300, | ||
"comment": "launch attack(https://etherscan.io/tx/0x1cb6fb36633d270edefc04d048145b4298e67b8aa82a9e5ec4aa1435dd770ce4)", | ||
"expectedBlockInfos" : { | ||
"txRootHash" : "a59ead74a3870e9b5ca352c5f59108df402ca203ef2109799fe2d8e1da49c83d", | ||
"stateRootHash" : "ed9bd589ee5ab5660a3d5d863bbeea13020a0aacab18e8655a626beaf9a54713", | ||
"receiptRootHash" : "3285579efa8521fbf95829b868ff5d37632c4feac6167e9ab2dc4961004c9272" | ||
} | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"initBalances": [{ | ||
"account": "io1mflp9m6hcgm2qcghchsdqj3z3eccrnekx9p0ms", | ||
"rawBalance": "1000000000000000000000000000" | ||
}], | ||
"deployments": [{ | ||
"rawByteCode": "608060405234801561001057600080fd5b50610315806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063574c807814610046575b600080fd5b34801561005257600080fd5b5061005b61005d565b005b606060006060600060036040519080825280601f01601f1916602001820160405280156100995781602001602082028038833980820191505090505b50935060117f0100000000000000000000000000000000000000000000000000000000000000028460008151811015156100cf57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060227f01000000000000000000000000000000000000000000000000000000000000000284600181518110151561013257fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060337f01000000000000000000000000000000000000000000000000000000000000000284600281518110151561019557fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508351925060036040519080825280601f01601f1916602001820160405280156101fd5781602001602082028038833980820191505090505b50915082602185018460208701600462010000fa9050826000602084013e6102248261022a565b50505050565b8060009080519060200190610240929190610244565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061028557805160ff19168380011785556102b3565b828001600101855582156102b3579182015b828111156102b2578251825591602001919060010190610297565b5b5090506102c091906102c4565b5090565b6102e691905b808211156102e25760008160009055506001016102ca565b5090565b905600a165627a7a723058208a35fa3071989284284d5ed558296837ad55fae1b176b939e5b493485c4794170029", | ||
"rawPrivateKey": "cfa6ef757dee2e50351620dca002d32b9c090cfda55fb81f37f1d26b273743f1", | ||
"rawAmount": "0", | ||
"rawGasLimit": 5000000, | ||
"rawGasPrice": "0", | ||
"rawExpectedGasConsumed": 250102, | ||
"expectedBalances": [], | ||
"comment": "deploy datacopy contract" | ||
}], | ||
"executions": [{ | ||
"rawPrivateKey": "cfa6ef757dee2e50351620dca002d32b9c090cfda55fb81f37f1d26b273743f1", | ||
"rawByteCode": "574c8078", | ||
"rawAmount": "0", | ||
"rawGasLimit": 1000000, | ||
"rawGasPrice": "0", | ||
"rawExpectedGasConsumed": 32504, | ||
"comment": "the data of return is [0x11, 0x22, 0x33]", | ||
"expectedBlockInfos" : { | ||
"txRootHash" : "3672945ca662bea4dd977e799374c5ce36c0c3e9ecbe98f1655f33439bbfe40c", | ||
"stateRootHash" : "6fb3dc7f5ef66ce9b384f034191d6a67801e01961ecd824061c4101035844667", | ||
"receiptRootHash" : "0dfe7718f029aaffccd9c20bfaa50a1fb3405014de68af4f89516160de53d2f2" | ||
} | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
pragma solidity ^0.8.3; | ||
|
||
contract Datacopy { | ||
bytes store; | ||
function dataCopy() public { | ||
bytes memory arr = new bytes(3); | ||
arr[0] = 0x11; | ||
arr[1] = 0x22; | ||
arr[2] = 0x33; | ||
uint length = arr.length; | ||
bytes memory result = new bytes(3); | ||
bool ret; | ||
assembly { | ||
// Call precompiled contract to copy data | ||
ret := staticcall(0x10000, 0x04, add(arr, 0x20), length, add(arr, 0x21), length) | ||
returndatacopy(add(result, 0x20), 0x00, length) | ||
} | ||
updateStore(result); | ||
} | ||
|
||
function updateStore(bytes memory ret) internal { | ||
store = ret; | ||
} | ||
} |
Oops, something went wrong.