start	end	text
1090	4690	Wow. Hello everybody. Thank you for coming.
6150	8570	Just a little survey before we start.
9290	16090	Does everybody have any experience with writing viruses kind of thing for master boot records?
16090	17910	Please raise your hand.
19710	22210	Okay, so officer, those two guys.
24630	28270	Okay, more seriously, if you have absolutely no idea what is a BIOS
28270	34090	or what is a boot loader, maybe you should take an app or something for the next 50 minutes.
35710	39630	Okay, basically we're going to talk about pre-boot authentication passwords.
40150	41670	Okay, everybody see? Okay.
42030	48350	Pre-boot authentication. So let's start with the initial introduction kind of thing.
49150	52350	So I'm a French guy. I live in India.
52350	55790	I work for a company named IVS Security.
56310	59590	I mean, IVS Technology Solutions Private Limited.
60990	65390	I would like to pass a private message kind of thing also
65390	72450	to the girl who leaked my tattoo yesterday night at the immunity party.
73110	77170	So we have not been introduced formally,
77170	81690	but my room number is 524 at the Sahara Hotel,
81690	83550	so you're most welcome anytime.
86320	90260	Okay, so basically we're going to talk about one new class of vulnerabilities.
90260	94260	It's not something affecting only one piece of software,
94260	98980	but multiple pre-boot authentication implementations.
98980	102480	We'll define later what is exactly a pre-boot authentication password.
102840	105880	We focus on password-based authentication only.
106520	111400	The thing that's a bit remarkable, like if you've been to Blackout or something this year,
111400	115600	there was a talk called boot attacks.
116040	118840	Here, we don't need at all physical access to the computer.
120920	123200	Okay, so we'll start with a few definitions,
123200	126000	like defining exactly what is the scope of the talk,
126000	128800	and what is a pre-boot authentication password.
129580	133520	Then we'll switch to Windows, and then to unique exploitation,
133520	138700	and then we will see a few further enhancements to the technology we've been developing.
140220	147600	Okay, so just as a reminder, I'm pretty sure all of you know the boot seconds kind of stuff,
147600	154020	but I've read so many mistakes that just to fix the IDs, I spent some time on that.
154240	157900	Then we will define the different types of passwords we're going to be attacking,
158800	165720	and have a closer look at the bias functions to read user keyboard, user input basically.
166860	168400	Okay, here we go.
168880	172560	So when you start a computer, the CPU starts in read mode.
173880	181640	There is pretty nothing which is known, like there is no disk, there is no RAM,
181640	183400	there is no nothing at the very beginning.
183680	191440	So while memory, I mean, control is transferred to the bias by performing a long jump kind of thing,
191440	199560	which is basically translated via hardware, since there is no RAM, to the bias entry point.
200180	207360	So the bias itself is in charge of several things, like setting up the power, initializing the clock.
209520	213300	Okay, it then discovers your RAM, so we can start doing things.
214080	217160	Your hard drive with the master boot record.
219200	225720	Okay, one thing really important, it starts at address zero, the interrupt vector table.
225980	230800	So from now on, we can basically issue interruptions, which was not the case before.
231480	236860	So using interruption 19, the master boot record is mapped in RAM.
237020	238840	Okay, it's basically the boot loader.
238840	243120	It was in charge of loading later on the kernel.
243120	250000	So if we think about it, like let's do our kind of collecting, kind of brainstorming.
250180	252420	Let's say we want to code a boot loader.
252620	256980	Basically, which is the API which is available to you?
256980	259080	There is no kernel in memory, no nothing.
259240	260580	So what can you use?
261740	262680	No one?
263300	267660	Okay, so all the API which is available is indeed the bias.
267660	273680	The bias provides you input-output interface, okay?
273700	279720	And you could use also physical ERQs, like writing directly to disk and stuff like that.
281000	285180	So this is very important for the rest of the speech, right?
285180	287260	We'll focus on bias stuff for a reason.
287260	291800	Because basically, when you want to write a boot loader, it's the only API which is available.
292760	297440	Okay, let's see a bit the different kind of passwords you can have when you boot a computer.
297440	304280	By pre-boot, we mean anything that can ask for a password before there is actually a kernel in memory, right?
304360	307480	So they could be of several kinds.
307920	313680	Like bias passwords, you know those blue screens that pop up when you first start your computer.
314060	315680	So those are one kind.
316060	319080	Boot loader passwords, basically those are the most common.
319080	326440	Like if you want to have a full disk encryption, or even partial disk encryption, usually it's implemented at that level.
326440	330280	So it could be like Vista Boot Loader, Grub, Lilo.
330440	332960	We'll see some other examples later on.
333380	336640	And it could be also early stage passwords.
337180	347040	Typically, when the kernel first starts in real mode, before switching in private mode, it could ask you for a password.
347040	350340	So we'll see that later on also.
351620	356420	Okay, let's have a closer look at the BIOS functions.
356420	358740	They are used to read user input.
359920	370520	Okay, there is basically one interruption for the BIOS, which is interruption 16, which has two function relevance to us.
370640	379940	The first one, getsKeyStroke, is mostly used to check and retrieve one keystroke at a time.
379940	393080	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.
393080	394260	Zero flag, sorry.
394300	403540	So this is typically used to first check if a keystroke has been entered, and then retrieve it.
403540	407480	For instance, in Lilo, this is done like that.
407480	411780	So you can see there are, I mean, there's two functions implemented, right?
411880	419400	The first one is using function, I mean, sub-function 01, and the second one is actually retrieving the key.
421300	423820	Okay, give me two second.
428960	443540	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,
443540	451440	because nowadays, I mean, most OSCs will prevent you to do that, they are running in private mode, okay?
451440	459100	So they have segmentation and stuff, and obviously you cannot trigger BIOS interrupts.
459900	471440	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,
471440	481800	so you enter as a parameter into AX either 0 or 01, and you later on call interruption 16,
481800	488140	and in return, okay, you opt to retrieve an ASCII scan code, okay, for a key that was pressed.
488940	497660	Okay, you must probably know that, or in fear, that somewhere on the field, there is a keyboard. Fine.
497660	503380	The real question is, how is it all tied together? Like, what's in the middle?
507660	514340	Okay, so let's detail a bit how this is all working from the keyboard to the process.
514440	517700	Because this is really the whole core of my presentation.
518500	522260	So basically, inside the keyboard, you have the first PIC.
522420	525960	So if you know PIC programming, you can actually program your keyboard.
525960	530500	I mean, the data sheets are available on Intel website.
530980	534860	So this one is the first one.
539220	547160	Okay, that chip is responsible for triggering an event every time you press or you release a key.
547260	551520	There is a second one, which is embedded inside your motherboard.
551520	559300	So the first PIC sends to the other one an event every time you press or release.
559320	561300	This is actually not good enough.
561300	565920	Like, if you press for quite a time, you would like the key to be repeated.
565920	570760	And if you just press and release, you would like it to be counted as only one key.
570760	583340	So this is the role of the second PIC, which actually unifies the scan codes and sends them to interruption 09,
583340	590160	which is also called DRQ01, which is responsible for handling the keyboard in the level.
590680	594120	Okay, the interesting thing is really the next thing.
594380	600040	Inside the RAM, there is a data structure called the BIOS data area.
600040	605920	It contains many fields of your BIOS configuration.
606360	611360	Okay, there are two pointers and one buffer who are interesting to us.
611560	624500	So what happens when you press a key, the keyboard interrupt service routine copies that key into the yellow buffer
624500	628100	and updates the pointers accordingly.
628100	630860	And same thing when you try to retrieve a key.
630860	638100	So here we have the full process, I mean, from a keyboard to a process kind of thing.
638300	642140	Okay, that's clear? Everybody? Awesome.
642920	649100	Okay, so in details, if you look at the keyboard buffer, that yellow thing inside memory,
649860	655180	every time you enter a key, the pointer to the last character is incremented.
655180	659700	Okay, so this is the yellow arrow there.
659940	666280	And when you retrieve a key, the red one, the pointer to the next character is updated.
666300	668680	Okay, so it's always pointing to the next one.
669080	672580	The big problem here, I guess you guys can already see it.
675080	681280	Okay, is that this buffer is actually never flushed.
681280	688100	So every time you enter a password at boot time, and the BIOS takes care of reading it,
688100	692520	it remains in memory forever. Okay? Yeah.
694800	696020	Thank you.
701700	708220	So this has been there for like 25 years, and more than that actually.
708660	712540	And we're going to see that pretty much everybody is vulnerable to that.
712540	718960	So in an ideal world, what you would do when you called a bootloader kind of thing,
718960	727640	you would sanitize the BIOS keyboard buffer, that yellow thing, after reading a password.
728340	732960	Okay, let's see how it actually works in real life, and how it is implemented.
734000	740680	So a good example to check how BIOS aware are people,
740680	746300	is to look at the way the BIOS guys implemented the BIOS password inside the BIOS itself.
746360	746880	Okay?
747420	752580	So to do that, I mean, every code you edit on the CD-ROM, there is a toggle on the CD-ROM,
752580	759420	so I really encourage you to have a look at it, and give us feedback if you have questions out of it.
760960	770700	So anyway, we wrote a small USB bootable OS, in 60-byte read mode,
770700	775880	to dump the content of the BIOS keyboard buffer.
776540	780420	So basically you boot, the BIOS asks you for a password,
781080	786500	and then, for a small OS kind of thing, dumps the content of the memory.
786500	791420	Okay, what we've been seeing is that most BIOS passwords are vulnerable to that.
791940	800080	So let's imagine third-party developers, like a guy writing software encryption things,
800080	805280	or any kind of bootloader asking for a password, they are most probably not aware of it.
805280	811360	I mean, even if the BIOS developers make mistakes, don't expect a third-party to be much more aware of it.
813140	820140	Okay, one interesting thing, let's imagine we have two passwords checking in a row.
822930	828910	Could be like, for instance, you have a BIOS password, plus a GRUB or LILO password,
828910	836530	or you could have a GRUB password, like asking an MD5 password, plus a disk encryption software in a row, okay?
836770	841510	So in that case, what would the BIOS keyboard buffer look like?
844880	853380	Okay, so actually, pass one would be the password for the first BIOS password,
853380	858820	then you would have the enter key, then you would have the second password, and then you would have enter.
859020	867060	So basically, if you have several passwords in a row, they are all concatenated inside the BIOS keyboard buffer.
867060	872180	So from an exploitation point of view, this is really like the best possible thing ever.
875350	877210	Okay, from now on, we're going to see...
877210	887770	Okay, so just to summarize the scope, we've seen that in many cases, when we have preboot authentication passwords,
887770	892070	the passwords remain in physical memory at a given location we know.
892070	894530	Okay, we know that location in physical memory.
894530	903470	The problem is, once the operating system is loaded, the kernel first switches in protected mode.
904170	910350	So there, there is segmentation, paging and stuff, so you're not supposed to read physical memory anymore.
910750	916210	So the whole deal of the next two chapters, Windows exploitation and Unix exploitation,
916210	922910	is actually to manage to retrieve the password from that physical location we know in physical memory.
923850	926050	Once the computer has booted.
926070	933130	Okay, so we assume that the OS has been fully booted and we're given a shell.
933690	936350	We're going to define the conditions later on.
936350	944290	So the big change with a common approach to cold boot attacks, we don't need physical access.
945670	950850	Okay, let's first discuss the Windows case.
950850	960050	We will discuss a bit, so just summarize the challenges, like I just did actually.
960190	966730	Then discuss possible attack scenario, and well, discuss the actual implementation we've done.
967930	975530	So that's the physical address, 40.0x1.e, from protected mode.
975650	978270	And we want to try to retrieve it.
978270	983330	So possible things we could do, like how do you read physical memory?
983910	986910	So one thing could be to get back to real mode.
986910	998130	That way you would disable segmentation, disable paging, so you could very well read the stuff from the physical memory.
999170	1000520	That's one solution.
1001050	1005690	You could think of switching to SMM, which is another CPU mode.
1005690	1008730	So same thing, there is no segmentation, no paging.
1008730	1010230	So that could be an option.
1010690	1013230	Or you could try to get it from Kernel land.
1014010	1020770	The big problem is that all those solutions require typically huge amount of privileges.
1020870	1024390	So under Windows you need system privileges or kernel privileges.
1024770	1026070	So let's not do that.
1027970	1031630	We're going to use a Microsoft feature.
1034430	1038170	Yeah, you can start laughing, but just wait to look at it.
1038170	1040230	I mean, it's pretty awesome.
1041650	1045130	Okay, we're going to use the MS-DOS emulation mode.
1046030	1055350	Basically it has been there since Windows 95 to allow retro compatibility with MS-DOS.
1055350	1064150	So it's built over the last CPU mode we've not seen so far, which is a virtual mode.
1064150	1074790	It basically emulates an 8886 CPU, so a very old Intel CPU, with some restrictions and with some mistakes.
1074790	1083930	Like, okay, this is fully documented, but the addressing from 16-bit to 32-bit triggers some problem in the stack and stuff.
1083930	1095070	Anyway, the good thing about that is that it maps physical memory in the ranges which are interesting to us into user layout.
1097110	1099630	So let's go for a demo.
1110880	1114280	Okay, I launched a demo in the background and let's keep going.
1118080	1121460	Now let's discuss the thing about UNIX.
1121460	1128540	By UNIX we mean BSD, Saurus, whatever, which is running Intel-compatible CPUs.
1128720	1132740	Otherwise, you don't have a BIOS in the first place, and it's not really interesting to us.
1134520	1147240	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.
1147240	1152860	So we will have to assume we have some privileges to retrieve the password.
1154040	1157400	So, first of all, we could try to get it from user layout.
1158120	1168500	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.
1168500	1177100	So if you use a simple tool, you can actually read the password in plain text into DevMem.
1177540	1181600	This is really awesome also. It has been there for years.
1181600	1186480	Everybody has been using password, and apparently it's the first time someone is disclosing it.
1188360	1193940	Instead of using DevMem, you could use DevCardMem, which is a mapping of the kernel.
1193940	1202980	For the technical guys here, I'm assuming 3GB, 1GB kernel split. Otherwise, the addresses won't be the same.
1203060	1207280	But the principle is always the same. You can get it from KernelN also.
1210000	1215140	DevCardCore, which basically contains the very same information in the form of a core file.
1215480	1218380	So using the very same tool, you can also retrieve your password.
1219760	1224440	Okay, so we have implemented a simple tool to automate pretty much the test for you.
1224580	1234080	It's been testing under a wide range of Unix distributions, running on x86 CPUs.
1235440	1241260	Okay, so same thing. You can see the stuff in red. It's your actual whatever password.
1241260	1244720	Like it could be a BIOS password, book loader password, and stuff.
1246200	1248180	Okay, let's get back to the demo.
1249660	1256120	Okay, so this is Windows. I have a guest account. And I'm using a very simple COM file.
1258340	1262820	The VOX is encrypted with, I mean it has full disk encryption with TrueCrypt.
1263140	1268220	And you can see my password is total. You can applaud here.
1271100	1272220	Thank you.
1281820	1290260	Okay, so we can also think about getting the password under Unix from a kernel end.
1290700	1300960	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.
1300960	1304660	This is done in setup.c if you want to look at the kernel source.
1304660	1308940	So it's really early stage of the kernel before switching to protected mode.
1309620	1314900	So we're assuming the same kernel split I explained before.
1314960	1318200	So does everybody know what is a kernel split in the first place?
1318740	1322280	Okay, basically it means that you have a user land and kernel land.
1322280	1326860	And the amount of memory allocated to both can differ.
1327100	1333660	And you can actually on any kind of distribution specify at boot time which kind of split you want.
1333660	1341200	So in case of the standard three gigabyte, one gigabyte split, the address where it is copied.
1341200	1346140	So this is defined by setup.c where it is copied inside the zero page.
1346200	1348900	This is the address written there.
1350920	1357240	So let's verify the password is actually located there in memory.
1357240	1361920	So to do that, we can use, for instance, kernel debugging.
1361920	1363520	Okay, remote kernel debugging.
1363540	1370740	Here I'm using a VMware machine and I'm debugging the kernel inside the VMware machine.
1371320	1378280	And what we see if we print what is at the given address, everybody gets to see it.
1378280	1381400	So the letters in red are actually my BIOS password.
1383860	1391840	Okay, since you probably don't want to have to do kernel debugging every time you want to read a password,
1391840	1400660	we have written a small kernel module which adds an entry in the slash file system.
1400800	1404840	And just by doing a cat on it, you can retrieve any kind of password.
1413410	1414610	Thank you.
1416190	1424010	Okay, so like we mentioned before, this bug has been there since humans have been using BIOS.
1424850	1426470	So since we have PCs.
1427430	1430690	And the awesome stuff is everything is in plain text.
1431030	1435210	So just open your eyes, there might be other kinds of bugs like that.
1436510	1439930	Okay, I'll give you a Unix demo.
1440610	1442870	Okay, this is a raw Ubuntu.
1444230	1447330	It has a GRUB MD5 password.
1448070	1450730	So I need to assume several privileges.
1450730	1453790	So typically I have a root console.
1459040	1464740	Okay, here are the kind of attacks you can do against it.
1464740	1468920	So you could try to retrieve it from DevMem, OldMem, whatever.
1468920	1472920	I mean, under Ubuntu, you have many links.
1474240	1478500	Like, slash dev static dev core is actually a link to dev core and stuff like that.
1478500	1483820	But still, you have many options to try to retrieve that stuff.
1483820	1489720	Even if you are into a stripped-down demo, you will... stripped-down distribution.
1490080	1495740	And any kind of Unix, not only Linux, you will at least find DevMem or something like that, right?
1496520	1499080	So let's execute it.
1501230	1503430	Okay, so guess what's my password?
1506400	1508940	Okay, it's not actually DefCon1.
1508940	1510260	That was a trick.
1510800	1514100	Every time you have one character, which is the ASCII code,
1514100	1517700	the next one inside the BIOS keyboard buffer is a scan code.
1517700	1519780	So you have to ignore that one.
1520200	1523720	It pretty much contains the same information, okay?
1523720	1529340	But it's the convention used by the microcontrollers we've seen earlier.
1529460	1532000	So here my password was indeed DefCon.
1535660	1538740	Okay, so now that we think about it,
1538740	1544560	we know that for many pre-boot authentication passwords,
1545180	1549000	developers do not sanitize the memory after reading the password.
1549160	1550300	Okay, good.
1552660	1556860	One case which you might find when you try to break into a computer
1558180	1560820	is that it would be nice to reboot the computer.
1561260	1563500	So in some cases, it's not that difficult,
1563500	1566740	but let's imagine you have a full disk encryption.
1567420	1569060	You rooted the box already.
1569060	1573060	You want to reboot it for some reason, like you want to flash the BIOS or something.
1573240	1577900	For instance, to, I don't know, downgrade the BIOS EPROM,
1577900	1581240	possibly to do SMM rootkit stuff,
1581240	1584180	or you want to manipulate...
1584180	1589900	I mean, if you have access to the machine before there is a kernel in memory,
1590540	1592280	it's like ring minus one.
1592280	1594000	You can't do anything, right?
1594280	1596960	You broke the integrity very early.
1597700	1601900	So let's assume we have a disk encryption kind of thing,
1601900	1603880	and we want to reboot it anyway.
1603980	1606360	If you just do a reboot, what's going to happen
1606360	1612360	is that the computer will switch down,
1612360	1614740	and then it will boot again
1614740	1616360	until the moment that someone...
1617100	1622040	I mean, the encryption software asks you for a password, right?
1622380	1624240	And since you don't have access to the console,
1624240	1627680	because we assume that you don't have physical access to the computer,
1627680	1630260	well, pretty much you're fucked.
1632700	1635180	So in the next section,
1635180	1639620	we will try to find ways to reboot the computer anyway.
1640380	1643640	So we assume you can write to the master boot record,
1643640	1645680	and you can indeed reboot the computer.
1645680	1649840	So typically, this will mean you have root kind of access.
1649900	1656240	There are several cases that can be interesting,
1656240	1658820	where you don't actually need root itself.
1658820	1662880	For instance, if you're running Ubuntu,
1662880	1664900	the default user would be good enough.
1665400	1668480	If you have access to KMM, basically KMM group,
1668480	1671100	you can read to DevMem, so that's good enough.
1671100	1673620	But let's say, okay, for the sake of simplicity,
1673620	1675740	let's say you have root access to the computer.
1676920	1679000	So there are really two cases here.
1679220	1683660	First one, the bootloader asks for a password,
1683660	1686440	which is just there to bug you,
1686440	1688720	but is not used to decrypt anything.
1688720	1691980	This is typically the case of Lilo, Grub.
1691980	1693920	There is no disk encryption stuff,
1693920	1698780	so if you just nopped the password checking routine,
1698780	1702120	you can bypass the authentication routine, right?
1702580	1704720	The other case is when the password
1704720	1707100	is actually used to decipher the disk.
1707100	1711160	Then, if you just try to nop the password checking routine,
1711160	1713080	well, nothing will happen.
1713080	1715360	Like, you won't decrypt your drive, and that's it.
1717060	1719780	Okay, so while the first case is really trivial,
1719780	1722100	like we mentioned, if you have a Lilo or Grub password,
1722100	1725080	or whatever, which does not use the password
1725080	1729480	to decrypt anything on the drive,
1729480	1732680	you can pretty much just patch the bootloader.
1733220	1739780	This has been studied deeply in not the latest,
1739780	1743180	but the previous FRAC issue.
1743180	1746100	It's an article called Hacking Deeper in the System.
1746100	1749000	It's pretty much a patch in Grub for fun and profit.
1749720	1752140	Okay, so this is the example,
1752140	1754000	I mean, a typical example of what could happen
1754000	1756100	if you can write to the master boot record.
1756720	1760360	Here, I had Lilo asking for a password,
1760360	1762380	and I patched it,
1762700	1764680	so it doesn't ask for a password anymore,
1764680	1765780	and just reboots.
1766280	1768660	If you look at Lilo, it's actually amazing.
1768660	1771040	You can change the delays and stuff like that.
1771040	1772800	Pretty fun.
1773740	1779060	Okay, let's now go to the actual interesting case
1779060	1785160	where you have a password check
1785160	1789100	which will use a password to decrypt your hard drive.
1796880	1798560	Okay, you might be thinking here,
1798820	1800760	why is he talking about that anyway?
1800920	1803300	So I'll show you that this is pretty linked
1803300	1805680	to what we've been doing before.
1805680	1808040	I will show you an actual attack scenario
1808040	1809880	and a demo for it.
1810700	1812260	Okay, here's a problem.
1812260	1816080	We've seen that we can retrieve the password from memory
1816080	1821860	because the guys who write bootloaders
1821860	1825960	do not sanitize, typically, the BIOS keyboard buffer
1825960	1828100	after reading the password.
1828380	1830280	What if they don't initialize it
1830280	1832420	before reading the password?
1833460	1836600	So actually, what you could do...
1836600	1839420	Okay, this is a world map we've been seeing before.
1839420	1840400	Like you have the bootloader
1842380	1844760	which uses BIOS interruptions
1844760	1848040	to retrieve the content of the BIOS keyboard buffer.
1849360	1851440	Okay, we don't need all of that.
1851580	1855440	Okay, let's imagine I write...
1855440	1858380	I replace the master boot record with mine.
1858460	1861260	Okay, a rogue bootloader kind of thing.
1861260	1865360	What it would do is actually talk directly
1866540	1867820	using PIC programming
1868480	1871020	to the two PICs inside the motherboard
1871020	1872680	and the one inside the keyboard
1873260	1874340	in order to...
1874340	1876580	Okay, so this is done via EOPorts
1876580	1880120	so you need root privileges to do that too.
1880740	1882540	I mean, it's nonsense.
1882540	1887560	Like, when you're a rogue bootloader
1889100	1890480	you're running in real mode
1890480	1892540	so you have access to anything anyway.
1892600	1896840	But you can use EOPorts to reprogram those two PICs.
1897020	1898360	So it's pretty much like
1899100	1903080	emulating the fact of typing keys inside a keyboard.
1903380	1907040	Okay, so you can fill in the BIOS keyboard buffer
1907040	1911540	with the password you've discovered previously.
1912120	1917180	Okay, and then remove the rogue bootloader
1917180	1919820	replace it by the original bootloader
1919820	1922360	which will do its task normally
1922360	1926280	which is, it will ask for...
1926820	1930740	it will ask using interruption 16 for user input
1930740	1933860	and the BIOS interruption service routine
1933860	1937860	will read the password you've entered previously.
1938040	1938900	Okay?
1939840	1941460	Normal stuff here.
1942920	1945440	Okay, so in order to do that
1946040	1949640	we need to write a rogue bootloader
1949640	1953600	which is, first of all, backup the old master boot record.
1957880	1960240	Okay, there are some conditions not very interesting.
1960240	1961880	I'll check all the details later.
1963060	1966020	Okay, so it basically backups the old master boot record.
1966020	1967960	Okay, that's the installation process.
1967960	1970320	This rogue bootloader will, using PIC programming
1970320	1974220	enter a password inside the BIOS data area
1974220	1975800	using PIC programming.
1976620	1978300	And then it will copy back
1978300	1982400	the old master boot record in place
1982400	1984660	using, for instance, interruption 19.
1984660	1986160	It's very valid.
1986380	1991520	And transfer, control transfer to the original bootloader.
1992280	1994940	Okay, I'll give you a demo here
1994940	1997560	only it's a bit tricky to put in place
1997560	2000640	so I'll cheat a bit, I'll show you a video.
2011860	2012580	Hopefully...
2012580	2018040	Okay, so in that case
2018040	2024280	the computer is protected with two passwords.
2024280	2028680	The first one is a grub password
2028680	2030420	using md5 encryption
2030420	2032840	and the computer is also...
2032840	2033960	so we're under Linux
2033960	2035980	we want to reboot that Windows machine
2035980	2040220	which is also encrypted using TrueCrypt.
2040980	2043780	So you can check the md5 password and stuff.
2043780	2045140	There is one trick here.
2045140	2051020	The name of the entry in grub is very long
2051020	2053340	so I can actually not copy
2054100	2056480	I cannot enter in grub
2056480	2061300	the whole name of the grub entry
2061300	2065500	because the size of the BIOS keyboard buffer is limited to 16.
2065500	2071240	So what we do using character backslash x19
2071240	2073300	is to use the arrow key.
2073960	2075600	First of all, the first character
2075600	2077160	we use the escape character
2077160	2079740	to escape the graphical interface
2079740	2080860	entering the grub menu
2081370	2083220	then we choose the actual entry
2083220	2085600	we want to reboot using arrow keys
2085600	2089460	we write the password for the first bootloader
2089460	2091140	grub, which is owned
2091860	2093160	then we press enter
2093160	2095540	it's really the exact same stuff
2095540	2097440	you would do if you were in front of the computer
2097440	2103280	only we do that using a bootloader
2103940	2107080	so we don't have to have access to the computer itself.
2107980	2113120	Ok, so we wrote a small installer for that
2113120	2114760	so you need to know the device
2114760	2115800	and here is what happened
2115800	2117180	it's going to be very fast
2118040	2119320	Ok, this is it
2120060	2122160	So, I don't know if you've seen
2122160	2123120	Thank you
2128900	2130020	So what happens is
2130020	2131180	you can really reboot
2132420	2132780	a computer
2132780	2134680	even if it has multiple encryption
2134680	2137380	and multiple password checking
2141050	2142410	Ok, let's go to the
2142990	2144670	I mean, I've been telling
2144670	2145910	most of the people
2145910	2146930	I've enabled and stuff
2146930	2148030	so now I'm going to disclose
2148030	2149750	the full list of people actually enabled
2150870	2152830	First of all, I would like to thank the vendors
2152830	2153950	for their attitude
2153950	2155290	they've been very responsible
2155290	2156490	and cooperative
2157250	2159970	but TrueCrypt, like these guys told us
2160670	2162470	the vulnerability only exists
2162470	2164710	because you are misusing the software
2166230	2167890	Thank you, that's very deep
2170310	2171330	Ok, so
2171330	2173210	the first kind of passwords
2173210	2174190	we've been talking about
2174190	2175070	are biased passwords
2175070	2177670	so here is a list of
2177670	2180910	vulnerable APROMs
2180910	2182870	so you can see pretty much
2182870	2184610	everybody is vulnerable
2184610	2187530	ranging from, well, you read it
2188690	2190610	Full disk encryption software
2190610	2192350	with pre-boot authentication
2192790	2193210	capabilities
2194590	2197150	so BitLocker, which is the
2197150	2198750	encryption
2198750	2200330	software
2200910	2202710	for Microsoft Vista
2202710	2204710	on the version
2204710	2206510	SP0 is vulnerable
2206510	2208650	it has been fixed in SP1
2209670	2210290	TrueCrypt
2210290	2212590	so even if those guys deny the truth
2212590	2214710	I showed you before
2214710	2216290	that you can also reboot it
2217430	2218390	DiskCryptor and
2218390	2219470	DriveCrypt
2220810	2222230	and bootloader passwords
2222230	2224670	so Grub and Lilo
2224670	2225470	are also vulnerable
2226730	2228570	for the sake of completeness
2228570	2230590	I will also show you the list
2230590	2232250	of non-vulnerable software we've seen
2232250	2234470	so there are several
2234470	2235710	biased passwords
2236430	2240130	full disk encryption software. This list is obviously far from
2240130	2244210	being exhaustive so I entitle you to, I mean, do your own
2244210	2248210	experiments. Actually the exploit is the same everywhere.
2248350	2251590	So there is one exploit for Unix which is going to work for
2251590	2256450	any pre-boot authentication password if available. And one
2256450	2261050	version for Windows. So you just check this, install a few
2261050	2266930	software and check if they are vulnerable. If you do so, I
2266930	2273550	would appreciate if you sent me a mail or something. Okay, so
2273550	2277510	how do we mitigate those vulnerabilities? Okay, the most
2277510	2285150	obvious, I mean, the most obvious advice I could give is
2285150	2288730	like to sanitize the BIOS keyboard buffer before and after
2288730	2295830	use, right? You can check on the website. We are trying to keep a
2295830	2299850	list of patches to do that. Unfortunately when it comes, for
2299850	2305530	instance, to BIOS EEPROMs, it's very difficult to patch it
2305530	2311510	yourself. You have to wait for the vendor to issue fix. So you
2311510	2314430	must probably looking for an intermediary solution which will
2314430	2321210	not fix all the problems but, I mean, will fix most of them. So
2321210	2325890	if you're using Linux, I can, I really entitle you to download
2325890	2330210	the geosecurity patch from openworld.net. Brad has been very
2330210	2333970	keen to release a new version today, including the patch we've
2333970	2355920	written for it. So what it does basically is, yeah, absolutely
2355920	2371580	not. No, no. What do you mean you have to actually? You're the
2371580	2382100	true creep guy or something? Okay. See, what happens is, if
2382100	2386300	the password can be entered by the keyboard, okay, just let me
2386300	2390660	reply to you. If the password can be entered at the keyboard,
2390660	2393560	okay, from the keyboard, there is no difference from the
2393560	2398140	bootloader point of view if it's actually typed at boot time on
2398140	2402380	the console or if it has been stored in the BIOS keyboard
2402380	2407940	buffer by a previous rogue bootloader, okay? It's exactly
2407940	2411100	the same thing. I mean, it's following the same process.
2420420	2428000	It's... Okay. So see, I'm afraid I don't really understand your
2428000	2443020	question, but we can... Okay. So what happens with, for instance,
2443020	2446660	TPM ships, you can't actually mitigate, yeah, you're right. So
2446660	2452180	you can retrieve the password, but you can't actually reboot
2452180	2457560	the computer using the, I mean, rogue bootloader method. That
2457560	2461860	was your point? So it's very true. No, I have no method to
2461860	2466740	bypass TPM so far. I have not studied it deeply. There are
2466740	2469860	really three vulnerabilities here. Like the first one is the
2469860	2473300	ability to retrieve the password in plain text. The second one is
2473300	2478340	the effect of rebooting, okay? And the third one is actually the
2479340	2484200	kernel leakage inside user LAN from Microsoft, right? Which
2484200	2488880	allows you to kind of retrieve the password with less
2488880	2494100	privileges, okay? So I've discussed with the, I mean, guys
2494100	2497000	responsible at Microsoft, they are working on a fix. This is
2497000	2502980	very complicated to fix, okay? But you're right. My bypassing
2502980	2507680	of TrueCrypt, of BitLocker, sorry, is not full. I could not
2507680	2514080	reboot it. Okay, so just a few greetings. So first of all, I
2514080	2519360	would like to thank my reviewers, the technical team
2519360	2525780	which I work with, and the guys from EverybodyDies.com. It's
2525780	2529060	actually a game, computer game, and they allowed me to use
2529060	2531620	their screenshots of the game which is now called DEFCON
2532150	2537800	inside my slides. This is why my slides look so good. Community
2537800	2542140	guys, so plug the plug, plug security. Thank you for coming
2542790	2547000	and waking up after the parties and stuff. All you for coming to
2547000	2550860	the presentation, and indeed the DEFCON staff for the awesome
2550860	2554960	event and parties. I think we can clap for that, yeah.
