automatic rendering of forensic information from memory ...ksun/csci780-f14/notes/21-dscrete.pdf ·...

33
DSCRETE Brendan Saltaformaggio, Zhongshu Gu, Xiangyu Zhang, and Dongyan Xu Purdue University Automatic Rendering of Forensic Information from Memory Images via Application Logic Reuse Presenter: Jianhua Sun

Upload: others

Post on 05-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

DSCRETE

Brendan Saltaformaggio, Zhongshu Gu, Xiangyu Zhang, and Dongyan Xu

Purdue University  

Automatic Rendering of Forensic Information from Memory Images via

Application Logic Reuse

Presenter: Jianhua Sun

Page 2: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Memory forensicsTraditional digital investigation based on analysis of non-volatile storage.

Loss of live evidence stored in system RAM

Information stored in RAM: executing processes open network connections volatile IPC data OS and application data structure

Page 3: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

How memory forensics works?

Step 1: Capture an image of the suspect machine's volatile memory hardware and software based memory acquisition tools minimally invasive

Step 2: Analyze resulting memory image using memory analysis tool. Goal: recreate the system's previously observable state based on the memory image.

Page 4: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

State-of-the-art memory analysis tools

Locate data structure instances in memory image via signature-based scanning

Step 1: Derive data structure signature by analyzing program binaries.

Step 2: Use the signature to scan memory images and identify instances of data structure

Step 3: Present contents of identified instances to forensic investigators as potential evidence.

Page 5: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

State of the Art  

Finds raw data structure instances in memory image  

Still cannot understand the content of the data structure!  

E.g., images, passwords, formatted/encoded data  

…but Limited

Page 6: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Content reverse engineering challenge

ObjectEntry @ 0xfcb840 {

Object* object = 0xfccfb0

}

ObjectStorage @ 0xfcf710 {

const ::Ref K {

int num = 5

int gen = 0

}

ObjectEntry* V = 0xfcb840

}

ObjectStorage @ 0xfd51c0 {

const ::Ref K {

int num = 8

int gen = 0

}

ObjectEntry* V = 0xfbf4b0

}

XRefWriter @ 0xf5e7c0 {

...

std::string pdfVersion {

int length = 3

char* s = 0xcfc660 "1.4"

}

uint* streamEnds = 0x0

int streamEndsLen = 0

ObjectStream* objStr = 0x0

bool useEncrypt = 0

bool encrypted = 0

...

ChangedStorage {

std::map<K, V> Mapping

}

...

}

ObjectEntry @ 0xfbf4b0 {

Object* object = 0xd403a0

}

Object @ 0xfccfb0 {

ObjType = objDict

union {

...

Dict* dict = 0xfcdd40

...

}

}

Object @ 0xd403a0 {

ObjType = objStream

union {

...

Stream* stream = 0xfce3a8

...

}

}

Dict @ 0xfcdd40 = {

XRef* xref = 0xf56e50 DictEntry* entries =0xfceff0 int size = 8 int length = 7 int ref = 1

}

Stream @ 0xfce3a8 {

void* _vptr = 0x7f3140

int ref = 1

}

(a) Signature-based scanner output. (b) DSCRETE-based scanner output.

Page 7: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

DSCRETE workflow

Page 8: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Content Reverse Engineering

Observation: Application that defined the data structure contains printing/rendering logic for it too!

Let’s call this logic the “P function”

Transforms data structure to formatted application output  

Page 9: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Content Reverse Engineering  Program  Code  

struct pdf* my_pdf;

my_pdf = load_pdf_file(…);

main_loop(my_pdf); // User edits PDF

save_pdf_file(my_pdf);

exit(0);

char* buf = format(ptr);

fwrite(buf, …);

}

Input: Data Structure Instance

Output: Formatted Content

P  Function  save_pdf_file(struct pdf* ptr){

char* buf = format_pdf(ptr);

fwrite(buf, …);

}

 "P function"

Page 10: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

P  Function  save_pdf_file(struct pdf* ptr)

{

char* buf = format_pdf(ptr);

fwrite(buf, …);

}

Scanner+Renderer  

DSCRETE reuse P to build a scanner+renderer tool

Page 11: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

P  Function  save_pdf_file(struct pdf* ptr)

{

char* buf = format_pdf(ptr);

fwrite(buf, …);

}

Scanner+Renderer

Intuition: Invalid input will crash P

1101000001010101111010010111000110100101001010010001001001111  

Page 12: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

P  Function  save_pdf_file(struct pdf* ptr)

{

char* buf = format_pdf(ptr);

fwrite(buf, …);

}

Scanner+Renderer  

Present  every  offset  of  a  memory  image  to  P  

Valid  output  is  reported  

Page 13: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Binary  to  Scanner+Renderer  

In  the  Forensics  Lab,  investigators  recover  the  binary  from  the  suspects  computer  

Based  on  dynamic  binary  analysis,  DSCRETE  then  builds  a  scanner+renderer  tool  in  2  steps  

The  resulting  scanner+renderer  tool  can  be  reused  in  all  future  investigations  of  that  application  

Page 14: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Step  1:  Find  the  P  Function  

Execute  the  binary  from  the  suspect’s  computer  

Slicing  techniques  find  printing/rendering  component  Select  which  output  functions  emit  the  evidence  

E.g.  fwrite(  …  )  that  saved  PDF  file  

DSCRETE  saves  a  memory  snapshot  during  output  function(s)  

Page 15: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Step  2:  Isolate  P’s  Entry  Point  

DSCRETE  finds  “candidates”  for  the  entry  point  

Candidates  must:  1. Take  a  heap  pointer  as  input

2. All  selected  output/rendering  functions  must  depend  on  it

Execute  the  binary  again  &  

Use  Cross-­‐State  Execution  to  find  correct  candidates  

Page 16: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Identified  Candidate  

Cross-­‐State  Execution  Program  Code  

struct pdf* my_pdf;

my_pdf = load_pdf_file(…);

main_loop(my_pdf); // User edits PDF

save_pdf_file(my_pdf);

exit(0);

save_pdf_file(struct pdf* ptr)

{

char* buf = format(ptr);

fwrite(buf, …);

}

Page 17: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Cross-­‐State  Execution  Program  Code  

struct pdf* my_pdf;

my_pdf = load_pdf_file(…);

main_loop(my_pdf); // User edits PDF

save_pdf_file(my_pdf);

exit(0);

save_pdf_file(struct pdf* ptr)

{

char* buf = format(ptr);

fwrite(buf, …);

}

App’s  Memory  

Page 18: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Cross-­‐State  Execution  Program  Code  

struct pdf* my_pdf;

my_pdf = load_pdf_file(…);

main_loop(my_pdf); // User edits PDF

save_pdf_file(my_pdf);

exit(0);

save_pdf_file(struct pdf* ptr)

{

char* buf = format(ptr);

fwrite(buf, …);

}

App’s  Memory  

Page 19: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Cross-­‐State  Execution  Program  Code  

struct pdf* my_pdf;

my_pdf = load_pdf_file(…);

main_loop(my_pdf); // User edits PDF

save_pdf_file(my_pdf);

exit(0);

save_pdf_file(struct pdf* ptr)

{

char* buf = format(ptr);

fwrite(buf, …);

}

App’s  Memory  

Begin  Cross-­‐State  Execution!  

1.  Map  in  memory  snapshot2. Swap  my_pdf  pointer

Memory  Snapshot  (from  Step  1)  

Page 20: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Cross-­‐State  Execution  Program  Code  

struct pdf* my_pdf;

my_pdf = load_pdf_file(…);

main_loop(my_pdf); // User edits PDF

save_pdf_file(my_pdf);

exit(0);

save_pdf_file(struct pdf* ptr)

{

char* buf = format(ptr);

fwrite(buf, …);

}

App’s  Memory  

Memory  Snapshot  (from  Step  1)  

Page 21: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Cross-­‐State  Execution  Program  Code  

struct pdf* my_pdf;

my_pdf = load_pdf_file(…);

main_loop(my_pdf); // User edits PDF

save_pdf_file(my_pdf);

exit(0);

save_pdf_file(struct pdf* ptr)

{

char* buf = format(ptr);

fwrite(buf, …);

}

App’s  Memory  

Memory  Snapshot  (from  Step  1)  

Key  Observation:  A  Correct  Candidate  will  

output  the  PDF  from  Step  1  

Page 22: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Reused  Application  Logic  

Correct  candidate  is  packed  into  scanner+renderer  tool  

Presents  each  offset  in  suspect’s  memory  image  to  P  Reports  natural  application  output  as  evidence  

This  tool  can  be  used  in  all  future  investigations  of  this  app.  

Page 23: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Evaluation  App.   Data   Truth   Found   FP   FP%   FN   FN%  

convert   Image   1   1   0   0%   0   0%  

gnome-­‐paint   Image   51   51   0   0%   0   0%  

gThumb   Image   382   381   0   0%   1   0.4%  

Filename   63   63   0   0%   0   0%  

gnome-­‐screenshot   Screenshot  Image   1   1   0   0%   0   0%  

Nginx   Request  log   6   6   0   0%   0   0%  

PDFedit   PDF   1   1   0   0%   0   0%  

top   Process  data   382   382   0   0%   0   0%  

Xfig   Figure   1   1   0   0%   0   0%  

CenterIM   Username  &  Password   1   1   0   0%   0   0%  

darktable   SQL  query   1   1   0   0%   0   0%  

Firefox   SQL  query   1   1   0   0%   0   0%  

SQL  log   788   1384   502   40%   35   4%  

Page 24: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Evaluation  App.   Data   Truth   Found   FP   FP%   FN   FN%  

convert   Image   1   1   0   0%   0   0%  

gnome-­‐paint   Image   51   51   0   0%   0   0%  

gThumb   Image   382   381   0   0%   1   0.4%  

Filename   63   63   0   0%   0   0%  

gnome-­‐screenshot   Screenshot  Image   1   1   0   0%   0   0%  

Nginx   Request  log   6   6   0   0%   0   0%  

PDFedit   PDF   1   1   0   0%   0   0%  

top   Process  data   382   382   0   0%   0   0%  

Xfig   Figure   1   1   0   0%   0   0%  

CenterIM   Username  &  Password   1   1   0   0%   0   0%  

darktable   SQL  query   1   1   0   0%   0   0%  

Firefox   SQL  query   1   1   0   0%   0   0%  

SQL  log   788   1384   502   40%   35   4%  

Page 25: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Evaluation  App.   Data   Truth   Found   FP   FP%   FN   FN%  

convert   Image   1   1   0   0%   0   0%  

gnome-­‐paint   Image   51   51   0   0%   0   0%  

gThumb   Image   382   381   0   0%   1   0.4%  

Filename   63   63   0   0%   0   0%  

gnome-­‐screenshot   Screenshot  Image   1   1   0   0%   0   0%  

Nginx   Request  log   6   6   0   0%   0   0%  

PDFedit   PDF   1   1   0   0%   0   0%  

top   Process  data   382   382   0   0%   0   0%  

Xfig   Figure   1   1   0   0%   0   0%  

CenterIM   Username  &  Password   1   1   0   0%   0   0%  

darktable   SQL  query   1   1   0   0%   0   0%  

Firefox   SQL  query   1   1   0   0%   0   0%  

SQL  log   788   1384   502   40%   35   4%  

Page 26: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Evaluation  App.   Data   Truth   Found   FP   FP%   FN   FN%  

convert   Image   1   1   0   0%   0   0%  

gnome-­‐paint   Image   51   51   0   0%   0   0%  

gThumb   Image   382   381   0   0%   1   0.4%  

Filename   63   63   0   0%   0   0%  

gnome-­‐screenshot   Screenshot  Image   1   1   0   0%   0   0%  

Nginx   Request  log   6   6   0   0%   0   0%  

PDFedit   PDF   1   1   0   0%   0   0%  

top   Process  data   382   382   0   0%   0   0%  

Xfig   Figure   1   1   0   0%   0   0%  

CenterIM   Username  &  Password   1   1   0   0%   0   0%  

darktable   SQL  query   1   1   0   0%   0   0%  

Firefox   SQL  query   1   1   0   0%   0   0%  

SQL  log   788   1384   502   40%   35   4%  

Page 27: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Evaluation  App.   Data   Truth   Found   FP   FP%   FN   FN%  

convert   Image   1   1   0   0%   0   0%  

gnome-­‐paint   Image   51   51   0   0%   0   0%  

gThumb   Image   382   381   0   0%   1   0.4%  

Filename   63   63   0   0%   0   0%  

gnome-­‐screenshot   Screenshot  Image   1   1   0   0%   0   0%  

Nginx   Request  log   6   6   0   0%   0   0%  

PDFedit   PDF   1   1   0   0%   0   0%  

top   Process  data   382   382   0   0%   0   0%  

Xfig   Figure   1   1   0   0%   0   0%  

CenterIM   Username  &  Password   1   1   0   0%   0   0%  

darktable   SQL  query   1   1   0   0%   0   0%  

Firefox   SQL  query   1   1   0   0%   0   0%  

SQL  log   788   1384   502   40%   35   4%  

Page 28: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Evaluation  App.   Data   Truth   Found   FP   FP%   FN   FN%  

convert   Image   1   1   0   0%   0   0%  

gnome-­‐paint   Image   51   51   0   0%   0   0%  

gThumb   Image   382   381   0   0%   1   0.4%  

Filename   63   63   0   0%   0   0%  

gnome-­‐screenshot   Screenshot  Image   1   1   0   0%   0   0%  

Nginx   Request  log   6   6   0   0%   0   0%  

PDFedit   PDF   1   1   0   0%   0   0%  

top   Process  data   382   382   0   0%   0   0%  

Xfig   Figure   1   1   0   0%   0   0%  

CenterIM   Username  &  Password   1   1   0   0%   0   0%  

darktable   SQL  query   1   1   0   0%   0   0%  

Firefox   SQL  query   1   1   0   0%   0   0%  

SQL  log   788   1384   502   40%   35   4%  

Page 29: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Evaluation  App.   Data   Truth   Found   FP   FP%   FN   FN%  

convert   Image   1   1   0   0%   0   0%  

gnome-­‐paint   Image   51   51   0   0%   0   0%  

gThumb   Image   382   381   0   0%   1   0.4%  

Filename   63   63   0   0%   0   0%  

gnome-­‐screenshot   Screenshot  Image   1   1   0   0%   0   0%  

Nginx   Request  log   6   6   0   0%   0   0%  

PDFedit   PDF   1   1   0   0%   0   0%  

top   Process  data   382   382   0   0%   0   0%  

Xfig   Figure   1   1   0   0%   0   0%  

CenterIM   Username  &  Password   1   1   0   0%   0   0%  

darktable   SQL  query   1   1   0   0%   0   0%  

Firefox   SQL  query   1   1   0   0%   0   0%  

SQL  log   788   1384   502   40%   35   4%  

Page 30: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

P function identification effectiveness

Page 31: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Normalized size of P vs. entire binary code

Page 32: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Conclusion  Identified  the  Content  Reverse  Engineering  problem  in  forensics  

DSCRETE  leverages  binary  logic  reuse  to  automatically  locate  data  structures  in  memory  images  and  reverse  engineer  content  

Highly  effective  at  recovering  many  forms  of  digital  evidence  

Page 33: Automatic Rendering of Forensic Information from Memory ...ksun/csci780-f14/notes/21-DSCRETE.pdf · Locate data structure instances in memory image via signature-based scanning Step

Thank  you!  

Questions?