1. Given a random point n, is n a valid point on the sepc265k1 curve?
- checkSpecp256k1Point
python3 checkSpecp256k1Point.py x y
(should check x,y must in [1,p-1])?python3 GetRandomPoint.py
2. generate an address that starts with 0x0000 GenerateProfanityAddress
-
python3 GenerateProfanityAddress.py
- `private_key 0x3447dbf8b5f32b1dbae7abc969c9ab3da88a54f0c4d719c4c74bbac362102a8e
- eth_addr 0x0000defe1e41e5da8303fedfd9b380664590ac3d`
-
Deployed the contract on-chain FuzzyIdentityChallenge.sol
-
howt to get the contract's identity?
For hacking the authenticate
- one point is the caller should as smart contract supplying one funtion
function name() external pure returns (bytes32) { return bytes32("smarx"); }
, - Another point is the smart contract's address should include
badc0de
no matter its postion in the address.
- one point is the caller should as smart contract supplying one funtion
-
The steps to get the identity.
-
Create the ExploitContract
-
Using create2 to create above contract by selecting a rondom salt to make the smart contract's address inludes
badc0de
-
As create2 creating one contract, there are three params needed, one is the factory contract, one is the created contract's creationCode, one is salt.
- For the facotry contract CreateContract, which will create the ExploitContract contract, deployed address is CreateContract
- As factory contract address, CreateContract's creationCode code known, Calculatingthe possible salt brutely force which make the CreateContract's address includes
badc0de
.
Considering the efficiency, I use the this tool github:styled-evm-address,styled-evm-addres。
- Then using the salt call CreateContract's createDesiredAddress function.
-
Now the ExploitContract was deployed and its address includes
badc0de
, directly call exploit() getting the identity. on-chain-tx
-
- https://0xfoobar.substack.com/p/vanity-addresses
- https://github.com/0age/create2crunch
- The efficient ways to minting the vantiy address
- VanityEth, which use more cpus to generate address and the random seed is based on 2^256.
- create2crunch using rust language
- Spin up a GPU Example instance using vast.ai.
- The private-key can be calculated by the generated vanity-addresses which have some problem. the-profanity-address-hack-how-are-vanity-addresses-generated
python generate_vanity_address_ethereum_problem.py
, the logic generate the vulnerability address.- implement the code to hack the vanity_address which has problem toodo
- when checking point(x,y) # x,y must in the field [1,p-1] todo check ?
- check below
- ECDSA (for Elliptic Curve Digital Signature Algorithm), can sign messages that are greater than P?
- RSA can only sign messages that are smaller than its p?