WEBVTT

00:01.090 --> 00:01.930
Wow.

00:02.230 --> 00:03.410
Hello everybody.

00:03.410 --> 00:04.690
Thank you for coming.

00:06.150 --> 00:08.570
Just a little survey before we start.

00:09.290 --> 00:16.090
Does everybody have any experience with writing viruses kind of thing for master boot records?

00:16.090 --> 00:17.910
Please raise your hand.

00:19.710 --> 00:22.210
Okay, so officer, those two guys.

00:24.630 --> 00:34.090
Okay, more seriously, if you have absolutely no idea what is a BIOS or what is a boot loader, maybe you should take an app or something for the next 50 minutes.

00:35.710 --> 00:39.630
Okay, basically we're going to talk about pre-boot authentication passwords.

00:40.150 --> 00:41.070
Okay, everybody see?

00:41.070 --> 00:41.670
Okay.

00:42.030 --> 00:43.450
Pre-boot authentication.

00:43.950 --> 00:48.350
So let's start with the initial introduction kind of thing.

00:49.150 --> 00:51.010
So I'm a French guy.

00:51.010 --> 00:52.350
I live in India.

00:52.350 --> 00:55.790
I work for a company named IVS Security.

00:56.310 --> 00:59.590
I mean, IVS Technology Solutions Private Limited.

01:00.990 --> 01:12.450
I would like to pass a private message kind of thing also to the girl who leaked my tattoo yesterday night at the immunity party.

01:13.110 --> 01:23.550
So we have not been introduced formally, but my room number is 524 at the Sahara Hotel, so you're most welcome anytime.

01:26.320 --> 01:30.260
Okay, so basically we're going to talk about one new class of vulnerabilities.

01:30.260 --> 01:38.980
It's not something affecting only one piece of software, but multiple pre-boot authentication implementations.

01:38.980 --> 01:42.480
We'll define later what is exactly a pre-boot authentication password.

01:42.840 --> 01:45.880
We focus on password-based authentication only.

01:46.520 --> 01:55.600
The thing that's a bit remarkable, like if you've been to Blackout or something this year, there was a talk called boot attacks.

01:56.040 --> 01:58.840
Here, we don't need at all physical access to the computer.

02:00.920 --> 02:08.800
Okay, so we'll start with a few definitions, like defining exactly what is the scope of the talk, and what is a pre-boot authentication password.

02:09.580 --> 02:18.700
Then we'll switch to Windows, and then to unique exploitation, and then we will see a few further enhancements to the technology we've been developing.

02:20.220 --> 02:34.020
Okay, so just as a reminder, I'm pretty sure all of you know the boot seconds kind of stuff, but I've read so many mistakes that just to fix the IDs, I spent some time on that.

02:34.240 --> 02:45.720
Then we will define the different types of passwords we're going to be attacking, and have a closer look at the bias functions to read user keyboard, user input basically.

02:46.860 --> 02:48.400
Okay, here we go.

02:48.880 --> 02:52.560
So when you start a computer, the CPU starts in read mode.

02:53.880 --> 03:03.400
There is pretty nothing which is known, like there is no disk, there is no RAM, there is no nothing at the very beginning.

03:03.680 --> 03:19.560
So while memory, I mean, control is transferred to the bias by performing a long jump kind of thing, which is basically translated via hardware, since there is no RAM, to the bias entry point.

03:20.180 --> 03:27.360
So the bias itself is in charge of several things, like setting up the power, initializing the clock.

03:29.520 --> 03:33.300
Okay, it then discovers your RAM, so we can start doing things.

03:34.080 --> 03:37.160
Your hard drive with the master boot record.

03:39.200 --> 03:45.720
Okay, one thing really important, it starts at address zero, the interrupt vector table.

03:45.980 --> 03:50.800
So from now on, we can basically issue interruptions, which was not the case before.

03:51.480 --> 03:56.860
So using interruption 19, the master boot record is mapped in RAM.

03:57.020 --> 03:58.840
Okay, it's basically the boot loader.

03:58.840 --> 04:03.120
It was in charge of loading later on the kernel.

04:03.120 --> 04:10.000
So if we think about it, like let's do our kind of collecting, kind of brainstorming.

04:10.180 --> 04:12.420
Let's say we want to code a boot loader.

04:12.620 --> 04:16.980
Basically, which is the API which is available to you?

04:16.980 --> 04:19.080
There is no kernel in memory, no nothing.

04:19.240 --> 04:20.580
So what can you use?

04:21.740 --> 04:22.680
No one?

04:23.300 --> 04:27.660
Okay, so all the API which is available is indeed the bias.

04:27.660 --> 04:33.680
The bias provides you input-output interface, okay?

04:33.700 --> 04:39.720
And you could use also physical ERQs, like writing directly to disk and stuff like that.

04:41.000 --> 04:45.180
So this is very important for the rest of the speech, right?

04:45.180 --> 04:47.260
We'll focus on bias stuff for a reason.

04:47.260 --> 04:51.800
Because basically, when you want to write a boot loader, it's the only API which is available.

04:52.760 --> 04:57.440
Okay, let's see a bit the different kind of passwords you can have when you boot a computer.

04:57.440 --> 05:04.280
By pre-boot, we mean anything that can ask for a password before there is actually a kernel in memory, right?

05:04.360 --> 05:07.480
So they could be of several kinds.

05:07.920 --> 05:13.680
Like bias passwords, you know those blue screens that pop up when you first start your computer.

05:14.060 --> 05:15.680
So those are one kind.

05:16.060 --> 05:19.080
Boot loader passwords, basically those are the most common.

05:19.080 --> 05:26.440
Like if you want to have a full disk encryption, or even partial disk encryption, usually it's implemented at that level.

05:26.440 --> 05:30.280
So it could be like Vista Boot Loader, Grub, Lilo.

05:30.440 --> 05:32.960
We'll see some other examples later on.

05:33.380 --> 05:36.640
And it could be also early stage passwords.

05:37.180 --> 05:47.040
Typically, when the kernel first starts in real mode, before switching in private mode, it could ask you for a password.

05:47.040 --> 05:50.340
So we'll see that later on also.

05:51.620 --> 05:56.420
Okay, let's have a closer look at the BIOS functions.

05:56.420 --> 05:58.740
They are used to read user input.

05:59.920 --> 06:10.520
Okay, there is basically one interruption for the BIOS, which is interruption 16, which has two function relevance to us.

06:10.640 --> 06:19.940
The first one, getsKeyStroke, is mostly used to check and retrieve one keystroke at a time.

06:19.940 --> 06:33.080
And the second one, when you invoke it with a parameter, I mean, AH, parameter 01, it does pretty much the same, only it does not update the carry flag.

06:33.080 --> 06:34.260
Zero flag, sorry.

06:34.300 --> 06:43.540
So this is typically used to first check if a keystroke has been entered, and then retrieve it.

06:43.540 --> 06:47.480
For instance, in Lilo, this is done like that.

06:47.480 --> 06:51.780
So you can see there are, I mean, there's two functions implemented, right?

06:51.880 --> 06:59.400
The first one is using function, I mean, sub-function 01, and the second one is actually retrieving the key.

07:01.300 --> 07:03.820
Okay, give me two second.

07:08.960 --> 07:28.740
Okay, so if you've been doing any kind of assembly, like especially under Windows, I mean, under MS-DOS, in the good old times, when we could actually trigger BIOS interrupts and stuff like that, because nowadays, I mean, most OSCs will prevent you to do that,

07:28.740 --> 07:31.440
they are running in private mode, okay?

07:31.440 --> 07:39.100
So they have segmentation and stuff, and obviously you cannot trigger BIOS interrupts.

07:39.900 --> 08:03.120
So when you code either in real mode or under MS-DOS, which is a virtual mode kind of thing, when you try to access BIOS interrupt routines, so you enter as a parameter into AX either 0 or 01, and you later on call interruption 16, and in return, okay,

08:03.120 --> 08:08.140
you opt to retrieve an ASCII scan code, okay, for a key that was pressed.

08:08.940 --> 08:16.740
Okay, you must probably know that, or in fear, that somewhere on the field, there is a keyboard.

08:16.880 --> 08:17.660
Fine.

08:17.660 --> 08:21.880
The real question is, how is it all tied together?

08:21.880 --> 08:23.380
Like, what's in the middle?

08:27.660 --> 08:34.340
Okay, so let's detail a bit how this is all working from the keyboard to the process.

08:34.440 --> 08:37.700
Because this is really the whole core of my presentation.

08:38.500 --> 08:42.260
So basically, inside the keyboard, you have the first PIC.

08:42.420 --> 08:45.960
So if you know PIC programming, you can actually program your keyboard.

08:45.960 --> 08:50.500
I mean, the data sheets are available on Intel website.

08:50.980 --> 08:54.860
So this one is the first one.

08:59.220 --> 09:07.160
Okay, that chip is responsible for triggering an event every time you press or you release a key.

09:07.260 --> 09:11.520
There is a second one, which is embedded inside your motherboard.

09:11.520 --> 09:19.300
So the first PIC sends to the other one an event every time you press or release.

09:19.320 --> 09:21.300
This is actually not good enough.

09:21.300 --> 09:25.920
Like, if you press for quite a time, you would like the key to be repeated.

09:25.920 --> 09:30.760
And if you just press and release, you would like it to be counted as only one key.

09:30.760 --> 09:50.160
So this is the role of the second PIC, which actually unifies the scan codes and sends them to interruption 09, which is also called DRQ01, which is responsible for handling the keyboard in the level.

09:50.680 --> 09:54.120
Okay, the interesting thing is really the next thing.

09:54.380 --> 10:00.040
Inside the RAM, there is a data structure called the BIOS data area.

10:00.040 --> 10:05.920
It contains many fields of your BIOS configuration.

10:06.360 --> 10:11.360
Okay, there are two pointers and one buffer who are interesting to us.

10:11.560 --> 10:28.100
So what happens when you press a key, the keyboard interrupt service routine copies that key into the yellow buffer and updates the pointers accordingly.

10:28.100 --> 10:30.860
And same thing when you try to retrieve a key.

10:30.860 --> 10:38.100
So here we have the full process, I mean, from a keyboard to a process kind of thing.

10:38.300 --> 10:39.560
Okay, that's clear?

10:39.980 --> 10:40.900
Everybody?

10:41.420 --> 10:42.140
Awesome.

10:42.920 --> 10:55.180
Okay, so in details, if you look at the keyboard buffer, that yellow thing inside memory, every time you enter a key, the pointer to the last character is incremented.

10:55.180 --> 10:59.700
Okay, so this is the yellow arrow there.

10:59.940 --> 11:06.280
And when you retrieve a key, the red one, the pointer to the next character is updated.

11:06.300 --> 11:08.680
Okay, so it's always pointing to the next one.

11:09.080 --> 11:12.580
The big problem here, I guess you guys can already see it.

11:15.080 --> 11:21.280
Okay, is that this buffer is actually never flushed.

11:21.280 --> 11:30.060
So every time you enter a password at boot time, and the BIOS takes care of reading it, it remains in memory forever.

11:30.180 --> 11:30.820
Okay?

11:31.540 --> 11:32.520
Yeah.

11:34.800 --> 11:36.020
Thank you.

11:41.700 --> 11:48.220
So this has been there for like 25 years, and more than that actually.

11:48.660 --> 11:52.540
And we're going to see that pretty much everybody is vulnerable to that.

11:52.540 --> 12:07.640
So in an ideal world, what you would do when you called a bootloader kind of thing, you would sanitize the BIOS keyboard buffer, that yellow thing, after reading a password.

12:08.340 --> 12:12.960
Okay, let's see how it actually works in real life, and how it is implemented.

12:14.000 --> 12:26.300
So a good example to check how BIOS aware are people, is to look at the way the BIOS guys implemented the BIOS password inside the BIOS itself.

12:26.360 --> 12:26.880
Okay ?

12:27.420 --> 12:39.420
So to do that, I mean, every code you edit on the CD-ROM, there is a toggle on the CD-ROM, so I really encourage you to have a look at it, and give us feedback if you have questions out of it.

12:40.960 --> 12:55.880
So anyway, we wrote a small USB bootable OS, in 60-byte read mode, to dump the content of the BIOS keyboard buffer.

12:56.540 --> 13:06.500
So basically you boot, the BIOS asks you for a password, and then, for a small OS kind of thing, dumps the content of the memory.

13:06.500 --> 13:11.420
Okay, what we've been seeing is that most BIOS passwords are vulnerable to that.

13:11.940 --> 13:25.280
So let's imagine third-party developers, like a guy writing software encryption things, or any kind of bootloader asking for a password, they are most probably not aware of it.

13:25.280 --> 13:31.360
I mean, even if the BIOS developers make mistakes, don't expect a third-party to be much more aware of it.

13:33.140 --> 13:40.140
Okay, one interesting thing, let's imagine we have two passwords checking in a row.

13:42.930 --> 13:56.530
Could be like, for instance, you have a BIOS password, plus a GRUB or LILO password, or you could have a GRUB password, like asking an MD5 password, plus a disk encryption software in a row, okay?

13:56.770 --> 14:01.510
So in that case, what would the BIOS keyboard buffer look like?

14:04.880 --> 14:18.820
Okay, so actually, pass one would be the password for the first BIOS password, then you would have the enter key, then you would have the second password, and then you would have enter.

14:19.020 --> 14:27.060
So basically, if you have several passwords in a row, they are all concatenated inside the BIOS keyboard buffer.

14:27.060 --> 14:32.180
So from an exploitation point of view, this is really like the best possible thing ever.

14:35.350 --> 14:37.210
Okay, from now on, we're going to see...

14:37.210 --> 14:52.070
Okay, so just to summarize the scope, we've seen that in many cases, when we have preboot authentication passwords, the passwords remain in physical memory at a given location we know.

14:52.070 --> 14:54.530
Okay, we know that location in physical memory.

14:54.530 --> 15:03.470
The problem is, once the operating system is loaded, the kernel first switches in protected mode.

15:04.170 --> 15:10.350
So there, there is segmentation, paging and stuff, so you're not supposed to read physical memory anymore.

15:10.750 --> 15:22.910
So the whole deal of the next two chapters, Windows exploitation and Unix exploitation, is actually to manage to retrieve the password from that physical location we know in physical memory.

15:23.850 --> 15:26.050
Once the computer has booted.

15:26.070 --> 15:33.130
Okay, so we assume that the OS has been fully booted and we're given a shell.

15:33.690 --> 15:36.350
We're going to define the conditions later on.

15:36.350 --> 15:44.290
So the big change with a common approach to cold boot attacks, we don't need physical access.

15:45.670 --> 15:50.850
Okay, let's first discuss the Windows case.

15:50.850 --> 16:00.050
We will discuss a bit, so just summarize the challenges, like I just did actually.

16:00.190 --> 16:06.730
Then discuss possible attack scenario, and well, discuss the actual implementation we've done.

16:07.930 --> 16:15.530
So that's the physical address, 40.0x1.e, from protected mode.

16:15.650 --> 16:18.270
And we want to try to retrieve it.

16:18.270 --> 16:23.330
So possible things we could do, like how do you read physical memory?

16:23.910 --> 16:26.910
So one thing could be to get back to real mode.

16:26.910 --> 16:38.130
That way you would disable segmentation, disable paging, so you could very well read the stuff from the physical memory.

16:39.170 --> 16:40.520
That's one solution.

16:41.050 --> 16:45.690
You could think of switching to SMM, which is another CPU mode.

16:45.690 --> 16:48.730
So same thing, there is no segmentation, no paging.

16:48.730 --> 16:50.230
So that could be an option.

16:50.690 --> 16:53.230
Or you could try to get it from Kernel land.

16:54.010 --> 17:00.770
The big problem is that all those solutions require typically huge amount of privileges.

17:00.870 --> 17:04.390
So under Windows you need system privileges or kernel privileges.

17:04.770 --> 17:06.070
So let's not do that.

17:07.970 --> 17:11.630
We're going to use a Microsoft feature.

17:14.430 --> 17:18.170
Yeah, you can start laughing, but just wait to look at it.

17:18.170 --> 17:20.230
I mean, it's pretty awesome.

17:21.650 --> 17:25.130
Okay, we're going to use the MS-DOS emulation mode.

17:26.030 --> 17:35.350
Basically it has been there since Windows 95 to allow retro compatibility with MS-DOS.

17:35.350 --> 17:44.150
So it's built over the last CPU mode we've not seen so far, which is a virtual mode.

17:44.150 --> 17:54.790
It basically emulates an 8886 CPU, so a very old Intel CPU, with some restrictions and with some mistakes.

17:54.790 --> 18:03.930
Like , okay, this is fully documented, but the addressing from 16-bit to 32-bit triggers some problem in the stack and stuff.

18:03.930 --> 18:15.070
Anyway, the good thing about that is that it maps physical memory in the ranges which are interesting to us into user layout.

18:17.110 --> 18:19.630
So let's go for a demo.

18:30.880 --> 18:34.280
Okay, I launched a demo in the background and let's keep going.

18:38.080 --> 18:41.460
Now let's discuss the thing about UNIX.

18:41.460 --> 18:48.540
By UNIX we mean BSD, Saurus, whatever, which is running Intel-compatible CPUs.

18:48.720 --> 18:52.740
Otherwise, you don't have a BIOS in the first place, and it's not really interesting to us.

18:54.520 --> 19:07.240
So, unfortunately, we don't have such a good thing as the kernel mapping all the interesting BIOS data area thing inside user layout for you.

19:07.240 --> 19:12.860
So we will have to assume we have some privileges to retrieve the password.

19:14.040 --> 19:17.400
So, first of all, we could try to get it from user layout.

19:18.120 --> 19:28.500
When it comes to physical memory under UNIX, you have a special device which is called DevMem, which is actually a mapping of your physical memory.

19:28.500 --> 19:37.100
So if you use a simple tool, you can actually read the password in plain text into DevMem.

19:37.540 --> 19:39.540
This is really awesome also.

19:39.540 --> 19:41.600
It has been there for years.

19:41.600 --> 19:46.480
Everybody has been using password, and apparently it's the first time someone is disclosing it.

19:48.360 --> 19:53.940
Instead of using DevMem, you could use DevCardMem, which is a mapping of the kernel.

19:53.940 --> 20:00.620
For the technical guys here, I'm assuming 3GB, 1GB kernel split.

20:00.620 --> 20:02.980
Otherwise, the addresses won't be the same.

20:03.060 --> 20:04.500
But the principle is always the same.

20:04.500 --> 20:07.280
You can get it from KernelN also.

20:10.000 --> 20:15.140
DevCardCore, which basically contains the very same information in the form of a core file.

20:15.480 --> 20:18.380
So using the very same tool, you can also retrieve your password.

20:19.760 --> 20:24.440
Okay, so we have implemented a simple tool to automate pretty much the test for you.

20:24.580 --> 20:34.080
It's been testing under a wide range of Unix distributions, running on x86 CPUs.

20:35.440 --> 20:37.160
Okay, so same thing.

20:37.160 --> 20:38.500
You can see the stuff in red.

20:38.500 --> 20:41.260
It's your actual whatever password.

20:41.260 --> 20:44.720
Like it could be a BIOS password, book loader password, and stuff.

20:46.200 --> 20:48.180
Okay, let's get back to the demo.

20:49.660 --> 20:51.600
Okay, so this is Windows.

20:51.600 --> 20:53.240
I have a guest account.

20:53.520 --> 20:56.120
And I'm using a very simple COM file.

20:58.340 --> 21:02.820
The VOX is encrypted with, I mean it has full disk encryption with TrueCrypt.

21:03.140 --> 21:05.320
And you can see my password is total.

21:06.660 --> 21:08.220
You can applaud here.

21:11.100 --> 21:12.220
Thank you.

21:21.820 --> 21:30.260
Okay, so we can also think about getting the password under Unix from a kernel end.

21:30.700 --> 21:40.960
So actually what happens is that the BIOS data area is copied inside a special page inside the kernel, which is called the zero page.

21:40.960 --> 21:44.660
This is done in setup.c if you want to look at the kernel source.

21:44.660 --> 21:48.940
So it's really early stage of the kernel before switching to protected mode.

21:49.620 --> 21:54.900
So we're assuming the same kernel split I explained before.

21:54.960 --> 21:58.200
So does everybody know what is a kernel split in the first place?

21:58.740 --> 22:02.280
Okay, basically it means that you have a user land and kernel land.

22:02.280 --> 22:06.860
And the amount of memory allocated to both can differ.

22:07.100 --> 22:13.660
And you can actually on any kind of distribution specify at boot time which kind of split you want.

22:13.660 --> 22:21.200
So in case of the standard three gigabyte, one gigabyte split, the address where it is copied.

22:21.200 --> 22:26.140
So this is defined by setup.c where it is copied inside the zero page.

22:26.200 --> 22:28.900
This is the address written there.

22:30.920 --> 22:37.240
So let's verify the password is actually located there in memory.

22:37.240 --> 22:41.920
So to do that, we can use, for instance, kernel debugging.

22:41.920 --> 22:43.520
Okay, remote kernel debugging.

22:43.540 --> 22:50.740
Here I'm using a VMware machine and I'm debugging the kernel inside the VMware machine.

22:51.320 --> 22:58.280
And what we see if we print what is at the given address, everybody gets to see it.

22:58.280 --> 23:01.400
So the letters in red are actually my BIOS password.

23:03.860 --> 23:20.660
Okay, since you probably don't want to have to do kernel debugging every time you want to read a password, we have written a small kernel module which adds an entry in the slash file system.

23:20.800 --> 23:24.840
And just by doing a cat on it, you can retrieve any kind of password.

23:33.410 --> 23:34.610
Thank you.

23:36.190 --> 23:44.010
Okay, so like we mentioned before, this bug has been there since humans have been using BIOS.

23:44.850 --> 23:46.470
So since we have PCs.

23:47.430 --> 23:50.690
And the awesome stuff is everything is in plain text.

23:51.030 --> 23:55.210
So just open your eyes, there might be other kinds of bugs like that.

23:56.510 --> 23:59.930
Okay, I'll give you a Unix demo.

24:00.610 --> 24:02.870
Okay, this is a raw Ubuntu.

24:04.230 --> 24:07.330
It has a GRUB MD5 password.

24:08.070 --> 24:10.730
So I need to assume several privileges.

24:10.730 --> 24:13.790
So typically I have a root console.

24:19.040 --> 24:24.740
Okay, here are the kind of attacks you can do against it.

24:24.740 --> 24:28.920
So you could try to retrieve it from DevMem, OldMem, whatever.

24:28.920 --> 24:32.920
I mean, under Ubuntu, you have many links.

24:34.240 --> 24:38.500
Like, slash dev static dev core is actually a link to dev core and stuff like that.

24:38.500 --> 24:43.820
But still, you have many options to try to retrieve that stuff.

24:43.820 --> 24:49.720
Even if you are into a stripped-down demo, you will... stripped-down distribution.

24:50.080 --> 24:55.740
And any kind of Unix, not only Linux, you will at least find DevMem or something like that, right?

24:56.520 --> 24:59.080
So let's execute it.

25:01.230 --> 25:03.430
Okay, so guess what's my password?

25:06.400 --> 25:08.940
Okay, it's not actually DefCon1.

25:08.940 --> 25:10.260
That was a trick.

25:10.800 --> 25:17.700
Every time you have one character, which is the ASCII code, the next one inside the BIOS keyboard buffer is a scan code.

25:17.700 --> 25:19.780
So you have to ignore that one.

25:20.200 --> 25:23.720
It pretty much contains the same information, okay?

25:23.720 --> 25:29.340
But it's the convention used by the microcontrollers we've seen earlier.

25:29.460 --> 25:32.000
So here my password was indeed DefCon.

25:35.660 --> 25:49.000
Okay, so now that we think about it, we know that for many pre-boot authentication passwords, developers do not sanitize the memory after reading the password.

25:49.160 --> 25:50.300
Okay, good.

25:52.660 --> 26:00.820
One case which you might find when you try to break into a computer is that it would be nice to reboot the computer.

26:01.260 --> 26:06.740
So in some cases, it's not that difficult, but let's imagine you have a full disk encryption.

26:07.420 --> 26:09.060
You rooted the box already.

26:09.060 --> 26:13.060
You want to reboot it for some reason, like you want to flash the BIOS or something.

26:13.240 --> 26:24.180
For instance, to, I don't know, downgrade the BIOS EPROM, possibly to do SMM rootkit stuff, or you want to manipulate...

26:24.180 --> 26:32.280
I mean, if you have access to the machine before there is a kernel in memory, it's like ring minus one.

26:32.280 --> 26:34.000
You can't do anything, right?

26:34.280 --> 26:36.960
You broke the integrity very early.

26:37.700 --> 26:43.880
So let's assume we have a disk encryption kind of thing, and we want to reboot it anyway.

26:43.980 --> 26:56.360
If you just do a reboot, what's going to happen is that the computer will switch down, and then it will boot again until the moment that someone...

26:57.100 --> 27:02.040
I mean, the encryption software asks you for a password, right?

27:02.380 --> 27:10.260
And since you don't have access to the console, because we assume that you don't have physical access to the computer, well, pretty much you're fucked.

27:12.700 --> 27:19.620
So in the next section, we will try to find ways to reboot the computer anyway.

27:20.380 --> 27:25.680
So we assume you can write to the master boot record, and you can indeed reboot the computer.

27:25.680 --> 27:29.840
So typically, this will mean you have root kind of access.

27:29.900 --> 27:38.820
There are several cases that can be interesting, where you don't actually need root itself.

27:38.820 --> 27:44.900
For instance, if you're running Ubuntu, the default user would be good enough.

27:45.400 --> 27:51.100
If you have access to KMM, basically KMM group, you can read to DevMem, so that's good enough.

27:51.100 --> 27:55.740
But let's say, okay, for the sake of simplicity, let's say you have root access to the computer.

27:56.920 --> 27:59.000
So there are really two cases here.

27:59.220 --> 28:08.720
First one, the bootloader asks for a password, which is just there to bug you, but is not used to decrypt anything.

28:08.720 --> 28:11.980
This is typically the case of Lilo, Grub.

28:11.980 --> 28:22.120
There is no disk encryption stuff, so if you just nopped the password checking routine, you can bypass the authentication routine, right?

28:22.580 --> 28:27.100
The other case is when the password is actually used to decipher the disk.

28:27.100 --> 28:33.080
Then, if you just try to nop the password checking routine, well, nothing will happen.

28:33.080 --> 28:35.360
Like, you won't decrypt your drive, and that's it.

28:37.060 --> 28:52.680
Okay, so while the first case is really trivial, like we mentioned, if you have a Lilo or Grub password, or whatever, which does not use the password to decrypt anything on the drive, you can pretty much just patch the bootloader.

28:53.220 --> 29:03.180
This has been studied deeply in not the latest, but the previous FRAC issue.

29:03.180 --> 29:06.100
It's an article called Hacking Deeper in the System.

29:06.100 --> 29:09.000
It's pretty much a patch in Grub for fun and profit.

29:09.720 --> 29:16.100
Okay, so this is the example, I mean, a typical example of what could happen if you can write to the master boot record.

29:16.720 --> 29:25.780
Here, I had Lilo asking for a password, and I patched it, so it doesn't ask for a password anymore, and just reboots.

29:26.280 --> 29:28.660
If you look at Lilo, it's actually amazing.

29:28.660 --> 29:31.040
You can change the delays and stuff like that.

29:31.040 --> 29:32.800
Pretty fun.

29:33.740 --> 29:49.100
Okay, let's now go to the actual interesting case where you have a password check which will use a password to decrypt your hard drive.

29:56.880 --> 30:00.760
Okay, you might be thinking here, why is he talking about that anyway?

30:00.920 --> 30:05.680
So I'll show you that this is pretty linked to what we've been doing before.

30:05.680 --> 30:09.880
I will show you an actual attack scenario and a demo for it.

30:10.700 --> 30:12.260
Okay, here's a problem.

30:12.260 --> 30:28.100
We've seen that we can retrieve the password from memory because the guys who write bootloaders do not sanitize, typically, the BIOS keyboard buffer after reading the password.

30:28.380 --> 30:32.420
What if they don't initialize it before reading the password?

30:33.460 --> 30:36.600
So actually, what you could do...

30:36.600 --> 30:39.420
Okay, this is a world map we've been seeing before.

30:39.420 --> 30:48.040
Like you have the bootloader which uses BIOS interruptions to retrieve the content of the BIOS keyboard buffer.

30:49.360 --> 30:51.440
Okay, we don't need all of that.

30:51.580 --> 30:55.440
Okay, let's imagine I write...

30:55.440 --> 30:58.380
I replace the master boot record with mine.

30:58.460 --> 31:01.260
Okay, a rogue bootloader kind of thing.

31:01.260 --> 31:14.340
What it would do is actually talk directly using PIC programming to the two PICs inside the motherboard and the one inside the keyboard in order to...

31:14.340 --> 31:20.120
Okay, so this is done via EOPorts so you need root privileges to do that too.

31:20.740 --> 31:22.540
I mean, it's nonsense.

31:22.540 --> 31:32.540
Like , when you're a rogue bootloader you're running in real mode so you have access to anything anyway.

31:32.600 --> 31:36.840
But you can use EOPorts to reprogram those two PICs.

31:37.020 --> 31:43.080
So it's pretty much like emulating the fact of typing keys inside a keyboard.

31:43.380 --> 31:51.540
Okay, so you can fill in the BIOS keyboard buffer with the password you've discovered previously.

31:52.120 --> 32:06.280
Okay, and then remove the rogue bootloader replace it by the original bootloader which will do its task normally which is, it will ask for...

32:06.820 --> 32:17.860
it will ask using interruption 16 for user input and the BIOS interruption service routine will read the password you've entered previously.

32:18.040 --> 32:18.900
Okay?

32:19.840 --> 32:21.460
Normal stuff here.

32:22.920 --> 32:33.600
Okay, so in order to do that we need to write a rogue bootloader which is, first of all, backup the old master boot record.

32:37.880 --> 32:40.240
Okay, there are some conditions not very interesting.

32:40.240 --> 32:41.880
I'll check all the details later.

32:43.060 --> 32:46.020
Okay, so it basically backups the old master boot record.

32:46.020 --> 32:47.960
Okay, that's the installation process.

32:47.960 --> 32:55.800
This rogue bootloader will, using PIC programming enter a password inside the BIOS data area using PIC programming.

32:56.620 --> 33:04.660
And then it will copy back the old master boot record in place using, for instance, interruption 19.

33:04.660 --> 33:06.160
It's very valid.

33:06.380 --> 33:11.520
And transfer, control transfer to the original bootloader.

33:12.280 --> 33:20.640
Okay, I'll give you a demo here only it's a bit tricky to put in place so I'll cheat a bit, I'll show you a video.

33:31.860 --> 33:32.580
Hopefully...

33:32.580 --> 33:44.280
Okay, so in that case the computer is protected with two passwords.

33:44.280 --> 33:52.840
The first one is a grub password using md5 encryption and the computer is also...

33:52.840 --> 34:00.220
so we're under Linux we want to reboot that Windows machine which is also encrypted using TrueCrypt.

34:00.980 --> 34:03.780
So you can check the md5 password and stuff.

34:03.780 --> 34:05.140
There is one trick here.

34:05.140 --> 34:25.500
The name of the entry in grub is very long so I can actually not copy I cannot enter in grub the whole name of the grub entry because the size of the BIOS keyboard buffer is limited to 16.

34:25.500 --> 34:33.300
So what we do using character backslash x19 is to use the arrow key.

34:33.960 --> 35:07.080
First of all, the first character we use the escape character to escape the graphical interface entering the grub menu then we choose the actual entry we want to reboot using arrow keys we write the password for the first bootloader grub, which is owned then we press enter it's really the exact same stuff you would do if you were in front of the computer only we do that using a bootloader so we don't have to have access to the computer itself.

35:07.980 --> 35:23.120
Ok, so we wrote a small installer for that so you need to know the device and here is what happened it's going to be very fast Ok, this is it So, I don't know if you've seen Thank you

35:28.900 --> 35:37.380
So what happens is you can really reboot a computer even if it has multiple encryption and multiple password checking

35:41.050 --> 35:58.690
Ok, let's go to the I mean, I've been telling most of the people I've enabled and stuff so now I'm going to disclose the full list of people actually enabled First of all, I would like to thank the vendors for their attitude they've been very responsible and cooperative but TrueCrypt,

35:58.690 --> 36:26.210
like these guys told us the vulnerability only exists because you are misusing the software Thank you, that's very deep Ok, so the first kind of passwords we've been talking about are biased passwords so here is a list of vulnerable APROMs so you can see pretty much everybody is vulnerable ranging from,

36:26.210 --> 37:18.590
well, you read it Full disk encryption software with pre-boot authentication capabilities so BitLocker, which is the encryption software for Microsoft Vista on the version SP0 is vulnerable it has been fixed in SP1 TrueCrypt so even if those guys deny the truth I showed you before that you can also reboot it DiskCryptor and DriveCrypt and bootloader passwords so Grub and Lilo are also vulnerable for the sake of completeness I will also show you the list of non-vulnerable software we've seen so there are several biased passwords full disk encryption software.

37:18.750 --> 37:25.310
This list is obviously far from being exhaustive so I entitle you to, I mean, do your own experiments.

37:25.350 --> 37:28.210
Actually the exploit is the same everywhere.

37:28.350 --> 37:35.690
So there is one exploit for Unix which is going to work for any pre-boot authentication password if available.

37:35.890 --> 37:37.630
And one version for Windows.

37:37.630 --> 37:44.250
So you just check this, install a few software and check if they are vulnerable.

37:45.450 --> 37:50.070
If you do so, I would appreciate if you sent me a mail or something.

37:51.930 --> 37:56.190
Okay, so how do we mitigate those vulnerabilities?

37:56.930 --> 38:10.190
Okay, the most obvious, I mean, the most obvious advice I could give is like to sanitize the BIOS keyboard buffer before and after use, right?

38:11.950 --> 38:14.250
You can check on the website.

38:14.250 --> 38:17.990
We are trying to keep a list of patches to do that.

38:18.130 --> 38:25.710
Unfortunately when it comes, for instance , to BIOS EEPROMs, it's very difficult to patch it yourself .

38:25.710 --> 38:28.190
You have to wait for the vendor to issue fix.

38:29.030 --> 38:41.010
So you must probably looking for an intermediary solution which will not fix all the problems but, I mean, will fix most of them.

38:41.110 --> 38:48.970
So if you're using Linux, I can, I really entitle you to download the geosecurity patch from openworld.net.

38:49.450 --> 38:55.050
Brad has been very keen to release a new version today, including the patch we've written for it.

38:55.310 --> 38:59.610
So what it does basically is, yeah,

39:15.380 --> 39:16.440
absolutely not .

39:16.780 --> 39:17.860
No, no.

39:17.860 --> 39:19.900
What do you mean you have to actually?

39:31.220 --> 39:33.020
You're the true creep guy or something?

39:38.700 --> 39:39.700
Okay.

39:39.700 --> 39:47.420
See, what happens is, if the password can be entered by the keyboard, okay, just let me reply to you.

39:47.420 --> 40:06.260
If the password can be entered at the keyboard, okay, from the keyboard, there is no difference from the bootloader point of view if it's actually typed at boot time on the console or if it has been stored in the BIOS keyboard buffer by a previous rogue bootloader,

40:06.260 --> 40:06.680
okay?

40:07.060 --> 40:08.740
It's exactly the same thing.

40:08.740 --> 40:11.100
I mean, it's following the same process.

40:20.420 --> 40:21.880
It's... Okay.

40:25.680 --> 40:31.240
So see, I'm afraid I don't really understand your question, but we can...

40:39.040 --> 40:39.980
Okay.

40:40.000 --> 40:46.560
So what happens with, for instance, TPM ships, you can't actually mitigate, yeah, you're right.

40:46.560 --> 40:57.420
So you can retrieve the password, but you can't actually reboot the computer using the, I mean, rogue bootloader method.

40:57.420 --> 40:58.440
That was your point?

40:59.260 --> 41:00.740
So it's very true.

41:00.740 --> 41:03.320
No, I have no method to bypass TPM so far.

41:03.320 --> 41:05.480
I have not studied it deeply.

41:06.200 --> 41:08.740
There are really three vulnerabilities here.

41:08.740 --> 41:12.280
Like the first one is the ability to retrieve the password in plain text.

41:12.280 --> 41:16.120
The second one is the effect of rebooting, okay?

41:16.120 --> 41:23.860
And the third one is actually the kernel leakage inside user LAN from Microsoft, right?

41:23.860 --> 41:30.500
Which allows you to kind of retrieve the password with less privileges, okay?

41:30.500 --> 41:36.620
So I've discussed with the, I mean, guys responsible at Microsoft, they are working on a fix.

41:36.620 --> 41:39.580
This is very complicated to fix, okay?

41:40.240 --> 41:41.420
But you're right.

41:41.640 --> 41:47.220
My bypassing of TrueCrypt, of BitLocker, sorry, is not full.

41:47.220 --> 41:48.640
I could not reboot it.

41:50.440 --> 41:52.820
Okay, so just a few greetings.

41:52.860 --> 42:05.600
So first of all, I would like to thank my reviewers, the technical team which I work with, and the guys from EverybodyDies.com.

42:05.600 --> 42:13.380
It's actually a game, computer game, and they allowed me to use their screenshots of the game which is now called DEFCON inside my slides.

42:13.380 --> 42:15.240
This is why my slides look so good.

42:17.300 --> 42:21.040
Community guys, so plug the plug, plug security.

42:21.380 --> 42:25.060
Thank you for coming and waking up after the parties and stuff.

42:26.180 --> 42:32.160
All you for coming to the presentation, and indeed the DEFCON staff for the awesome event and parties.

42:32.360 --> 42:34.960
I think we can clap for that, yeah.

