[00:00.510 --> 00:03.070] I should probably not give my talk and just let it be that. [00:05.030 --> 00:06.350] All right, everybody ready? [00:07.330 --> 00:10.030] All right, before we start, a few points of order. [00:10.730 --> 00:25.770] For people watching the live stream or anyone in the audience who would prefer subtitles, the entire transcript, all the slides, and all the supporting materials for this talk are live now at nfc.toys, nfc.toys. [00:26.370 --> 00:32.050] We're covering a lot in this talk, and it clocks into just under 50 minutes, which means we won't have time for live Q&A. [00:32.490 --> 00:36.630] But Q&A is important, so I will be taking questions on paper and electronically. [00:37.090 --> 00:41.230] The in-person audience can write their questions on the flip side of their feedback form. [00:41.550 --> 00:51.710] Both the in-person and live stream audiences can submit questions via Twitter to at nfc.toys or via text message for the remainder of the day. [00:51.870 --> 01:01.350] I know you don't have great cell phone reception down here, but you can type them in and queue them up and send them later to 1-856-2-NFC-Q&A. [01:01.430 --> 01:03.870] 1-856-2-NFC-Q&A. [01:04.030 --> 01:06.750] There are slide numbers on each slide you can reference. [01:07.010 --> 01:12.290] I will post answers to questions on nfc.toys and reply to you with a link to your answer. [01:12.610 --> 01:19.350] If you're watching this talk in the future, asking questions via Twitter will be your best bet for a response. [01:20.290 --> 01:25.410] This is an introductory level talk, but there were also more advanced and related talks at HOPE this year. [01:25.590 --> 01:29.790] I linked to the information about these and others on nfc.toys. [01:30.830 --> 01:36.410] And finally, as the MC mentioned, for the in-person audience, I've provided speaker feedback forms and pens. [01:36.790 --> 01:40.030] One side is for Q&A, the other side is for talk or speaker feedback. [01:40.490 --> 01:44.650] Please fill these out and at the end pass them forward or leave them on the tables outside. [01:45.190 --> 01:49.530] It helps me know how this went independent of any feedback you may provide HOPE directly. [01:49.750 --> 01:53.370] If you need paper for your own notes, I've also provided blank index cards. [01:53.550 --> 01:57.070] So please use the feedback forms to ask questions and provide feedback. [01:57.270 --> 02:01.110] There's extra ones up here up front and also on the table in the middle of the aisle. [02:02.850 --> 02:08.130] All right, we're going to talk about NFC toys, which are toys which have NFC tags embedded in them. [02:08.330 --> 02:16.350] I want to give you an idea of why this is worth an hour of your time, but I need to start with a couple of examples for everyone who doesn't know what NFC is. [02:16.870 --> 02:18.870] So, a round of applause. [02:19.150 --> 02:23.790] Who has paid for something using an iPhone with Apple Pay or an Android phone with Google Pay? [02:26.690 --> 02:27.510] Cool, all right. [02:27.930 --> 02:35.310] NFC is how your phone talks to the payment terminal you hold it up to, and all of those wireless payment systems work the same way under the hood. [02:35.490 --> 02:38.990] Part of NFC is a standard method of wireless communication. [02:39.930 --> 02:40.890] Round of applause. [02:41.110 --> 02:44.530] Who waves a security badge against the reader to get into their building at work? [02:47.350 --> 02:48.050] All right. [02:48.370 --> 02:52.830] NFC is a subset of the RFID technology that your badge probably uses. [02:53.710 --> 02:57.930] Inside that badge, just like inside an NFC toy, is what's called a tag. [02:58.250 --> 03:02.350] NFC tags are a small amount of memory, logic, and an antenna. [03:02.610 --> 03:05.090] They're not really a full-on microprocessor. [03:05.090 --> 03:09.150] NFC tags are more like tiny, slow, wireless flash drives. [03:09.530 --> 03:12.650] Part of NFC is a standard set of tag types. [03:13.210 --> 03:28.930] When a tag, or your phone talking like a tag, is near enough to a reader, generally millimeters to centimeters, the reader's radio frequency transmissions provide enough wireless power to allow the tag to communicate back and forth, often just tens to a few hundred bytes. [03:30.050 --> 03:38.910] Now, NFC tags, which store tiny amounts of data, wireless NFC communication methods to transmit them, these are technical tools for engineers. [03:39.310 --> 03:43.210] But NFC toys are first and foremost toys. [03:43.770 --> 03:45.770] Toys are meant to be fun. [03:46.230 --> 03:48.270] Toys are meant to be played with. [03:48.650 --> 03:56.970] Everyone understands that toys are toys, so when a toy does something that a toy wouldn't normally do, that's visually interesting, that's stimulating. [03:57.350 --> 04:02.370] Swiping a toy of Samus Aran from Metroid on a subway turnstall, that perks you up. [04:02.510 --> 04:03.610] That's super interesting. [04:03.930 --> 04:06.410] What other kinds of data could you put on one? [04:06.790 --> 04:08.070] Well, anything. [04:08.310 --> 04:12.250] Because, remember, they're like tiny, slow, wireless flash drives. [04:12.650 --> 04:17.290] You could have a Maleficent toy, holding within it the original curse from the grim fairy tale. [04:17.870 --> 04:21.830] You could have a Tinkerbell toy with a link to the e-book of Peter and Wendy. [04:22.390 --> 04:25.770] You could have a piggy bank with your Bitcoin wallet's private key. [04:27.010 --> 04:30.530] You could have a Kylo Ren toy with a playlist of emo songs. [04:33.110 --> 04:36.250] You could have a toy car to unlock your real car. [04:37.330 --> 04:41.050] You could have a kickoff countdowns toy store your World Cup predictions. [04:42.090 --> 04:46.570] You could have a toy in a geocache with coordinates to another geocache. [04:48.050 --> 04:52.010] You could have a Pikachu toy with the credentials to your dev environment at work. [04:52.650 --> 04:56.650] You could have a larger Pikachu toy with the credentials to your QA environment at work. [04:57.710 --> 05:02.150] You could have a giant Pikachu toy with the credentials to your production environment at work. [05:03.770 --> 05:22.670] Even though they're technically no different than a bare NFC tag, storing the same amount of data in the same way, communicating the same way, The novelty and playful aspect of NFC toys supports us in thinking about unique and fun uses for NFC tags in a way that NFC tags by themselves don't. [05:23.790 --> 05:37.090] That said, while they are technically no different than a bare NFC tag, because NFC toys are often intended to support interactions with copyrighted digital content, they may be legally different if we want to use them for our own purposes. [05:37.090 --> 05:43.390] We should be able to play with our toys as we see fit, and it's up to us to assert our rights to do so. [05:44.570 --> 05:55.290] We're going to talk about three makes of NFC toys, with most of our time spent on Activision Skylanders, because that's where most of the literature is, but we'll also cover Disney Infinity and Nintendo Amiibo. [05:55.830 --> 06:01.870] There are other makes of NFC toys, and the techniques we'll use can apply to them, but these are what we'll be talking about today. [06:02.430 --> 06:11.350] As we talk about them, we're going to explain how they work, along with some background information about the toys-to-life genre of video games, and pertinent details about NFC tags in general. [06:11.710 --> 06:21.710] We'll explore each one with off-the-shelf hardware and software, referencing a long history of security research, and learn how that exploration can lead to determining read and write credentials. [06:22.390 --> 06:29.210] And then we'll see how to write our own data to those three different types of NFC toy, and talk about the legal implications of doing so. [06:29.970 --> 06:34.690] While I will be discussing legal matters, I am not a lawyer, and this is not legal advice. [06:35.850 --> 06:42.470] Finally, I will hand out NFC toys and worksheets for anyone in the audience who wants to try this out for themselves. [06:42.790 --> 06:43.610] And I hope you will. [06:44.850 --> 06:47.550] We're going to start with Activision Skylanders. [06:48.250 --> 06:54.630] Round of applause, who has kids who are into Skylanders and you had to buy them a bunch of stupid toys and video games for the last seven years? [06:54.630 --> 06:57.050] Yeah, parents in the audience, okay? [06:57.690 --> 07:04.850] Okay, round of applause, who was personally into Skylanders and bought yourself a bunch of awesome toys and video games over the last seven years? [07:06.490 --> 07:07.050] Fantastic. [07:07.950 --> 07:19.210] For everyone else who isn't familiar, Skylanders is a video game that launched in 2011 as a Spyro the Dragon reboot across every major platform, plus a Flash-based web game. [07:19.210 --> 07:23.870] It's a game in the Toys to Life genre, as in bring your toys to life. [07:24.290 --> 07:30.730] Each Skylanders game shipped with a few starter figures and a USB NFC reader styled as a portal. [07:31.490 --> 07:35.670] To play the game, you place a figure on the portal and that's the character you play as. [07:36.170 --> 07:42.450] When you name your character and you earn points and collect items, they're stored in the NFC tag on the toy. [07:42.450 --> 07:49.230] So when you take that same toy to your friend's house, it shows up with the name you gave it and all its points and experience and all its history. [07:50.150 --> 07:58.890] While you can beat the game with what comes in the starter kit to reach 100% completion and to collect every achievement, you need to buy additional types of characters and expansion toys. [07:59.410 --> 08:01.610] And Skylanders was a huge success. [08:01.610 --> 08:14.250] Sequels were shipped every year, variously offering extra-large figures, recombinable figures with twice the NFC tags, or vehicle figures, resulting in over 350 Skylanders toys of all types. [08:15.590 --> 08:20.550] Earlier, we said that some Android phones, ones that support Google Pay, can talk NFC. [08:20.830 --> 08:24.790] And so an Android phone will be the first of three standard tools I'll be discussing. [08:25.190 --> 08:30.770] When you're exploring NFC tags on your own, it's easiest to look for an Android phone with Google Pay support. [08:30.770 --> 08:36.610] Any Android phone with NFC support can read any NFC Type 1 through 4 tag. [08:37.050 --> 08:45.090] However, the proprietary NXP MyFair tags can only be read by phones with NFC chips produced by NXP. [08:45.330 --> 08:49.670] You should be able to find an older Android phone with NFC support for under $100. [08:50.790 --> 08:56.450] So what happens when we swipe an NFC toy against an appropriate Android phone? [08:56.450 --> 09:05.470] This is a Ninjini figure from Activision Skylanders, when swiped against an Android phone with NFC support, running the app NFC Tools. [09:05.850 --> 09:08.790] It gives us five pieces of information, as it should. [09:09.050 --> 09:13.810] Some of the expected uses for NFC are for things like business cards and advertisements. [09:14.070 --> 09:21.490] So some information can always be read from an NFC tag using standard tools, and this represents some of that standard public information. [09:21.490 --> 09:25.430] The first thing we see is that it's an NXP brand tag. [09:25.770 --> 09:33.690] NXP is a major manufacturer of NFC tags, and they've promoted the use of their NFC tags in games like Skylanders since at least 2011. [09:34.770 --> 09:43.390] We also see the serial number for the tag, called the UID, and the ATQA and SAK, which help identify the type of tag it is. [09:43.990 --> 09:49.950] Since it's an NXP tag, let's see if NXP's own app, NXP Tag Info, can tell us anything more. [09:51.250 --> 09:55.030] So I gotta say, these screens are kind of empty. [09:55.210 --> 10:00.190] They're not telling us much more than NFC Tools did, and that is actually a little unusual. [10:00.630 --> 10:05.430] Let me show you what some other NFC tags look like in the same NXP Tag Info app. [10:05.510 --> 10:07.670] Here's a payment card for my local arcade. [10:08.270 --> 10:16.310] While the first two screens are pretty bare, the third one shows us the memory size, which is how much storage the tag has and how it's set up. [10:16.470 --> 10:23.690] And the fourth one shows us the actual data on the card, and it formats it to match up with the description and the memory size. [10:24.090 --> 10:28.170] This is laid out just like the data is stored on the tag. [10:28.330 --> 10:33.990] In this case, 16 sectors with four rows of 16 bytes each. [10:33.990 --> 10:51.770] We can see this because along with the standard public information that every tag presents, for NFC tags which can be protected, there are also standard keys and passwords which are commonly used, often to allow for public readers while still restricting who can write to or update a tag. [10:52.450 --> 10:58.250] This tag uses a common standard factory default key, meaning anyone can see what's on it. [10:59.530 --> 11:04.770] Here's a pair of Bluetooth headphones, which embed an NFC tag for easy pairing with your phone. [11:05.230 --> 11:06.190] This one is great. [11:06.330 --> 11:14.870] The second screen explains a lot of the technical details of the content, like the manufacturer, the model of the headset, the kinds of Bluetooth protocols it supports, and more. [11:15.810 --> 11:26.970] The fourth screen again shows us all the raw content that it's getting all that information from, again, laid out how it's stored in the tag, in this case, four rows of four bytes each called pages. [11:27.750 --> 11:30.670] Unfortunately, the asterisks here mean it's read-only. [11:30.810 --> 11:36.110] There's no way to write to this NFC tag and, for example, change what it identifies as for pairing. [11:37.230 --> 11:51.070] Here's a business card printed by Moo, which embeds an NFC tag to support sharing contact information, sending the user to a URL or app store or social network profile, or even triggering custom behaviors using if this then that. [11:51.510 --> 11:57.390] This tag was set up to send a notification to my phone when someone taps it and then direct them to NFC.toys. [11:58.730 --> 12:01.010] This output is also really detailed. [12:01.190 --> 12:04.010] The second screen explains the technical details of the content. [12:04.010 --> 12:09.570] In this case, the Moo URL that provides all of the custom functionality through their online service. [12:10.230 --> 12:13.790] The third screen has detailed information about the NFC tag itself. [12:13.970 --> 12:18.870] And the fourth screen again shows us all the raw memory content that it's getting all of that information from. [12:19.950 --> 12:21.690] Again, this is in a pages structure. [12:21.950 --> 12:29.370] The entire business card appears writable, meaning we can put anything we want to on it, even replacing Moo's online service with our own. [12:30.750 --> 12:41.950] So those other NFC tags show me memory contents and the layout of the data on the tag, but the TNP3XXX in the Skylander figure doesn't show me anything. [12:42.450 --> 12:44.070] We know that it has memory. [12:44.230 --> 12:45.530] The third tab says so. [12:45.670 --> 12:46.590] So what's up? [12:47.230 --> 12:51.770] To figure it out, let's use that elite hacking technique called go poking around the Internet. [12:52.970 --> 13:02.990] Like if we search NXP's website for TNP3XXX, we find it in this PDF, describing ways to identify NXP MyFair tags. [13:03.210 --> 13:04.570] So it's a MyFair tag. [13:04.970 --> 13:07.970] Curiously, it doesn't have any other information. [13:08.330 --> 13:13.830] But table two in this PDF describes another MyFair tag with one K of memory, the MyFair classic. [13:14.870 --> 13:18.270] Wikipedia describes the MyFair classic's memory size as so. [13:18.270 --> 13:22.910] It matches the description of what the third screenshot from NXP tag info told us. [13:23.030 --> 13:32.490] So maybe the TNP3XXX is a MyFair classic compatible tag, even if tag info pretends to not know what it is. [13:33.690 --> 13:36.090] Wikipedia also says this. [13:36.830 --> 13:43.350] As a common type of NFC tag, MyFair classic is pretty well explored from a security standpoint. [13:43.350 --> 13:54.610] If TNP3XXX is a MyFair classic derivative, could it be vulnerable to the same exploits that MyFair classic tags are, allowing us access to the tag? [13:57.820 --> 14:02.280] So that's as far as we can get on a Skylanders toy with an Android phone. [14:02.520 --> 14:06.360] So it's time to upgrade to the second set of three standard tools I'll be discussing. [14:06.940 --> 14:09.980] Dedicated NFC reader hardware plugged into your computer. [14:10.780 --> 14:21.200] We want to look for hardware that's compatible with the LibNFC open source library, which supports a select range of NFC reader chips on Linux, Mac, and even Windows with some futzing. [14:21.420 --> 14:32.920] We want LibNFC compatible hardware because a lot of the dedicated NFC readers you'll find are Windows only, or only exposed low-level communication functions, requiring more complex technical programming. [14:32.920 --> 14:44.240] There are higher-level, easier-to-use libraries in various languages which use LibNFC under the hood, so it provides security researchers and hobbyists alike with a standard platform. [14:45.000 --> 14:48.900] You can find a LibNFC supported NFC reader for around $50. [14:49.620 --> 15:01.540] In addition to a supported NFC reader plugged into our Mac or Linux computer, you'll also need to already know or be comfortable figuring out how to compile software yourselves, but we won't need to write anything new. [15:02.580 --> 15:14.460] So Wikipedia describes something like nine different papers and presentations going back to 2007, which provide various attacks on and compromises to MyFair Classic tags. [15:15.020 --> 15:22.260] In addition, NXP released so-called hardened versions of MyFair tags, quote, in and around 2011. [15:23.060 --> 15:27.740] In exploring this Ninjini toy, we're really just taking the next steps in a long line of scholarship. [15:28.880 --> 15:32.440] Now this Ninjini toy is from 2012, the Giants line. [15:32.580 --> 15:49.820] I use it as an example because it's bigger and it lights up, but if it's a MyFair Classic tag in disguise, we're going to have to use a compromise that works against the hardened version of the tag, like the one from this paper published in 2015, which finally led NXP to tell people to stop using them. [15:49.820 --> 15:54.680] Now all you need is one known key, but what's a key? [15:55.280 --> 15:58.620] So remember that payment card from earlier and its memory layout? [15:59.060 --> 16:05.500] This is the same as how a MyFair Classic tag is laid out in 16 sectors numbered 0 through 15. [16:06.260 --> 16:09.420] Each of those rows in each sector is called a block. [16:09.920 --> 16:12.240] Each block can store 16 bytes. [16:12.720 --> 16:18.060] 16 bytes times 4 blocks times 16 sectors is 1k of storage. [16:18.860 --> 16:31.940] The last block in each sector stores two passwords, called key A and key B, with access bits in between them, which define which of the keys can read or write the blocks, as well as read or write the other key. [16:32.540 --> 16:43.100] In this sector from the payment card, the first password key A is hidden, unknown, Xed out, which probably means you need it to update the dollar figure on the card. [16:43.640 --> 16:53.560] The second password, key B, is the factory default key, and it's readable, which means we can see it, but probably also means we can only use it to see what data is on the tag, but not change it. [16:54.760 --> 17:05.320] 16 sectors, a key A and a key B each, mean there can be up to 32 passwords you need to uncover to get access to a completely locked down 1k MyFair Classic tag. [17:05.320 --> 17:13.980] But what this paper tells us is that we only need to know one, and due to vulnerabilities in the logic on the tag, it can figure out the rest from there. [17:14.680 --> 17:18.320] Knowing one in advance is not as difficult a task as it might seem like. [17:18.420 --> 17:20.800] Obviously, we already know one for this payment card. [17:20.800 --> 17:24.960] And maybe the TNP3 XXX has a similar situation. [17:25.140 --> 17:35.620] We could search documentation and source code for common MyFair keys and try each one of them against the key A and key B for every sector, and spoiler alert, it'll eventually work. [17:35.740 --> 17:36.880] You'll eventually find one. [17:37.100 --> 17:44.800] But this is 2018, and you have slightly newer information available to you than I did when I did that myself back in 2014. [17:44.800 --> 17:47.100] So let's head back to the Internet to find it. [17:47.920 --> 17:55.640] So we're looking for a known key for a Skylanders toy, and some not-so-creative searching, and that says an interesting paper. [17:56.480 --> 18:04.180] Comprehensive Security Analysis of A Toys to Life Game and Possible Countermeasures, A Master's Thesis by Kevin Volk. [18:04.820 --> 18:12.180] And when you find the author's homepage, you also find the fact that he worked with Toys for Bob, developers of Skylanders, for a year. [18:13.160 --> 18:20.320] Now, the thesis never says Skylanders by name, but knowing what we know now, it's easy to recognize that's what it's about. [18:20.480 --> 18:23.280] And it contains exactly what we're looking for. [18:24.180 --> 18:25.300] And this. [18:25.860 --> 18:30.620] It says that the first key, the key A, in every toy is the same. [18:30.880 --> 18:33.580] And what does the paper say the first key is? [18:35.260 --> 18:35.820] Yes. [18:37.680 --> 18:45.880] Okay, so thanks to two research papers, we have a known key, and we have an attack vector, and now we just need software to run it that works with LibNFC. [18:46.800 --> 18:52.740] Let's look for ciphertext-only, cryptanalysis, and hardened MyFair classic tags, LibNFC. [18:53.460 --> 18:59.640] And a little ways down on the page, we have an implementation of the paper's algorithms suitable for use with LibNFC. [18:59.640 --> 19:11.800] And if you compile and run their LibNFC, Crypto One Crack program with the Giants figure, you get a valid key for block four in sector one, and you can repeat that for a block in each of the remaining sectors. [19:12.340 --> 19:22.420] And just to make sure, let's try it with an even later modelutrapp team figure, and we get a valid key for block nine, sector two, And you can repeat that for a block in each of the remaining sectors. [19:23.020 --> 19:27.900] With this, you can get keys A for every Skylanders toy. [19:29.520 --> 19:42.640] You can then plug these into any LibNFC MyFair reading app, or into MyFair reading apps on your supported Android phone, assuming the apps recognize the Skylanders toy as MyFair classic tags, and see the full contents of the toy. [19:42.820 --> 19:43.720] That looks like this. [19:44.400 --> 19:48.300] Just like in the payment card, you can see the access bits on every fourth line. [19:48.300 --> 19:53.820] Sector 0 blocks 0 to 3 has the access bits 0F, 0F, 0F. [19:54.080 --> 20:01.960] Sector 1 blocks 4 to 7, and every sector after that have the access bits 7F, 0F, 08. [20:02.280 --> 20:08.060] If we look in NXP's MyFair classic documentation, we see that we have to turn it into binary, and we'll learn this. [20:08.620 --> 20:13.080] Sector 0, the first four blocks on the toy, is completely read-only. [20:13.620 --> 20:16.720] Every other sector is writable by its key A. [20:17.320 --> 20:20.960] We can't ever read each key A, so we always have to know them in advance. [20:21.580 --> 20:26.920] Key B is all zeros, which is a really common password, but it can't do anything. [20:27.140 --> 20:30.480] So all it's really good for is being used to exploit other keys. [20:31.200 --> 20:37.320] There's more in there, but that's enough for us to know that we can completely own any given Skylanders toy. [20:37.320 --> 20:43.500] With a method to obtain all the keys A, we have full read and write access to every available block. [20:43.680 --> 20:47.320] That's 15 sectors, 3 writable blocks of 16 bytes each. [20:47.680 --> 20:51.420] For a total of 720 bytes, we can write anything we want to. [20:53.460 --> 20:54.680] But there's one more thing. [20:55.080 --> 20:57.460] Going back to that quote we pulled from the Volk thesis. [20:57.900 --> 21:14.200] For the toys to work as they do, across multiple platforms, and offline, and with every key A on every toy being different, there has to be some formula or math that sets them, that the portal or the game knows about, that has to be based on some fixed, [21:14.380 --> 21:18.080] immutable information about the character, like the content in Sector 0. [21:18.900 --> 21:21.280] So, how do you figure out what that formula is? [21:21.480 --> 21:28.660] Well, if you're like me, or like the security researchers who also eventually figured it out, you buy and you crack a lot more toys. [21:29.400 --> 21:41.380] As RFID and security researchers discovered across 2014 and 2015, if you collect enough keys and do some math, you can see patterns in how each sector's keys relate to each other. [21:41.380 --> 21:44.260] And come up with more than one method to generate the keys. [21:45.300 --> 21:51.140] Volk's thesis even included the fact that the patterns in the keys could be discovered, documenting that there were patterns. [21:51.300 --> 21:55.080] But he didn't go so far as to document what the patterns meant. [21:56.460 --> 22:06.500] So today, I present the first public clean room description of an algorithm to generate the keys A for all Skylanders figures released to date. [22:06.500 --> 22:12.100] I'm publishing this to support new interoperability of Activision Skylanders NFC toys. [22:12.660 --> 22:27.960] By knowing an algorithm used to set the read and write passwords, keys A, we can interoperably read and write our own data to Skylanders NFC toys using our own NFC hardware and software without tedious manual cracking on a per-toy basis. [22:35.710 --> 22:48.490] On NFC toys, you'll find a video showing me writing custom data using a Mac, using an off-the-shelf USB NFC reader, and reading that custom data back out with a Raspberry Pi using an off-the-shelf NFC add-on. [22:48.730 --> 22:52.390] You'll also find a sample implementation of the algorithm in Python 2. [22:54.370 --> 22:55.930] So that's it for Skylanders. [22:56.070 --> 22:57.810] Let's talk about Disney Infinity next. [22:58.710 --> 22:59.650] Round of applause. [22:59.830 --> 23:01.350] Who has kids who are into Disney Infinity? [23:02.170 --> 23:02.690] No? [23:03.610 --> 23:04.570] Round of applause. [23:04.790 --> 23:09.650] Who was personally into Disney Infinity and was devastated as I was when they canceled the series? [23:10.430 --> 23:11.970] Oh, y'all missed out. [23:13.570 --> 23:19.590] So for everyone else, Disney Infinity was Disney's entry into the Toys to Life genre, launched in 2013. [23:19.590 --> 23:35.530] As in Skylanders, the toy you place on their base is the character you play as in the game, unlike Skylanders, which is mostly all original IP, Disney Infinity let you play with characters from many different Disney properties, all together in an open-world sandbox called the Toy Box. [23:36.170 --> 23:48.570] There were also separate story-based environments for specific environments and characters, such as a Pirates of the Caribbean playset, various Pixar playsets, various Marvel playsets, and various Star Wars playsets. [23:48.570 --> 23:56.430] Sequels were released in 2014 and 2015, resulting in over 300 NFC toys between figures and accessories. [23:57.470 --> 24:02.910] This is a Kanan Jarrus figure from Disney Infinity, as seen in NXP tag info. [24:03.410 --> 24:08.150] Here again, we can see that it's an NXP tag, also specifically a My Fair Classic tag. [24:08.810 --> 24:11.870] We can see that there's 320 bytes total on this tag. [24:11.870 --> 24:17.490] We can see its ID and its ATQA and its SAK, and we can also see memory content. [24:18.130 --> 24:24.090] It's all crossed out and reports unknown key, and it's like that for all the way down for all 320 bytes. [24:24.470 --> 24:28.990] But at least we can see the structure of the storage on the tag, which we couldn't for the Skylander. [24:28.990 --> 24:32.350] Now, we're less fortunate working with Disney Infinity figures. [24:32.550 --> 24:37.450] None of the 10 keys are standard keys, so any exploit that relies on knowing a key won't work. [24:37.630 --> 24:43.530] In addition, Disney Infinity came out in 2013, well after NXP hardened the My Fair Classic. [24:44.370 --> 24:49.230] To get into these figures, we're going to have to upgrade to the third of the three standard tools I'll be discussing. [24:49.830 --> 24:51.550] Specialized RFID testing equipment. [24:52.090 --> 24:55.470] Now, phones and LibNFC compatible hardware can get you far. [24:55.630 --> 25:05.050] But to figure out NFC tags that are password protected and not exploitable, you'll need to be able to listen in on the wireless communication between the tag and the reader. [25:05.270 --> 25:07.490] And that means using more serious hardware. [25:08.270 --> 25:16.410] The Proxmark was an open source design for RFID test equipment, providing high-end functionality at a much lower price point than commercial test equipment. [25:16.970 --> 25:22.030] Because NFC is a subset of RFID, it also works for NFC toys. [25:22.490 --> 25:29.390] But as specialized RFID test equipment, it also requires a more thorough understanding of RFID in general. [25:30.370 --> 25:34.410] Depending on where you get it from, a new Proxmark 3 will run you $200 to $400. [25:35.310 --> 25:40.230] Their community is very active, and it's possible someone has already figured out the tag you're looking at. [25:40.230 --> 25:47.350] Although, you'll need technical expertise to translate something that works on the Proxmark to something that works for a general-purpose NFC reader. [25:48.370 --> 25:59.570] Now, a Proxmark 3 will let us place our own antenna right up against the antenna in the NFC reader and the antenna in the NFC toy, and listen in on the communication between the figure and the base. [25:59.950 --> 26:09.050] Remember, all of these data transfers are happening wirelessly, over the air, even though the toy and their base are only a few millimeters of plastic apart. [26:09.350 --> 26:11.870] If we listen in, we can get the keys. [26:13.070 --> 26:18.550] Unfortunately, that also means we're going to need the video game and a console to play it on, since we need the conversation to happen. [26:18.770 --> 26:26.410] It was possible to get into a Skylanders figure with just a toy, a thesis, and a research paper, but not so for figuring out Disney Infinity. [26:26.590 --> 26:29.130] And we'll talk about how that affects our risk later. [26:29.930 --> 26:37.950] Now, when you have a Proxmark listen in on the toy-based communication, you'll learn that Disney Infinity toys use one key for the entire toy. [26:38.530 --> 26:41.830] Both key A and B for all five sectors is the same. [26:42.490 --> 26:45.230] Neither one can be read, so you need to know it in advance. [26:45.530 --> 26:51.810] Sectors 0 is read-only, and sectors 1 through 4 are readable and writable by both key A and key B. [26:52.650 --> 26:59.530] Four sectors, three blocks each, means every toy has 192 bytes of storage we can use for our own purposes. [27:01.150 --> 27:05.510] The other nice thing about having a Proxmark is that it can simulate a MyFair tag. [27:05.790 --> 27:10.970] I don't need to buy a bunch of Disney Infinity toys to get a bunch of keys to see if there are patterns. [27:11.210 --> 27:18.530] I can have the Proxmark pretend to be a tag with a randomly generated ID, and then have it listen in on what key the base would use for it. [27:18.930 --> 27:24.950] And when you do this for dozens of keys and regular patterns, you find there's no pattern at all. [27:26.230 --> 27:34.950] When there aren't any patterns, the only solution left is to reverse engineer the algorithm by figuring out where it lives, and then extracting it from the software or firmware. [27:35.230 --> 27:38.890] And as a liberal arts major, I don't really have the engineering experience for that. [27:39.930 --> 27:43.270] What I could do, though, is what I was just doing, but at web scale. [27:43.270 --> 27:59.370] So for about 16 months, I ran a web service that accepted a Disney Infinity toy UID, passed it along to a Proxmark for simulation, listened in for the key, and then posted it publicly along with all the other UIDs that had ever been requested, a kind of public UID key database. [28:01.250 --> 28:13.430] But finally, another security researcher did have the engineering experience, and so today I can present the first public cleanroom description of an algorithm to generate the keys A and B for all Disney Infinity figures released. [28:18.740 --> 28:23.440] This algorithm supports new interoperability of Disney Infinity NFC toys. [28:23.780 --> 28:38.240] By knowing the algorithm used to set the read and write passwords, the keys A and B, we can interoperably read and write our own data to an Infinity NFC toy using our own NFC hardware and software without tedious manual simulation and sniffing on a per-toy basis. [28:38.940 --> 28:48.580] On NFC.toys, you'll find a video showing me writing custom data using a Mac and reading that custom data back out with an Android phone using a standard app from the Google Play Store. [28:48.900 --> 28:52.400] You'll also find a sample implementation of that algorithm in Python 2. [28:53.920 --> 29:08.700] Now, there haven't been any new Skylanders figures in a year, and Disney Infinity was canceled in 2016, but Amiibo, which is Nintendo's line of collectible figures, playing cards, and cereal, is still going strong. [29:10.120 --> 29:11.140] Same thing as before. [29:11.320 --> 29:11.880] Round of applause. [29:12.100 --> 29:14.320] Who has kids who regularly demand new Amiibo figures? [29:17.360 --> 29:26.260] So, who has been forced to pirate Amiibo figures, either buying pre-cloned tags or clone tags, because the Amiibos you want always sell out before you can get one? [29:27.520 --> 29:28.560] Nobody's going to admit to that? [29:28.700 --> 29:28.860] Okay. [29:30.000 --> 29:46.020] For everyone else, Nintendo launched Amiibo in 2014, and in classic Nintendo fashion, treats them as much as rare collectibles for obsessive adults as video game accessories for kids, resulting in lines in front of stores on release days, and toys selling out and never being reissued. [29:46.980 --> 29:56.960] Because NFC support is built into Nintendo's Wii U, New 3DS, and Switch consoles, no game-specific reader is necessary for any game to provide Amiibo support. [29:57.200 --> 29:59.680] You just swipe the toy right on the controller. [30:00.080 --> 30:03.460] What each Amiibo toy does is different in each game. [30:03.700 --> 30:09.240] Some support only specific figures, some store gameplay data on the figure, some will recognize any figure. [30:09.860 --> 30:12.260] Nintendo lists over 60 games in the U.S. with Amiibo support and over 160 toys, and there are also additional Japan-exclusive figures and games. [30:19.200 --> 30:24.600] This is a Duck Hunt figure from Nintendo Amiibo, as seen in NXP Tag Info. [30:25.160 --> 30:39.120] NXP Tag Info says Duck Hunt is also an NXP, this one a Type 2 tag called N-Tag 215, with 504 bytes, made up of 126 pages with 4 bytes per page, similar to that pair of Bluetooth headphones we saw. [30:39.680 --> 30:40.980] Here's the memory content. [30:41.860 --> 30:48.600] Unlike the Disney Infinity figure, nearly all of the Amiibo is readable, but some of it is marked as locked and blocked or blocked. [30:49.060 --> 30:53.540] If we were figuring out Amiibo ourselves, we'd have to work it like we did Disney Infinity. [30:53.720 --> 30:55.140] But we're luckier here in two ways. [30:55.840 --> 31:08.920] First, by the time I got around to trying Amiibo toys, researcher Marcos Del Sol Vives had already figured out how to derive their password from the toy's UID, and services for it and code have been published across the Internet since. [31:09.840 --> 31:16.500] Second, many of us could probably have independently replicated his work, just like fellow HOPE 2018 speaker James Chambers did. [31:17.060 --> 31:23.140] While the Skyliner's math was pretty gnarly, the Amiibo math as presented is a bitwise exclusive OR operation. [31:23.680 --> 31:33.240] It's simple enough that you can do it by hand, with pen and paper, enabling us to write 428 bytes of our own data onto any Amiibo NFC toy. [31:33.900 --> 31:49.600] So today, along with presenting that public clean room description of an algorithm to generate the PWD for current Amiibo figures, I'm also handing out a worksheet with an Amiibo card and its UID, so you can generate a PWD by hand, yourself, right now, [31:49.760 --> 31:50.840] in your seat if you'd like. [31:51.320 --> 31:57.100] These support new interoperability of Nintendo Amiibo NFC toys. [31:58.120 --> 32:10.600] By knowing an algorithm used to set the right password, we can interoperably write our own data to an Amiibo NFC toy using our own NFC hardware and software without needing to compute the PWD by hand on a per-toy basis. [32:11.760 --> 32:23.400] On NFC.toys, you'll find a video showing me writing custom data using a Raspberry Pi, and reading that data out using a Windows 10 laptop using the open-source Google Chrome NFC library. [32:23.400 --> 32:27.600] And again, you'll also find a sample implementation of this algorithm in Python 2. [32:29.260 --> 32:34.280] Before I hand out those worksheets, though, it's important to consider those legal subtleties I mentioned. [32:34.560 --> 32:37.400] Can we get in some sort of trouble if we do this? [32:37.980 --> 32:39.760] So, a few points of order again. [32:40.180 --> 32:45.820] First, I'm about to talk about legal stuff, but I am not an attorney, and this is not legal advice. [32:46.240 --> 33:02.500] If you intend to publicly discuss or publish your own NFC toy efforts, especially if you explore areas beyond what this talk covers, like the data encryption or the USB reader hardware, and you're a US citizen or you ever intend to visit the US afterwards, [33:03.040 --> 33:04.520] you should talk with an attorney first. [33:05.100 --> 33:11.720] Your local bar association can usually refer you to an appropriate attorney, often with a free or reduced-cost initial conversation. [33:13.080 --> 33:20.100] Second, this is America, where you can be sued by anyone at any time for any reason, and then you're stuck having to defend yourself. [33:20.380 --> 33:22.460] This is lawsuit as threat model. [33:22.580 --> 33:26.560] If you can't afford to defend yourself, you should be taking that into consideration. [33:27.560 --> 33:34.160] And third, while the next several minutes may be an interesting discussion, at the end of the day, our opinion doesn't matter. [33:34.640 --> 33:43.780] Everything we're going to cover is a gray area of the law, and I will be positioning it as such, because it's things that can only be decided by a judge in a court. [33:44.900 --> 33:59.940] All right, so why are we suddenly talking about legal trouble when I've just discussed a long history of security research and academic scholarship, some even acknowledged by the companies affected, which actively and directly discuss security compromises in these NFC tags, [34:00.140 --> 34:01.880] and I'm just taking the next steps. [34:02.440 --> 34:09.600] The reason is that legally, some NFC toys may not count as regular NFC tags. [34:09.600 --> 34:14.160] Let's define NFC toys in a way that might help clarify this. [34:15.080 --> 34:22.740] NFC toys are physical toys which embed NFC tags to support some sort of interaction. [34:23.280 --> 34:27.100] The interaction is typically digital and is important. [34:27.620 --> 34:33.780] Now, there are probably toys that embed NFC tags for tracking or anti-counterfeiting purposes, and we just don't know about them. [34:33.980 --> 34:44.020] Toys that use NFC to support interactions, typically digital ones, means the toy may contain, affect, or involve digital content, which may be covered by copyright. [34:45.220 --> 34:50.380] In 1998, the United States passed the Digital Millennium Copyright Act, or the DMCA. [34:50.580 --> 34:56.720] Most of you probably know it for Section 512, which establishes the safe harbor provisions for online hosts. [34:56.900 --> 35:05.780] This is when a copyright owner notifies your upstream provider, like your ISP or web host, that you've put their copyrighted content online and they need to take it down. [35:05.780 --> 35:07.720] That's not the part we're concerned with. [35:08.200 --> 35:10.060] There's a different part of the DMCA. [35:10.180 --> 35:13.460] Section 1201, known as the anti-circumvention provisions. [35:13.720 --> 35:24.340] 1201 establishes that circumventing or working around any type of copy protection mechanism is a crime, as is distributing tools to support others' circumventions. [35:24.960 --> 35:32.760] You can be sued by the copyright owner whose digital locks you picked, a civil action, and also be charged by the federal government, a criminal action. [35:32.760 --> 35:35.940] If it's a criminal action, this is the damage. [35:37.540 --> 35:43.000] Now, it doesn't matter whether you can or do use an NFC toy with the video game it was intended for. [35:43.260 --> 35:49.320] That it may be intended to protect copyrighted content is what makes any possible circumvention illegal. [35:49.320 --> 36:01.440] So, maybe let's take this seriously and see how the DMCA concerns us based on excerpts from the 2013 Department of Justice Prosecuting Intellectual Property Crimes Manual, 4th edition. [36:02.640 --> 36:16.380] To prove a violation, the government must establish that the defendant willfully circumvented a technological measure that effectively controls access to a copyrighted work for commercial advantage or private financial gain. [36:16.900 --> 36:18.200] Let's take those one at a time. [36:19.260 --> 36:19.700] Willfully. [36:20.140 --> 36:22.040] Willfully has a specific legal meaning. [36:22.400 --> 36:28.800] But let's just go with the idea that since you're all in this room, you can't argue that you didn't know it might not be okay for you to do this. [36:30.360 --> 36:34.260] Someone who just comes across those clean room algorithms might have a stronger case. [36:35.900 --> 36:36.420] Circumvented. [36:36.860 --> 36:46.520] Even if buying the toy legally doesn't grant us the right to crack its keys and put our own data on it, once we have the keys, we're not bypassing anything. [36:46.640 --> 36:48.660] We're using the keys as intended. [36:49.040 --> 36:53.820] Now, we might be eligible for other charges under other laws, but that's not a DMCA violation. [36:54.880 --> 36:58.220] A technological measure that effectively controls access. [36:58.220 --> 37:02.880] Now, obviously, an NFC's tags, keys, or passwords are technological measures. [37:03.200 --> 37:08.440] But effectively is a great example of legalese not being plain English despite sounding like it. [37:08.620 --> 37:15.080] Effectively doesn't mean what it does to us in this room, where you're probably interpreting it as something like, does a good job at. [37:15.480 --> 37:20.400] In court, effectively basically means, does it exist to do this? [37:21.420 --> 37:22.920] To a copyrighted work. [37:22.920 --> 37:31.060] If we're just talking about the toy right now and the existing data on the toy, then if that data is just facts and figures, it wouldn't be copyrighted. [37:31.240 --> 37:35.040] And therefore, breaking into the NFC toy wouldn't be an infringement. [37:36.060 --> 37:46.180] Finally, for commercial advantage or private financial gain, if you are just using these toys yourself, for yourself, and there's no commercial advantage, then there's no commercial advantage or private financial gain. [37:46.180 --> 37:58.240] If you're selling keys, maybe that's an issue, but I'm not being paid to give this talk, and the content on NFC.toys is deeded to the public domain, so I hope that's evidence of my lack of profit motive. [37:59.080 --> 38:00.340] So here's where we stand. [38:00.580 --> 38:16.520] If we're only talking about the toy right now, and only about the existing data on the toy, because we need to tick all of the boxes, if the data on the toy is not a copyrighted work, then maybe we're not violating the DMCA, either civilly or criminally. [38:17.100 --> 38:19.380] Now, it doesn't mean we can't be sued for this anyway. [38:19.460 --> 38:23.960] It just means that if we can afford to defend ourselves, we might have a defensible case. [38:25.180 --> 38:32.160] But if part of our legal standing depends on the data on the toy not being copyrightable, how can we figure that out? [38:32.560 --> 38:35.040] Let's start by looking at what copyright protects. [38:35.040 --> 38:43.840] Now, if the data on the toy includes things like the actual character art and sound effects which get used in the game, those would be original creative expressions. [38:44.180 --> 38:51.900] If the data is just, this is a ninjini toy with this health and this experience level, those are discrete facts and figures. [38:52.420 --> 38:54.080] They're not creative expressions. [38:54.260 --> 38:56.740] Facts and figures alone are not copyrightable. [38:57.500 --> 39:02.900] So how can we tell if the data is uncopyrightable facts and figures or copyrightable content? [39:02.900 --> 39:04.280] Well, there's a few ways. [39:04.460 --> 39:10.320] Some researchers might reverse engineer the video game or its support code to understand what data gets read or written. [39:10.820 --> 39:16.180] Others might reverse engineer the encryption on the data, reading it from the tag frequently to see what changes get made. [39:16.300 --> 39:20.120] But this is a talk focusing on just the NFC tag and the NFC toy. [39:20.120 --> 39:30.080] And it turns out that there's a lot we can learn without doing any additional work at all, just by very carefully playing the game and paying close attention to the tag. [39:30.480 --> 39:40.060] Now, I go into more detail on this on NFC.toys, but the short version is we can absolutely collect evidence that there isn't anything original or copyrightable on a figure. [39:40.060 --> 39:47.460] Being careful about changing things in a game means we can figure out which blocks are likely to store many of our characters' variables. [39:48.400 --> 39:52.760] These are blocks that Skylanders Giants writes to that Ningenie toy during gameplay. [39:53.260 --> 39:58.480] By watching the clock, we can see that these two blocks probably store some kind of playtime counter. [39:59.060 --> 40:04.380] By testing different nicknames, we can see that these two blocks store the nickname and that they change depending on its length. [40:04.380 --> 40:10.920] By gaining gold and experience, we can see that the same blocks that store the playtime counter probably also store gold. [40:11.140 --> 40:13.480] And that these new blocks seem to store experience. [40:14.320 --> 40:23.600] The NFC tags in these NFC toys are merely storage devices for numeric text and data that track your character's progress and can't be covered by copyright. [40:24.280 --> 40:27.700] Now, there's one other concern which we touched on briefly before. [40:27.700 --> 40:35.480] Even if we're not circumventing an access control to read and write toy data, the toys are still used to access content within a game. [40:35.640 --> 40:38.360] And the game content is almost certainly under copyright. [40:38.820 --> 40:39.940] Here's that list again. [40:40.080 --> 40:47.000] If we're changing number four to mean the game content instead of the data on the toy, how does that change number three? [40:47.760 --> 40:54.400] Are the NFC tags and tag keys and passwords effective access controls that protect the game content? [40:54.400 --> 41:00.360] And I think the additional argument here hinges on that particular legal definition of the term effectively. [41:00.700 --> 41:06.780] That is, the point of the NFC tags and keys isn't to protect the game content. [41:06.920 --> 41:09.240] They're there to only protect the data on the tag. [41:09.780 --> 41:19.700] Every NFC toy that controls access to content in a video game requires at least its initial presence on an NFC reader to access that content. [41:19.700 --> 41:28.180] Suggesting the access control for the game content is the NFC toy plus the reader plus the code in the game altogether. [41:29.240 --> 41:33.340] Every NFC toy we've looked at uses keys and passwords in different ways. [41:33.680 --> 41:39.240] But they are all able to perform that same function in that same combination despite those differences. [41:39.240 --> 41:47.340] The Valk thesis even asserts that using a static key for Sector Zero shows a misunderstanding of the NFC technology. [41:47.940 --> 41:49.700] Amiibos don't have read protection. [41:49.840 --> 41:55.080] Another toy we didn't even get to discuss, the Pokemon Rumble U-figures, don't have write protection. [41:55.220 --> 41:57.720] You can do whatever you want with them right out of the Pokeball. [41:59.420 --> 42:05.980] This suggests that the NFC tag keys and passwords aren't effective access controls for the game content. [42:05.980 --> 42:13.340] They don't exist to have any effect on access to the game content if they can be misunderstood or not used at all. [42:13.580 --> 42:20.940] They are simply there by virtue of an arbitrary technical decision to make it easier or harder to work with the toys as data storage devices. [42:21.120 --> 42:23.740] So, maybe number three is also a maybe not. [42:25.600 --> 42:30.300] So, we've talked about NFC toys, which are toys, which have NFC tags embedded on them. [42:30.300 --> 42:36.540] We talked a little bit about them and about the toys to life genre of video games and about NFC tags in general. [42:37.100 --> 42:50.560] We talked about various off-the-shelf hardware and software you can use to explore these NFC toys and how that exploration can lead to determining read and write credentials and how to write your own data to three different types of NFC toy. [42:51.840 --> 42:54.800] Finally, we talked about the legal implications of doing so. [42:54.980 --> 43:12.360] And I have hopefully established that using NFC toys for your own data storage is probably not circumventing an effective access control, probably not a copyright infringement, and that this work is legally enabling new interoperability of NFC toys with your own hardware. [43:13.400 --> 43:17.540] While I discuss legal matters, I am not a lawyer and this was not legal advice. [43:18.620 --> 43:26.400] So, who believes, round of applause, that obtaining credentials for an NFC toy is legal and wants to assert their rights to do so? [43:32.320 --> 43:34.700] So, these are amiibo cards. [43:35.500 --> 43:39.820] Each card has amiibo NFC tag inside just like the full-size toys do. [43:40.600 --> 43:43.540] I will be handing them out out front after this talk. [43:43.700 --> 43:50.100] Clipped to each amiibo card will be a worksheet which explains how to compute the PWD for the amiibo card longhand. [43:50.100 --> 43:51.880] I hope you'll enjoy working through it. [43:52.120 --> 43:56.540] I also have Skylanders and other NFC toys available for you and I hope you'll please take one. [43:57.720 --> 43:58.680] That's it for my talk. [43:58.880 --> 44:03.380] Again, we won't have time to do Q&A, but I will reply to NFC.toys to any questions submitted. [44:03.660 --> 44:07.200] Please fill out your feedback forms and either pass them up or leave them on the tables out front. [44:07.840 --> 44:08.640] Thanks so much. [44:08.640 --> 44:08.660] Now we'll take notes. [44:08.660 --> 44:08.920] So thank you very much for 28 Skinashes. [44:09.000 --> 44:09.280] Thank you very much for training. [44:09.280 --> 44:09.320] More patience. [44:09.320 --> 44:09.420] I hope you'll get started as well. [44:09.420 --> 44:09.440] So really nice. [44:09.440 --> 44:09.480] That's a interesting question.