










Last year I had participated in Digital Forensics Challenge 2019 (DFC2019) and enjoyed a lot.
They made a lot of exciting questions. Especially, I had spent a fair amount of times to work on challenges around Microsoft SQL Server(MSSQL). During my challenge I tried to find useful tools/articles for MSSQL forensics, but it seems that there is not much information on the Internet.
That's why I will write a series what I have learned about MSSQL from a forensic perspective.
There are a lot of components of MSSQL. What I can describe at the series is as follows:
Unfortunately, all questions and dataset of DFC2019 are not available because DFC2019 has ended. Then I created sample MSSQL database.
Sample database has been created as follows.
After the execution of the query, we can see 2 allocated records.

Just for reference, these two binaries of data column contain JPG picture as follows:

(I've got these pictures at PIXNIO, which provides public domain images)
Now my goal is to recover deleted record (i.e. id=3) as possible.
Sample database files consist of "4n6ist_sample.mdf" and "4n6ist_sample_log.ldf". Here I focus on only "4n6ist_sample.mdf" file.
Paul Randal has already covered MSSQL page structure at this article. Here is a big picture.

In summary what we should understand is:
We can get information about page header using DBCC IND and DBCC PAGE query. Here is an example output on SSMS.
DBCC IND shows summary of all pages associated with specified table.
DBCC IND('database name', 'table name', -1)
DBCC PAGE shows detail information of specified page.
DBCC PAGE('4n6ist_sample', 1, 368, 0)
We can see record area with hex view if we set 1 to third parameter like "DBCC PAGE('4n6ist_sample', 1, 368, 1)"
What our interest in page header is:
From my understanding, m_feeCnt and m_freeData are illustrated as follows:

In addition to Paul's article, Mark S. Rasmussen has described the details of page header structure. I have written a python script for parsing MDF page header. The script allows to parse MDF file without SQL Server environment.

I will cover how to handle the output and data page structure next time.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。