A Novel Obfusca/on: Class Hierarchy Fla9ening Christophe - - PowerPoint PPT Presentation

a novel obfusca on class hierarchy fla9ening
SMART_READER_LITE
LIVE PREVIEW

A Novel Obfusca/on: Class Hierarchy Fla9ening Christophe - - PowerPoint PPT Presentation

A Novel Obfusca/on: Class Hierarchy Fla9ening Christophe Foket, Bjorn De Su9er, Bart Coppens & Koen De Bosschere Computer Systems Lab Ghent


slide-1
SLIDE 1

A ¡Novel ¡Obfusca/on: ¡ Class ¡Hierarchy ¡Fla9ening ¡

Christophe ¡Foket, ¡Bjorn ¡De ¡Su9er, ¡ ¡ Bart ¡Coppens ¡& ¡Koen ¡De ¡Bosschere ¡

¡ Computer ¡Systems ¡Lab ¡ Ghent ¡University, ¡Belgium ¡ ¡ FPS ¡2012 ¡ October ¡26, ¡2012 ¡

slide-2
SLIDE 2

Outline ¡

  • Bytecode ¡obfusca/on ¡
  • Class ¡hierarchy ¡fla9ening ¡
  • Evalua/on ¡
  • Conclusions ¡

2 ¡

slide-3
SLIDE 3

Binary ¡soQware ¡

Bytecode ¡is ¡vulnerable ¡

3 ¡

slide-4
SLIDE 4

Binary ¡soQware ¡ Bytecode ¡soQware ¡

Bytecode ¡is ¡vulnerable ¡

4 ¡

slide-5
SLIDE 5

Bytecode ¡obfusca/on ¡

5 ¡

an/-­‑reverse ¡ engineering ¡ Goal ¡ an/-­‑code ¡liQing ¡ an/-­‑code ¡injec/on ¡ Goal ¡

Bytecode ¡soQware ¡

slide-6
SLIDE 6

Bytecode ¡obfusca/on ¡

6 ¡

an/-­‑reverse ¡ engineering ¡ Goal ¡ an/-­‑code ¡liQing ¡ an/-­‑code ¡injec/on ¡ Goal ¡

Bytecode ¡soQware ¡

remove ¡inheritance ¡ rela/ons ¡between ¡classes ¡

slide-7
SLIDE 7

Class ¡hierarchy ¡fla9ening ¡

Example ¡

7 ¡

class ¡Main ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡ShapeWindow ¡w ¡= ¡new ¡ShapeWindow(…); ¡ ¡ ¡ ¡ ¡Circle ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡Rectangle ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:add>(c); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:add>(r); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:paint>(); ¡ ¡ ¡ ¡ ¡c.<Circle:draw>(); ¡ ¡ ¡ ¡ ¡r.<Rectangle:draw>(); ¡ ¡ ¡} ¡ } ¡

slide-8
SLIDE 8

Class ¡hierarchy ¡fla9ening ¡

Example ¡

8 ¡

class ¡Main ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡Common ¡w ¡= ¡new ¡ShapeWindow(…); ¡ ¡ ¡ ¡ ¡Common ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡Common ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡ ¡ ¡w.<Common:add>(c); ¡ ¡ ¡ ¡ ¡w.<Common:add>(r); ¡ ¡ ¡ ¡ ¡w.<Common:paint>(); ¡ ¡ ¡ ¡ ¡c.<Common:draw>(); ¡ ¡ ¡ ¡ ¡r.<Common:draw>(); ¡ ¡ ¡} ¡ } ¡

slide-9
SLIDE 9

Class ¡hierarchy ¡fla9ening ¡

Step ¡1: ¡subtree ¡selec/on ¡

9 ¡

class ¡Main ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡ShapeWindow ¡w ¡= ¡new ¡ShapeWindow(…); ¡ ¡ ¡ ¡ ¡Circle ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡Rectangle ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:add>(c); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:add>(r); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:paint>(); ¡ ¡ ¡ ¡ ¡c.<Circle:draw>(); ¡ ¡ ¡ ¡ ¡r.<Rectangle:draw>(); ¡ ¡ ¡} ¡ } ¡

slide-10
SLIDE 10

Class ¡hierarchy ¡fla9ening ¡

Step ¡2: ¡interface ¡inser/on ¡

10 ¡

  • one ¡interface ¡per ¡subtree ¡
  • acts ¡as ¡a ¡common ¡super ¡type ¡
  • declares ¡all ¡instance ¡methods ¡ ¡

declared ¡in ¡all ¡classes ¡of ¡the ¡ ¡ subtree ¡ ¡

slide-11
SLIDE 11

Class ¡hierarchy ¡fla9ening ¡

Step ¡3: ¡subtree ¡type ¡abstrac/on ¡

11 ¡

class ¡Main ¡implements ¡Common3 ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡ShapeWindow ¡w ¡= ¡new ¡ShapeWindow(…); ¡ ¡ ¡ ¡ ¡Circle ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡Rectangle ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:add>(c); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:add>(r); ¡ ¡ ¡ ¡ ¡w.<ShapeWindow:paint>(); ¡ ¡ ¡ ¡ ¡c.<Circle:draw>(); ¡ ¡ ¡ ¡ ¡r.<Rectangle:draw>(); ¡ ¡ ¡} ¡ } ¡

slide-12
SLIDE 12

class ¡Main ¡implements ¡Common3 ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡Common2 ¡w ¡= ¡new ¡ShapeWindow(…); ¡ ¡ ¡ ¡ ¡Common1 ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡Common1 ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡ ¡ ¡w.<Common2:add>(c); ¡ ¡ ¡ ¡ ¡w.<Common2:add>(r); ¡ ¡ ¡ ¡ ¡w.<Common2:paint>(); ¡ ¡ ¡ ¡ ¡c.<Common1:draw>(); ¡ ¡ ¡ ¡ ¡r.<Common1:draw>(); ¡ ¡ ¡} ¡ } ¡

Class ¡hierarchy ¡fla9ening ¡

Step ¡3: ¡subtree ¡type ¡abstrac/on ¡

12 ¡

slide-13
SLIDE 13

Class ¡hierarchy ¡fla9ening ¡

Step ¡4: ¡subtree ¡fla9ening ¡

13 ¡

  • recursively ¡traverse ¡each ¡subtree ¡
  • copy ¡to ¡each ¡direct ¡subclass ¡

– instance ¡fields ¡ – instance ¡methods ¡ – implemented ¡interfaces ¡

  • update ¡super ¡calls ¡
  • update ¡field ¡accesses ¡
  • move ¡up ¡subclass ¡

in ¡the ¡hierarchy ¡

  • add ¡dummy ¡ ¡

methods ¡ ¡

slide-14
SLIDE 14

class ¡Main ¡implements ¡Common3 ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡Common2 ¡w ¡= ¡new ¡ShapeWindow(…); ¡ ¡ ¡ ¡ ¡Common1 ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡Common1 ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡ ¡ ¡w.<Common2:add>(c); ¡ ¡ ¡ ¡ ¡w.<Common2:add>(r); ¡ ¡ ¡ ¡ ¡w.<Common2:paint>(); ¡ ¡ ¡ ¡ ¡c.<Common1:draw>(); ¡ ¡ ¡ ¡ ¡r.<Common1:draw>(); ¡ ¡ ¡} ¡ } ¡ class ¡Main ¡implements ¡Common3 ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡Common2 ¡w ¡= ¡new ¡ShapeWindow(…); ¡// ¡w ¡can ¡hold ¡objects ¡of ¡2 ¡types ¡ ¡ ¡ ¡ ¡Common1 ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡ ¡// ¡c ¡can ¡hold ¡objects ¡of ¡3 ¡types ¡ ¡ ¡ ¡ ¡Common1 ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡// ¡r ¡can ¡hold ¡objects ¡of ¡3 ¡types ¡ ¡ ¡ ¡ ¡w.<Common2:add>(c); ¡ ¡ ¡ ¡ ¡w.<Common2:add>(r); ¡ ¡ ¡ ¡ ¡w.<Common2:paint>(); ¡ ¡ ¡ ¡ ¡c.<Common1:draw>(); ¡ ¡ ¡ ¡ ¡r.<Common1:draw>(); ¡ ¡ ¡} ¡ } ¡

Class ¡hierarchy ¡fla9ening ¡

Step ¡5: ¡interface ¡merging ¡

14 ¡

slide-15
SLIDE 15

class ¡Main ¡implements ¡Common ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡Common ¡w ¡= ¡new ¡ShapeWindow(…); ¡// ¡w ¡can ¡hold ¡objects ¡of ¡6 ¡types ¡ ¡ ¡ ¡ ¡Common ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡ ¡// ¡c ¡can ¡hold ¡objects ¡of ¡6 ¡types ¡ ¡ ¡ ¡ ¡Common ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡// ¡r ¡can ¡hold ¡objects ¡of ¡6 ¡types ¡ ¡ ¡ ¡ ¡w.<Common:add>(c); ¡ ¡ ¡ ¡ ¡w.<Common:add>(r); ¡ ¡ ¡ ¡ ¡w.<Common:paint>(); ¡ ¡ ¡ ¡ ¡c.<Common:draw>(); ¡ ¡ ¡ ¡ ¡r.<Common:draw>(); ¡ ¡ ¡} ¡ } ¡

Class ¡hierarchy ¡fla9ening ¡

Step ¡5: ¡interface ¡merging ¡

15 ¡

16 ¡dummy ¡methods ¡

slide-16
SLIDE 16

Class ¡hierarchy ¡fla9ening ¡

Step ¡5: ¡interface ¡merging ¡

16 ¡

class ¡Main ¡implements ¡Common3 ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡Common2 ¡w ¡= ¡new ¡ShapeWindow(…); ¡// ¡w ¡can ¡hold ¡objects ¡of ¡2 ¡types ¡ ¡ ¡ ¡ ¡Common1 ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡ ¡// ¡c ¡can ¡hold ¡objects ¡of ¡3 ¡types ¡ ¡ ¡ ¡ ¡Common1 ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡// ¡r ¡can ¡hold ¡objects ¡of ¡3 ¡types ¡ ¡ ¡ ¡ ¡w.<Common2:add>(c); ¡ ¡ ¡ ¡ ¡w.<Common2:add>(r); ¡ ¡ ¡ ¡ ¡w.<Common2:paint>(); ¡ ¡ ¡ ¡ ¡c.<Common1:draw>(); ¡ ¡ ¡ ¡ ¡r.<Common1:draw>(); ¡ ¡ ¡} ¡ } ¡

slide-17
SLIDE 17

class ¡Main ¡implements ¡Common2 ¡{ ¡ ¡ ¡void ¡main(){ ¡ ¡ ¡ ¡ ¡Common2 ¡w ¡= ¡new ¡ShapeWindow(…); ¡// ¡w ¡can ¡hold ¡objects ¡of ¡3 ¡types ¡ ¡ ¡ ¡ ¡Common1 ¡c ¡= ¡new ¡Circle(…); ¡ ¡ ¡ ¡ ¡ ¡// ¡c ¡can ¡hold ¡objects ¡of ¡3 ¡types ¡ ¡ ¡ ¡ ¡Common1 ¡r ¡= ¡new ¡Rectangle(…); ¡ ¡ ¡// ¡r ¡can ¡hold ¡objects ¡of ¡3 ¡types ¡ ¡ ¡ ¡ ¡w.<Common2:add>(c); ¡ ¡ ¡ ¡ ¡w.<Common2:add>(r); ¡ ¡ ¡ ¡ ¡w.<Common2:paint>(); ¡ ¡ ¡ ¡ ¡c.<Common1:draw>(); ¡ ¡ ¡ ¡ ¡r.<Common1:draw>(); ¡ ¡ ¡} ¡ } ¡

Class ¡hierarchy ¡fla9ening ¡

Step ¡5: ¡interface ¡merging ¡

17 ¡

5 ¡dummy ¡methods ¡

slide-18
SLIDE 18

Outline ¡

  • Bytecode ¡obfusca/on ¡
  • Class ¡hierarchy ¡fla9ening ¡
  • Evalua/on ¡
  • Conclusions ¡

18 ¡

slide-19
SLIDE 19

Evalua/on ¡

19 ¡

DaCapo ¡benchmark ¡suite ¡

Name ¡ Descrip/on ¡ # ¡appl ¡types ¡ # ¡transf ¡classes ¡ # ¡jar ¡files ¡ ba/k ¡ Scalable ¡Vector ¡Graphics ¡processor ¡ 4573 ¡ 3505 ¡(77%) ¡ 6 ¡ eclipse ¡ Non-­‑GUI ¡version ¡of ¡Eclipse ¡IDE ¡ 5947 ¡ 2258 ¡(38%) ¡ 48 ¡ fop ¡ XLS-­‑FI ¡to ¡PDF ¡conversion ¡ 4479 ¡ 3349 ¡(75%) ¡ 7 ¡ luindex ¡ Document ¡indexing ¡based ¡on ¡Lucene ¡ 633 ¡ 526 ¡(83%) ¡ 3 ¡

slide-20
SLIDE 20

Evalua/on ¡

20 ¡

DaCapo ¡benchmark ¡suite ¡

  • bfuscator ¡on ¡top ¡of ¡Soot ¡
slide-21
SLIDE 21

Evalua/on ¡

21 ¡

DaCapo ¡benchmark ¡suite ¡

  • bfuscator ¡on ¡top ¡of ¡Soot ¡
slide-22
SLIDE 22

Evalua/on ¡

22 ¡

[BD02] ¡ ¡Bansiya, ¡J. ¡and ¡Davis, ¡C. ¡G., ¡A ¡Hierarchical ¡Model ¡for ¡Object-­‑Oriented ¡Design ¡Quality ¡Assessment, ¡In ¡ IEEE ¡Transac/ons ¡on ¡SoQware ¡Engineering, ¡volume ¡28, ¡2002. ¡

Quality ¡Model ¡for ¡Object-­‑Oriented ¡Design ¡[BD02]: ¡understandability ¡metric ¡ understandability ¡

Protec/on ¡against ¡human ¡program ¡understanding ¡

slide-23
SLIDE 23

Evalua/on ¡

23 ¡

distribu/on ¡of ¡points-­‑to ¡set ¡sizes ¡for ¡ba/k ¡

Protec/on ¡against ¡sta/c ¡analysis ¡tools ¡

slide-24
SLIDE 24

Evalua/on ¡

24 ¡

Code ¡size ¡

slide-25
SLIDE 25

Evalua/on ¡

25 ¡

Execu/on ¡/me ¡

slide-26
SLIDE 26

Outline ¡

  • Bytecode ¡obfusca/on ¡
  • Class ¡hierarchy ¡fla9ening ¡
  • Evalua/on ¡
  • Conclusions ¡

26 ¡

slide-27
SLIDE 27

Conclusions ¡

27 ¡

  • class ¡hierarchy ¡fla9ening ¡
  • measurable ¡protec/on ¡
  • rela/vely ¡low ¡run-­‑/me ¡overhead ¡
  • real-­‑life ¡applica/ons ¡
  • extensions ¡possible ¡
slide-28
SLIDE 28

Ques/ons? ¡

slide-29
SLIDE 29

Evalua/on ¡

29 ¡

Protec/on ¡against ¡human ¡program ¡understanding ¡

[BD02] ¡ ¡Bansiya, ¡J. ¡and ¡Davis, ¡C. ¡G., ¡A ¡Hierarchical ¡Model ¡for ¡Object-­‑Oriented ¡Design ¡Quality ¡Assessment, ¡In ¡ IEEE ¡Transac/ons ¡on ¡SoQware ¡Engineering, ¡volume ¡28, ¡2002. ¡

Quality ¡Model ¡for ¡Object-­‑Oriented ¡Design ¡[BD02]: ¡understandability ¡metric ¡ understandability ¡breakdown ¡for ¡ba/k ¡