All Projects → forrest-orr → DoubleStar

forrest-orr / DoubleStar

Licence: GPL-3.0 license
A personalized/enhanced re-creation of the Darkhotel "Double Star" APT exploit chain with a focus on Windows 8.1 and mixed with some of my own techniques

Programming Languages

javascript
184084 projects - #8 most used programming language
c
50402 projects - #5 most used programming language
assembly
5116 projects

Projects that are alternatives of or similar to DoubleStar

Exploits
A personal collection of Windows CVE I have turned in to exploit source, as well as a collection of payloads I've written to be used in conjunction with these exploits.
Stars: ✭ 75 (-46.43%)
Mutual labels:  exploit, wpad, cve-2020-0674, cve-2019-17026
dePAC
seamless Proxy Auto-Config (a.k.a. Web Proxy Auto Discovery) for CLI apps
Stars: ✭ 26 (-81.43%)
Mutual labels:  pac, wpad
Exploit-Development
Exploit Development - Weaponized Exploit and Proof of Concepts (PoC)
Stars: ✭ 84 (-40%)
Mutual labels:  exploit, eop
Poc
Proofs-of-concept
Stars: ✭ 467 (+233.57%)
Mutual labels:  exploit, rpc
Workflow
一个工作流平台
Stars: ✭ 1,888 (+1248.57%)
Mutual labels:  chain, star
K8tools
K8工具合集(内网渗透/提权工具/远程溢出/漏洞利用/扫描工具/密码破解/免杀工具/Exploit/APT/0day/Shellcode/Payload/priviledge/BypassUAC/OverFlow/WebShell/PenTest) Web GetShell Exploit(Struts2/Zimbra/Weblogic/Tomcat/Apache/Jboss/DotNetNuke/zabbix)
Stars: ✭ 4,173 (+2880.71%)
Mutual labels:  apt, exploit
exploits
Some of my public exploits
Stars: ✭ 50 (-64.29%)
Mutual labels:  exploit
adorad
Fast, Expressive, & High-Performance Programming Language for those who dare
Stars: ✭ 54 (-61.43%)
Mutual labels:  jit
py-cryptonight
Python Cryptonight binding / extension. Monero hash function, proof-of-work, cn_slow_hash()
Stars: ✭ 20 (-85.71%)
Mutual labels:  jit
arriba
Fast and accurate gene fusion detection from RNA-Seq data
Stars: ✭ 162 (+15.71%)
Mutual labels:  star
monero-java
A Java library for using Monero
Stars: ✭ 76 (-45.71%)
Mutual labels:  rpc
cirrina
cirrina is an opinionated asynchronous web framework based on aiohttp
Stars: ✭ 32 (-77.14%)
Mutual labels:  rpc
exynos-usbdl
Unsigned code loader for Exynos BootROM
Stars: ✭ 57 (-59.29%)
Mutual labels:  exploit
exploit-CVE-2016-6515
OpenSSH remote DOS exploit and vulnerable container
Stars: ✭ 53 (-62.14%)
Mutual labels:  exploit
LogServiceCrash
POC code to crash Windows Event Logger Service
Stars: ✭ 23 (-83.57%)
Mutual labels:  exploit
vstar
⭐ A simple web app to count a GitHub user's total stars
Stars: ✭ 22 (-84.29%)
Mutual labels:  star
elm-protobuf
protobuf plugin for elm
Stars: ✭ 93 (-33.57%)
Mutual labels:  rpc
blockchain-in-node
This is an afternoon-project, a blockchain built in node, supporting PoW.
Stars: ✭ 20 (-85.71%)
Mutual labels:  chain
IterTools.jl
Common functional iterator patterns
Stars: ✭ 124 (-11.43%)
Mutual labels:  chain
xmlrpcwsc-dotnet
XML-RPC Web Service Client C# implementation
Stars: ✭ 30 (-78.57%)
Mutual labels:  rpc
________                 ___.    .__                 _________  __
\______ \    ____   __ __\_ |__  |  |    ____       /   _____/_/  |_ _____  _______
 |    |  \  /  _ \ |  |  \| __ \ |  |  _/ __ \      \_____  \ \   __\\__  \ \_  __ \
 |    `   \(  <_> )|  |  /| \_\ \|  |__\  ___/      /        \ |  |   / __ \_|  | \/
/_______  / \____/ |____/ |___  /|____/ \___  >    /_______  / |__|  (____  /|__|
        \/                    \/            \/             \/             \/
Windows 8.1 IE/Firefox RCE -> Sandbox Escape -> SYSTEM EoP Exploit Chain

                            ______________
                            | Remote PAC | 
                            |____________|  
                                   ^
                                   | HTTPS
_______________  RPC/ALPC   _______________   RPC/ALPC   _______________
| firefox.exe | ----------> | svchost.exe | -----------> | spoolsv.exe |
|_____________|             |_____________| <----------- |_____________|
                                   |          RPC/Pipe
                                   |
               _______________     | 
               | malware.exe | <---| Execute impersonating NT AUTHORY\SYSTEM
               |_____________|

~

Usage

To run this exploit chain, download the full release/folder structure to an
unpatched Windows 8.1 x64 machine and load either of these two .html files
while connected to the internet:
- CVE-2019-17026\Forrest_Orr_CVE-2019-17026_64-bit.html - via Firefox v65-69
  64-bit.
- CVE-2020-0674\Forrest_Orr_CVE-2020-0674_64-bit.html - via Internet Explorer
  11 64-bit (Enhanced Protected Mode enabled).
  
The initial RCE may be run through either IE or FF, and will result in the
execution of a cmd.exe process to your user session with NT AUTHORY\SYSTEM
privileges.

The individual exploits have been successfully tested in the following context:
- CVE-2020-0674 - IE8 64-bit and WPAD on Windows 7 x64, IE11 64-bit and WPAD
  on Windows 8.1 x64.
- CVE-2019-17026 - Firefox 65-69 (64-bit) on Windows 7, 8.1 and 10 x64.

Note that while the individual exploits themselves may work on multiple
versions of Windows, the full chain will only work on Windows 8.1.

~

Overview

While this exploit chain makes use of two (now patched) 0day exploits, it also
contains a sandbox escape and EoP technique which are still as of 5/4/2021 not
patched, and remain feasible for integration into future attacka chains today.

The Darkhotel APT group (believed to originate from South Korea) launched a
campaign againt Chinese and Japanese business executives and government officials
through a combination of spear phishing and hacking of luxury hotel networks in
early 2020. The exploits they used (CVE-2020-0674 and CVE-2019-17026, together
dubbed "Double Star") were slight 0day variations of old/existing exploits from
2019: specifically UAF bugs in the legacy JavaScript engine (jscript.dll) and
aliasing bugs in the Firefox IonMonkey engine.

What made the use of these 0day interesting went beyond their ability to achieve
RCE through the Internet Explorer and Firefox web browsers: CVE-2020-0674 in 
particular (a UAF in the legacy jscript.dll engine) is exploitable in any process
in which legacy JS code can be executed via jscript.dll. In late 2017, Google
Project Zero released a blog post entitled "aPAColypse now: Exploiting Windows 10
in a Local Network with WPAD/PAC and JScript" [1].

This research brought to light a very interesting attack vector which (at the
time) affected all versions of Windows from 7 onward: the WPAD service (or
"WinHTTP Web Proxy Auto-Discovery Service") contains an ancient functionality
for updating proxy configurations via a "PAC" file. Any user which can speak
to the WPAD service (running within an svchost.exe process as LOCAL SERVICE) over
RPC can coerce it into downloading a PAC file from a remote URL containing JS
code which is responsible for setting the correct proxy configuration for a user
supplied URL. Most notably, the legacy jscript.dll engine is used to parse these
PAC files. This opened up an attack vector wherein any process (regardless of
limited user privileges or even sandboxing) could connect to the local WPAD
service over ALPC and coerce it into downloading a malicious PAC file containing
a jscript.dll exploit from a remote URL. This would result in code execution in
the context of LOCAL SERVICE.

Darkhotel took this concept and used it as their sandbox escape after they
obtained RCE via Firefox or Internet Explorer. The next step in their attack
chain is unclear: it appears that they somehow elevated their privileges from
LOCAL SERVICE to SYSTEM and proceeded to execute their malware from this context.
In all of the analysis of the Darkhotel Double Star attack chain, I was not able
to find a detailed explanation of how they achieved this, however it is safe to
assume that their technique need not have been a 0day exploit. Processes launched
by the LOCAL SERVICE account are provided with the SeImpersonate privilege by 
default and thus can elevate their security context in the event they can coerce
a privileged connection to themselves via named pipes or ALPC. 

It is likely that the Darkhotel APT group used Rotten Potato for their EoP from
LOCAL SERVICE, as this was the simplest and most common technique in widespread
use several years ago (as well as the technique used in the Google Project Zero
"aPAColypse now" research, however I settled on a more robust/modern technique
instead: named pipe impersonation of a coerced RPC connection from the Print
Spooler [2]. This technique combined an old RPC interface popular among Red
Teamers for TGT harvesting in environments with unconstrained delegation enabled
(aka the "Printer Bug") with an impersonation/Rotten Potato style attack adapted
for local privilege escalation. 

Additionally, rather than targeting Windows 7, I decided to focus on Windows 8.1
due to the challenge presented by its enhanced security mitigations such as
non-deterministic LFH, high entropy ASLR and Control Flow Guard (CFG).

~

CVE-2020-0674

Malicious PAC file containing CVE-2020-0674 UAF exploit - downloaded into
the WPAD service svchost.exe (LOCAL SERVICE) via RPC trigger. Contains
stage three shellcode (Spool Potato EoP). This exploit may serve a dual purpose
as an initial RCE attack vector through IE11 64-bit aas well.

_______________  RPC   _______________  CVE-2020-0674   ________________
| firefox.exe | -----> | svchost.exe | ---------------> | Spool Potato |
|_____________|        |_____________|                  | shellcode    |
                                                        |______________|
~

CVE-2019-17026

Firefox 64-bit IonMonkey JIT/Type Confusion RCE. Represents the initial attack
vector when a user visits an infected web page with a vulnerable version of
Firefox. This component contains a stage one (egg hunter) and stage two (WPAD
sandbox escape) shellcode, the latter of which is only effective on Windows 8.1
due to hardcoded RPC IDL interface details for WPAD.

_______________  JIT spray   ______________  DEP bypass   _______________________
| firefox.exe | -----------> | Egg hunter | ------------> | WPAD sandbox escape |
|_____________|              | shellcode  |               | shellcode (heap)    |
                             |____________|               |_____________________|

~

Payloads

This exploit chain has three shellcode payloads, found within this repository
under Payloads\Compiled\JS in their JavaScript encoded shellcode form:
- Stage one: egg hunter shellcode (ASM).
- Stage two: WPAD sandbox escape shellcode (C DLL, sRDI to shellcode).
- Stage three: Spool Potato privilege escalation shellcode (C DLL, sRDI to
  shellcode).

When IE is used as the initial RCE attack vector, only the stage two and three
shellcodes are needed. When FF is used as the initial RCE attack vector, all
three are used.

I've also included several additional shellcodes for testing purposes (a
MessageBoxA and WinExec shellcode). Note when using these that in the case of
Firefox CVE-2019-17026, the shellcode should be represented as a Uint8Array
prefixed by the following egg QWORD: 0x8877665544332211. In the case of
CVE-2020-0674, the shellcode should be represented as a DWORD array.

Also note that when using a WinExec or MessageBoxA payload in conjunction with
Firefox CVE-2019-17026, you must adjust the sandbox content level in the
"about:config" down to 2 first. 

~

Credits

maxpl0it      - for writing the initial analysis and PoC for CVE-2019-17026
                with a focus on the Linux OS, and for writing the initial
                analysis and PoC for CVE-2020-0674 with a focus on IE8/11 on
                Windows 7 x64.
            
0vercl0k      - for documenting IonMonkey internals in relation to aliasing and
                the GVN.

HackSys Team  - for tips on the WPAD service and low level JS debugging.

itm4n         - for the original research on combining the RPC printer bug with
                named pipe impersonation.
				
~

Links

[1] https://googleprojectzero.blogspot.com/2017/12/apacolypse-now-exploiting-windows-10-in_18.html
[2] https://itm4n.github.io/printspoofer-abusing-impersonate-privileges/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].