Upload
insight-forensic
View
83
Download
7
Embed Size (px)
Citation preview
forensicinsight.org Page 2
Contents of Table
1. Introduction
2. Case
3. How
4. Conclusion
forensicinsight.org Page 3
Introduction
forensicinsight.org Page 4
Introduction
SQLite 파일의 복구
• 데이터 추출을 효과적으로 하는 방법
텍스트 형식으로 저장되어 있으므로, Strings 같은 명령어로 모든 데이터를 볼 수 있음
삭제된 데이터로 범위를 줄인 후 분석하면 조금이나마 더 효율적
• SQLite Viewer로 볼 수 있도록 복원하는 방법
SQLite Viewer가 해석할 수 있도록 구조를 복원하고 Cell을 연결시키는 작업
SQLite Recovery
forensicinsight.org Page 5
Case
forensicinsight.org Page 6
Case
아이폰 문자메시지 백업 파일
Target
App Data Type Location(WinXP)
Safari Cache%USERPROFILE%\Local Settings\Application
Data\Apple Computer\Safari\Cache.db
I-Phone Mobile Comm
%USERPROFILE%\Local Settings\Application
data\Apple Computer\MobileSync\Backup\
<Random>.mdata
FirefoxHistory
Cookie
%USERPROFILE%\Local Settings\Application
Data\Mozilla\Firefox\Profiles\<Random>\
places.SQLite or cookies.SQLite
Chrome
Cache
History
Cookie
%USERPROFILE%\Local Settings\Application
Data\Google\Chrome\UserData\Default\
Cache or History or Cookies
Zero Fill
Zero Fill
If delete(group_msg):
group_msg = unallocated space
forensicinsight.org Page 7
How
forensicinsight.org Page 8
How
Header Page + Page Chain
SQLite 구조(간략)
Database Header
…
Schema Table
Unallocated Page
Root Page
…
Header Page
Page Chain(B-Tree)
forensicinsight.org Page 9
How
Database Header
우선 페이지 크기를 확인하자
SQLite File Signature
Page Size(Big endian)
forensicinsight.org Page 10
How
Database Schema Table
다음으로 루트 페이지 번호를 확인하자
Schema Type
SQL Query Statement
Schema Name
Root Page Number
forensicinsight.org Page 11
How
Page Header + Cell offset + Free Space + Cell
페이지 구조(간략)
Database Header
Cell offset 1…n
Free Space
Cell n…1
forensicinsight.org Page 12
How
Leaf 페이지 헤더
• 이것만 잘 해석해도 절반 이상은 건짐
실제 데이터가 존재하는 페이지는 Leaf 페이지
Offset Contents
0 Page Flag : 0x0D
1-2 First Unallocated Block Offset
3-4 Cell Count
5-6 First Cell Offset
7 Over 3Byte Unallocated Block Count
forensicinsight.org Page 13
How
Leaf Cell 구조(간략)
그럼 Leaf 페이지 안의 Cell은 어떤 구조?
Record
Size
Row
ID
Length of
Data HeaderType1 … TypeN Data1 … DataN
Cell Header Data Header Data Area
Record
Cell Header
Next Free
Block
Free
Block Len
Deleted
forensicinsight.org Page 14
How
1. Leaf 페이지를 찾는다.
2. Free Space를 찾는다.
1. 페이지 헤더의 오프셋 5~6에 있는 가장 첫 번째 활성 셀을 찾고
2. 셀 오프셋 체인의 오프셋이 0x0000이 될 때까지 확인
3. 그럼 셀 오프셋 n과 셀 n 사이의 공간을 복구하면 끝
일단 Free Space 부터 복구
Page Header
Cell offset 1…n
Free Space
Cell n..1
forensicinsight.org Page 15
How
1. Leaf 페이지를 찾는다.
2. 첫 번째 Free Block을 찾는다.
1. 페이지 헤더의 오프셋 1~2에 있는 가장 첫 번째 비 활성 오프셋을 찾고
2. 삭제된 Leaf Cell 체인을 읽어나가자
다음으로 Free Block 복구
Page Header
Cell offset 1…n
Free Space
Cell n
Deleted cell
Cell n-2 … 1
forensicinsight.org Page 16
How
복원은 어떻게 함1
복원해야 할 부분
• Legnth of Record
• Row ID
• Length of Data Header 일부분
Record
Size
Row
ID
Length of
Data HeaderType1 … TypeN Data1 … DataN
Data Header Data AreaNext Free
Block
Free
Block Len
복구해야 할 부분
forensicinsight.org Page 17
How
복원은 어떻게 함2
일단 데이터 헤더와 데이터 연결부터
• 데이터 헤더의 값과 데이터 길이의 관계
• 브루트 포싱 ㄱ ㄱ
Value Data Type Data Size
0 NULL 0
N (N=1-4) Signed Integer N
5 Signed Integer 6
6 Signed Integer 8
7 IEEE float 8
8-11 Reserved
N>12
(N:even)BLOB (N-12)/2
N>13
(N:odd)TEXT (N-13)/2
forensicinsight.org Page 18
How
복원은 어떻게 함3
Length of Record는?
• 데이터 헤더와 데이터 길이가 맞아 떨어지면, 자연스레 될 듯
Row ID는?
• 브루트 포싱 때리면 되지 않을까? 어짜피 0xFF – 활성 블록 개수 * n(약 200 미만)일 것같은데
forensicinsight.org Page 19
How
한눈에 봅시다(어딘가 모르게 익숙한 그림)
Length of
RecordRow ID
Length of Data
Header
Size of
Field 1
Size of
Field 2...
Size of
Field NData of Field 1 Data of Field 2 ... Data of Field N
Data Header
Record
Variable length
integer
Length of
RecordRow ID
Length of Data
Header
Size of
Field 1
Size of
Field 2...
Size of
Field NData of Field 1 Data of Field 2 ... Data of Field N
Offset of next free block
Length of free block
2 Byte2 Byte
Data Header
Record
forensicinsight.org Page 20
Conclusion
Recover Iphone Message
복원은 아니고 복구만