instruction subsets in software diversity malware project nguyet nguyen nov. 30 th 2004

28
Instruction Subsets Instruction Subsets in in Software Diversity Software Diversity Malware Project Malware Project Nguyet Nguyen Nguyet Nguyen Nov. 30 Nov. 30 th th 2004 2004

Upload: loren-miles

Post on 18-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Instruction Subsets Instruction Subsets in in

Software DiversitySoftware Diversity

Instruction Subsets Instruction Subsets in in

Software DiversitySoftware Diversity

Malware ProjectMalware ProjectNguyet NguyenNguyet NguyenNov. 30Nov. 30thth 2004 2004

Page 2: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Motivation: Visit the company

Computer

•CPU is the main worker of the company Computer

•CPU joins a set of parts called Insts into robots called Softs

•Softs work at the Computer office•Computer stores some gold boxes in the office•Insts are delivered by DevelopersGold boxes have some holes on it The office door is opened

Page 3: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Computer’s Office

InstInst

InstInst

Software

CPU

Gold boxes

Page 4: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Motivation: meet Evil• Mr Evil knows how CPU works• Mr Evil knows the holes of gold

boxes•Evil creates a new array of Insts that CPU will assemble them in to a new kinds of Robots called Worms

•Worms can steal gold via the holes

Page 5: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Problems occurIn Computer Office

InstInst

InstInst

CPU

Gold boxes

SoftwareWorms

Page 6: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Bigger Problem: All companies

Page 7: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Current Solutions• Using a Gatekeeper before CPU• Dye the Insts with dying solution

Key• Gatekeeper applies rev-Key to

dyed InstsRandomizing

Instruction DIALECTS

Page 8: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Illustrator

InstInst

Inst

Inst

Inst

Hu hu, I cannot do anything

Page 9: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Is it good?• Portable? No• Performance? reduce• Security?

– Rely on the enforcement environment

– Key can be guessed

Page 10: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Subset

InstInst

Inst

Hu hu, I cannot do anything

Page 11: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Is Instruction Subset better?

• Portable• Performance: Hardware

Gatekeeper• Security:

– work without the enforcement environment

– Difference size of versions

Page 12: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Groups of Instructions• Divide the Instruction Set in to

Groups:– Group of unique instructions (UI)– Groups of equivalent instructions (EIs)

• New IS = UI + new EI– EI’s members are selected from each

of old EIs

Page 13: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Unique Instructions• Call• Int/Ret• Convert Instructions: Cbw, Cdq• Set/Clear Interrupt Flag: CLI, SLI• Ascii and Decimal Adjust: Aaa,

Aad• ESC, Halt• Lea• Lock• Nop• Push/Pop, PushF/PopF• Wait/FWait• In/Out

Page 14: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Groups of EIs• Load instructions: lds, lodsb, lodsw• Store instructions: sodsb, sodw• Branch instructions: jump, loop, repeat

35+5+5=45 insts• Move instructions: Mov, Movs, Movsx,

Movsz• Add/Sub: Add, Inc, Dec, Sub• Mul/Div: imul, mul, idiv, div• Test: ;• Interchange: Cmp and Change• Flags set: • Logical Operation: and, or, xor, not (4 insts)

Page 15: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Transformation• Some transformation is easy, others are

not• Transformation complexity depends

from other groupsEx:

• dec and sub• Jmp

Mov ax,0Je ax;

Page 16: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Instruction selecting in EI sets

• Insts with transformation complexity are statically omitted or allowed (50% of allowing)

• Inc, dec, mov, jmp

• Pick randomly 1 of remaining instructions

Page 17: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Does it work? • 3 questions:

– Is it possible for a worm to use only UI to complete its work?

– How many diverse subsets we have?– How long should a worm be to ensure

an acceptable rate of protection?

Page 18: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Question 1: UI is enough?

• NO• Why?

– A worm should use a Jump – A worm should use a load

• Verification?– CodeRed– Shapphire– Nimda– Unix worms: ADM Worm v1

Page 19: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Question 2: How diverse this approach

is?• The number of difference version we

have is:2number_of_static_instx number_of_EI1x…

• Depends on the number of EIs that we apply selecting process and how many instruction that we pick up in a set

Page 20: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Question 3: Performance?

• Not depends on how long a worm is

• It is how many different instruction a worm uses

• Using only opcode limits opportunities of subset diversity

Page 21: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Example: Sapphire• push• mov• xor• loop• lea• call• cmp• jz• or• shl• jmp

UI: push, call, lea

OI:

•Logical Operation: or,xor, cmp, shl

•Branch Operation: loop, jz, jmp

•Move Operation: movPERFOMANCE:

P(all insts pass)=2(3/4)(2/3)(1/45)(1/45)(1/2)

=10-4

Anything wrong?

Page 22: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

How to enhance Diversity?• Determine how many instructions

needed to complete a worm? • Enhance diversity of UI by adding

addressing mode/operant mode• Complicated? Yes• How to reduce costs: apply with only

“important instructions”

Page 23: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

High Level Hypothesis about worms

• Every worm needs to use a call• Every worm needs to use a push• Every worm needs communication instructions?• Every worm needs a load or a store• Every worm needs at least one of arithmetic

instructions

What are we need?

Page 24: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Push and Call• Push: 6 Operant Modes• Call: 30 Operant Modes

• 6 near• 8 far• 4 task• 12 gate

Page 25: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Example: Sapphire (II)• Callcall eaxcall dword ptr [esi]

• Push:push 42B0C9DCh

push eax

call esi

PERFOMANCE:

P(all call/push passed)=(1/6)(1/8)(1/6)(1/6)(1/6)

Page 26: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Issues? • Instruction Guessing?

– Worms may not be fast enough– People can try to guess from simple

to complicated instruction

• Hypothesis proof– Disassembled code– Static Analysis

Page 27: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

ConclusionsNothing is perfectMore solutions of diversity better

diversity

Page 28: Instruction Subsets in Software Diversity Malware Project Nguyet Nguyen Nov. 30 th 2004

Thank you