Skip to content

Commit 75b39e2

Browse files
committed
v 3.5.7
Method 70 added; Methods 23, 36 reimplemented for win11 support; UAS patterns updated; Readme updated.
1 parent 78b9ee1 commit 75b39e2

29 files changed

+618
-782
lines changed

README.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ First parameter is number of method to use, second is optional command (executab
375375
36. Author: Thomas Vanhoutte aka SandboxEscaper
376376
* Type: Race condition
377377
* Method: NTFS reparse point & Dll Hijack
378-
* Target(s): wusa.exe
378+
* Target(s): wusa.exe, pkgmgr.exe
379379
* Component(s): Attacker defined
380380
* Implementation: ucmJunctionMethod
381381
* Works from: Windows 7 (7600)
@@ -577,11 +577,11 @@ First parameter is number of method to use, second is optional command (executab
577577
* Method: Registry key manipulation
578578
* Target(s): \system32\WSReset.exe
579579
* Component(s): Attacker defined
580-
* Implementation: ucmShellRegModMethod
580+
* Implementation: ucmShellRegModMethod2
581581
* Works from: Windows 10 (17134)
582-
* Fixed in: unfixed :see_no_evil:
583-
* How: -
584-
* Code status: added in v3.1.7
582+
* Fixed in: Windows 11 (22000)
583+
* How: Windows components redesign
584+
* Code status: removed starting from v3.5.7 :tractor:
585585
57. Author: Leo Davidson derivative by Win32/Gapz
586586
* Type: Dll Hijack
587587
* Method: IFileOperation
@@ -713,6 +713,16 @@ First parameter is number of method to use, second is optional command (executab
713713
* Fixed in: unfixed :see_no_evil:
714714
* How: -
715715
* Code status: added in v3.5.6
716+
70. Author: V3ded
717+
* Type: Shell API
718+
* Method: Registry key manipulation
719+
* Target(s): \system32\fodhelper.exe, \system32\computerdefaults.exe
720+
* Component(s): Attacker defined
721+
* Implementation: ucmShellRegModMethod3
722+
* Works from: Windows 10 (10240)
723+
* Fixed in: unfixed :see_no_evil:
724+
* How: -
725+
* Code status: added in v3.5.7
716726

717727
</details>
718728

@@ -768,25 +778,21 @@ https://devblogs.microsoft.com/oldnewthing/20160816-00/?p=94105
768778
## Instructions
769779

770780
* Select Platform ToolSet first for project in solution you want to build (Project->Properties->General):
771-
* v120 for Visual Studio 2013;
772781
* v140 for Visual Studio 2015;
773782
* v141 for Visual Studio 2017;
774783
* v142 for Visual Studio 2019.
775784
* For v140 and above set Target Platform Version (Project->Properties->General):
776785
* If v140 then select 8.1 (Note that Windows 8.1 SDK must be installed);
777-
* If v141/v142 then select 10 (Note that Windows 10 SDK must be installed).
786+
* If v141/v142 then select 10 (Note that Windows 10 (19041) SDK must be installed).
778787

779788
* To build working binary:
780-
* Undefine KUMA_STUB
781789
* Compile payload units
782790
* Compile Naka module
783791
* Encrypt all payload units using Naka module
784792
* Generate secret blobs for these units using Naka module
785793
* Move compiled units and secret blobs to the Akagi\Bin directory
786794
* Rebuild Akagi
787795

788-
* Can be built with SDK 8.1 and later versions.
789-
790796
# References
791797

792798
* Windows 7 UAC whitelist, http://www.pretentiousname.com/misc/win7_uac_whitelist2.html
@@ -818,6 +824,7 @@ https://devblogs.microsoft.com/oldnewthing/20160816-00/?p=94105
818824
* Microsoft Windows 10 UAC bypass local privilege escalation exploit, https://packetstormsecurity.com/files/155927/Microsoft-Windows-10-Local-Privilege-Escalation.html
819825
* UACMe 3.5, WD and the ways of mitigation, https://swapcontext.blogspot.com/2020/10/uacme-35-wd-and-ways-of-mitigation.html
820826
* UAC bypasses from COMAutoApprovalList, https://swapcontext.blogspot.com/2020/11/uac-bypasses-from-comautoapprovallist.html
827+
* Utilizing Programmatic Identifiers (ProgIDs) for UAC Bypasses, https://v3ded.github.io/redteam/utilizing-programmatic-identifiers-progids-for-uac-bypasses
821828

822829
# Authors
823830

Source/Akagi/Resource.rc

-16 Bytes
Binary file not shown.

Source/Akagi/global.h

+2-14
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*
55
* TITLE: GLOBAL.H
66
*
7-
* VERSION: 3.56
7+
* VERSION: 3.57
88
*
9-
* DATE: 30 July 2021
9+
* DATE: 01 Nov 2021
1010
*
1111
* Common header file for the program support routines.
1212
*
@@ -22,10 +22,6 @@
2222
#error ANSI build is not supported
2323
#endif
2424

25-
#ifndef _DEBUG
26-
#define KUMA_STUB
27-
#endif
28-
2925
#include "shared\libinc.h"
3026

3127
//disable nonmeaningful warnings.
@@ -158,13 +154,5 @@ typedef UINT(WINAPI *pfnEntryPoint)(
158154
_In_ BOOL OutputToDebugger
159155
);
160156

161-
typedef struct _UACME_THREAD_CONTEXT {
162-
TEB_ACTIVE_FRAME Frame;
163-
pfnEntryPoint ucmMain;
164-
NTSTATUS ReturnedResult;
165-
ULONG OptionalParameterLength;
166-
LPWSTR OptionalParameter;
167-
} UACME_THREAD_CONTEXT, *PUACME_THREAD_CONTEXT;
168-
169157
extern PUACMECONTEXT g_ctx;
170158
extern HINSTANCE g_hInstance;

Source/Akagi/main.c

+8-143
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*
55
* TITLE: MAIN.C
66
*
7-
* VERSION: 3.56
7+
* VERSION: 3.57
88
*
9-
* DATE: 17 July 2021
9+
* DATE: 01 Nov 2021
1010
*
1111
* Program entry point.
1212
*
@@ -26,33 +26,6 @@ PUACMECONTEXT g_ctx;
2626
//Image Base Address global variable
2727
HINSTANCE g_hInstance;
2828

29-
TEB_ACTIVE_FRAME_CONTEXT g_fctx = { 0, "<??>" };
30-
31-
/*
32-
* ucmDummyWindowProc
33-
*
34-
* Purpose:
35-
*
36-
* Part of antiemulation, does nothing.
37-
*
38-
*/
39-
LRESULT CALLBACK ucmDummyWindowProc(
40-
HWND hwnd,
41-
UINT uMsg,
42-
WPARAM wParam,
43-
LPARAM lParam
44-
)
45-
{
46-
switch (uMsg) {
47-
case WM_SHOWWINDOW:
48-
SendMessage(hwnd, WM_CLOSE, 0, 0);
49-
break;
50-
case WM_CLOSE:
51-
PostQuitMessage(0);
52-
break;
53-
}
54-
return DefWindowProc(hwnd, uMsg, wParam, lParam);
55-
}
5629

5730
/*
5831
* ucmInit
@@ -77,19 +50,13 @@ NTSTATUS ucmInit(
7750
NTSTATUS Result = STATUS_SUCCESS;
7851
LPWSTR optionalParameter = NULL;
7952
ULONG optionalParameterLength = 0;
80-
MSG msg1;
81-
WNDCLASSEX wincls;
82-
BOOL rv = 1;
83-
HWND TempWindow;
8453

8554
#ifndef _DEBUG
8655
TOKEN_ELEVATION_TYPE ElevType;
8756
#endif
8857

8958
ULONG bytesIO;
9059
WCHAR szBuffer[MAX_PATH + 1];
91-
WCHAR WndClassName[] = TEXT("reyortseD");
92-
WCHAR WndTitleName[] = TEXT("ikibiH");
9360

9461

9562
do {
@@ -167,49 +134,6 @@ NTSTATUS ucmInit(
167134
optionalParameterLength = OptionalParameterLength;
168135
}
169136

170-
wincls.cbSize = sizeof(WNDCLASSEX);
171-
wincls.style = CS_OWNDC;
172-
wincls.lpfnWndProc = &ucmDummyWindowProc;
173-
wincls.cbClsExtra = 0;
174-
wincls.cbWndExtra = 0;
175-
wincls.hInstance = g_hInstance;
176-
wincls.hIcon = NULL;
177-
wincls.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(OCR_NORMAL), IMAGE_CURSOR, 0, 0, LR_SHARED);
178-
wincls.hbrBackground = NULL;
179-
wincls.lpszMenuName = NULL;
180-
wincls.lpszClassName = WndClassName;
181-
wincls.hIconSm = 0;
182-
183-
RegisterClassEx(&wincls);
184-
185-
TempWindow = CreateWindowEx(WS_EX_TOPMOST,
186-
WndClassName,
187-
WndTitleName,
188-
WS_VISIBLE | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
189-
0, 0,
190-
32,
191-
32,
192-
NULL, NULL,
193-
g_hInstance,
194-
NULL);
195-
196-
if (TempWindow)
197-
return STATUS_FATAL_APP_EXIT;
198-
199-
do {
200-
rv = GetMessage(&msg1, NULL, 0, 0);
201-
202-
if (rv == -1) {
203-
return STATUS_FATAL_APP_EXIT;
204-
}
205-
206-
TranslateMessage(&msg1);
207-
DispatchMessage(&msg1);
208-
209-
} while (rv != 0);
210-
211-
UnregisterClass(WndClassName, g_hInstance);
212-
213137
g_ctx = (PUACMECONTEXT)supCreateUacmeContext(Method,
214138
optionalParameter,
215139
optionalParameterLength,
@@ -282,45 +206,6 @@ NTSTATUS WINAPI ucmMain(
282206
return MethodsManagerCall(method);
283207
}
284208

285-
/*
286-
* ucmSehHandler
287-
*
288-
* Purpose:
289-
*
290-
* Program entry point seh handler, indirect control passing.
291-
*
292-
*/
293-
INT ucmSehHandler(
294-
_In_ UINT ExceptionCode,
295-
_In_ EXCEPTION_POINTERS *ExceptionInfo
296-
)
297-
{
298-
UACME_THREAD_CONTEXT *uctx;
299-
300-
UNREFERENCED_PARAMETER(ExceptionInfo);
301-
302-
if (ExceptionCode == STATUS_INTEGER_DIVIDE_BY_ZERO) {
303-
uctx = (UACME_THREAD_CONTEXT*)RtlGetFrame();
304-
while ((uctx != NULL) && (uctx->Frame.Context != &g_fctx)) {
305-
uctx = (UACME_THREAD_CONTEXT *)uctx->Frame.Previous;
306-
}
307-
if (uctx) {
308-
if (uctx->ucmMain) {
309-
uctx->ucmMain = (pfnEntryPoint)supDecodePointer(uctx->ucmMain);
310-
311-
uctx->ReturnedResult = uctx->ucmMain(UacMethodInvalid,
312-
NULL,
313-
0,
314-
FALSE);
315-
}
316-
}
317-
return EXCEPTION_EXECUTE_HANDLER;
318-
}
319-
return EXCEPTION_CONTINUE_SEARCH;
320-
}
321-
322-
#ifndef KUMA_STUB
323-
324209
/*
325210
* main
326211
*
@@ -332,30 +217,10 @@ INT ucmSehHandler(
332217
#pragma comment(linker, "/ENTRY:main")
333218
VOID __cdecl main()
334219
{
335-
int v = 1, d = 0;
336-
UACME_THREAD_CONTEXT uctx;
337-
338-
RtlSecureZeroMemory(&uctx, sizeof(uctx));
339-
340-
if (wdIsEmulatorPresent() == STATUS_NOT_SUPPORTED) {
341-
342-
uctx.Frame.Context = &g_fctx;
343-
uctx.ucmMain = (pfnEntryPoint)supEncodePointer(ucmMain);
344-
RtlPushFrame((PTEB_ACTIVE_FRAME)&uctx);
345-
346-
__try {
347-
v = (int)USER_SHARED_DATA->NtProductType;
348-
d = (int)USER_SHARED_DATA->AlternativeArchitecture;
349-
v = (int)(v / d);
350-
}
351-
__except (ucmSehHandler(GetExceptionCode(), GetExceptionInformation())) {
352-
v = 1;
353-
}
354-
355-
RtlPopFrame((PTEB_ACTIVE_FRAME)&uctx);
356-
}
357-
if (v > 0)
358-
ExitProcess(uctx.ReturnedResult);
359-
}
360-
220+
#ifdef _WIN64
221+
__writegsqword(FIELD_OFFSET(NT_TIB, ArbitraryUserPointer), (DWORD_PTR)ucmMain);
222+
#else
223+
__writefsdword(FIELD_OFFSET(NT_TIB, ArbitraryUserPointer), (DWORD_PTR)ucmMain);
361224
#endif
225+
ExitProcess(StubInit());
226+
}

0 commit comments

Comments
 (0)