Wednesday, July 31, 2019



- Layout for this exercise:


- The goal for this exercise is to develop a hacking process for the vulnerable machine SecNotes from the Hack The Box pentesting platform:


- SecNotes' IP is

- Scanning with Nmap:

- Browsing the web server on port 80:

- Registering a new user whitelist:

- Login as the new user whitelist:

- Secure Notes is a notepad application that stores notes and to-do list with secure password protection using AES encryption and providing quick and easy access using a simple password:

- The email tyler@secnotes.htb informs about two details:

  • user named tyler
  • domain secnotes.htb

- Also, it is interesting the .php extension at the login page, revealing PHP is run by the server.

- Confirming the existence of user tyler with a random password:

- Browsing the other web server at port 8808:

- Viewing the source we find the image iisstart.png:


3.1 - SQL injection

- "Second order" SQL injection attack delays execution until a secondary query, by injecting a query fragment into a query (that’s not necessarily vulnerable to injection), and then have that injected SQL execute in a second query that is vulnerable to SQL injection.

- Using wfuzz to help us finding a valid SQL injection:


- From the proposed queries the last one ' or 1=1 or ''=' seems easy to apply:

- Entering ' or 1=1 or ''=' as a new user and password, and later login with those credentials:

- Now the home page yields credentials for user tyler at the 3rd note named new site:

3.2 - Exploiting SMB

- Using credentials tyler:92g!mA8BGjOirkL%OG*& to access SMB service on port 445:

- Connecting and listing new-site:

- So we confirm that there is a web service at port 8808 where folder new-site contains the image iisstart.png.

3.3 - Getting a remote shell

- First of all let's download to Kali the Windows Netcat application:

- Also let's create exploit.php, a PHP exploit which goal is to spawn a remote shell  with a Netcat connection:

- Transferring nc.exe and exploit.php from Kali to SecNotes:

- The transfer of both files is successful:

- Setting a Netcat listening on port 5555:

- Running exploit.php directly on the browser:

- A remote shell is successfully spawned:


- Reading user.txt:


- Access to Administrator's account is denied, as expected, so we need Privilege Escalation:

- Checking user tyler's Desktop there is a file bash.lnk:

- Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10 and Windows Server 2019.

- Reading bash.lnk the path C:\Windows\System32\bash.exe seems to be interesting:

- However the clue is false because there is no bash.exe at C:\Windows\System32:

- Let's find real location for bash.exe:

- Running bash.exe we get a root shell for the Windows Subsystem for Linux (WSL):

- Improving the shell:

- Checking content of root  home folder there is the hidden file .bash_history:

- Reading .bash_history credentials for Administrator are available:

- Making use of credentials administrator%u6!4ZwgwOM#^OBf#Nwnh there are two ways of accessing the Administrator's account:

5.1 - Smbclient

- Connecting with the SMB service:

5.2 -

- The Impacket Python script helps to get a remote root shell, just by providing credentials for Administrator:


- So we have two options to read root.txt:

- First, transferring root.txt from SecNotes to Kali and reading it locally:

- Second, reading it from the remote root shell: 

Tuesday, July 30, 2019



- Layout for this exercise:


- The goal for this exercise is to develop a hacking process for the vulnerable machine Jeeves from the Hack The Box pentesting platform:


- Jeeves's IP is

- Scanning with Nmap:

- Connecting to the web server on port 80:

- Connecting to the web server on port 50000:

- Applying dirbuster to both web servers we find the folder askjeeves on port 50000:

- Browsing /askjeeves we find a Jenkins server.

- Jenkins is an open source automation server which enables developers around the world to reliably build, test, and deploy their software:

- Going to Manage Jenkins:

- Checking the Script Console there is available a Groovy Script that allows to write and run code on the server:


3.1 - Getting a remote reverse shell

- The Apache Groovy language is a Java-syntax-compatible object-oriented programming language that can be used as both a programming and scripting language for the Java Platform:

- There are multiple available scripts for getting a reverse shell, for instance this one:

- Just setting a Netcat listener session, adapting the script to our needs and running it:

- The consequence is a remote reverse shell:

- The user is kohsuke:

- However it seems that we cannot get out of the current folder due to lack of enough administrative privileges:

3.2 - Meterpreter session with web_delivery

- Let's create a web_delivery exploit on Kali with the purpose of getting a Meterpreter session:

- Setting all options and running the web_delivery exploit a Powershell script is created:

- Now, the Powershell script must be run on the remote reverse shell from Jeeves:

- As a consequence a Meterpreter session is opened:

- Getting information about the current folder, user and the system:


- RottenPotato is a local privilege escalation binary from service account to System:

- Downloading rottenpotato.exe to Kali:

- Getting as many system privilege as possible with getprivs:

- Uploading rottenpotato.exe to Jeeves:

- Loading the incognito extension:

- Executing rottenpotato.exe:

- Impersonating as System:

- Now we've got System privileges:

- Spawning a shell:


- Reading user.txt:


- Going to the Administrator's Desktop we find hm.txt:

Alternate Data Stream (ADS) is the ability of an NTFS file system (the main file system format in Windows) to store different streams of data, in addition to the default stream which is normally used for a file.

- The two stream types that are commonly used directly by Windows programs are data ($DATA) and index ($INDEX_ALLOCATION).

- The relevant attribute for our scope is the $DATA attribute, which is used to store the data streams of a file.

- In the past, it was common to store a malicious payload within an ADS of a legitimate file. But today, many today security solutions will detect and scan ADSs’.

- For further information:

-  The option dir /R calls FindFirstStreamW and FindNextStreamW on each file or directory in a listing in order to list its $DATA streams: