A file system for safely interacting with untrusted USB flash drives - - PowerPoint PPT Presentation

a file system for safely interacting with untrusted usb
SMART_READER_LITE
LIVE PREVIEW

A file system for safely interacting with untrusted USB flash drives - - PowerPoint PPT Presentation

A file system for safely interacting with untrusted USB flash drives Ke Zhong , Zhihao Jiang , Ke Ma , and Sebastian Angel University of Pennsylvania Shanghai Jiao Tong University Most Storage has moved to cloud! USB flash drives


slide-1
SLIDE 1

A file system for safely interacting with untrusted USB flash drives

Ke Zhong, Zhihao Jiang⋆, Ke Ma⋆, and Sebastian Angel University of Pennsylvania ⋆Shanghai Jiao Tong University

slide-2
SLIDE 2

Most Storage has moved to cloud!

slide-3
SLIDE 3

USB flash drives remain popular

u Legacy data u No network connections u Store confidential data − Bitcoin keys − Medical records − ID photos

slide-4
SLIDE 4

USB stack has several issues

u Trust-by-default design principle u Devices can bypass kernel and access memory (DMA) u Driver code tends to be buggy − There are many drivers by third party producers u Masquerade as other devices − A device could declare to be a keyboard

slide-5
SLIDE 5

u Trust-by-default design principle u Devices can bypass kernel and access memory (DMA) u Driver code tends to be buggy − There are many drivers by third party producers u Masquerade as other devices − A device could declare to be a keyboard

USB stack has several issues

Could be exploited by a malicious flash drive

slide-6
SLIDE 6

u Trust-by-default design principle u Devices can bypass kernel and access memory (DMA) u Driver code tends to be buggy − There are many drivers by third party producers u Masquerade as other devices − A device could declare to be a keyboard

USB stack has several issues

slide-7
SLIDE 7

Previous work

u Packet filtering − Cinch: Security’16 − USBFilter: Security’16 u Device authentication − ProvUSB: CCS’16 u Sandbox the device − GoodUSB: ACSAS’15

slide-8
SLIDE 8

Limitation

u Packet filtering − Malicious payload that changes dynamically avoids rule-based detection u Device authentication − Require new hardware/kernel modifications u Sandbox the device − False negative (i.e., a device is malicious but sandbox says it's ok)

slide-9
SLIDE 9

We propose RBFuse, which is a file system that accesses flash drives without interacting with the USB stack on the host machine

slide-10
SLIDE 10

Key idea

RBFuse remaps memory space of host controller to a virtual machine, and exports file system of flash drives as a mountable virtual file system

slide-11
SLIDE 11

System overview

IOMMU

slide-12
SLIDE 12

System overview

IOMMU VFS Server

Virtual machine

slide-13
SLIDE 13

System overview

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

slide-14
SLIDE 14

System overview

IOMMU VFS Server

Virtual machine

VFS Client USB Directory User space daemon

slide-15
SLIDE 15

System overview

IOMMU VFS Server

Virtual machine

VFS Client USB Directory User space daemon Fuse kernel driver

slide-16
SLIDE 16

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”!

slide-17
SLIDE 17

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! ① getattr

slide-18
SLIDE 18

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! ① getattr Execute ① getattr

slide-19
SLIDE 19

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! “No such file” “No such file”

slide-20
SLIDE 20

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! ① getattr ② mknod Execute ① getattr

slide-21
SLIDE 21

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! ① getattr ② mknod Execute ① getattr ② mknod

slide-22
SLIDE 22

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! “Succeed!” “Succeed!”

slide-23
SLIDE 23

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! ① getattr ② mknod ③ getattr Execute ① getattr ② mknod

slide-24
SLIDE 24

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! ① getattr ② mknod ③ getattr Execute ① getattr ② mknod ③ getattr

slide-25
SLIDE 25

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! “foo exists!” “foo exists!”

slide-26
SLIDE 26

How RBFuse runs

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! Done! Execute ① getattr ② mknod ③ getattr ① getattr ② mknod ③ getattr

slide-27
SLIDE 27

Performance issues

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! Execute ① getattr ② mknod ③ getattr ① getattr ② mknod ③ getattr

slide-28
SLIDE 28

Performance issues

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! Execute ① getattr ② mknod ③ getattr ① getattr ② mknod ③ getattr

Too many requests for accessing metadata 3,000 getattr calls are issued when reading 1,000 files

slide-29
SLIDE 29

Performance issues

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Write 1024KB to “foo”! Execute ①write 128KB ②write 128KB …… ⑧write 128KB ①write 128KB ②write 128KB …… ⑧write 128KB

Write requests are split into smaller chunks

slide-30
SLIDE 30

Performance issues

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Read 1024KB from “foo”! Execute ①read 128KB ②read 128KB …… ⑧read 128KB ①read 128KB ②read 128KB …… ⑧read 128KB

Read requests are split into smaller chunks

slide-31
SLIDE 31

Compromised virtual machine

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Malicious

slide-32
SLIDE 32

Compromised virtual machine

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Compromised Malicious

slide-33
SLIDE 33

Compromised virtual machine

IOMMU VFS Server

Virtual machine

VFS Client USB Directory ①Confidential data might be stolen ②Files transferred might be tampered ③Issue malformed file system responses

Compromised Malicious

slide-34
SLIDE 34

Parsing errors

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Requests Serialize requests Parse responses

slide-35
SLIDE 35

Parsing errors

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Requests Serialize requests Parse responses

Parsers, if not designed correctly, can be easily compromised to exploit memory errors and integer overflow.

slide-36
SLIDE 36

Agenda

u How to address those challenges − Optimizations − Encrypted communication − Formally verified serializer and parser u Preliminary evaluation u Discussion & Conclusion

slide-37
SLIDE 37

Agenda

u How to address those challenges − Optimizations − Encrypted communication − Formally verified serializer and parser u Preliminary evaluation u Discussion & Conclusion

slide-38
SLIDE 38

Caching metadata

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! Execute ① getattr ② mknod ③ getattr ① getattr ② mknod ③ getattr

slide-39
SLIDE 39

Caching metadata

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! Execute ① getattr ② mknod ③ getattr ① getattr ② mknod ③ getattr

u Cache during initialization − RBFuse fetches and caches the metadata of all files

and directories during initialization getattr could be done locally at the VFS Client

slide-40
SLIDE 40

Caching metadata

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Create a file “foo”! Execute ① getattr ② mknod ③ getattr ① getattr ② mknod ③ getattr

u Cache during initialization − RBFuse fetches and caches the metadata of all files

and directories during initialization

u Update metadata accordingly − Mknod, write, etc.

slide-41
SLIDE 41

Prefetching

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Read 1024KB from “foo”! Execute ①read 128KB ②read 128KB …… ⑧read 128KB ①read 128KB ②read 128KB …… ⑧read 128KB

slide-42
SLIDE 42

Prefetching

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Read 1024KB from “foo”! Execute read 128KB + 896KB ①read 128KB ②read 128KB …… ⑧read 128KB

Read subsequent chunks for large file

slide-43
SLIDE 43

Prefetching

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Read all files in “dir” Execute ①read f1 ②read f2 …… ⑧read f8 ①read f1 ②read f2 …… ⑧read f8

slide-44
SLIDE 44

Prefetching

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Read all files in “dir” Execute read f1 + f2 ~ f8 ①read f1 ②read f2 …… ⑧read f8

Read other small files in the same directory

slide-45
SLIDE 45

Batching operations

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Write 1024KB to “foo”! Execute ①write 128KB ②write 128KB …… ⑧write 128KB ①write 128KB ②write 128KB …… ⑧write 128KB

slide-46
SLIDE 46

Batching operations

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Write 1024KB to “foo”! Execute write 128KB + write 128KB + …… + write 128KB write 128KB + write 128KB + …… + write 128KB

u Multiple write are combined into one

slide-47
SLIDE 47

Batching operations

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Write 1024KB to “foo”! Execute write 128KB + write 128KB + …… + write 128KB write 128KB + write 128KB + …… + write 128KB

u Multiple write are combined into one u Other requests related to write can also be merged − getattr, mknod, getattr, open, write, close u Speculatively respond to requests first − By monitoring remaining size of flash drives,

if size permitted, then responds “succeed”

slide-48
SLIDE 48

Agenda

u How to address those challenges − Optimizations − Encrypted communication − Formally verified serializer and parser u Preliminary evaluation u Conclusion & Discussion

slide-49
SLIDE 49

Encrypted communication

IOMMU VFS Server

Virtual machine

VFS Client USB Directory Adapter

Optional hardware adapter can be used which could encrypt all read/write contents Malicious

slide-50
SLIDE 50

Encrypted communication

IOMMU VFS Server

Virtual machine

VFS Client USB Directory Adapter

Optional hardware adapter can be used which could encrypt all read/write contents Only two endpoints would see unencrypted contents Endpoint 1 Endpoint 2 Malicious

slide-51
SLIDE 51
slide-52
SLIDE 52

Agenda

u How to address those challenges − Optimizations − Encrypted communication − Formally verified serializer and parser u Preliminary evaluation u Conclusion & Discussion

slide-53
SLIDE 53

Formally verified serializer and parser

IOMMU VFS Server

Virtual machine

VFS Client USB Directory

Requests Serialize requests Parse responses

Our parser and serializer are based on EverParse(Security’19), which has been formally verified. This avoid vulnerabilities, such as memory errors.

slide-54
SLIDE 54

Agenda

u How to address those challenges − Optimizations − Encrypted communication − Formally verified serializer and parser u Preliminary evaluation u Discussion & Conclusion

slide-55
SLIDE 55

Experiment setup

u For virtual machine we run Ubuntu 16.04 (Linux 4.15.0-45) on QEMU.

Host machine is also Ubuntu 16.04 with KVM.

u Adapter for authentication and data encryption is built on a BeagleBone Black

which runs Debian 9.1 (Linux 4.4.88-ti-r125).

u We used filebench to run our experiments. u Our baseline is flash drive connected to the host without any of our mechanisms.

slide-56
SLIDE 56

One large file (500MB)

50 100 150 200 250 Write Read Completion Time (s) Host Adapter RBFuse RBFuse+Adapter

Takeaway: ① RBFuse itself brings little overhead

slide-57
SLIDE 57

One large file (500MB)

50 100 150 200 250 Write Read Completion Time (s) Host Adapter RBFuse RBFuse+Adapter

Takeaway: ① RBFuse itself brings little overhead ② RBFuse + adapter brings about 3x-10x

  • verhead, due to the bad performance
  • f adapter and increased roundtrips

between flash drive and host

slide-58
SLIDE 58

1,000 small files (16KB each)

Takeaway: ① RBFuse itself brings 2x-4x overhead

5 10 15 20 25 30 35 Write Read Completion Time (s) Host Adapter RBFuse RBFuse+Adapter

slide-59
SLIDE 59

1,000 small files (16KB each)

Takeaway: ① RBFuse itself brings 2x-4x overhead ② For write, RBFuse + adapter

  • utperforms directly accessing due to

better performance of adapter on this task

5 10 15 20 25 30 35 Write Read Completion Time (s) Host Adapter RBFuse RBFuse+Adapter

slide-60
SLIDE 60

1,000 small files (16KB each)

Takeaway: ① RBFuse itself brings 2x-4x overhead ② For write, RBFuse + adapter

  • utperforms directly accessing due to

better performance of adapter on this task

5 10 15 20 25 30 35 Write Read Completion Time (s) Host Adapter RBFuse RBFuse+Adapter

Note: adapter could be viewed as another machine with Debian

slide-61
SLIDE 61

1,000 small files (16KB each)

Takeaway: ① RBFuse itself brings 2x-4x overhead ② For write, RBFuse + adapter

  • utperforms directly accessing due to

better performance of adapter on this task ③ For read, RBFuse + adapter brings 8.8x overhead, due to that adapter itself would bring about 2x overhead

5 10 15 20 25 30 35 Write Read Completion Time (s) Host Adapter RBFuse RBFuse+Adapter

Note: adapter could be viewed as another machine with Debian

slide-62
SLIDE 62

Agenda

u How to address those challenges − Optimizations − Encrypted communication − Formally verified serializer and parser u Preliminary evaluation u Discussion & Conclusion

slide-63
SLIDE 63

Crash consistency test

u We modified and ran crashmonkey (OSDI’18) on RBFuse − ext4 − vfat

slide-64
SLIDE 64

Crash consistency test

u We modified and ran crashmonkey (OSDI’18) on RBFuse − ext4 − vfat

  • pen foo O_RDWR|O_CREAT 0777

fsync foo checkpoint 1 close foo

slide-65
SLIDE 65

Crash consistency test

u We modified and ran crashmonkey (OSDI’18) on RBFuse − ext4 − vfat

  • pen foo O_RDWR|O_CREAT 0777

fsync foo checkpoint 1 close foo vfat and RBFuse on vfat would fail!

slide-66
SLIDE 66

Crash consistency test

u We modified and ran crashmonkey (OSDI’18) on RBFuse − ext4 − vfat

  • pen foo O_RDWR|O_CREAT 0777

fsync foo checkpoint 1 close foo vfat and RBFuse on vfat would fail! Hydra (SOSP’19): Parent directory of foo need to be sync

slide-67
SLIDE 67

Previous file system fuzzing

File system User(Client)

u Janus (S&P’19): two-dimensional input fuzzing

slide-68
SLIDE 68

Previous file system fuzzing

File system User(Client)

u Janus (S&P’19): two-dimensional input fuzzing

Image fuzzing

slide-69
SLIDE 69

Previous file system fuzzing

File system User(Client)

u Janus (S&P’19): two-dimensional input fuzzing

Image fuzzing Client program fuzzing

slide-70
SLIDE 70

Server side fuzzing

File system Server (flash drive) User(Client)

u We assume the (file system) server is malicious

slide-71
SLIDE 71

Server side fuzzing

File system Server (flash drive) User(Client)

u We assume the (file system) server is malicious

Malicious messages fuzzing

slide-72
SLIDE 72

Formal verification

u VFS interface is small, has better-defined semantics than USB u Formal verification on our system − Getting the virtual file system interface “right”

slide-73
SLIDE 73

Conclusion

u We propose RBFuse, which is a file system that accesses flash drives without

interacting with the USB stack on the host machine with reasonable overhead

u Discussion − Crash consistency test for RBFuse − Server side fuzzing − Formal verification

slide-74
SLIDE 74

Thank you! Any questions or suggestions?

u We propose RBFuse, which is a file system that accesses flash drives without

interacting with the USB stack on the host machine with reasonable overhead

u Discussion − Crash consistency test for RBFuse − Server side fuzzing − Formal verification