Post

Log Analysis — Privilege Escalation — Blue Team Labs Online writeup

Welcome back !

I investigated what a system happened and how attacker gained root access by viewing and analyzing through a bash_history file from a challenge among challenges of blue team labs online (BTLO).

Bash_history is simply the shell’s memory of the commands a user typed before, which helps with reviewing activity, repeating commands, and sometimes investigating what someone did on the system.

Let’s head to the questions.

What user (other than ‘root’) is present on the server? (2 points)

I opened bash_history file in sublime text. Here, you can use any text editor. After attacker gained normal remote access to my machine, he checked which user exists.

Screenshot 1

What script did the attacker try to download to the server? (2 points)

Normally, when attacker have gained normal remote access, it doesn’t mean that the tool which attacker wanted is already in machine. So attacker needed to download various tools through using commands according to accessed machine. Here, he did “wget” command (since linux machine) to download additional tool or script that might help him.

Screenshot 2

What packet analyzer tool did the attacker try to use? (2 points)

Ok, for this question, I searched up and down for packet analyzer tool. There it is !

Screenshot 3

What file extension did the attacker use to bypass the file upload filter implemented by the developer? (2 points)

Ok, I focused on file extension.

Screenshot 4

Normally, we use ‘.php’ extension for php files. It says “.phtml”.

Based on the commands run by the attacker before removing the php shell, what misconfiguration was exploited in the ‘python’ binary to gain root-level access? 1- Reverse Shell ; 2- File Upload ; 3- File Write ; 4- SUID ; 5- Library load (2 points)

To get root-level access, you have to do one of three things:

  1. Misconfiguration
  2. SUID Abuse
  3. Check pwned OS version and search for any CVE with that

I have to choose one option for answer and checked given bash_history file.

Screenshot 5

There, attacker used “sudo -l” to identify potential paths for privilege escalation.

I hope you will be satisfied with my solution. Thank you for your time !Happy Hacking.

Disclaimer: In this article, I described some of approaches attacker used to pwn the machine. It’s strictly for educational purpose.

This post is licensed under CC BY 4.0 by the author.