start	end	text
2820	12500	Alright, hello! I'm not used to a mic so sensitive so I'm going to talk like back here and if
12500	20960	that doesn't work then I'll adjust, whatever. This is Xiaomi the money, our Toronto Pwn2Own
20960	28760	2023 exploit and behind the scenes story. What this talk is about is our hack against
28760	34940	the Xiaomi 13 Pro which includes the full exploit chain that we used and also issues
34940	40400	encountered during the research itself. And then we're going to cover what happened during
40400	46480	the Pwn2Own competition itself and for a little bit of background on who we are, I'm Ken
46480	52580	Gannon, I'm a principal security consultant at NCC group and I usually focus on hacking
52580	60380	mobile shit. This is Ilyas, at the time of the competition he was also part of NCC group, he
60380	66940	is a veteran Android malware reverse engineer and this was his first time competing at Pwn2Own
66940	72700	so we got first time Pwn2Own, first time Defcon, this is his first time in the US, this is a
72700	82440	lot of stuff for this guy right here. So a little bit about us, so it was in 2022, no 2023
82440	87680	of last year, it was around May. Ilyas was looking to do Pwn2Own, for those of you that don't
87680	93200	know what Pwn2Own is, it is a zero day competition where you try to hack some devices and
93200	100340	some prize money involved and Ilyas was looking to do Pwn2Own this year, last year for his
100340	105540	first time. And so he started researching previous vulnerabilities, previous competitions to
105540	111540	see what that was like. And then he came across my name because I've done exploits, I've
111540	117160	done previous attempts at Pwn2Own and he realized, oh shit, I work at the same company as Ken
117160	122420	Gannon, I'm gonna reach out to him. So it was like May of last year, we get together, we talk
122420	130400	over teams and we discuss what we want to hack. And we decided to hack the Samsung Galaxy S23.
130980	136000	So that was as of May last, oh it's, hi Will, I didn't see you there. So that was May of last
136000	144460	year. And then July of last year, ZDI announces their list of devices. And as you can see on the
144460	150580	screen, it includes the Xiaomi 13 Pro. So the thing about the Xiaomi 13 Pro though is that the
150580	158340	Xiaomi devices has not been a target of Pwn2Own since 2020, the COVID pandemic. And him and I
158340	164120	got together again and we're like, oh, this sounds interesting. Maybe we should try to
164120	170980	hack this new device or we should try to stick with Samsung Galaxy S23. And the thing about
171540	176380	our discussions at the time is that we were discussing this on July 13th of last year, when
176380	183380	the devices were announced. And as I said, we were thinking about Samsung Galaxy S23, but I
183380	190800	have a history with Samsung at this point. A lot of traumatic experiences with Samsung,
190800	199180	including a failed Pwn2Own attempt in 2021, because I am a very shitty programmer. So because
199180	205600	of that, and we decided that maybe we should just go for the Samsung, for the Xiaomi 13 Pro
205600	210800	instead. Something new, something fresh. We we just thought, you know, something that we both
210800	216960	can learn together. What could possibly fucking go wrong, right? This is gonna be awesome. So
217700	223720	let's talk about the Xiaomi 13 Pro. There's essentially two versions of this device. The
223720	229700	global variant and the China variant. The global variant is available worldwide, wherever
229700	236680	you can get a Xiaomi device, whereas the China variant is typically only found in China. At a
236680	241180	hardware level, they're exactly the same thing. Same camera, same processor, same board,
241180	247660	same chip set. The only minor difference between these two models is the type of firmware
247660	255540	that can be installed on each device. Uh, the China model can have the China firmware as
255540	261340	well as what's called the global variant firmware. Whereas the global model can only
261340	267780	install the global variant firmware. Now, the unique part about the global firmware though,
267780	276060	is that depending on the settings, you can have it emulate different regions. Like for example,
276060	284040	in Europe, in India and in Taiwan, they have their own Taiwan, India and Europe firmware. Or
284040	290500	you can tell the global mother one to emulate a different region and it will become that
290500	296660	region. Why this is important is because certain regions have certain apps enabled or
296660	303500	disabled. For example, if you set the region to United Kingdom, the get apps application,
303500	309600	which is the Xiaomi uh application store, will be enabled if the phone is set to the UK
309600	315400	region. Whereas if you were to set it to United States region, the get apps store is
315400	320960	disabled. And this is just one example. Another one is that if you set the region to Russia,
320960	326580	then the Yandex browser becomes enabled on the device. Keep in mind that this browser,
326580	331720	the APK file, is in the firmware already, it's just that it gets enabled or disabled
331720	337940	depending on what region the firmware is set to. Another example is that with the Spain
337940	346000	region, the Opera browser becomes enabled and one more example, and one more example, the
346000	351640	Indonesia region, the WhatsApp uh app becomes enabled or disabled. So at this point, we
351640	355140	have multiple different regions, multiple apps being enabled, multiple apps being
355140	362380	disabled. So we thought, well, why don't we determine what each region does, download all
362380	366540	400 plus applications from the phone, and start reverse engineering every single
366540	372220	application. Except that's a really fucking bad idea because that's a lot of applications.
372220	378200	So instead, we decided to just prioritize the Xiaomi developed applications,
378200	384300	specifically the ones that were developed by Xiaomi for that phone. And so then 22 days
384300	390640	later, we had 3 exploits for the GetApps application. And this is where Elias is going to
390640	392220	talk about them real quick.
392340	399260	Hey everyone. I'm going to be talking about the app we exploited. So we found 3 different
399260	405600	exploits in the GetApps application. This application is also what the, what we ended up
405600	412460	exploiting at point one. So we found 3 different ways to force install application. And the
412460	418900	attack scenario is the following. Tapping a malicious hyperlink in a web browser would
418900	425460	result in automatically install any application available on the GetApps store without user
425460	431560	consent. Two of the methods were unfortunately patched before the competition. And I'm
431560	438460	going to show here the exploit code of those 2 patch exploits. So here's the first one. Um,
438460	443580	that was used to install WhatsApp automatically. On the first screenshot, you can see the
443580	450020	browsable intent code. And if you've never created a browsable intent hyperlink before, we've
450020	459060	also put the Java code which does the exact same thing. And there is an ID equal com.whatsapp
459060	465100	parameter in there. And that's what could be used to install any application available in
465100	474140	GetApps. Here's the second patch exploit. On the left, you can see the browsable intent code.
474140	480120	And again, on the right, you can see the Java code which does the exact same thing. It's a
480120	487900	lot chunkier as you can see. And if you base 64 decode that string, you'll be able to see the
487900	495080	WhatsApp packet name, package name in there. Before we can get into the third exploit, we
495960	503640	need to talk a little bit about WebView in GetApps. Um, GetApps had a WebView which
503640	510300	contained a JavaScript interface. And for non-Android people, this means that JavaScript could
510300	517300	be used to execute a set of Java function defined in the application. It's defined in the
517300	525020	JavaScript interface class. And some of those JavaScript interface function were benign, like
525100	531980	show toast function, for show toast functions, um, which literally just shows a toast, as you
531980	537900	can see in the screenshot. But there are two interesting functions there for us, for point
537900	544000	one. The install function, which installs any application available on the GetApps store
544000	551580	without user consent. And the open app functions, which opens any specific application, again,
551580	559980	without user consent. And this WebView is obviously dangerous, and Xiaomi knows it. So, they
559980	566580	implemented some protection to ensure that attackers cannot obviously open this WebView and
566580	573460	execute any of those JavaScript interface functions. And one of those protection was that
573460	581560	whatever URL being loaded in the WebView, must be a valid URL. And by valid, I mean that
581580	590420	it either starts with the HTTPS protocol, and the domain should belong to a defined set of,
590420	599480	um, uh, white listed domains. All of them were owned by Xiaomi. And the other valid URL, um,
599480	605920	should start with the file protocol, and the file should be located in the GetApps private
605920	616440	directory. A GetApps private directory, um, names was always web hyphen raise, I hyphen some
616440	625820	random numbers. So now, we have a new plan. First, we can launch the WebView and load a valid
625820	632060	URL. Second, inject, inject some custom JavaScript code into the WebView, possibly through
632060	638020	cross-site scripting. Third, having the JavaScript code execute the two JavaScript
638020	646200	interface functions mentioned before. And fourth, got, get remote code execution. Okay, step
646200	653020	one. To launch the WebView, we use the activity called join activity. This activity could be
653020	658840	launched via browsable intent. Again, this means that this activity could be launched via
658840	665480	hyperlink in a website. And it was also really simple to tell join activity what URL we wanted
665480	673740	to load in the WebView. It was just a get parameter called URL. This is the proof of concept,
673740	682680	uh, which launched join activity and loaded the file detail dot html that was in the GetApps
682680	688820	private folder. That detail dot html is pretty blank, as you can see on the screenshot. Um,
688840	696540	but that's just because we didn't give him the application's data to use. So now step one is
696540	703820	done. Let's move on to step two. We had two options to inject custom JavaScript. We could
703820	710380	either load a show me domain URL and then print this dot URL and look for usable
710380	717760	vulnerabilities. Or, we can analyze the file in the private folder and look for user input
717760	725580	vulnerabilities. We choose the second option. And now this research just became a JavaScript
725580	733740	source code review job. And as you can see on the picture, this was my reaction when I realized
733740	739940	what was going on. Um, point one will make you do stuff you really don't want to do, but we
739940	747740	still did it. Um, in, in the, uh, the web hyphen res folder, um, you can see the
747760	754900	folder. We had like HTML file and JavaScript file with similar names. As an example, we had
754900	763240	the detail dot HTML file and this file would load the detail dot chunk dot JS. Some JavaScript
763240	771600	file would accept user input via get parameters. But also, all of those JavaScript file had a
771600	777740	building function to filter out any cross-scripting payloads. Well, except for this one.
777760	786100	One that we found. There was a file called integral dialogue page dot chunk dot JS which failed
786100	793380	to sanitize cross-scripting payloads in one specific area. So, let's try to get a dumb XSS
793860	800440	payload working in this file. This was the initial payload that was used for testing. On the
800440	806980	right, you can see the decoded version of it. So, we had different inputs and we had different
806980	815660	payloads. All of them started with XSS test, 1, 2, 3, 4, 5, and they all ended with, um, two
816320	822540	characters that was encoded. And those characters were double quote symbol and the less than
822540	831460	symbol. On the left is what the web view looked like with the payloads. And on the right is a
831460	838480	debugging window in Chrome. Our less than symbol character was unfiltered in one of the
838480	847620	area, specifically the XSS test 2. All the others were filtered, filtered the right way. So,
847620	856920	now, with this XSS test 2 payload, we can try to just pop a simple alert box. And then, what
856920	865660	the hell? We got some errors. Locat was showing us disabled XSS text, XSS errors, um, errors.
865660	870440	So, let's dig into that. Remember the protection against the web view that we mentioned
870440	877260	earlier? There was another one, unfortunately. The GitOps application had a built in XSS
877260	886760	filter in the Java code itself. And it looked for XSS payload in the URL. So, if the URL
886760	895860	had any XSS payload found, then the URL would fail to load. And here is the list of the XSS
895860	904000	filter. And as you can see, it detected our forward slash script string in our payload. At
904000	910620	this point, we decided that maybe we shouldn't be using script string at all. Maybe because
910620	916400	there might be other filters we haven't found yet. And also, script is just too obvious for an
916400	924020	XSS payload. Okay, so going through the list and thinking about what could we use now, we
924020	931640	realized that the Java XSS filter was just looking for string matches. So, we thought, what
931640	938660	if we could encode, um, a less than symbol, um, a character in one of those payloads. Such
938660	946380	as, the less than symbol SVG. So, that's what we tried. And we used, um, we used a
946400	955240	SVG unload to run the JavaScript alert box and that, that said, yeah, dumb XSS here. And
955240	963680	boom, it worked. We finally have an XSS in the web view now. So, step two is done. Let's move
963680	970360	on to step three. Oops, sorry. Now, let's try to call the, those JavaScript interface
970360	977540	function mentioned earlier. To test, we tested our payload just to see if we could run the
977540	982860	show toast function. And on the screen shot on the right, you can see that we managed to do
982860	991840	that. So now, after some time, we did some reverse engineering and we came up with this lovely
991840	997760	JavaScript payload to install any application. On the screen shot, you can see that we first
997760	1003480	called the install with the package name of the application we want to install and then we run
1003660	1010660	a loop, um, and wait for the, the application to install and then we use the open app with the
1010660	1018180	package name again to open the application. So now, there is just one problem. We didn't know
1018180	1025860	what to install. So now, what application should we install? Ideally, we want some malware
1025860	1032400	that we can control in the application store, store somewhere. And I'm going to let Ken talk
1032400	1040540	about his baby now. So, for those of you that don't know, I'm also an active contributor for
1040540	1046920	this Android tool Drozer. Yay! For those of you that know what Drozer is, yay! Uh, and
1046920	1053320	because I'm an active contributor, I know how to reskin it into an application called Sunfish
1053320	1060040	which does literally the same exact thing as Drozer except it starts a bind shell on boot as
1060040	1066940	well and then I uploaded it to this Xiaomi app store. So, for a little bit on the Xiaomi app
1066940	1074340	store, there was a, a copy of Drozer called Sunfish up on the app store. That was fun. So, we
1074340	1080960	had a new payload. In this case, the payload is going to step one, install Sunfish and then
1080960	1088020	step two, open it after Sunfish is installed on the device. So, alright, all the pieces, all
1088020	1094200	the puzzle pieces are in place. Let's uh, let's watch it do its thing real quick. We open up
1094200	1099040	Google Chrome. Uh, in this case, we're going to, as you can see, it's a new copy of Chrome
1099040	1105440	with all those popups. We browse to the web server I had at my house, uh, over HTTP because
1105440	1111620	I'm lazy. But eventually what's going to happen is I will load the website and there's a
1111620	1119180	yay POC hyperlink. Click that one link. This appears and then Sunfish gets installed and boom,
1119180	1125080	Sunfish is now installed. The server has started as well. I put the phone down. At this
1125080	1130700	point, I have the IP address of the phone that reached out to my web server as well. And so,
1130700	1137000	to put the bind shell open, all I had to do was use my re-skinned Drozer console thingy
1137000	1142820	whatever to connect to the Drozer application installed on the phone. And then for, per the
1142820	1149520	rules of Pwn2Own, as long as you get RCE on the device, that is good enough. Including just
1149520	1155700	RCE as a single application. So, in this case, I'm running ID and who am I as Sunfish? There
1155700	1165220	we go. One click to, one click to RCE. Yay! So, we got RCE. All the steps are done. And like I
1165220	1172140	said, that was only 22 days later. We had 22 days of research time. We had 77 more days to
1172140	1177140	go to to do whatever the fuck we wanted. Everything was awesome. Nothing could have
1177140	1185680	possibly gone wrong. Let's discuss what went wrong. So, late August of 2023, Xiaomi released
1185700	1190700	Xiaomi made changes to their get app server. Uh, specifically, one of the changes that they
1190700	1199480	made was that the install parameter, the install function that we were using, now required a
1199480	1209980	shit ton more code. Our payload was now chonky as fuck. But wait, there's more. You see, this
1209980	1215440	payload did not work in all parts of the world. So, for a little bit of background, last year and
1215440	1222940	around August, late August 2023, I went on vacation to Japan and the Philippines. And this new
1222940	1229820	chonky install payload would work in Japan and the United Kingdom. Thanks to Ilias here being
1229820	1234400	based in the United Kingdom. But it fucking wouldn't work in the Philippines for some
1234400	1243920	reason. And while in uh, Japan and the Philippines, I noticed that the get apps application was
1243920	1251520	showing different content based on the physical location of the phone. Not the IP address.
1251900	1256520	I'm talking about doing a factory reset and you, you know, you go, factory reset, you go
1256520	1260160	through the whole setup, the cell phone towers are, the cell phone signal is now enabled on
1260160	1265320	the phone. And for some reason, after you do a factory reset and you go through the initial
1265320	1273320	setup, there was stuff on the uh, in the get app store that was exclusive to that one region.
1274220	1279540	And what I also realized at the time, or as we were doing like research, like figuring out
1279540	1288980	what is going on, uh, VPN did not affect this. The reason I was talking about factory reset is
1288980	1295200	because during Pwn2Own specifically, uh, they typically factory reset their phone before
1295200	1300700	every single uh, entry goes up. And so then during a factory reset process, the cell phone
1300700	1306020	tower, the cell phone signal antenna is enabled. So we wanted to mimic that. And we realized
1306020	1312420	that just really weird stuff was happening with the get app store depending on where I was in
1312420	1318640	Japan and the Philippines. And so then after looking at the developer documentation and
1318640	1324260	looking at uh, the, the developer portal I had access to since I uploaded Sunfish to their app
1324260	1331720	store, I realized that there were some places that were launched. Uh, for example, get apps was
1331720	1341840	not launched in the US, UK and Japan. But it was launched in the Philippines. Now I don't have
1341840	1348500	definitive proof, but this is literally the only thing I could think of at the moment. Maybe we
1348500	1353440	were seeing different behavior in the Philippines because the get app store was not, was
1353440	1360340	launched in the Philippines but was not launched anywhere else that we've been to. Now,
1360340	1366520	thankfully, cause we are awesome, eventually we found a way for the payload to work in the
1366520	1373240	Philippines. But that payload would only work in the Philippines. It would not work in US, UK
1373240	1381220	or Japan. We didn't know what to do. Because another issue came up, Pwn2Own that we were
1381220	1388000	going to takes place in Canada. Do we have a payload that works in Canada? We, I like, it's a
1388000	1393820	theory, this whole like launch not launch thing is just a theory. And technically, get apps was
1393820	1400300	not launched in Canada. So maybe, maybe our get apps or non-launch payload would work in
1400300	1406180	Canada. We're not entirely sure. It'd be nice to confirm. Well, NCC group is a global
1406180	1411520	company. And we have offices in Canada. So surely we can just, no, no, we're not, we're not
1411520	1417160	working with the Canada office for this talk. Because you cannot get the Xiaomi 13 Pro in
1417160	1422520	Canada. So, if you try to get the Xiaomi 13 Pro here in the US, you're going to go through
1422520	1426580	eBay. You're going to go through a, a seller on eBay or on Amazon or something to get the
1426580	1434140	phone. Uh, in fact, my phone, I know for a fact, what, was a China model imported here from
1434140	1441040	China, sold by a, a Chinese guy on eBay. I could not procure the Xiaomi 13 Pro in Canada.
1441040	1445280	eBay Canada, Amazon Canada, none of the cell phone providers in Canada, like I could not get it
1445280	1450700	in Canada. So, you know, I'm in North America, I might as well just send my phone to Canada.
1450700	1456240	No, no, I'm not sending my phone to Canada. Because another issue came up with my schedule
1456240	1464320	specifically. You see, in August of 2023, uh, or 20, 2023 in general, NCC announced that they
1464320	1471080	were going to open an office in the Philippines. And I was chosen to go out to Manila to spend
1471080	1476600	the rest of 2023 in the Philippines to help set it up. Uh, fun fact, I'm still in the
1476600	1486220	Philippines. So, because of this, I had a very, very weird travel schedule last year. Because
1486240	1493300	as I said earlier, I went on a vacation, right? I come back from vacation on September 10th. And
1493300	1498340	then on September 11th through 14th, I'm at my house, I'm like packing, I'm like trying to get
1498340	1504180	ready because I'm going to be spending the rest of the year in the Philippines. Uh, and then on
1504180	1509320	Friday the 15th, and, and I do this thing in Vermont for like a race, I come back on the 17th.
1509320	1514700	And then again, 18th through 20, I'm at home. And then the 21st of September, I fly to the
1514700	1521340	Philippines. That leaves only seven business days where I am in the U.S. So that's the
1521340	1527200	schedule. Uh, it's a little bit hectic, but it gets more hectic, I promise. But first, we
1527200	1534460	want to, I want to talk about why those seven days sucks. Because it is too risky to send a
1534460	1538920	phone to Canada, pay Canada import taxes, test and develop an exploit, send the phone back to
1538920	1547680	U.S., and then pay U.S. import taxes all in seven days. That is not going to happen. Well, what
1547680	1555120	if I just send my phone to Canada and keep it there? Well, I, I, the Philippines has a lot of
1555120	1558980	Xiaomi stores. That's, there's literally a picture of a Xiaomi store that I sent to Italy, that's
1558980	1564340	when I found my first one. And they were selling Xiaomi 13 Pros for 1,000 U.S. dollars. I can
1564340	1570400	just go to the Philippines and get a new phone, right? Well, the problem is that now we're
1570400	1574880	dealing with three different time zones. If I'm in the Philippines, he's in the U.K., and the
1574880	1580220	Canada consultants are in Eastern Standard Time. Uh, for those of you that don't know, half of
1580220	1585080	the time of the year, the Eastern Standard Time and the Philippines are literally 12 hours, 12
1585080	1591000	hour difference. And trying to manage those time zones on top of the consultants in Canada
1591000	1599240	being available, that sounds like way too much fucking stress for a theory. On top of that, the
1599240	1606020	biggest issue, the biggest threat to any pawn to own competition are the patches. So, at this
1606020	1613320	point, we had a good idea as to how the patches worked. Uh, first, during the first week of, of
1613320	1619680	every month, a firmware gets updated to the beta channel and in, and as, after that first week in
1619680	1625140	the beta channel, the firmware also gets put in the stable channel. With that firmware update
1625140	1633600	comes a new GetApps update. Every single month, there is a new update for GetApps. So, the real
1633600	1639760	schedule now is that after I fly back to the Philippines, no one is in the U.S. to test the
1639760	1672040	exploit, or no one's in North America to test the exploit a... Hey, you know what? If I try
1672040	1680220	to shut... Alright. No one's in North America. Hey, we're back. Yay. Alright. Yeah, like I
1680220	1684480	said, no one's back in, no one's in here in North America to test stuff and we have a new patch
1684480	1693160	coming out sometime, supposedly October 9th, right? I really, really want to test this theory
1693160	1700620	though. I really, really do. Because, here's the thing. We think that Canada is a non-launched
1700620	1708720	region, right? Just like with U.K. or U.K. and U.S. uh, and Japan. If we can group, and this is
1708720	1714480	just a theory we had at the moment, if we could group Canada into that non-launched region and
1714480	1720680	test and make sure that we, that, that theory is true, then let's say that October rolls around
1720680	1727160	and they release their patch, right? All we would need is Ilyas here to test his U.K., uh, his
1727160	1735160	exploit in the U.K. And if it works, then in theory it should work in the U.S., in Japan and in
1735160	1746700	Canada. So, earlier I mentioned that it costs 1,000 U.S. dollars to buy a new phone. Another
1746700	1753000	thing that costs 1,000 U.S. dollars is to go to Canada, literally for a day, literally hang
1753000	1759560	out in the Marriott Hotel at Toronto Airport and test the exploit. And then fly back the next
1759560	1766740	day. So that's what I did. On, let's see, on September 17th I fly back from my race, on
1766740	1774160	September 18th I fly back to Toronto to test the exploit, on September 19th uh, I fly back home
1774160	1782400	and then on September 21st I fly to Manila. So many miles. And like a, and after a few hours in
1782400	1789920	Toronto, it was confirmed. We did it. We, we confirmed that this was a non-launched region. And
1789920	1797060	so now, if our, if October rolls around, our exploit works in the U.K., we should be good.
1797060	1804000	Everything is awesome. Uh, we are, uh, we are so excited for everything to happen and we are
1804000	1811760	going to get our, uh, get our first phone to own wind. Right Elias? Yeah! So, October rolls
1811760	1817860	around. As expected, get apps releases their, their update in October. It's literally
1817860	1824860	October 9th. I have it marked down in my calendar and we confirm that the exploit works. We
1824860	1829420	have our books flight for September 20th. I'm flying from the Philippines, he's flying from
1829420	1836980	the U.K. We, all this is good to go. We're going to fucking do this. No, hold on. One week
1836980	1845280	before phone to own, Xiaomi releases an out of band update to get apps. Which happened to
1845280	1852460	fucking remove the file that we were going to exploit. Specifically, the file was removed
1852460	1857780	from the APK file itself. For those of you that are on Android, uh, that means that the file
1857780	1864720	was removed from the installer file of the app itself. It was no longer there. But
1864720	1870800	thankfully they are, Xiaomi also has shitty programmers. Because they forgot to remove the
1870800	1878320	file from the device if it was already there. So, in theory, assuming that we show up to
1878320	1882480	phone to own and we're one of the first few people to hack the phone. And like I said
1882480	1891060	earlier, uh, uh, ZDI usually factory resets the target device per, uh, competition. They
1891060	1896260	usually have multiple devices. So, as long as we could hack one of the initial devices
1896260	1902100	before they factory reset it again. Again, it's a dice roll, but there's still a chance. We
1902100	1907260	still follow through. We still decide, okay, this is not that big a deal. Let's fucking do
1907260	1913000	this. So, we fly out to Canada. It is now October 20th. Him and I are both on our flights.
1913900	1919780	Literally while I'm on the plane. And the Saturday before phone to own, there is another get
1919780	1926100	apps update. Now, this is the most interesting part because they introduced a new thing in
1926100	1933180	get apps where they can modify what files are on the device using Google Firebase. Which is
1933180	1939740	really, really cool. And for some reason they pushed our file back to the device. Like if
1939740	1943740	you were moved, if you went in and manually removed the file that we were going to
1943740	1948640	exploit, they just pushed it back for us. That's so fucking convenient. Thank you,
1948640	1955960	Xiaomi. Except they added one more thing. So, we were going to exploit the activity, join
1955960	1965500	activity, as we, as Ilya said. But they happened to add code to that one activity where if the
1965500	1972880	intent came from any of these four browsers, the uh, Xiaomi browser, uh, the Android HTML
1972880	1983120	viewer, the Android NFC, or Google fucking Chrome, then join activity will not launch. What the
1983120	1988640	fuck, Xiaomi? As you all saw in my video earlier, we use specifically Google Chrome. We
1988640	1997920	can't, there's no other browsers on this phone that we can use. Except there is. Because if you
1997920	2006820	set the region to Spain, the Opera browser is enabled on the phone. So technically we had an
2006820	2013440	exploit for the country of Spain specifically. Which is still technically a zero day,
2013440	2020500	because now it's a zero day in Spain. So we told ZDI this. We told them, hey, Xiaomi is doing
2020500	2027900	some shitty stuff, but Spain. And ZDI goes, Spain. And we're good to go. And we're
2027920	2033040	good to go. Alright. We dodged another bullet. We can now, we can do this. We can hack a
2033040	2041540	Xiaomi 13 Pro. The first day of the competition, Xiaomi starts disabling the ability to
2041540	2049660	install apps from their app store. Now, I don't know if this was a global thing. I genuinely
2049660	2055840	don't know. I don't talk to many Xiaomi users after this. I don't want to. But the very
2055840	2063340	least, the people in Toronto area that were, that were also going to hack the Xiaomi 13 Pro,
2063340	2068320	they corroborated it. They all saw the same issue that we saw. It was a hit or miss, whether
2068320	2073660	an application wouldn't install. It was like a 20% chance that we could install an
2073660	2084260	application. And they killed my boy. This, this really genuinely hurts. That I could not
2084260	2092960	install Sunfish at all. It was a 0% success rate. So, on that day, there was 2 teams that
2092960	2099680	were supposed to go and hack the Xiaomi 13 Pro. Uh, it was us at NCC group and it was, uh,
2099680	2105840	the awesome people at Team Viettel. Uh, Team Viettel went first, we went second. Uh, we
2105840	2112620	discussed with ZDI what happened and we're like, what the fuck do we do? Oh wait, can we
2112620	2121360	please just install one random app from the app store? And they go, okay. And we did. We did
2121360	2127560	it. Technically that works because we showed ZDI that we had malware up on the app store.
2127780	2132940	ZDI already heard from other contestants around the area that Xiaomi was doing something
2132940	2138260	very funky with their app store and they're like, fine, good enough. So, Team Viettel
2138260	2146300	managed to install Discord and I, we installed no pics color by number and pixel. Yeah, it
2146300	2149800	was that app. I literally just found another random app on the app store and we installed
2149800	2160020	it. And we did it! We got a win! Yay! Except that's not the end of the story because the next
2160020	2168220	day, Xiaomi releases another update. First, they removed the file that we exploited and
2168620	2174260	now nothing installs from the app store. Period. The day before, those that got 20 percent
2174260	2180520	success rate on installing something, no. The next day, nothing gets installed. Period. And
2180520	2191360	on top of that, they added code to block Yandex and Opera. You can't make this shit up. So,
2191360	2195740	the rest of the week, it was just failure after failure after failure after failure.
2195740	2200780	Unfortunately, it's pretty obvious why nothing would install. They removed a bunch of other
2200780	2206940	stuff from the app. And, you know, the lesson of this story is that during Pwn2Own
2206940	2213360	specifically, Xiaomi is the most secure phone in the world. If there was one phone I would
2213360	2217900	have on me during Pwn2Own specifically, especially here at DEF CON where nothing bad
2217900	2224700	happens, it's a Xiaomi 13 Pro during Pwn2Own. There is one more side to this story that I
2224700	2229460	think everyone here should check out eventually. Uh, my friend Maxploit, who was also a
2229460	2234640	competitor last year at Pwn2Own, uh, he says, and I quote, props to the Xiaomi crew who
2234640	2239800	proved you can patch RCE bugs completely remotely in only a few hours and also break your
2239800	2244420	flagship device across the country as long as you're doing it to be a dick. Not because you
2244420	2250280	actually care about fixing things. If you guys want, he actually talked earlier this year at
2250280	2254440	OffensiveCon about his side of the story as well as his exploit. I do recommend you all
2254440	2260180	check it out. It's also a fun time. So, after Pwn2Own, what happened? The browser
2260180	2267700	blocking code got removed for some reason and applications can install just like normal.
2267700	2275120	Everything works. Everything is back to normal. Now, both us and team Vietel never got credit
2275120	2279120	from Xiaomi. Usually with a vendor they are like, hey we want to acknowledge so and so
2279120	2284700	working together with, with ZDI to do so and so. No, they said fuck you, we don't, we don't
2284700	2290260	want to acknowledge you. So, Zero Day Initiative had to be the one to give us CVE numbers.
2290460	2296260	And they said something in their posting that was possibly my favorite quote of this entire
2296260	2305620	time. Xiaomi informed ZDI they would assign a CVE but never followed through. Except they
2305620	2315280	did, specifically to team Vietel a few days later. But not us. Where's my fucking CVE
2315280	2323380	Xiaomi? And that's it. That's the end of our story. Yay! I hope they get the worst vendor
2323380	2331320	response at Pony Awards. Yay! Uh, we're also very introverted so we're gonna take questions
2331320	2336280	out there instead of up here. If you guys don't mind, alright? Alright, thank you for coming!
2336280	2337100	Yay!
