SlideShare a Scribd company logo
1 of 36
Download to read offline
MS-LogParser를 활용한
WebShell 탐지
파일 업로드 취약점
최일선
1E-mail : isc0304@naver.com Writing by Ilsun Choi
Index
2E-mail : isc0304@naver.com Writing by Ilsun Choi
1. Log Parser 2.2 개요
1) 특징 : 다양한 용도
2) LogParser 기본 사용법
2. IISW3C Log 분석 : Fields
3. IISW3C Log 분석 : Example Queries
4. 실습
1) 스크립트 제작
2) 분석
3) Log 분석 결과
4) 대응방안
부록. LogPaser GUI 버전
참고 문헌
1. Log Parser 2.2 개요
• Windows 운영 체제의 핵심 데이터 원본에 대
한 범용 쿼리 액세스를 제공
• 로그 파일, XML 파일, CSV 파일 등과 같은 텍
스트 기반 지원
• 이벤트 로그, 레지스트, 파일 시스템, Active
Directory 지원
• 모든 것을 데이터베이스로 사용
3
MS - Log Parser 웹사이트
E-mail : isc0304@naver.com Writing by Ilsun Choi
• 광범위한 용도의 특성 때문에 전문 서적이 제작됨
4E-mail : isc0304@naver.com Writing by Ilsun Choi
1. Log Parser 2.2 개요 > 1) 특징
• 다음과 같이 –h 옵션을 사용하면 도움말이 출력된다.
5
 logparser 도움말 출력
 logparser Usage Help
 SQL Query Help
E-mail : isc0304@naver.com Writing by Ilsun Choi
1. Log Parser 2.2 개요 > 2) 기본 사용법[1/3]
A. 기본 형식
• 우리가 사용할 구문은 다음과 같은 형식으로 간소화할 수 있다.
6
LogParser.exe –i:[입력형식] –o:[출력형식]
“SELECT [필드명]
INTO [출력파일명]
FROM ex*.log
GROUP BY [필드명]
WHERE [조건]
ORDER BY [필드명] ASC|DESC”
E-mail : isc0304@naver.com Writing by Ilsun Choi
1. Log Parser 2.2 개요 > 2) 기본 사용법[2/3]
B. 다양한 도움말
• 다양한 형식을 지원하기 때문에 여러 도움말이 존재한다.
7
 logparser 입출력 형식
 그림 2.2.2. logparser에 내장된 예제 출력
 그림 2.2.3. IISW3C의 포맷 도움말
E-mail : isc0304@naver.com Writing by Ilsun Choi
1. Log Parser 2.2 개요 > 2) 기본 사용법[2/3]
2. IISW3C Log 분석 : Fields
Field Name Description Uses
Date (date) The date of the request. Event correlation.
Time (time) The UTC time of the request. Event correlation, determine time zone, identif
y scanning scripts.
Client IP Address (
c-ip)
The IP address of the client or
proxy that sent the request.
Identify user or proxy server.
User Name (cs-us
ername)
The user name used to authent
icate to the resource.
Identify compromised user passwords.
Service Name (s-si
tename)
The W3SVC instance number o
f the site accessed.
Can verify the site accessed if the log files ar
e later moved from the system.
Server Name (s-co
mputername)
The Windows host name assig
ned to the system that generat
ed the log entry.
Can verify the server accessed if the log files
are later moved from the system.
Server IP Address (
s-ip)
The IP address that received th
e request.
Can verify the IP address accessed if the log
files are later moved from the system or if the
server is moved to a new location.
Server Port (s-port
)
The TCP port that received the
request.
To verify the port when correlating with other t
ypes of log files.
Method (cs-metho
d)
The HTTP method used by the
client.
Can help track down abuse of scripts or exec
utables.
URI Stem (cs-uri-
stem)
The resource accessed on the
server.
Can identify attack vectors.
URI Query (cs-uri-
query)
The contents of the query strin
g portion of the URI.
Can identify injection of malicious data.
8
Field Name Description Uses
Protocol Status (s
c-status)
The result code sent to the cl
ient.
Can identify CGI scans, SQL injection and
other intrusions.
Win32 Status (sc-
win32-status)
The Win32 error code produc
ed by the request.
Can help identify script abuse.
Bytes Sent (sc-by
tes)
The number of bytes sent to
the client.
Can help identify unusual traffic from a sin
gle script.
Bytes Received (c
s-bytes)
The number of bytes receive
d from the client.
Can help identify unusual traffic to a single
script.
Time Taken (time
-taken)
The amount of server time, in
milliseconds, taken to proces
s the request.
Can identify unusual activity from a single s
cript.
Protocol Version (
cs-version)
The HTTP protocol version s
upplied by the client.
Can help identify older scripts or browsers.
Host (cs-host) The contents of the HTTP Ho
st header sent by the client.
Can determine if the user browsed to the si
te by IP address or host name.
User Agent (cs(U
ser-Agent))
The contents of the HTTP Us
er-Agent header sent by the
client.
Can help uniquely identify users or attack s
cripts.
Cookie (cs(Cooki
e))
The contents of the HTTP Co
okie header sent by the client
.
Can help uniquely identify users.
Referer (cs(Refer
er))
The contents of the HTTP Re
ferer header sent by the clien
t.
Can help identify the source of an attack or
see if an attacker is using search engines t
o find vulnerable sites.
E-mail : isc0304@naver.com Writing by Ilsun Choi
• 주요 항목은 노란색으로 강조하였다.
3. IISW3C Log 분석 > Example Queries [1/9]
9
1. Tracing Attack
Logparser
"SELECT DISTINCT
TO_LOWERCASE(cs-uri-stem)
AS URL, Count(*) AS Hits
FROM ex*.log
WHERE sc-status=200
GROUP BY URL
ORDER BY HITS"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
10
2. Last Write Time
Logparser -i:FS
"SELECT TOP 20 Path, LastWriteTime
FROM *.*
ORDER BY LastWriteTime DESC"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [2/9]
11
3. Count Number of Hits by a Client
logparser
"SELECT DISTINCT date, cs-uri-stem, c-ip,
Count(*) AS Hits
FROM ex*.log
GROUP BY date, c-ip, cs-uri-stem
HAVING Hits>100
ORDER BY Hits DESC"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [3/9]
12
4. 404 > Error Page Response
logparser
"SELECT cs-uri-query, Count(*) AS Total
FROM ex*.log
WHERE sc-status>=404
GROUP BY cs-uri-query
ORDER BY Total DESC"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [4/9]
13
5. Specific client ip order by hits
logparser
"SELECT DISTINCT TO_LOWERCASE(cs-uri-
stem) AS URL, Count(*) As HITS
FROM ex*.log
WHERE sc-status=200
and c-ip='211.34.150.3'
GROUP BY URL
ORDER BY hits"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [5/9]
14
6. Count number of urls if the file name extension is asp or exe
logparser
"SELECT cs-uri-stem, Count(*) as Hits, AVG(time-taken) AS Avg,
Max(time-taken) AS Max, Min(time-taken) AS Min,
Sum(time-taken) AS Total
FROM ex*.log
WHERE TO_LOWERCASE(cs-uri-stem)
LIKE '%.asp%'
OR TO_LOWERCASE(cs-uri-stem)
LIKE '%.exe%'
GROUP BY cs-uri-stem
ORDER BY cs-uri-stem"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [6/9]
15
7. Win32 error
logparser
"SELECT cs-uri-stem,
WIN32_ERROR_DESCRIPTION(sc-win32-status)
as Error, Count(*) AS Total
FROM ex*.log
WHERE sc-win32-status>0
AND (TO_LOWERCASE(cs-uri-stem)
LIKE '%.asp%'
OR TO_LOWERCASE(cs-uri-stem)
LIKE '%.exe%')
GROUP BY cs-uri-stem, Error
ORDER BY cs-uri-stem, Error
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [7/9]
16
8. Count numbers Classified according to the error and the url
logparser
"SELECT cs-uri-stem, sc-status, Count(*) AS Total
FROM ex*.log
WHERE TO_LOWERCASE(cs-uri-stem) LIKE '%.asp%'
OR TO_LOWERCASE(cs-uri-stem) LIKE '%.exe%'
GROUP BY cs-uri-stem, sc-status
ORDER BY cs-uri-stem, sc-status"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [8/9]
17
9. Error Report about the pages over 500 error code
logparser
"SELECT cs-uri-query, Count(*) AS Total
FROM ex*.log
WHERE sc-status>=500
GROUP BY cs-uri-query
ORDER BY Total DESC"
-rtp:-1
E-mail : isc0304@naver.com Writing by Ilsun Choi
3. IISW3C Log 분석 > Example Queries [9/9]
4. 실습
18E-mail : isc0304@naver.com Writing by Ilsun Choi
SEC 스터디에서 제공 받은 실제 웹셸 탐지 사례의 LOG를 사용하여 해당 웹의 로그를 분석
(SEC 스터디: 웹 모의해킹과 시큐어코딩 가이드 – 최경철 저자 스터디 까페)
LOG만을 사용하여 분석했기 때문에 일부 오탐 및 미탐이 존재할 수 있음
4. 실습 > 1) 스크립트 제작
• 로그 분석 예제 -> Python 스크립트
19
 LogParser 자동화를 위한 Python 스크립트  Python 스크립트 실행 결과
E-mail : isc0304@naver.com Writing by Ilsun Choi
• 두 가지의 의심스러운 점을 발견
I. DoS Attack?
II. Web Shell?
20E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
• GET Flooding 공격으로 추측
• 해당 웹서버에 IPS 동작 하지 않음.
21
 count_hit.csv 파일 - 1  count_hit.csv 파일 - 2
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
I. DoS Attack
• 가장 최근에 발생된 DoS 공격 시기인 2월 2일의 로그 파일이다.
22
 ex080202.log 파일 211.34.150.3 첫 번째 검색  ex080202.log 파일 211.34.150.3 마지막 요청 검색
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
I. DoS Attack > ex080202.log 파일 분석[1/3]
• %를 사용한 인증 우회가 있었는지 검사.
• ‘ 와 1=1 같은 인증을 우회하려는 시도 감지.
• 3초 단위로 공격.
• 정상적인 방법으로 URL에 접근하지 않음.
23
 ex080202.log 파일 : % 검색
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
I. DoS Attack > ex080202.log 파일 분석[2/3]
• https://db-ip.com/ 을 통해서 공격으로 추측되는 행위를 한 IP를 추적하였다.
24
 DoS 공격으로 추측되는 IP  인젝션으로 인증 우회를 시도한 IP
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
I. DoS Attack > ex080202.log 파일 분석[3/3]
• 같은 IP 주소의 첫 공격
• 1월 4일 10시 45분 경부터 1월 5일 1시 35분
• 서버 관리자는 첫 번째 공격 의심 로그 이후에도 해당 IP를 차단하지 않음
25
 첫 번째 DoS 공격
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
I. DoS Attack > ex080104.log 파일 분석
• 로그를 통한 웹셸 탐지 방법
1) 히트 수가 비정상적으로 적은 파일
2) 비정상적인 이름을 사용하는 파일
3) Upload PATH를 위치하는 파일
26E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
II. Web Shell Detect
• 히트 수를 오름차순으로 정렬
• dll이나 jpg, gif 등 검사에 불필요한 파
일이 섞여있음
• 히트 수 50 이하의 파일이 500개가 넘
기 때문에 목록 필터링이 필요하다.
27
그림 5.2.2.1. tracing_attack.cvs
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
II. Web Shell Detect > tracing_attack.csv
• Python Script로 불필요한 파일들을 걸러내었다.
• 히트 수 50 이하 파일이 100 여 개로 줄어 분석이 용이해졌다.
• 63번, 65번 라인에서 조건에 합하는 파일을 찾았다.
28
 new_tracing_attack.cvs : 50번 이하의 Hits
 new_tracing_attack.cvs : laobing.asa
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
II. Web Shell Detect > new_tracing_attack.cvs
• Google 검색을 사용하여 해당 파일에 대한 정보를 수집
• 멀웨어로 추측되어 LogParser를 사용하여 laobing.asa 파일에 접근한 IP 목록을 수집하
였다.
29
 laobing.asa 구글 검색 결과  laobing.asa에 접근한 IP 정보
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
II. Web Shell Detect > laobing.asa 구글 검색[1/2]
• laobing.asa 파일에 접근한 모든 IP는 중국 IP였다.
• Laobing의 사전적 의미는 중국식 flat bread를 의미한다.
30
 laobing.asa 접근한 IP  laobing 검색 결과
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
II. Web Shell Detect > laobing.asa 구글 검색[2/2]
• 이 IP 주소들이 다른 웹페이지로 접속한 이력이 있는지 확인하기 위해 접속한 웹 페이지
를 LogParser로 조회했다.
• 하지만 laobing.asa 파일 외에는 다른 파일에 접근한 기록이 없다. 분석을 어렵게 하기 위
해 여러 IP를 사용한 듯 보인다.
31
 중국발 IP들의 페이지 요청 이력
E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
II. Web Shell Detect > Web Shell Trace
• 파일을 올릴 때는 POST 방식으로 200 또는 300 대의 상태코드를 받는다.
 400>sc-status>=200상태코드를 받은 POST요청을 검색
 모든 URL, IP, Date를 조회했다.
 Date 오름차순으로 정렬하였다.
 laobing.asa 파일을 요청한 최초 요청(p29 오른쪽 그림 참고)
 2008. 1. 5
• 1월 5일 이전을 대상으로 멀웨어가 업로드된 free와 visitor 폴더 내 wirte_module
파일에 접근한 220.117.80.157이 가장 많이 의심된다.
32E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 2) 분석
II. Web Shell Detect > 업로드한 IP 조회
4. 실습 > 3) 로그 분석 결과
• DoS 공격은 부천 시청, 인증 우회는 동국 대학교, WebShell 접속은 중국으로부터 들어온
것으로 추측된다.
• DoS는 1월 4일, WebShell 최초 접근 날짜는 1월 5일로, 비슷한 시기에 수상한 로그가
많이 발견되었다.
• 이 모든 공격을 연관 지어 생각해 볼 필요성이 있다.
33E-mail : isc0304@naver.com Writing by Ilsun Choi
• 관리자의 보안 교육
• IPS, 웹 방화벽 등 보안 솔루션 필요
• laobing.asa의 파일 업로드 경로에 업로드하는 소스 파일 검사
-> 업로드 취약점 보완
34E-mail : isc0304@naver.com Writing by Ilsun Choi
4. 실습 > 4) 대응 방안
부록. LogPaser GUI 버전
• Visual LogParser(왼쪽)은 실시간으로 도움말이 출력되어 Log Parser 작성 시 용이하다.
• Log Parser Studio(오른쪽)은 라이브러리를 통하여 원하는 쿼리를 골라서 사용할 수 있다.
• 각 장단점을 잘 활용하여 상황과 자신에게 맞는 툴을 사용하는 것이 바람직하다.
35E-mail : isc0304@naver.com Writing by Ilsun Choi
참고 문헌
36
• https://technet.microsoft.com/ko-kr/scriptcenter/dd919274.aspx
• http://www.symantec.com/connect/articles/forensic-log-parsing-microsofts-logparser
• http://allimter.tistory.com/
E-mail : isc0304@naver.com Writing by Ilsun Choi

More Related Content

What's hot

3. 악성코드 분석 사례
3. 악성코드 분석 사례3. 악성코드 분석 사례
3. 악성코드 분석 사례Youngjun Chang
 
2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법Youngjun Chang
 
2.악성코드와 분석 방안
2.악성코드와 분석 방안2.악성코드와 분석 방안
2.악성코드와 분석 방안Youngjun Chang
 
레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)Sehan Lee
 
1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론Youngjun Chang
 
6. code level reversing
6. code level reversing6. code level reversing
6. code level reversingYoungjun Chang
 
2. windows system과 file format
2. windows system과 file format2. windows system과 file format
2. windows system과 file formatYoungjun Chang
 
(130216) #fitalk reverse connection tool analysis
(130216) #fitalk   reverse connection tool analysis(130216) #fitalk   reverse connection tool analysis
(130216) #fitalk reverse connection tool analysisINSIGHT FORENSIC
 
3. 악성코드 분석 사례
3. 악성코드 분석 사례3. 악성코드 분석 사례
3. 악성코드 분석 사례Youngjun Chang
 
1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론Youngjun Chang
 
(140407) #fitalk d trace를 이용한 악성코드 동적 분석
(140407) #fitalk   d trace를 이용한 악성코드 동적 분석(140407) #fitalk   d trace를 이용한 악성코드 동적 분석
(140407) #fitalk d trace를 이용한 악성코드 동적 분석INSIGHT FORENSIC
 
(160820) #fitalk fileless malware forensics
(160820) #fitalk    fileless malware forensics(160820) #fitalk    fileless malware forensics
(160820) #fitalk fileless malware forensicsINSIGHT FORENSIC
 

What's hot (13)

3. 악성코드 분석 사례
3. 악성코드 분석 사례3. 악성코드 분석 사례
3. 악성코드 분석 사례
 
2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법2. 악성코드 분석 방법론과 기법
2. 악성코드 분석 방법론과 기법
 
2.악성코드와 분석 방안
2.악성코드와 분석 방안2.악성코드와 분석 방안
2.악성코드와 분석 방안
 
레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)레이스 컨디션 기초(Basic Race Condition)
레이스 컨디션 기초(Basic Race Condition)
 
1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론
 
6. code level reversing
6. code level reversing6. code level reversing
6. code level reversing
 
2. windows system과 file format
2. windows system과 file format2. windows system과 file format
2. windows system과 file format
 
악성코드와 웜
악성코드와 웜악성코드와 웜
악성코드와 웜
 
(130216) #fitalk reverse connection tool analysis
(130216) #fitalk   reverse connection tool analysis(130216) #fitalk   reverse connection tool analysis
(130216) #fitalk reverse connection tool analysis
 
3. 악성코드 분석 사례
3. 악성코드 분석 사례3. 악성코드 분석 사례
3. 악성코드 분석 사례
 
1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론1. 악성코드 진단 기법 개론
1. 악성코드 진단 기법 개론
 
(140407) #fitalk d trace를 이용한 악성코드 동적 분석
(140407) #fitalk   d trace를 이용한 악성코드 동적 분석(140407) #fitalk   d trace를 이용한 악성코드 동적 분석
(140407) #fitalk d trace를 이용한 악성코드 동적 분석
 
(160820) #fitalk fileless malware forensics
(160820) #fitalk    fileless malware forensics(160820) #fitalk    fileless malware forensics
(160820) #fitalk fileless malware forensics
 

Viewers also liked

[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템
[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템
[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템GangSeok Lee
 
Ransomware: History, Analysis, & Mitigation
Ransomware: History, Analysis, & MitigationRansomware: History, Analysis, & Mitigation
Ransomware: History, Analysis, & MitigationWhiskeyNeon
 
Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)
Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)
Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)NAVER D2
 
해킹과 보안
해킹과 보안해킹과 보안
해킹과 보안창열 최
 
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이GangSeok Lee
 
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?GangSeok Lee
 
개영한줄영작_Giving Advice on Debugging
개영한줄영작_Giving Advice on Debugging개영한줄영작_Giving Advice on Debugging
개영한줄영작_Giving Advice on DebuggingNasol Kim
 
[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의 발전과 최신 트랜드GangSeok 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
 
(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토
(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토
(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토plainbit
 
[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
 
Warning.or.kr 취약점 분석
Warning.or.kr 취약점 분석Warning.or.kr 취약점 분석
Warning.or.kr 취약점 분석mangonamu
 
Programming skills 1부
Programming skills 1부Programming skills 1부
Programming skills 1부JiHyung 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
 
[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 문제풀이GangSeok Lee
 
제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹
제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹
제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹NAVER D2
 
(FICON2015) #1 어떻게 대응할 것인가?
(FICON2015) #1 어떻게 대응할 것인가?(FICON2015) #1 어떻게 대응할 것인가?
(FICON2015) #1 어떻게 대응할 것인가?plainbit
 
(FICON2015) #2 어떻게 조사할 것인가?
(FICON2015) #2 어떻게 조사할 것인가?(FICON2015) #2 어떻게 조사할 것인가?
(FICON2015) #2 어떻게 조사할 것인가?plainbit
 
Html5 강좌파일_v_3.0
Html5 강좌파일_v_3.0Html5 강좌파일_v_3.0
Html5 강좌파일_v_3.0Youngjo Jang
 

Viewers also liked (20)

[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템
[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템
[2013 CodeEngn Conference 08] Homeless - Android 악성앱 필터링 시스템
 
Ransomware: History, Analysis, & Mitigation
Ransomware: History, Analysis, & MitigationRansomware: History, Analysis, & Mitigation
Ransomware: History, Analysis, & Mitigation
 
Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)
Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)
Christmas CTF 보안대회 수상팀 문제풀이서(팀명:쀼쀼뺘뺘)
 
해킹과 보안
해킹과 보안해킹과 보안
해킹과 보안
 
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
[2012 CodeEngn Conference 07] nesk - Defcon 20th : 본선 CTF 문제풀이
 
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
[2014 CodeEngn Conference 11] 최우석 - 자바스크립트 난독화 너네 뭐니?
 
개영한줄영작_Giving Advice on Debugging
개영한줄영작_Giving Advice on Debugging개영한줄영작_Giving Advice on Debugging
개영한줄영작_Giving Advice on Debugging
 
[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 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
 
(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토
(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토
(FICON2015) #5 보안담당자가 겪는 실무적 이슈와 법률적 검토
 
[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
 
Warning.or.kr 취약점 분석
Warning.or.kr 취약점 분석Warning.or.kr 취약점 분석
Warning.or.kr 취약점 분석
 
엑셀왕국
엑셀왕국엑셀왕국
엑셀왕국
 
Programming skills 1부
Programming skills 1부Programming skills 1부
Programming skills 1부
 
[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
 
[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 문제풀이
 
제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹
제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹
제12회 IT4U 강연회 - 화이트햇 해커들의 웹 해킹
 
(FICON2015) #1 어떻게 대응할 것인가?
(FICON2015) #1 어떻게 대응할 것인가?(FICON2015) #1 어떻게 대응할 것인가?
(FICON2015) #1 어떻게 대응할 것인가?
 
(FICON2015) #2 어떻게 조사할 것인가?
(FICON2015) #2 어떻게 조사할 것인가?(FICON2015) #2 어떻게 조사할 것인가?
(FICON2015) #2 어떻게 조사할 것인가?
 
Html5 강좌파일_v_3.0
Html5 강좌파일_v_3.0Html5 강좌파일_v_3.0
Html5 강좌파일_v_3.0
 

Similar to Log parser&webshell detection

[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO
[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO
[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTOiFunFactory Inc.
 
Web server page_ed10
Web server page_ed10Web server page_ed10
Web server page_ed10hungrok
 
(141031) #fitalk plaso 슈퍼 타임라인 분석 도구 활용 방안
(141031) #fitalk   plaso 슈퍼 타임라인 분석 도구 활용 방안(141031) #fitalk   plaso 슈퍼 타임라인 분석 도구 활용 방안
(141031) #fitalk plaso 슈퍼 타임라인 분석 도구 활용 방안INSIGHT FORENSIC
 
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라INSIGHT FORENSIC
 
(120128) #fitalk sql server anti-forensics
(120128) #fitalk   sql server anti-forensics(120128) #fitalk   sql server anti-forensics
(120128) #fitalk sql server anti-forensicsINSIGHT FORENSIC
 
Web App Security 2015.10
Web App Security 2015.10Web App Security 2015.10
Web App Security 2015.10Chanjin Park
 
(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 baseINSIGHT FORENSIC
 
2. 악성코드 동적 분석 방법론
2. 악성코드 동적 분석 방법론2. 악성코드 동적 분석 방법론
2. 악성코드 동적 분석 방법론Youngjun Chang
 
5. system level reversing
5. system level reversing5. system level reversing
5. system level reversingYoungjun Chang
 
광안 1반 2팀 엠퀴즈 최종 발표 자료.pptx
광안 1반 2팀 엠퀴즈 최종 발표 자료.pptx광안 1반 2팀 엠퀴즈 최종 발표 자료.pptx
광안 1반 2팀 엠퀴즈 최종 발표 자료.pptxYeongKiKim1
 
모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개Hyogi Jung
 
Redis data design by usecase
Redis data design by usecaseRedis data design by usecase
Redis data design by usecaseKris Jeong
 
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...Amazon Web Services Korea
 
20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)
20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)
20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)Amazon Web Services Korea
 
The beginner’s guide to 웹 크롤링 (스크래핑)
The beginner’s guide to 웹 크롤링 (스크래핑)The beginner’s guide to 웹 크롤링 (스크래핑)
The beginner’s guide to 웹 크롤링 (스크래핑)Eunjeong (Lucy) Park
 
REST API 설계
REST API 설계REST API 설계
REST API 설계Terry Cho
 

Similar to Log parser&webshell detection (20)

[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO
[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO
[MGDC] 리눅스 게임 서버 성능 분석하기 - 아이펀팩토리 김진욱 CTO
 
기술6기 3조
기술6기 3조기술6기 3조
기술6기 3조
 
Web server page_ed10
Web server page_ed10Web server page_ed10
Web server page_ed10
 
(141031) #fitalk plaso 슈퍼 타임라인 분석 도구 활용 방안
(141031) #fitalk   plaso 슈퍼 타임라인 분석 도구 활용 방안(141031) #fitalk   plaso 슈퍼 타임라인 분석 도구 활용 방안
(141031) #fitalk plaso 슈퍼 타임라인 분석 도구 활용 방안
 
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
(Ficon2016) #2 침해사고 대응, 이렇다고 전해라
 
(120128) #fitalk sql server anti-forensics
(120128) #fitalk   sql server anti-forensics(120128) #fitalk   sql server anti-forensics
(120128) #fitalk sql server anti-forensics
 
Web App Security 2015.10
Web App Security 2015.10Web App Security 2015.10
Web App Security 2015.10
 
(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
 
2. 악성코드 동적 분석 방법론
2. 악성코드 동적 분석 방법론2. 악성코드 동적 분석 방법론
2. 악성코드 동적 분석 방법론
 
5. system level reversing
5. system level reversing5. system level reversing
5. system level reversing
 
Node.js 첫걸음
Node.js 첫걸음Node.js 첫걸음
Node.js 첫걸음
 
광안 1반 2팀 엠퀴즈 최종 발표 자료.pptx
광안 1반 2팀 엠퀴즈 최종 발표 자료.pptx광안 1반 2팀 엠퀴즈 최종 발표 자료.pptx
광안 1반 2팀 엠퀴즈 최종 발표 자료.pptx
 
모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개모바일 메신저 아키텍쳐 소개
모바일 메신저 아키텍쳐 소개
 
Redis data design by usecase
Redis data design by usecaseRedis data design by usecase
Redis data design by usecase
 
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
AWS CLOUD 2018- 관리형 Kubernetes 지원과 새로운 컨테이너 서비스 Amazon Fargate 소개 (정영준 솔루션즈 아...
 
20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)
20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)
20140528 AWS Meister BlackBelt - Amazon Kinesis (Korean)
 
The beginner’s guide to 웹 크롤링 (스크래핑)
The beginner’s guide to 웹 크롤링 (스크래핑)The beginner’s guide to 웹 크롤링 (스크래핑)
The beginner’s guide to 웹 크롤링 (스크래핑)
 
REST API 설계
REST API 설계REST API 설계
REST API 설계
 
Web server
Web serverWeb server
Web server
 
3장
3장3장
3장
 

Log parser&webshell detection

  • 1. MS-LogParser를 활용한 WebShell 탐지 파일 업로드 취약점 최일선 1E-mail : isc0304@naver.com Writing by Ilsun Choi
  • 2. Index 2E-mail : isc0304@naver.com Writing by Ilsun Choi 1. Log Parser 2.2 개요 1) 특징 : 다양한 용도 2) LogParser 기본 사용법 2. IISW3C Log 분석 : Fields 3. IISW3C Log 분석 : Example Queries 4. 실습 1) 스크립트 제작 2) 분석 3) Log 분석 결과 4) 대응방안 부록. LogPaser GUI 버전 참고 문헌
  • 3. 1. Log Parser 2.2 개요 • Windows 운영 체제의 핵심 데이터 원본에 대 한 범용 쿼리 액세스를 제공 • 로그 파일, XML 파일, CSV 파일 등과 같은 텍 스트 기반 지원 • 이벤트 로그, 레지스트, 파일 시스템, Active Directory 지원 • 모든 것을 데이터베이스로 사용 3 MS - Log Parser 웹사이트 E-mail : isc0304@naver.com Writing by Ilsun Choi
  • 4. • 광범위한 용도의 특성 때문에 전문 서적이 제작됨 4E-mail : isc0304@naver.com Writing by Ilsun Choi 1. Log Parser 2.2 개요 > 1) 특징
  • 5. • 다음과 같이 –h 옵션을 사용하면 도움말이 출력된다. 5  logparser 도움말 출력  logparser Usage Help  SQL Query Help E-mail : isc0304@naver.com Writing by Ilsun Choi 1. Log Parser 2.2 개요 > 2) 기본 사용법[1/3]
  • 6. A. 기본 형식 • 우리가 사용할 구문은 다음과 같은 형식으로 간소화할 수 있다. 6 LogParser.exe –i:[입력형식] –o:[출력형식] “SELECT [필드명] INTO [출력파일명] FROM ex*.log GROUP BY [필드명] WHERE [조건] ORDER BY [필드명] ASC|DESC” E-mail : isc0304@naver.com Writing by Ilsun Choi 1. Log Parser 2.2 개요 > 2) 기본 사용법[2/3]
  • 7. B. 다양한 도움말 • 다양한 형식을 지원하기 때문에 여러 도움말이 존재한다. 7  logparser 입출력 형식  그림 2.2.2. logparser에 내장된 예제 출력  그림 2.2.3. IISW3C의 포맷 도움말 E-mail : isc0304@naver.com Writing by Ilsun Choi 1. Log Parser 2.2 개요 > 2) 기본 사용법[2/3]
  • 8. 2. IISW3C Log 분석 : Fields Field Name Description Uses Date (date) The date of the request. Event correlation. Time (time) The UTC time of the request. Event correlation, determine time zone, identif y scanning scripts. Client IP Address ( c-ip) The IP address of the client or proxy that sent the request. Identify user or proxy server. User Name (cs-us ername) The user name used to authent icate to the resource. Identify compromised user passwords. Service Name (s-si tename) The W3SVC instance number o f the site accessed. Can verify the site accessed if the log files ar e later moved from the system. Server Name (s-co mputername) The Windows host name assig ned to the system that generat ed the log entry. Can verify the server accessed if the log files are later moved from the system. Server IP Address ( s-ip) The IP address that received th e request. Can verify the IP address accessed if the log files are later moved from the system or if the server is moved to a new location. Server Port (s-port ) The TCP port that received the request. To verify the port when correlating with other t ypes of log files. Method (cs-metho d) The HTTP method used by the client. Can help track down abuse of scripts or exec utables. URI Stem (cs-uri- stem) The resource accessed on the server. Can identify attack vectors. URI Query (cs-uri- query) The contents of the query strin g portion of the URI. Can identify injection of malicious data. 8 Field Name Description Uses Protocol Status (s c-status) The result code sent to the cl ient. Can identify CGI scans, SQL injection and other intrusions. Win32 Status (sc- win32-status) The Win32 error code produc ed by the request. Can help identify script abuse. Bytes Sent (sc-by tes) The number of bytes sent to the client. Can help identify unusual traffic from a sin gle script. Bytes Received (c s-bytes) The number of bytes receive d from the client. Can help identify unusual traffic to a single script. Time Taken (time -taken) The amount of server time, in milliseconds, taken to proces s the request. Can identify unusual activity from a single s cript. Protocol Version ( cs-version) The HTTP protocol version s upplied by the client. Can help identify older scripts or browsers. Host (cs-host) The contents of the HTTP Ho st header sent by the client. Can determine if the user browsed to the si te by IP address or host name. User Agent (cs(U ser-Agent)) The contents of the HTTP Us er-Agent header sent by the client. Can help uniquely identify users or attack s cripts. Cookie (cs(Cooki e)) The contents of the HTTP Co okie header sent by the client . Can help uniquely identify users. Referer (cs(Refer er)) The contents of the HTTP Re ferer header sent by the clien t. Can help identify the source of an attack or see if an attacker is using search engines t o find vulnerable sites. E-mail : isc0304@naver.com Writing by Ilsun Choi • 주요 항목은 노란색으로 강조하였다.
  • 9. 3. IISW3C Log 분석 > Example Queries [1/9] 9 1. Tracing Attack Logparser "SELECT DISTINCT TO_LOWERCASE(cs-uri-stem) AS URL, Count(*) AS Hits FROM ex*.log WHERE sc-status=200 GROUP BY URL ORDER BY HITS" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi
  • 10. 10 2. Last Write Time Logparser -i:FS "SELECT TOP 20 Path, LastWriteTime FROM *.* ORDER BY LastWriteTime DESC" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [2/9]
  • 11. 11 3. Count Number of Hits by a Client logparser "SELECT DISTINCT date, cs-uri-stem, c-ip, Count(*) AS Hits FROM ex*.log GROUP BY date, c-ip, cs-uri-stem HAVING Hits>100 ORDER BY Hits DESC" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [3/9]
  • 12. 12 4. 404 > Error Page Response logparser "SELECT cs-uri-query, Count(*) AS Total FROM ex*.log WHERE sc-status>=404 GROUP BY cs-uri-query ORDER BY Total DESC" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [4/9]
  • 13. 13 5. Specific client ip order by hits logparser "SELECT DISTINCT TO_LOWERCASE(cs-uri- stem) AS URL, Count(*) As HITS FROM ex*.log WHERE sc-status=200 and c-ip='211.34.150.3' GROUP BY URL ORDER BY hits" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [5/9]
  • 14. 14 6. Count number of urls if the file name extension is asp or exe logparser "SELECT cs-uri-stem, Count(*) as Hits, AVG(time-taken) AS Avg, Max(time-taken) AS Max, Min(time-taken) AS Min, Sum(time-taken) AS Total FROM ex*.log WHERE TO_LOWERCASE(cs-uri-stem) LIKE '%.asp%' OR TO_LOWERCASE(cs-uri-stem) LIKE '%.exe%' GROUP BY cs-uri-stem ORDER BY cs-uri-stem" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [6/9]
  • 15. 15 7. Win32 error logparser "SELECT cs-uri-stem, WIN32_ERROR_DESCRIPTION(sc-win32-status) as Error, Count(*) AS Total FROM ex*.log WHERE sc-win32-status>0 AND (TO_LOWERCASE(cs-uri-stem) LIKE '%.asp%' OR TO_LOWERCASE(cs-uri-stem) LIKE '%.exe%') GROUP BY cs-uri-stem, Error ORDER BY cs-uri-stem, Error -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [7/9]
  • 16. 16 8. Count numbers Classified according to the error and the url logparser "SELECT cs-uri-stem, sc-status, Count(*) AS Total FROM ex*.log WHERE TO_LOWERCASE(cs-uri-stem) LIKE '%.asp%' OR TO_LOWERCASE(cs-uri-stem) LIKE '%.exe%' GROUP BY cs-uri-stem, sc-status ORDER BY cs-uri-stem, sc-status" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [8/9]
  • 17. 17 9. Error Report about the pages over 500 error code logparser "SELECT cs-uri-query, Count(*) AS Total FROM ex*.log WHERE sc-status>=500 GROUP BY cs-uri-query ORDER BY Total DESC" -rtp:-1 E-mail : isc0304@naver.com Writing by Ilsun Choi 3. IISW3C Log 분석 > Example Queries [9/9]
  • 18. 4. 실습 18E-mail : isc0304@naver.com Writing by Ilsun Choi SEC 스터디에서 제공 받은 실제 웹셸 탐지 사례의 LOG를 사용하여 해당 웹의 로그를 분석 (SEC 스터디: 웹 모의해킹과 시큐어코딩 가이드 – 최경철 저자 스터디 까페) LOG만을 사용하여 분석했기 때문에 일부 오탐 및 미탐이 존재할 수 있음
  • 19. 4. 실습 > 1) 스크립트 제작 • 로그 분석 예제 -> Python 스크립트 19  LogParser 자동화를 위한 Python 스크립트  Python 스크립트 실행 결과 E-mail : isc0304@naver.com Writing by Ilsun Choi
  • 20. • 두 가지의 의심스러운 점을 발견 I. DoS Attack? II. Web Shell? 20E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석
  • 21. • GET Flooding 공격으로 추측 • 해당 웹서버에 IPS 동작 하지 않음. 21  count_hit.csv 파일 - 1  count_hit.csv 파일 - 2 E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 I. DoS Attack
  • 22. • 가장 최근에 발생된 DoS 공격 시기인 2월 2일의 로그 파일이다. 22  ex080202.log 파일 211.34.150.3 첫 번째 검색  ex080202.log 파일 211.34.150.3 마지막 요청 검색 E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 I. DoS Attack > ex080202.log 파일 분석[1/3]
  • 23. • %를 사용한 인증 우회가 있었는지 검사. • ‘ 와 1=1 같은 인증을 우회하려는 시도 감지. • 3초 단위로 공격. • 정상적인 방법으로 URL에 접근하지 않음. 23  ex080202.log 파일 : % 검색 E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 I. DoS Attack > ex080202.log 파일 분석[2/3]
  • 24. • https://db-ip.com/ 을 통해서 공격으로 추측되는 행위를 한 IP를 추적하였다. 24  DoS 공격으로 추측되는 IP  인젝션으로 인증 우회를 시도한 IP E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 I. DoS Attack > ex080202.log 파일 분석[3/3]
  • 25. • 같은 IP 주소의 첫 공격 • 1월 4일 10시 45분 경부터 1월 5일 1시 35분 • 서버 관리자는 첫 번째 공격 의심 로그 이후에도 해당 IP를 차단하지 않음 25  첫 번째 DoS 공격 E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 I. DoS Attack > ex080104.log 파일 분석
  • 26. • 로그를 통한 웹셸 탐지 방법 1) 히트 수가 비정상적으로 적은 파일 2) 비정상적인 이름을 사용하는 파일 3) Upload PATH를 위치하는 파일 26E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 II. Web Shell Detect
  • 27. • 히트 수를 오름차순으로 정렬 • dll이나 jpg, gif 등 검사에 불필요한 파 일이 섞여있음 • 히트 수 50 이하의 파일이 500개가 넘 기 때문에 목록 필터링이 필요하다. 27 그림 5.2.2.1. tracing_attack.cvs E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 II. Web Shell Detect > tracing_attack.csv
  • 28. • Python Script로 불필요한 파일들을 걸러내었다. • 히트 수 50 이하 파일이 100 여 개로 줄어 분석이 용이해졌다. • 63번, 65번 라인에서 조건에 합하는 파일을 찾았다. 28  new_tracing_attack.cvs : 50번 이하의 Hits  new_tracing_attack.cvs : laobing.asa E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 II. Web Shell Detect > new_tracing_attack.cvs
  • 29. • Google 검색을 사용하여 해당 파일에 대한 정보를 수집 • 멀웨어로 추측되어 LogParser를 사용하여 laobing.asa 파일에 접근한 IP 목록을 수집하 였다. 29  laobing.asa 구글 검색 결과  laobing.asa에 접근한 IP 정보 E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 II. Web Shell Detect > laobing.asa 구글 검색[1/2]
  • 30. • laobing.asa 파일에 접근한 모든 IP는 중국 IP였다. • Laobing의 사전적 의미는 중국식 flat bread를 의미한다. 30  laobing.asa 접근한 IP  laobing 검색 결과 E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 II. Web Shell Detect > laobing.asa 구글 검색[2/2]
  • 31. • 이 IP 주소들이 다른 웹페이지로 접속한 이력이 있는지 확인하기 위해 접속한 웹 페이지 를 LogParser로 조회했다. • 하지만 laobing.asa 파일 외에는 다른 파일에 접근한 기록이 없다. 분석을 어렵게 하기 위 해 여러 IP를 사용한 듯 보인다. 31  중국발 IP들의 페이지 요청 이력 E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 II. Web Shell Detect > Web Shell Trace
  • 32. • 파일을 올릴 때는 POST 방식으로 200 또는 300 대의 상태코드를 받는다.  400>sc-status>=200상태코드를 받은 POST요청을 검색  모든 URL, IP, Date를 조회했다.  Date 오름차순으로 정렬하였다.  laobing.asa 파일을 요청한 최초 요청(p29 오른쪽 그림 참고)  2008. 1. 5 • 1월 5일 이전을 대상으로 멀웨어가 업로드된 free와 visitor 폴더 내 wirte_module 파일에 접근한 220.117.80.157이 가장 많이 의심된다. 32E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 2) 분석 II. Web Shell Detect > 업로드한 IP 조회
  • 33. 4. 실습 > 3) 로그 분석 결과 • DoS 공격은 부천 시청, 인증 우회는 동국 대학교, WebShell 접속은 중국으로부터 들어온 것으로 추측된다. • DoS는 1월 4일, WebShell 최초 접근 날짜는 1월 5일로, 비슷한 시기에 수상한 로그가 많이 발견되었다. • 이 모든 공격을 연관 지어 생각해 볼 필요성이 있다. 33E-mail : isc0304@naver.com Writing by Ilsun Choi
  • 34. • 관리자의 보안 교육 • IPS, 웹 방화벽 등 보안 솔루션 필요 • laobing.asa의 파일 업로드 경로에 업로드하는 소스 파일 검사 -> 업로드 취약점 보완 34E-mail : isc0304@naver.com Writing by Ilsun Choi 4. 실습 > 4) 대응 방안
  • 35. 부록. LogPaser GUI 버전 • Visual LogParser(왼쪽)은 실시간으로 도움말이 출력되어 Log Parser 작성 시 용이하다. • Log Parser Studio(오른쪽)은 라이브러리를 통하여 원하는 쿼리를 골라서 사용할 수 있다. • 각 장단점을 잘 활용하여 상황과 자신에게 맞는 툴을 사용하는 것이 바람직하다. 35E-mail : isc0304@naver.com Writing by Ilsun Choi
  • 36. 참고 문헌 36 • https://technet.microsoft.com/ko-kr/scriptcenter/dd919274.aspx • http://www.symantec.com/connect/articles/forensic-log-parsing-microsofts-logparser • http://allimter.tistory.com/ E-mail : isc0304@naver.com Writing by Ilsun Choi