Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g....

39

Transcript of Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g....

Page 1: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Practical Overview of a Xen Covert Channel

Mickaël Salaün

ESIEA

<[email protected]>

May 11, 2009

18th EICAR Annual Conference

Page 2: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Introduction

1 Introduction

2 Isolation

3 Virtualization

4 XenCC

5 Conclusion

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 2 / 23

Page 3: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

VirtualizationVirtualization comes up at the 60th with IBM CP/CMS

This last years more softwares comes with di�erent methods,and now virtualization use is growing more and more

Common UsesMultiples OS in an unique hardware at the same time:

Host sharing (datacenter, computer farm)

Mutualization (e.g. multiple application servers in one realcomputer)

"Virtual" machine isolation

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 3 / 23

Page 4: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

VirtualizationVirtualization comes up at the 60th with IBM CP/CMS

This last years more softwares comes with di�erent methods,and now virtualization use is growing more and more

Common UsesMultiples OS in an unique hardware at the same time:

Host sharing (datacenter, computer farm)

Mutualization (e.g. multiple application servers in one realcomputer)

"Virtual" machine isolation

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 3 / 23

Page 5: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Isolation

1 Introduction

2 IsolationMultilevel securityCompromised SystemCovert Channel

3 Virtualization

4 XenCC

5 Conclusion

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 4 / 23

Page 6: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Multilevel security

Why?Keep in a safe place critical data

Avoid leaks

Stay out of reach from malware. . .

Opposite ConstraintsData isolation

Data sharing

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 5 / 23

Page 7: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Multilevel security

Why?Keep in a safe place critical data

Avoid leaks

Stay out of reach from malware. . .

Opposite ConstraintsData isolation

Data sharing

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 5 / 23

Page 8: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Compromised System

GoalsStay in place as long as possible

Remain stealthy

Use the system!

Needed FeaturesDesigned to remain hidden

Communicate with the outside

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 6 / 23

Page 9: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Compromised System

GoalsStay in place as long as possible

Remain stealthy

Use the system!

Needed FeaturesDesigned to remain hidden

Communicate with the outside

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 6 / 23

Page 10: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Covert Channel

De�nitionCovert channels are those that "use entities not normally viewed asdata objects to transfer information from one subject to another."[Kemmerer, Richard A.]

Software LevelToo permissive implementation

Design bugs. . .

Hardware LevelDevice with residual memory

Time factor (e.g. CPU time processing)

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 7 / 23

Page 11: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Covert Channel

De�nitionCovert channels are those that "use entities not normally viewed asdata objects to transfer information from one subject to another."[Kemmerer, Richard A.]

Software LevelToo permissive implementation

Design bugs. . .

Hardware LevelDevice with residual memory

Time factor (e.g. CPU time processing)

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 7 / 23

Page 12: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Covert Channel

De�nitionCovert channels are those that "use entities not normally viewed asdata objects to transfer information from one subject to another."[Kemmerer, Richard A.]

Software LevelToo permissive implementation

Design bugs. . .

Hardware LevelDevice with residual memory

Time factor (e.g. CPU time processing)

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 7 / 23

Page 13: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Virtualization

1 Introduction

2 Isolation

3 VirtualizationFeatures and ExpectationsXen OverviewXen Architecture (32 bits)Memory ManagementWaterproofness

4 XenCC

5 ConclusionMickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 8 / 23

Page 14: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Features and Expectations

Main GoalsMany virtual computers

Protection between guests

Virtualizer protection from virtual guests

...and protection from hardware

Main ProblemsLoads/devices sharing

⇒ Quality of service mechanism

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 9 / 23

Page 15: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Features and Expectations

Main GoalsMany virtual computers

Protection between guests

Virtualizer protection from virtual guests

...and protection from hardware

Main ProblemsLoads/devices sharing

⇒ Quality of service mechanism

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 9 / 23

Page 16: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Xen Overview

Open Source SoftwarePossibility to audit the code

⇒ Increase trustworthy

Paravirtualization SystemHypervisor:

Virtualizer in the lowest ringAware guests

⇒ Hight performances

Hypercalls:

Virtualizer "syscall"Communication features (e.g. data sharing, administration)

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 10 / 23

Page 17: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Xen Overview

Open Source SoftwarePossibility to audit the code

⇒ Increase trustworthy

Paravirtualization SystemHypervisor:

Virtualizer in the lowest ringAware guests

⇒ Hight performances

Hypercalls:

Virtualizer "syscall"Communication features (e.g. data sharing, administration)

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 10 / 23

Page 18: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Xen Architecture (32 bits)

Guests OS aware ofAdministrator domain(dom0)

User domains (domU)

⇒ hypercalls

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 11 / 23

Page 19: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Memory Management

HypercallsMemory allocation

Data sharing

A lot of things. . .

MemoriesVirtual memory for userland

Pseudo-physical memory for OS (common physical memory)

Machine memory for hypervisor

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 12 / 23

Page 20: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Memory Management

HypercallsMemory allocation

Data sharing

A lot of things. . .

MemoriesVirtual memory for userland

Pseudo-physical memory for OS (common physical memory)

Machine memory for hypervisor

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 12 / 23

Page 21: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Waterproofness

The Pseudo-physical Transition TableSame table for all guests: for a performancepurpose (less context switching)

Some addresses usable for reading: guest'sones and the shared space (under control)

Can only write in our one memory space(hopefully!)

No entry check: the guest manage its oneallocations (and mechanism) alone

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 13 / 23

Page 22: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

XenCC

1 Introduction

2 Isolation

3 Virtualization

4 XenCCThe Xen WeaknessCommunicationUseInteresting Points

5 ConclusionMickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 14 / 23

Page 23: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

The Xen Weakness

A Design FeatureThe trick: use the shared pseudo-physical memory table

⇒ the PFN table can be read in most part (addresses of otherguests)

Covert Channel MechanismPut data in place of address: virtual (useless) memory allocationwith custom addresses

Make them recognizable with a special tag: custom protocol fordata exchange

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 15 / 23

Page 24: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

The Xen Weakness

A Design FeatureThe trick: use the shared pseudo-physical memory table

⇒ the PFN table can be read in most part (addresses of otherguests)

Covert Channel MechanismPut data in place of address: virtual (useless) memory allocationwith custom addresses

Make them recognizable with a special tag: custom protocol fordata exchange

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 15 / 23

Page 25: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Communication

Protocol DesignNeed an initial knowledge from each guest to know each other

Possibility to create a "chat room" between accomplice guests

The Header TagIdenti�er

Acknowledgement

Remaining data size

Current data size

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 16 / 23

Page 26: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Communication

Protocol DesignNeed an initial knowledge from each guest to know each other

Possibility to create a "chat room" between accomplice guests

The Header TagIdenti�er

Acknowledgement

Remaining data size

Current data size

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 16 / 23

Page 27: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Communication

Data ExtractionFirst reading: look for the accomplice's tag in all the table andrecord the tag place when its found

Next times: use the previous location to read again

Linux Implementation

Need to be able to call hypercalls (kernel land)

Easy use

⇒ A Linux driver (LKM: virtual device)

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 17 / 23

Page 28: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Communication

Data ExtractionFirst reading: look for the accomplice's tag in all the table andrecord the tag place when its found

Next times: use the previous location to read again

Linux Implementation

Need to be able to call hypercalls (kernel land)

Easy use

⇒ A Linux driver (LKM: virtual device)

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 17 / 23

Page 29: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Use

Writing (guest 1)

dom1:~# echo msg dom1 > /dev/ xencc

Reading (guest 2)

dom2:~# dd count=1 i f =/dev / xenccmsg dom10+1 r e c o r d s i n0+1 r e c o r d s out9 by t e s (9 B) cop ied , 0 .000185 s , 48 .6 kB/ s

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 18 / 23

Page 30: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Use

Writing (guest 1)

dom1:~# echo msg dom1 > /dev/ xencc

Reading (guest 2)

dom2:~# dd count=1 i f =/dev / xenccmsg dom10+1 r e c o r d s i n0+1 r e c o r d s out9 by t e s (9 B) cop ied , 0 .000185 s , 48 .6 kB/ s

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 18 / 23

Page 31: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Interesting Points

DrawbacksPush and pop design (no synchronisation)

A lot of memory in saw of the data transfer

Need to be careful with address range in use

May not be discreet (depending of use)

Advantages

Work well for an o�-the-shelf Xen! (≤ 450 KB/s)

Go through the Xen security policy

⇒ Can be use as a new stealthy communication channel bymalwares

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 19 / 23

Page 32: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Interesting Points

DrawbacksPush and pop design (no synchronisation)

A lot of memory in saw of the data transfer

Need to be careful with address range in use

May not be discreet (depending of use)

Advantages

Work well for an o�-the-shelf Xen! (≤ 450 KB/s)

Go through the Xen security policy

⇒ Can be use as a new stealthy communication channel bymalwares

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 19 / 23

Page 33: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Conclusion

1 Introduction

2 Isolation

3 Virtualization

4 XenCC

5 ConclusionCounter measuresSo What?

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 20 / 23

Page 34: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Counter measures

DetectionNo public implemented solution for now

Statistics of hypercalls usage about mfn2pfn table access (time)

Look for some similarity access of guests to the table (space)

PreventionFor now: use the shadow page tables (lower performances)

The better way: a mfn2pfn table for each guest containing onlyuseful data

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 21 / 23

Page 35: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Counter measures

DetectionNo public implemented solution for now

Statistics of hypercalls usage about mfn2pfn table access (time)

Look for some similarity access of guests to the table (space)

PreventionFor now: use the shadow page tables (lower performances)

The better way: a mfn2pfn table for each guest containing onlyuseful data

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 21 / 23

Page 36: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

So What?

About XenA great virtualization platform (new improvements: IOMMU,stub domains. . . )

Some design �ow regardless of the use

About virtualizationNo initial need of secure isolation

A good isolation is an hardware one, but. . .

Reactions?Covert-channels seems to not be interesting for developers

⇒ No real reaction about this problem. . .

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 22 / 23

Page 37: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

So What?

About XenA great virtualization platform (new improvements: IOMMU,stub domains. . . )

Some design �ow regardless of the use

About virtualizationNo initial need of secure isolation

A good isolation is an hardware one, but. . .

Reactions?Covert-channels seems to not be interesting for developers

⇒ No real reaction about this problem. . .

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 22 / 23

Page 38: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

So What?

About XenA great virtualization platform (new improvements: IOMMU,stub domains. . . )

Some design �ow regardless of the use

About virtualizationNo initial need of secure isolation

A good isolation is an hardware one, but. . .

Reactions?Covert-channels seems to not be interesting for developers

⇒ No real reaction about this problem. . .

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 22 / 23

Page 39: Practical Overview of a Xen Covert Channel€¦ · Device with residual memory Time factor (e.g. CPU time processing) Mickaël Salaün Practical Overview of a Xen Covert Channel May

Introduction Isolation Virtualization XenCC Conclusion

Thanks for your attention.

Questions ?

code: http://digikod.net/public/XenCC

Mickaël Salaün Practical Overview of a Xen Covert Channel May 11, 2009 23 / 23