SlideShare a Scribd company logo
1 of 88
Download to read offline
File Infector Virus Analysis
(from the point of view of an anti-virus developer)
sionics , kaientt
@issuemakerslab.com
3rd CodeEngn ReverseEngineering Seminar
2
Agenda
0x00 Malware Trends
0x01 File Infector and NOT infector
0x02 Prior Knowledge
- PE Format
0x03 File Infection Techniques
0x04 File Infector Virus Analysis – Demonstration
0x05 Development of disinfection code
3rd CodeEngn ReverseEngineering Seminar
3
0x00 Malware Trends
0x00 Malware Trends
3rd CodeEngn ReverseEngineering Seminar
4
The growth of malware
Source: Andreas Marx, http://www.av-test.org
3rd CodeEngn ReverseEngineering Seminar
5
The growth of malware
Source: McAfee Avert Labs
(20 Million Malware Samples)
3rd CodeEngn ReverseEngineering Seminar
6
The growth of malware
Source: Symantec Corporation
Internet Security Threat Report Volume XIV: April, 2009
(New malicious code signatures)
3rd CodeEngn ReverseEngineering Seminar
7
The growth of malware
Source: Symantec Corporation
Internet Security Threat Report Volume XIV: April, 2009
(Malicious code types)
Today's main threats are simple Trojan horses and worms,
not file-infectors.
BUT,
3rd CodeEngn ReverseEngineering Seminar
8
file infectors will increase again
>In this age of botnets, rootkits, spyware, and other bleeding-edge
security threats, file infectors are frequently thought of as a dead
threat.
>Historically, file viruses were among the very first types of virus,
dating back to the 1980's.
>recent increase in network file-infecting viruses
>file infectors will increase again
3rd CodeEngn ReverseEngineering Seminar
9
Advantage of File Infector
>생존 시간 증가
— 트로이목마 등의 단일파일 악성코드는 탐지가 쉬우며 치료가 파일 삭제
— 하나 이상의 파일을 감염
— 기존 실행파일들에 감염되면 사용자가 쉽게 감염여부 판단이 어려움
> 은폐기능 추가 시 더 어려움
>진단과 치료
— Not Infector
> Trojan, Worm, Backdoor 등, 진단시 파일 삭제만으로 치료가능
— File Infector
> 감염된 모든 실행 가능한 파일
> 잘못된 진단과 잘못된 치료는 곧 업체의 신뢰성 하락과 고객의 외면
> 어느 정도의 분석 시간과 테스트 기간 필요
– 탐지 회피/지연 목적의 기법
– EPO(Entry-Point Obscuring), Polymorphism
3rd CodeEngn ReverseEngineering Seminar
10
Malware Statistics
Monthly Malware Statistics: may 2009 (from Kaspersky Lab)
IFrame.aga is one more version of the iframe that
the now widespread Virus.Win32.Virut.ce uses to
infect web pages. And Sality.ae is the latest version
of the well-known Sality virus.
3rd CodeEngn ReverseEngineering Seminar
11
0x01 File Infector and NOT infector
0x01 File Infector and NOT infector
3rd CodeEngn ReverseEngineering Seminar
12
File infector virus
Glossary
3rd CodeEngn ReverseEngineering Seminar
13
File Infector and NOT infector
NOT infector
- Trojan, Backdoor, Worm, Rootkit, Spyware, Adware
File Infector
- Virus (Parite, Virut, Sality, Alman)
3rd CodeEngn ReverseEngineering Seminar
14
File Infector and NOT infector
NOT infector
- 파일 자체가 악성
- 치료 : 파일 자체를 삭제
3rd CodeEngn ReverseEngineering Seminar
15
File Infector and NOT infector
File Infector
- 기존 정상 파일에 바이러스 코드를 추가
- 치료 : 바이러스 코드 부분만 삭제 (정상 파일로 복구)
3rd CodeEngn ReverseEngineering Seminar
16
Common Malicious Code Analysis
>Dynamic Analysis
>Static Analysis
>Most modern malware use some sort of runtime packer (70-90%)
— If static analysis of malware is needed, protective layer(s) must be
opened
3rd CodeEngn ReverseEngineering Seminar
17
실행압축 해제 루틴 (복호화)
실행압축 (암호화)
일반 실행 파일 실행압축된 실행 파일
Executable compression
3rd CodeEngn ReverseEngineering Seminar
18
(Bonus) Common Malware Behavior - Analysis
>최초 감염
— 취약점(80% 이상)을 통한 최초 파일 생성
>파일 생성
— 자신복사, 다운로드, 드롭
>실행되도록 등록 (부팅 시)
— 레지스트리, 서비스, BHO
>동작
— 프로세스, 쓰레드, DLL Injection
>네트워크 활동
— 포트 오픈, 특정 도메인/포트 접속, IRC 접속
>악성행위
— 보안기능 비활성화, 온라인 게임 계정 절취, DDoS, 스팸메일 발송
3rd CodeEngn ReverseEngineering Seminar
19
최초 감염
>브라우저/윈도우 취약점을 Exploit한 후 파일 생성
— Buffer Overflow (Heap, Stack)
— Format String
— Privilege Escalation
— Memory Corruption
>탐지
— 일반적인 다운로드와 다름
> 사용자 모르게 파일이 생성되고 실행됨
— Shellcode
3rd CodeEngn ReverseEngineering Seminar
20
일반적인 파일 다운로드 (사용자가 인지)
Memory Corruption에 의한 파일 다운로드 (사용자 인지 불가능)
3rd CodeEngn ReverseEngineering Seminar
21
파일 생성
>자신복사, 다운로드, 드롭
>파일/디렉토리 관련 API
— CreateFile
— ReadFile
— WriteFile
— CopyFile
— GetSystemDirectory
— GetWindowsDirectory
3rd CodeEngn ReverseEngineering Seminar
22
최초 파일 최초 파일
최초 파일
인터넷
파일 #1
최초 파일
파일 복사
다운로드
드롭
임시 디렉토리
(Temp)
www.x.com/a.exe
윈도우 시스템 디렉토리
(windowssystem32)
파일 생성
3rd CodeEngn ReverseEngineering Seminar
233rd CodeEngn ReverseEngineering Seminar
24
다운로드
>관련 API
— URLDownloadToFileA
3rd CodeEngn ReverseEngineering Seminar
25
다운로드
3rd CodeEngn ReverseEngineering Seminar
26
드롭
>리소스 섹션 등으로부터 내부의 파일을 드롭함
>관련 API
— FindResourceA
— LoadResource
3rd CodeEngn ReverseEngineering Seminar
27
드롭
3rd CodeEngn ReverseEngineering Seminar
28
드롭
3rd CodeEngn ReverseEngineering Seminar
29
실행되도록 등록 (부팅 시)
>레지스트리, 서비스, BHO
>관련 API
— RegCreateKey
— RegOpenKeyEx
— RegSetValueEx
— RegQueryValueEx
— CreateServiceA
— OpenServiceA
— StartServiceA
3rd CodeEngn ReverseEngineering Seminar
30
실행되도록 등록 (부팅 시)
>시스템 재 시작시에 자동으로 실행되도록 설정
>해당 레지스트리 경로
— HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun
— HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon
— HKLMSOFTWAREMicrosoftWindows NTCurrentVersionImage File
Execution Options
— HKMLSYSTEMCurrentControlSetServices
3rd CodeEngn ReverseEngineering Seminar
31
실행되도록 등록 (부팅 시)
3rd CodeEngn ReverseEngineering Seminar
32
프로세스 동작
>프로세스, 쓰레드, DLL Injection, 서비스
>관련 API
— CreateProcess
— FindProcess
— TerminateProcess
— CreateThread
— CreateRemoteThread
— ShellExecute
— StartServiceA
3rd CodeEngn ReverseEngineering Seminar
33
DLL을 인젝션 하기 위한 프로세스 검색
프로세스 동작
3rd CodeEngn ReverseEngineering Seminar
34
CreateRemoteThread를 이용한 DLL Injection
프로세스 동작
3rd CodeEngn ReverseEngineering Seminar
35
네트워크 활동
>포트 오픈, 특정 도메인/포트 접속, IRC 접속
>관련 API
— WSAStartup
— WSASend
— socket
— send
— recv
— listen
— accept
— gethostbyname
— InternetGetConnectedState
3rd CodeEngn ReverseEngineering Seminar
36
네트워크 활동
3rd CodeEngn ReverseEngineering Seminar
37
악성행위
>보안기능 비활성화, 온라인 게임 계정 절취, DDoS, 스팸메일 발송
3rd CodeEngn ReverseEngineering Seminar
38
온라인 게임/포털 사이트 계정 절취를 위한 네트워크 관련 API 후킹
악성행위
3rd CodeEngn ReverseEngineering Seminar
39
국산 백신 제품들의 업데이트를 방해하는 코드 루틴
악성행위
3rd CodeEngn ReverseEngineering Seminar
40
악성행위
3rd CodeEngn ReverseEngineering Seminar
41
Malicious Behavior Analysis
Demonstration
Virut
Malicious Behavior (related API, IRCBot)
3rd CodeEngn ReverseEngineering Seminar
42
0x02 Prior Knowledge
0x02 Prior Knowledge
- PE Format
3rd CodeEngn ReverseEngineering Seminar
43
PE Format Poster - Ero Carrera
3rd CodeEngn ReverseEngineering Seminar
44
MZ header
PE header
Section 1
Section 2
Section n
Section table
File Headers : MZ Header
3rd CodeEngn ReverseEngineering Seminar
45
MZ header
PE header
Section 1
Section 2
Section n
Section table
File Headers : PE Header
3rd CodeEngn ReverseEngineering Seminar
46
MZ header
PE header
Section 1
Section 2
Section n
Section table
File header
Optional header
File Headers : File Header
3rd CodeEngn ReverseEngineering Seminar
47
MZ header
PE header
Section 1
Section 2
Section n
Section table
File header
Optional header
File Headers : Optional Header
3rd CodeEngn ReverseEngineering Seminar
48
MZ header
PE header
Section 1
Section 2
Section n
Section table
File Headers : Section Header
Section header
Section header
Section header
Section header
3rd CodeEngn ReverseEngineering Seminar
49
0x03 File Infection Techniques
0x03 File Infection Techniques
3rd CodeEngn ReverseEngineering Seminar
50
File Infection Techniques
Header
Section #1
Section #2
Section #n
EPOEP
OEP
Section #n+1
File Infector Virus
- change the entry-point
- add section
animation
3rd CodeEngn ReverseEngineering Seminar
51
File Infection Techniques
Header
Section #1
Section #2
Section #n
EPOEP
Section #n
File Infector Virus
OEP
- change the entry-point
- increase last section size
animation
3rd CodeEngn ReverseEngineering Seminar
52
Section #1
File Infection Techniques
Header
Section #2
Section #n
EP
Section #n+1
File Infector Virus
- patched code at EPanimation
3rd CodeEngn ReverseEngineering Seminar
53
Section #1
File Infection Techniques – EPO(Entry-Point Obscuring)
Header
Section #2
Section #n
EP
Section #n+1
File Infector Virus
- patched with a jump/call
routine at somewhere
animation
3rd CodeEngn ReverseEngineering Seminar
54
File Infection Techniques
>injects code in running processes and hooks the following
functions in ntdll.dll which transfers control to the virus every time
any of these function calls are made
>NtCreateFile
>NtCreateProcess
>NtCreateProcessEx
>NtOpenFile
>NtQueryInformationProcess
3rd CodeEngn ReverseEngineering Seminar
55
File Infector virus features
>Code Execution Starts in the Last Section
>Suspicious Section Characteristics
>Suspicious Code Redirection (EPO)
>Suspicious Code Section Name
>identifier marks of the virus
3rd CodeEngn ReverseEngineering Seminar
56
identifier marks of the virus
Virut
3rd CodeEngn ReverseEngineering Seminar
57
Encode/Decode Operation
>XOR
>NEG
>ADD, SUB
>ROR, ROL
3rd CodeEngn ReverseEngineering Seminar
58
Polymorphism
>mov eax, [edx]
>add eax, 17E0D0DCh
>mov [edx], eax
>push dword ptr [edx]
>pop eax
>add eax, 17E0D0DCh
>push eax
>pop dword ptr [edx]
3rd CodeEngn ReverseEngineering Seminar
59
Dummy Code
>mov eax, eax
>push eax
>pop eax
>nop
3rd CodeEngn ReverseEngineering Seminar
60
0x04 File Infector Virus Analysis – Demonstration
0x04 File Infector Virus Analysis – Demonstration
3rd CodeEngn ReverseEngineering Seminar
61
File Infector Virus Analysis
how to get malware samples
3rd CodeEngn ReverseEngineering Seminar
62
Malware Sample
http://www.offensivecomputing.net/ (Offensive Computing)
3rd CodeEngn ReverseEngineering Seminar
63
Malware Sample
http://vx.netlux.org/vl.php (VX Heavens)
3rd CodeEngn ReverseEngineering Seminar
64
Malware Sample
http://cafe.naver.com/malzero (바이러스 제로 시즌 2)
3rd CodeEngn ReverseEngineering Seminar
65
Approach for File Infector Virus Analysis
>File Compare, Original and Infected File
>Top-Down
— 1. VEP (Infected_EP or Patched_Code)
— 2. Decode_Loop
— 3. Decode_Key
— 4. Find restore OEP routine
— 5. OEP offset
> (OEP or Original_Code_before_Patched address)
>Bottom-Up
— 1. VEP (Infected_EP or Patched_Code)
— 2. Find restore OEP routine
> (set BP at OEP or Original_Code_before_Patched address)
— 3. Check if data is encoded
— 4. Decode_Loop
— 5. Decode_Key 3rd CodeEngn ReverseEngineering Seminar
66
Parite.A
>It's terrible
3rd CodeEngn ReverseEngineering Seminar
67
Parite.A
Header
Section #1
Section #2
Section #n
EPOEP
OEP
Section #n+1
Parite.A
Decode routine
Encoded
- encoded XOR operations
animation
3rd CodeEngn ReverseEngineering Seminar
68
Polymorphism in Parite.A
> xor 연산의 피연산자 중 xor_key 구하는 것
> (1)
— push xor_key
— pop [register]
> (2)
— mov [register], xor_key
> xor 연산의 피연산자중 디코드된 데이터 구하는 것
> (1)
— push [데이터 주소]
— xor [esp], xor_key
— pop [데이터 주소]
> (2)
— xor [데이터 주소], xor_key
> 카운터 증가
> (1)
— sub edi, 3
— dec edi
> (2)
— sub edi, 4
3rd CodeEngn ReverseEngineering Seminar
69
File Infector Virus Analysis
Parite.A
Demonstration (Top-Down)
IDA
3rd CodeEngn ReverseEngineering Seminar
70
Sality.AE
Header
Section #1
Section #2
Section #nSection #n
Sality.AE
-EPO (Entry-Point Obscuring)
- ADD or SUB
EP CALL
Decode routine
Original Code
Encoded
animation
3rd CodeEngn ReverseEngineering Seminar
71
Polymorphism in Sality.AE
3rd CodeEngn ReverseEngineering Seminar
72
Polymorphism in Sality.AE
3rd CodeEngn ReverseEngineering Seminar
73
File Infector Virus Analysis
Sality.AE
Demonstration (Bottom-Up)
Ollydbg, IDA
3rd CodeEngn ReverseEngineering Seminar
74
0x05 Development of disinfection code
0x05 Development of disinfection code
Parite.A
Sality.AE
3rd CodeEngn ReverseEngineering Seminar
75
Development of disinfection code
Needed
Precise PE parser
Strong disassembler
Development using Python
pefile - Ero Carrera
pydasm – Ero Carrera
3rd CodeEngn ReverseEngineering Seminar
76
>instruction opcode VS. instruction operands
>E8 ???????? => CALL XXXXXXXX
>68 332211E8 => PUSH E8112233
>68332211E8E840100000
Why Need Disassembler
3rd CodeEngn ReverseEngineering Seminar
77
Development of disinfection code
3rd CodeEngn ReverseEngineering Seminar
78
Consideration
>Virus를 치료시 Overlay에 대한 고려
>Virus가 추가한 section의 Data를 지우거나 section 자체를 지울 경우
— Optional header의 SizeOfImage를 계산 후 수정
>JMP나 CALL 호출을 할 경우 해당 주소의 범위 체크
>pydasm을 사용할 경우 지원하지 않는 OP Code에 대한 예외처리
— Sality.AE (SAL: shift arithmetic left)
3rd CodeEngn ReverseEngineering Seminar
79
Scan Filter
>PE 파일인지 체크
>EP가 마지막 section에서 시작하는지 체크 (Parite.A)
>OPTIONAL_HEADER의 Magic Signature 체크
>OPTIONAL_HEADER의 Subsystem 체크
3rd CodeEngn ReverseEngineering Seminar
80
Scan Filter
>FILE_HEADER의 Characteristics 체크
>마지막 section의 SizeOfRawData 가 0x1000 이하인지 체크(Parite.A)
>마지막 section의 Characteristics 체크
3rd CodeEngn ReverseEngineering Seminar
81
Parite.A detection
> Step 1:
— Find Decode Key
— 가장 처음의 [push] or [mov]의 오퍼랜드 데이터
> Step 2:
— Encoded Data의 시작위치 찾기
— Decode Key를 찾은 이후 나오는 [push] or [mov] 의 오퍼랜드 데이터
> Step 3:
— Encode Data의 시작 위치로 부터 4Byte 가져오기
— Test_Data를 찾는 과정
> Step 4:
— (복호화된 데이터는 항상 일정)
— Decode_Key와 Test_Data를 XOR연산 후 0x00017D8 인지 확인하여 Parite.A 식별
3rd CodeEngn ReverseEngineering Seminar
82
Parite.A disinfection
> Step 1:
— Encoded_Data의 시작 위치로 부터 약 72Byte를 Decode_Key로 Decode
> Step 2:
— Decode 된 Data의 특정 위치에서 OEP, IAT Offset 등의 값을 추출
> Step 3:
— Parite.A가 추가한 마지막 section header 삭제
— Calc New SizeOfImage
— NumberOfSections 카운트 1 감소
— OEP 및 Import Address Table, Import Name Table의 값 복구
> Step 4:
— Parite.A가 추가한 마지막 section Data 삭제
3rd CodeEngn ReverseEngineering Seminar
83
Development of disinfection code
Parite.A
Demonstration
3rd CodeEngn ReverseEngineering Seminar
84
Virus.Sality.AE detection
>1단계
— 마지막 섹션으로 점프하는 CALL (E8) 찾기
>2단계
— 처음 나오는 CALL (E8) 찾기
>3단계
— 디코드 루프 찾기
— JMP (E9) 식별하기
> 디코드된 데이터의 시작 위치 찾기
>4단계
— X-Ray 기법
> decode_key 찾기, decode_key와 특정 데이터 연산 후 Sality.AE 식별
3rd CodeEngn ReverseEngineering Seminar
85
>Decode Key를 모르는 상태에서 Encode Data와 Decode Data를 알
경우 Key를 알아내는 방법
>ADD
>SUB
Using X-Ray Method
+ =
-=
- =
-=
Decode Key
0x????????
Decode Data
0x000000E8
Encode Data
0xFC75F238
Decode Data
0x000000E8
Encode Data
0xFC75F238
Decode Key
0x????????
Decode Key
0x038A0EB0
Decode Key
0x????????
Decode Key
0x????????
Decode Key
0x21E5ABD8
+ =
Decode Key
0x038A0EB0
Decode Data
0x000000E8
Decode Data
0x000000E8
Encode Data
0x21E5ACC0
Encode Data
0x21E5ACC0
Encode Data
0xE9F74E50
Decode Data
0xED815D00
- =Decode Key
0x21E5ABD8
Decode Data
0xED815D00
Encode Data
0x0F6708D8
3rd CodeEngn ReverseEngineering Seminar
86
86
Virus.Sality.AE disinfection
>disinfection
— Encode Data 영역 Decode 후 Original Code before Patched (EPO) 복구
— Overlay 식별
— 바이러스 코드 시작위치부터 삭제
— Section header의 Section size 관련 필드 조정
> SizeOfRawData
> VirtualSize
— Optional header의 SizeOfImage 조정
— Overlay가 있을 경우 Overlay 복구
3rd CodeEngn ReverseEngineering Seminar
87
Development of disinfection code
Sality.AE
Demonstration
3rd CodeEngn ReverseEngineering Seminar
88
Questions
Questions?
contact us via e-mail
sionics 0x40 issuemakerslab.com
kaientt 0x40 issuemakerslab.com
3rd CodeEngn ReverseEngineering Seminar

More Related Content

What's hot

(140118) #fitalk detection of anti-forensics artifacts using ioa fs
(140118) #fitalk   detection of anti-forensics artifacts using ioa fs(140118) #fitalk   detection of anti-forensics artifacts using ioa fs
(140118) #fitalk detection of anti-forensics artifacts using ioa fs
INSIGHT FORENSIC
 
악성코드와 분석 방법
악성코드와 분석 방법악성코드와 분석 방법
악성코드와 분석 방법
Youngjun Chang
 

What's hot (20)

6. code level reversing
6. code level reversing6. code level reversing
6. code level reversing
 
2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법
 
악성코드와 분석 방안
악성코드와 분석 방안악성코드와 분석 방안
악성코드와 분석 방안
 
악성코드와 기업의 악성코드 대응
악성코드와 기업의 악성코드 대응악성코드와 기업의 악성코드 대응
악성코드와 기업의 악성코드 대응
 
악성코드와 개인 정보 보호
악성코드와 개인 정보 보호악성코드와 개인 정보 보호
악성코드와 개인 정보 보호
 
악성코드와 분석 방안
악성코드와 분석 방안악성코드와 분석 방안
악성코드와 분석 방안
 
2. 악성코드 동적 분석 방법론
2. 악성코드 동적 분석 방법론2. 악성코드 동적 분석 방법론
2. 악성코드 동적 분석 방법론
 
악성 코드와 보안 위협 동향
악성 코드와 보안 위협 동향악성 코드와 보안 위협 동향
악성 코드와 보안 위협 동향
 
악성코드 분석 도구
악성코드 분석 도구악성코드 분석 도구
악성코드 분석 도구
 
2.악성코드와 분석 방안
2.악성코드와 분석 방안2.악성코드와 분석 방안
2.악성코드와 분석 방안
 
보안 위협 형태와 악성코드 분석 기법
보안 위협 형태와 악성코드 분석 기법보안 위협 형태와 악성코드 분석 기법
보안 위협 형태와 악성코드 분석 기법
 
악성코드와 웜
악성코드와 웜악성코드와 웜
악성코드와 웜
 
(140118) #fitalk detection of anti-forensics artifacts using ioa fs
(140118) #fitalk   detection of anti-forensics artifacts using ioa fs(140118) #fitalk   detection of anti-forensics artifacts using ioa fs
(140118) #fitalk detection of anti-forensics artifacts using ioa fs
 
2. windows system과 file format
2. windows system과 file format2. windows system과 file format
2. windows system과 file format
 
3. windows system과 rootkit
3. windows system과 rootkit3. windows system과 rootkit
3. windows system과 rootkit
 
악성코드와 분석 방법
악성코드와 분석 방법악성코드와 분석 방법
악성코드와 분석 방법
 
1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론
 
2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법
 
보안 위협과 악성코드 분석 기법
보안 위협과 악성코드 분석 기법보안 위협과 악성코드 분석 기법
보안 위협과 악성코드 분석 기법
 
보안 위협과 악성코드 분석 기법
보안 위협과 악성코드 분석 기법보안 위협과 악성코드 분석 기법
보안 위협과 악성코드 분석 기법
 

Viewers also liked

Viewers also liked (9)

[2007 CodeEngn Conference 01] 김기오 - NASM 어셈블러 사용법과 Calling Convention
[2007 CodeEngn Conference 01] 김기오 - NASM 어셈블러 사용법과 Calling Convention[2007 CodeEngn Conference 01] 김기오 - NASM 어셈블러 사용법과 Calling Convention
[2007 CodeEngn Conference 01] 김기오 - NASM 어셈블러 사용법과 Calling Convention
 
[2008 CodeEngn Conference 02] 송민호 - 임베디드 시스템에서의 펌웨어 보호
[2008 CodeEngn Conference 02] 송민호 - 임베디드 시스템에서의 펌웨어 보호[2008 CodeEngn Conference 02] 송민호 - 임베디드 시스템에서의 펌웨어 보호
[2008 CodeEngn Conference 02] 송민호 - 임베디드 시스템에서의 펌웨어 보호
 
[2012 CodeEngn Conference 06] beist - Everyone has his or her own fuzzer
[2012 CodeEngn Conference 06] beist - Everyone has his or her own fuzzer[2012 CodeEngn Conference 06] beist - Everyone has his or her own fuzzer
[2012 CodeEngn Conference 06] beist - Everyone has his or her own fuzzer
 
[2007 CodeEngn Conference 01] amesianx - Art of Hooking
[2007 CodeEngn Conference 01] amesianx - Art of Hooking[2007 CodeEngn Conference 01] amesianx - Art of Hooking
[2007 CodeEngn Conference 01] amesianx - Art of Hooking
 
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
[2009 CodeEngn Conference 03] hkpco - DEFCON CTF 2009 Binary Leetness 100-500...
 
[2011 CodeEngn Conference 05] ashine - 안드로이드 리눅스에서의 시스템 해킹
[2011 CodeEngn Conference 05] ashine - 안드로이드 리눅스에서의 시스템 해킹[2011 CodeEngn Conference 05] ashine - 안드로이드 리눅스에서의 시스템 해킹
[2011 CodeEngn Conference 05] ashine - 안드로이드 리눅스에서의 시스템 해킹
 
[2012 CodeEngn Conference 07] manGoo - Exploit Writing Technique의 발전과 최신 트랜드
[2012 CodeEngn Conference 07] manGoo - Exploit Writing Technique의 발전과 최신 트랜드[2012 CodeEngn Conference 07] manGoo - Exploit Writing Technique의 발전과 최신 트랜드
[2012 CodeEngn Conference 07] manGoo - Exploit Writing Technique의 발전과 최신 트랜드
 
[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
 
[2013 CodeEngn Conference 08] singi - Android Platform 3G, 4G 통신 분석
[2013 CodeEngn Conference 08] singi - Android Platform 3G, 4G 통신 분석[2013 CodeEngn Conference 08] singi - Android Platform 3G, 4G 통신 분석
[2013 CodeEngn Conference 08] singi - Android Platform 3G, 4G 통신 분석
 

Similar to [2009 CodeEngn Conference 03] sionics, kaientt - (파일바이러스 치료로직 개발자 입장에서 본) 파일 바이러스 분석

지능형지속위협공격 최신동향 분석
지능형지속위협공격 최신동향 분석지능형지속위협공격 최신동향 분석
지능형지속위협공격 최신동향 분석
한익 주
 

Similar to [2009 CodeEngn Conference 03] sionics, kaientt - (파일바이러스 치료로직 개발자 입장에서 본) 파일 바이러스 분석 (20)

(FICON2015) #3 어떻게 들어왔는가?
(FICON2015) #3 어떻게 들어왔는가?(FICON2015) #3 어떻게 들어왔는가?
(FICON2015) #3 어떻게 들어왔는가?
 
(Ficon2015) #3 어떻게 들어왔는가
(Ficon2015) #3 어떻게 들어왔는가(Ficon2015) #3 어떻게 들어왔는가
(Ficon2015) #3 어떻게 들어왔는가
 
보안 위협과 악성코드 분석 기법
보안 위협과 악성코드 분석 기법보안 위협과 악성코드 분석 기법
보안 위협과 악성코드 분석 기법
 
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
[2013 CodeEngn Conference 09] 제갈공맹 - MS 원데이 취약점 분석 방법론
 
(130511) #fitalk utilization of ioc, ioaf and sig base
(130511) #fitalk   utilization of ioc, ioaf and sig base(130511) #fitalk   utilization of ioc, ioaf and sig base
(130511) #fitalk utilization of ioc, ioaf and sig base
 
[2014 CodeEngn Conference 10] 심준보 - 급전이 필요합니다
[2014 CodeEngn Conference 10] 심준보 -  급전이 필요합니다[2014 CodeEngn Conference 10] 심준보 -  급전이 필요합니다
[2014 CodeEngn Conference 10] 심준보 - 급전이 필요합니다
 
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
 
악성코드 최신 동향과 분석 방안
악성코드 최신 동향과 분석 방안악성코드 최신 동향과 분석 방안
악성코드 최신 동향과 분석 방안
 
[2007 CodeEngn Conference 01] 이강석 - Malware Analysis Start
[2007 CodeEngn Conference 01] 이강석 - Malware Analysis Start[2007 CodeEngn Conference 01] 이강석 - Malware Analysis Start
[2007 CodeEngn Conference 01] 이강석 - Malware Analysis Start
 
(160820) #fitalk fileless malware forensics
(160820) #fitalk    fileless malware forensics(160820) #fitalk    fileless malware forensics
(160820) #fitalk fileless malware forensics
 
[2011 CodeEngn Conference 05] daly25 - 파일바이러스 분석 및 치료로직 개발
[2011 CodeEngn Conference 05] daly25 - 파일바이러스 분석 및 치료로직 개발[2011 CodeEngn Conference 05] daly25 - 파일바이러스 분석 및 치료로직 개발
[2011 CodeEngn Conference 05] daly25 - 파일바이러스 분석 및 치료로직 개발
 
Under attack - application
Under attack - applicationUnder attack - application
Under attack - application
 
App check pro_표준제안서_z
App check pro_표준제안서_zApp check pro_표준제안서_z
App check pro_표준제안서_z
 
2007년 6월 악성코드 최신 동향과 대응
2007년 6월 악성코드 최신 동향과 대응2007년 6월 악성코드 최신 동향과 대응
2007년 6월 악성코드 최신 동향과 대응
 
지능형지속위협공격 최신동향 분석
지능형지속위협공격 최신동향 분석지능형지속위협공격 최신동향 분석
지능형지속위협공격 최신동향 분석
 
랜섬웨어 vs 윈도우 10
랜섬웨어 vs 윈도우 10랜섬웨어 vs 윈도우 10
랜섬웨어 vs 윈도우 10
 
1.악성코드 최신 동향과 기법
1.악성코드 최신 동향과 기법1.악성코드 최신 동향과 기법
1.악성코드 최신 동향과 기법
 
보안 위협 동향과 대응 방안
보안 위협 동향과 대응 방안보안 위협 동향과 대응 방안
보안 위협 동향과 대응 방안
 
3. 악성코드 분석 사례
3. 악성코드 분석 사례3. 악성코드 분석 사례
3. 악성코드 분석 사례
 
랜섬웨어(Ransomware)와 AWS 클라우드 보안 - 신용녀 (AWS 솔루션즈아키텍트) :: 특별 보안 웨비나
랜섬웨어(Ransomware)와 AWS 클라우드 보안 - 신용녀 (AWS 솔루션즈아키텍트) :: 특별 보안 웨비나랜섬웨어(Ransomware)와 AWS 클라우드 보안 - 신용녀 (AWS 솔루션즈아키텍트) :: 특별 보안 웨비나
랜섬웨어(Ransomware)와 AWS 클라우드 보안 - 신용녀 (AWS 솔루션즈아키텍트) :: 특별 보안 웨비나
 

More from GangSeok Lee

[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
[2014 CodeEngn Conference 11] 박한범 - 가상화 기술과 보안
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] 정든품바 - 웹성코드
[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] 노용환 - 디버거 개발, 삽질기
 
[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] 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 보안컨설팅 인턴쉽
 
[2010 CodeEngn Conference 04] Max - Fighting against Botnet
[2010 CodeEngn Conference 04] Max - Fighting against Botnet[2010 CodeEngn Conference 04] Max - Fighting against Botnet
[2010 CodeEngn Conference 04] Max - Fighting against Botnet
 
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
[2010 CodeEngn Conference 04] window31 - Art of Keylogging 키보드보안과 관계없는 키로거들
 
[2010 CodeEngn Conference 04] hahah - Defcon 18 CTF 문제풀이
[2010 CodeEngn Conference 04] hahah - Defcon 18 CTF 문제풀이[2010 CodeEngn Conference 04] hahah - Defcon 18 CTF 문제풀이
[2010 CodeEngn Conference 04] hahah - Defcon 18 CTF 문제풀이
 

Recently uploaded

Grid Layout (Kitworks Team Study 장현정 발표자료)
Grid Layout (Kitworks Team Study 장현정 발표자료)Grid Layout (Kitworks Team Study 장현정 발표자료)
Grid Layout (Kitworks Team Study 장현정 발표자료)
Wonjun Hwang
 

Recently uploaded (7)

Grid Layout (Kitworks Team Study 장현정 발표자료)
Grid Layout (Kitworks Team Study 장현정 발표자료)Grid Layout (Kitworks Team Study 장현정 발표자료)
Grid Layout (Kitworks Team Study 장현정 발표자료)
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
도심 하늘에서 시속 200km로 비행할 수 있는 미래 항공 모빌리티 'S-A2'
도심 하늘에서 시속 200km로 비행할 수 있는 미래 항공 모빌리티 'S-A2'도심 하늘에서 시속 200km로 비행할 수 있는 미래 항공 모빌리티 'S-A2'
도심 하늘에서 시속 200km로 비행할 수 있는 미래 항공 모빌리티 'S-A2'
 
[Terra] Terra Money: Stability and Adoption
[Terra] Terra Money: Stability and Adoption[Terra] Terra Money: Stability and Adoption
[Terra] Terra Money: Stability and Adoption
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 

[2009 CodeEngn Conference 03] sionics, kaientt - (파일바이러스 치료로직 개발자 입장에서 본) 파일 바이러스 분석

  • 1. File Infector Virus Analysis (from the point of view of an anti-virus developer) sionics , kaientt @issuemakerslab.com 3rd CodeEngn ReverseEngineering Seminar
  • 2. 2 Agenda 0x00 Malware Trends 0x01 File Infector and NOT infector 0x02 Prior Knowledge - PE Format 0x03 File Infection Techniques 0x04 File Infector Virus Analysis – Demonstration 0x05 Development of disinfection code 3rd CodeEngn ReverseEngineering Seminar
  • 3. 3 0x00 Malware Trends 0x00 Malware Trends 3rd CodeEngn ReverseEngineering Seminar
  • 4. 4 The growth of malware Source: Andreas Marx, http://www.av-test.org 3rd CodeEngn ReverseEngineering Seminar
  • 5. 5 The growth of malware Source: McAfee Avert Labs (20 Million Malware Samples) 3rd CodeEngn ReverseEngineering Seminar
  • 6. 6 The growth of malware Source: Symantec Corporation Internet Security Threat Report Volume XIV: April, 2009 (New malicious code signatures) 3rd CodeEngn ReverseEngineering Seminar
  • 7. 7 The growth of malware Source: Symantec Corporation Internet Security Threat Report Volume XIV: April, 2009 (Malicious code types) Today's main threats are simple Trojan horses and worms, not file-infectors. BUT, 3rd CodeEngn ReverseEngineering Seminar
  • 8. 8 file infectors will increase again >In this age of botnets, rootkits, spyware, and other bleeding-edge security threats, file infectors are frequently thought of as a dead threat. >Historically, file viruses were among the very first types of virus, dating back to the 1980's. >recent increase in network file-infecting viruses >file infectors will increase again 3rd CodeEngn ReverseEngineering Seminar
  • 9. 9 Advantage of File Infector >생존 시간 증가 — 트로이목마 등의 단일파일 악성코드는 탐지가 쉬우며 치료가 파일 삭제 — 하나 이상의 파일을 감염 — 기존 실행파일들에 감염되면 사용자가 쉽게 감염여부 판단이 어려움 > 은폐기능 추가 시 더 어려움 >진단과 치료 — Not Infector > Trojan, Worm, Backdoor 등, 진단시 파일 삭제만으로 치료가능 — File Infector > 감염된 모든 실행 가능한 파일 > 잘못된 진단과 잘못된 치료는 곧 업체의 신뢰성 하락과 고객의 외면 > 어느 정도의 분석 시간과 테스트 기간 필요 – 탐지 회피/지연 목적의 기법 – EPO(Entry-Point Obscuring), Polymorphism 3rd CodeEngn ReverseEngineering Seminar
  • 10. 10 Malware Statistics Monthly Malware Statistics: may 2009 (from Kaspersky Lab) IFrame.aga is one more version of the iframe that the now widespread Virus.Win32.Virut.ce uses to infect web pages. And Sality.ae is the latest version of the well-known Sality virus. 3rd CodeEngn ReverseEngineering Seminar
  • 11. 11 0x01 File Infector and NOT infector 0x01 File Infector and NOT infector 3rd CodeEngn ReverseEngineering Seminar
  • 12. 12 File infector virus Glossary 3rd CodeEngn ReverseEngineering Seminar
  • 13. 13 File Infector and NOT infector NOT infector - Trojan, Backdoor, Worm, Rootkit, Spyware, Adware File Infector - Virus (Parite, Virut, Sality, Alman) 3rd CodeEngn ReverseEngineering Seminar
  • 14. 14 File Infector and NOT infector NOT infector - 파일 자체가 악성 - 치료 : 파일 자체를 삭제 3rd CodeEngn ReverseEngineering Seminar
  • 15. 15 File Infector and NOT infector File Infector - 기존 정상 파일에 바이러스 코드를 추가 - 치료 : 바이러스 코드 부분만 삭제 (정상 파일로 복구) 3rd CodeEngn ReverseEngineering Seminar
  • 16. 16 Common Malicious Code Analysis >Dynamic Analysis >Static Analysis >Most modern malware use some sort of runtime packer (70-90%) — If static analysis of malware is needed, protective layer(s) must be opened 3rd CodeEngn ReverseEngineering Seminar
  • 17. 17 실행압축 해제 루틴 (복호화) 실행압축 (암호화) 일반 실행 파일 실행압축된 실행 파일 Executable compression 3rd CodeEngn ReverseEngineering Seminar
  • 18. 18 (Bonus) Common Malware Behavior - Analysis >최초 감염 — 취약점(80% 이상)을 통한 최초 파일 생성 >파일 생성 — 자신복사, 다운로드, 드롭 >실행되도록 등록 (부팅 시) — 레지스트리, 서비스, BHO >동작 — 프로세스, 쓰레드, DLL Injection >네트워크 활동 — 포트 오픈, 특정 도메인/포트 접속, IRC 접속 >악성행위 — 보안기능 비활성화, 온라인 게임 계정 절취, DDoS, 스팸메일 발송 3rd CodeEngn ReverseEngineering Seminar
  • 19. 19 최초 감염 >브라우저/윈도우 취약점을 Exploit한 후 파일 생성 — Buffer Overflow (Heap, Stack) — Format String — Privilege Escalation — Memory Corruption >탐지 — 일반적인 다운로드와 다름 > 사용자 모르게 파일이 생성되고 실행됨 — Shellcode 3rd CodeEngn ReverseEngineering Seminar
  • 20. 20 일반적인 파일 다운로드 (사용자가 인지) Memory Corruption에 의한 파일 다운로드 (사용자 인지 불가능) 3rd CodeEngn ReverseEngineering Seminar
  • 21. 21 파일 생성 >자신복사, 다운로드, 드롭 >파일/디렉토리 관련 API — CreateFile — ReadFile — WriteFile — CopyFile — GetSystemDirectory — GetWindowsDirectory 3rd CodeEngn ReverseEngineering Seminar
  • 22. 22 최초 파일 최초 파일 최초 파일 인터넷 파일 #1 최초 파일 파일 복사 다운로드 드롭 임시 디렉토리 (Temp) www.x.com/a.exe 윈도우 시스템 디렉토리 (windowssystem32) 파일 생성 3rd CodeEngn ReverseEngineering Seminar
  • 24. 24 다운로드 >관련 API — URLDownloadToFileA 3rd CodeEngn ReverseEngineering Seminar
  • 26. 26 드롭 >리소스 섹션 등으로부터 내부의 파일을 드롭함 >관련 API — FindResourceA — LoadResource 3rd CodeEngn ReverseEngineering Seminar
  • 29. 29 실행되도록 등록 (부팅 시) >레지스트리, 서비스, BHO >관련 API — RegCreateKey — RegOpenKeyEx — RegSetValueEx — RegQueryValueEx — CreateServiceA — OpenServiceA — StartServiceA 3rd CodeEngn ReverseEngineering Seminar
  • 30. 30 실행되도록 등록 (부팅 시) >시스템 재 시작시에 자동으로 실행되도록 설정 >해당 레지스트리 경로 — HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun — HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon — HKLMSOFTWAREMicrosoftWindows NTCurrentVersionImage File Execution Options — HKMLSYSTEMCurrentControlSetServices 3rd CodeEngn ReverseEngineering Seminar
  • 31. 31 실행되도록 등록 (부팅 시) 3rd CodeEngn ReverseEngineering Seminar
  • 32. 32 프로세스 동작 >프로세스, 쓰레드, DLL Injection, 서비스 >관련 API — CreateProcess — FindProcess — TerminateProcess — CreateThread — CreateRemoteThread — ShellExecute — StartServiceA 3rd CodeEngn ReverseEngineering Seminar
  • 33. 33 DLL을 인젝션 하기 위한 프로세스 검색 프로세스 동작 3rd CodeEngn ReverseEngineering Seminar
  • 34. 34 CreateRemoteThread를 이용한 DLL Injection 프로세스 동작 3rd CodeEngn ReverseEngineering Seminar
  • 35. 35 네트워크 활동 >포트 오픈, 특정 도메인/포트 접속, IRC 접속 >관련 API — WSAStartup — WSASend — socket — send — recv — listen — accept — gethostbyname — InternetGetConnectedState 3rd CodeEngn ReverseEngineering Seminar
  • 36. 36 네트워크 활동 3rd CodeEngn ReverseEngineering Seminar
  • 37. 37 악성행위 >보안기능 비활성화, 온라인 게임 계정 절취, DDoS, 스팸메일 발송 3rd CodeEngn ReverseEngineering Seminar
  • 38. 38 온라인 게임/포털 사이트 계정 절취를 위한 네트워크 관련 API 후킹 악성행위 3rd CodeEngn ReverseEngineering Seminar
  • 39. 39 국산 백신 제품들의 업데이트를 방해하는 코드 루틴 악성행위 3rd CodeEngn ReverseEngineering Seminar
  • 41. 41 Malicious Behavior Analysis Demonstration Virut Malicious Behavior (related API, IRCBot) 3rd CodeEngn ReverseEngineering Seminar
  • 42. 42 0x02 Prior Knowledge 0x02 Prior Knowledge - PE Format 3rd CodeEngn ReverseEngineering Seminar
  • 43. 43 PE Format Poster - Ero Carrera 3rd CodeEngn ReverseEngineering Seminar
  • 44. 44 MZ header PE header Section 1 Section 2 Section n Section table File Headers : MZ Header 3rd CodeEngn ReverseEngineering Seminar
  • 45. 45 MZ header PE header Section 1 Section 2 Section n Section table File Headers : PE Header 3rd CodeEngn ReverseEngineering Seminar
  • 46. 46 MZ header PE header Section 1 Section 2 Section n Section table File header Optional header File Headers : File Header 3rd CodeEngn ReverseEngineering Seminar
  • 47. 47 MZ header PE header Section 1 Section 2 Section n Section table File header Optional header File Headers : Optional Header 3rd CodeEngn ReverseEngineering Seminar
  • 48. 48 MZ header PE header Section 1 Section 2 Section n Section table File Headers : Section Header Section header Section header Section header Section header 3rd CodeEngn ReverseEngineering Seminar
  • 49. 49 0x03 File Infection Techniques 0x03 File Infection Techniques 3rd CodeEngn ReverseEngineering Seminar
  • 50. 50 File Infection Techniques Header Section #1 Section #2 Section #n EPOEP OEP Section #n+1 File Infector Virus - change the entry-point - add section animation 3rd CodeEngn ReverseEngineering Seminar
  • 51. 51 File Infection Techniques Header Section #1 Section #2 Section #n EPOEP Section #n File Infector Virus OEP - change the entry-point - increase last section size animation 3rd CodeEngn ReverseEngineering Seminar
  • 52. 52 Section #1 File Infection Techniques Header Section #2 Section #n EP Section #n+1 File Infector Virus - patched code at EPanimation 3rd CodeEngn ReverseEngineering Seminar
  • 53. 53 Section #1 File Infection Techniques – EPO(Entry-Point Obscuring) Header Section #2 Section #n EP Section #n+1 File Infector Virus - patched with a jump/call routine at somewhere animation 3rd CodeEngn ReverseEngineering Seminar
  • 54. 54 File Infection Techniques >injects code in running processes and hooks the following functions in ntdll.dll which transfers control to the virus every time any of these function calls are made >NtCreateFile >NtCreateProcess >NtCreateProcessEx >NtOpenFile >NtQueryInformationProcess 3rd CodeEngn ReverseEngineering Seminar
  • 55. 55 File Infector virus features >Code Execution Starts in the Last Section >Suspicious Section Characteristics >Suspicious Code Redirection (EPO) >Suspicious Code Section Name >identifier marks of the virus 3rd CodeEngn ReverseEngineering Seminar
  • 56. 56 identifier marks of the virus Virut 3rd CodeEngn ReverseEngineering Seminar
  • 57. 57 Encode/Decode Operation >XOR >NEG >ADD, SUB >ROR, ROL 3rd CodeEngn ReverseEngineering Seminar
  • 58. 58 Polymorphism >mov eax, [edx] >add eax, 17E0D0DCh >mov [edx], eax >push dword ptr [edx] >pop eax >add eax, 17E0D0DCh >push eax >pop dword ptr [edx] 3rd CodeEngn ReverseEngineering Seminar
  • 59. 59 Dummy Code >mov eax, eax >push eax >pop eax >nop 3rd CodeEngn ReverseEngineering Seminar
  • 60. 60 0x04 File Infector Virus Analysis – Demonstration 0x04 File Infector Virus Analysis – Demonstration 3rd CodeEngn ReverseEngineering Seminar
  • 61. 61 File Infector Virus Analysis how to get malware samples 3rd CodeEngn ReverseEngineering Seminar
  • 62. 62 Malware Sample http://www.offensivecomputing.net/ (Offensive Computing) 3rd CodeEngn ReverseEngineering Seminar
  • 63. 63 Malware Sample http://vx.netlux.org/vl.php (VX Heavens) 3rd CodeEngn ReverseEngineering Seminar
  • 64. 64 Malware Sample http://cafe.naver.com/malzero (바이러스 제로 시즌 2) 3rd CodeEngn ReverseEngineering Seminar
  • 65. 65 Approach for File Infector Virus Analysis >File Compare, Original and Infected File >Top-Down — 1. VEP (Infected_EP or Patched_Code) — 2. Decode_Loop — 3. Decode_Key — 4. Find restore OEP routine — 5. OEP offset > (OEP or Original_Code_before_Patched address) >Bottom-Up — 1. VEP (Infected_EP or Patched_Code) — 2. Find restore OEP routine > (set BP at OEP or Original_Code_before_Patched address) — 3. Check if data is encoded — 4. Decode_Loop — 5. Decode_Key 3rd CodeEngn ReverseEngineering Seminar
  • 66. 66 Parite.A >It's terrible 3rd CodeEngn ReverseEngineering Seminar
  • 67. 67 Parite.A Header Section #1 Section #2 Section #n EPOEP OEP Section #n+1 Parite.A Decode routine Encoded - encoded XOR operations animation 3rd CodeEngn ReverseEngineering Seminar
  • 68. 68 Polymorphism in Parite.A > xor 연산의 피연산자 중 xor_key 구하는 것 > (1) — push xor_key — pop [register] > (2) — mov [register], xor_key > xor 연산의 피연산자중 디코드된 데이터 구하는 것 > (1) — push [데이터 주소] — xor [esp], xor_key — pop [데이터 주소] > (2) — xor [데이터 주소], xor_key > 카운터 증가 > (1) — sub edi, 3 — dec edi > (2) — sub edi, 4 3rd CodeEngn ReverseEngineering Seminar
  • 69. 69 File Infector Virus Analysis Parite.A Demonstration (Top-Down) IDA 3rd CodeEngn ReverseEngineering Seminar
  • 70. 70 Sality.AE Header Section #1 Section #2 Section #nSection #n Sality.AE -EPO (Entry-Point Obscuring) - ADD or SUB EP CALL Decode routine Original Code Encoded animation 3rd CodeEngn ReverseEngineering Seminar
  • 71. 71 Polymorphism in Sality.AE 3rd CodeEngn ReverseEngineering Seminar
  • 72. 72 Polymorphism in Sality.AE 3rd CodeEngn ReverseEngineering Seminar
  • 73. 73 File Infector Virus Analysis Sality.AE Demonstration (Bottom-Up) Ollydbg, IDA 3rd CodeEngn ReverseEngineering Seminar
  • 74. 74 0x05 Development of disinfection code 0x05 Development of disinfection code Parite.A Sality.AE 3rd CodeEngn ReverseEngineering Seminar
  • 75. 75 Development of disinfection code Needed Precise PE parser Strong disassembler Development using Python pefile - Ero Carrera pydasm – Ero Carrera 3rd CodeEngn ReverseEngineering Seminar
  • 76. 76 >instruction opcode VS. instruction operands >E8 ???????? => CALL XXXXXXXX >68 332211E8 => PUSH E8112233 >68332211E8E840100000 Why Need Disassembler 3rd CodeEngn ReverseEngineering Seminar
  • 77. 77 Development of disinfection code 3rd CodeEngn ReverseEngineering Seminar
  • 78. 78 Consideration >Virus를 치료시 Overlay에 대한 고려 >Virus가 추가한 section의 Data를 지우거나 section 자체를 지울 경우 — Optional header의 SizeOfImage를 계산 후 수정 >JMP나 CALL 호출을 할 경우 해당 주소의 범위 체크 >pydasm을 사용할 경우 지원하지 않는 OP Code에 대한 예외처리 — Sality.AE (SAL: shift arithmetic left) 3rd CodeEngn ReverseEngineering Seminar
  • 79. 79 Scan Filter >PE 파일인지 체크 >EP가 마지막 section에서 시작하는지 체크 (Parite.A) >OPTIONAL_HEADER의 Magic Signature 체크 >OPTIONAL_HEADER의 Subsystem 체크 3rd CodeEngn ReverseEngineering Seminar
  • 80. 80 Scan Filter >FILE_HEADER의 Characteristics 체크 >마지막 section의 SizeOfRawData 가 0x1000 이하인지 체크(Parite.A) >마지막 section의 Characteristics 체크 3rd CodeEngn ReverseEngineering Seminar
  • 81. 81 Parite.A detection > Step 1: — Find Decode Key — 가장 처음의 [push] or [mov]의 오퍼랜드 데이터 > Step 2: — Encoded Data의 시작위치 찾기 — Decode Key를 찾은 이후 나오는 [push] or [mov] 의 오퍼랜드 데이터 > Step 3: — Encode Data의 시작 위치로 부터 4Byte 가져오기 — Test_Data를 찾는 과정 > Step 4: — (복호화된 데이터는 항상 일정) — Decode_Key와 Test_Data를 XOR연산 후 0x00017D8 인지 확인하여 Parite.A 식별 3rd CodeEngn ReverseEngineering Seminar
  • 82. 82 Parite.A disinfection > Step 1: — Encoded_Data의 시작 위치로 부터 약 72Byte를 Decode_Key로 Decode > Step 2: — Decode 된 Data의 특정 위치에서 OEP, IAT Offset 등의 값을 추출 > Step 3: — Parite.A가 추가한 마지막 section header 삭제 — Calc New SizeOfImage — NumberOfSections 카운트 1 감소 — OEP 및 Import Address Table, Import Name Table의 값 복구 > Step 4: — Parite.A가 추가한 마지막 section Data 삭제 3rd CodeEngn ReverseEngineering Seminar
  • 83. 83 Development of disinfection code Parite.A Demonstration 3rd CodeEngn ReverseEngineering Seminar
  • 84. 84 Virus.Sality.AE detection >1단계 — 마지막 섹션으로 점프하는 CALL (E8) 찾기 >2단계 — 처음 나오는 CALL (E8) 찾기 >3단계 — 디코드 루프 찾기 — JMP (E9) 식별하기 > 디코드된 데이터의 시작 위치 찾기 >4단계 — X-Ray 기법 > decode_key 찾기, decode_key와 특정 데이터 연산 후 Sality.AE 식별 3rd CodeEngn ReverseEngineering Seminar
  • 85. 85 >Decode Key를 모르는 상태에서 Encode Data와 Decode Data를 알 경우 Key를 알아내는 방법 >ADD >SUB Using X-Ray Method + = -= - = -= Decode Key 0x???????? Decode Data 0x000000E8 Encode Data 0xFC75F238 Decode Data 0x000000E8 Encode Data 0xFC75F238 Decode Key 0x???????? Decode Key 0x038A0EB0 Decode Key 0x???????? Decode Key 0x???????? Decode Key 0x21E5ABD8 + = Decode Key 0x038A0EB0 Decode Data 0x000000E8 Decode Data 0x000000E8 Encode Data 0x21E5ACC0 Encode Data 0x21E5ACC0 Encode Data 0xE9F74E50 Decode Data 0xED815D00 - =Decode Key 0x21E5ABD8 Decode Data 0xED815D00 Encode Data 0x0F6708D8 3rd CodeEngn ReverseEngineering Seminar
  • 86. 86 86 Virus.Sality.AE disinfection >disinfection — Encode Data 영역 Decode 후 Original Code before Patched (EPO) 복구 — Overlay 식별 — 바이러스 코드 시작위치부터 삭제 — Section header의 Section size 관련 필드 조정 > SizeOfRawData > VirtualSize — Optional header의 SizeOfImage 조정 — Overlay가 있을 경우 Overlay 복구 3rd CodeEngn ReverseEngineering Seminar
  • 87. 87 Development of disinfection code Sality.AE Demonstration 3rd CodeEngn ReverseEngineering Seminar
  • 88. 88 Questions Questions? contact us via e-mail sionics 0x40 issuemakerslab.com kaientt 0x40 issuemakerslab.com 3rd CodeEngn ReverseEngineering Seminar