KS note – Telegram
KS note
495 subscribers
61 photos
2 files
71 links
・ Web3 & etc.

🥷⛓️🍷 @MostPow3rful
Download Telegram
6️⃣ #ETHERNAUT #level_6 #Delegation

must solve this challenge using cast and call the challenge contract :
cast send $CHALLENGE_CONTRACT_ADDRESS "pwn()" --rpc-url $RPC_URL --private-key $PRIVATE_KEY

but i wrote the Solidity Code too,

🥷🍷 <Happy Hacking/>
7️⃣ #ETHERNAUT #level_7 #Force

🥷🍷 <Happy Hacking/>
8️⃣ #ETHERNAUT #level_8 #Vault

you can access the private variables using cast :
cast storage $CHALLENGE_CONTRACT_ADDRESS 1 --rpc-url $RPC_URL


🥷🍷 <Happy Hacking/>
9️⃣ #ETHERNAUT #level_9 #King

🥷🍷 <Happy Hacking/>
🔟 #ETHERNAUT #level_10 #Re_entrancy

🥷🍷 <Happy Hacking/>
1️⃣1️⃣ #ETHERNAUT #level_11 #Elevator

🥷🍷 <Happy Hacking/>
🔥1
1️⃣2️⃣ #ETHERNAUT #level_12 #Privacy

you can access the private variables using cast :
cast storage $CHALLENGE_CONTRACT_ADDRESS 5 --rpc-url $RPC_URL


🥷🍷 <Happy Hacking/>
🧩 Function's Correct order

[public/external/internal/private] [view/pure/none] [payable|OPTIONAL] [virtual|OPTIONAL] [override|OPTIONAL] [customModifier|OPTIONAL] [returns|OPTIONAL]
🔎 Decode The `msg.data`

⁉️ Why msg.data[4:] => Because the first 4-byte of data is function signature

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

contract Decode {
function run(
string memory _i1,
address _i2,
uint256 _i3,
bool _i4
) public pure returns (
string memory,
address,
uint256,
bool
) {
return abi.decode(
msg.data[4:],
(string,address,uint256,bool)
);
}
}
📖 Mastering Ethereum Book - Online

https://cypherpunks-core.github.io/ethereumbook/
started with solidity, played CTF/Challenge(s) such as HTB & Ethernaut (playing until death 🫡), Learned many things and at this point, i want to start Auditing on the past CodeHawks's First Flights 🦅✈️ and i want to write report at the specified time, then want to check other auditor's submission and compare with myself. hope to learn many things 🥷

🍷 Enjoy The Road
🦅✈️ First Flight 1️⃣
https://www.codehawks.com/contests/clnuo221v0001l50aomgo4nyn


🔴 [HIGH-0] user can access the value of s_password and s_owner variables beacuse of the storage layout. we can get the value and decode them.
cast storage $CONTRACT_ADDRESS 0 # s_owner
cast storage $CONTRACT_ADDRESS 1 # s_password

🔴 [HIGH-1] there is not any limit on setPassword() function. user can access the setPassword() function without any limit and can change the value of s_password;


⚪️ [INFO-0] should declare errors out of the contract ( make them global )
⚪️ [INFO-1] should change the name of errors.


🍷 Learned :
1️⃣ sensitive variables mustn't have the default value during deploying. deployer must pass the value to constructor and set the new value there.
📜 About Remappings in foundry ( something like alias )

🔗 https://book.getfoundry.sh/projects/dependencies#remapping-dependencies