1. 악성코드 진단 기법 개론
2009.05.20
㈜ 안철수연구소
ASEC (AhnLab Security Emergency response Center)
Anti-Virus Researcher, CISSP
장 영 준 주임 연구원
2. 1. PE Format 개론
1. PE (Portable Executable) Format
Win32 기반의 윈도우 운영체제에서 실행 가능한 파일 형식
PE 형식은 유닉스의 COFF(Common Object File Format)에서 유래
MZ 는 PE를 만든 Mark Zbilowski의 이니셜
[PE 파일]
2
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
3. 1. PE Format 개론
2. PE (Portable Executable) Format 파일 생성 순서
컴파일
링크
가독성이 있는 소스코드
심볼과 바이너리 코드
바이너리 코드
3
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
4. 1. PE Format 개론
3. PE (Portable Executable) Format 구조
PE와 관련된 구조체
PE Header 뒤에 오는 구조체의 배열
.text – 실행 가능한 코드 영역
.data – 초기화된 전역 변수 영역
.rdata – 읽기 전용 데이터 섹션
.idata – Import 함수 정보 영역
.edata – Export 함수 정보 영역
.rsrc – 리소스 데이터 영역
4
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
5. 1. PE Format 개론
4. PE (Portable Executable) Header
시작점
로드주소
5
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
6. 1. PE Format 개론
5. Win32/Dellboy.AH에 의한 EP 변경
[정상 파일]
[감염 파일]
6
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
7. 1. PE Format 개론
5. Win32/Dellboy.AH에 의한 Section 변경
[정상 파일]
7
[감염 파일]
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
8. 1. PE Format 개론
5. Win32/Dellboy.AH에 의한 전체 구조 변경
0h
0h
Dos Header
Dos Header
PE Header
PE Header
Section 1 Header
Section 1 Header
Section 2 Header
Section 2 Header
400h
NULL
.aaa0
1000h
400h
.text
.aaa1
Entry Point
55,8B,EC,6A
Entry Point
9C,60,E8,00
NULL
8000h
27800h
.rdata
.aaa2
2864Eh
.data ~ .rsrc
D000h
[정상 파일]
(53,248 바이트)
8
정상 파일
3566Ch
[165,484 바이트 증가]
[감염 파일]
(218,732 바이트)
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
9. 2. 악성코드 진단 기법
1. String 기반 진단
악성코드 내부 특정 코드 영역을 진단의 위치로 선정
가장 간단하고 빠르게 진단할 수 있는 기법
[Win-Trojan/OnlineGameHack.86016.CC 의 String 일부]
9
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
10. 2. 악성코드 진단 기법
2. Generic 진단
특정 악성코드의 집합의 공통된 OPcode(Operation Code) 영역을
진단 위치로 선정
알려지지 않은 변형들에 대해 유연하게 대응 가능
[Win-Trojan/OnlineGameHack.86016.CC의 I.E 인젝션 코드 일부]
10
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
11. 2. 악성코드 진단 기법
3. Heuristic진단
기존에 알려진 악성코드의 일반적인 특성을 바탕으로 그와 얼마나
유사한 코드를 가지고 있는가를 비교
* Static Heuristic Detection
악성코드의 실행 없이 기존 악성코드와 얼마나 많은 유사한 코드를
가지고 있는가를 비교 판단
* Dynamic Heuristic Detection
SandBox 또는 Emulator Buffer 를 이용하여 악성코드 실행시 나타나는 증상
을 바탕으로 기존에 알려진 악성코드와 얼마나 유사한가를 판단
11
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
12. AhnLab
The Joy of Care-Free Your Internet World
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.
AhnLab, the AhnLab logo, and V3 are trademarks or registered trademarks of AhnLab, Inc.,
in Korea and certain other countries. All other trademarks mentioned in this document are the property of their respective owners.
12
Copyright (C) AhnLab, Inc. 1988-2009. All rights reserved.