1 00:00:00,000 --> 00:00:04,540 Hello, I'm Hyejin and thank you for coming here. 2 00:00:04,540 --> 00:00:11,420 The topic I will talk about today is HackDMI, Pwning, HDMI for fun and profit. 3 00:00:13,320 --> 00:00:14,500 Yes. 4 00:00:14,700 --> 00:00:21,560 First of all, my name is Hyejin and I am a vulnerability assessment training mentee of B.O.B. 5 00:00:21,560 --> 00:00:27,440 which is the next generation cyber security leader training program in Korea. 6 00:00:28,020 --> 00:00:34,080 And his name, his name is Jung Eunjin and who is sitting down there. 7 00:00:35,840 --> 00:00:43,540 And he is working as a researcher at a company named Theory and he is mentor at B.O.B. 8 00:00:45,660 --> 00:00:53,340 We are both members of the team Shin Ki-ha-jin and actually I was a mentee and he was a mentor. 9 00:00:53,340 --> 00:01:01,380 We worked on the topic of vulnerability assessment for HDMI based embedded device at B.O.B. 10 00:01:01,800 --> 00:01:07,280 Our team is made up of two mentors, one PL and five mentees. 11 00:01:10,020 --> 00:01:13,560 The table of contents is as follows. 12 00:01:13,660 --> 00:01:21,800 First, I'd like to give you a quick introduction about previous talk and one day vulnerabilities about HDMI. 13 00:01:22,100 --> 00:01:29,740 And after that, I'm going to talk about the CEC and DDC protocols that we regard as attack vectors. 14 00:01:30,700 --> 00:01:38,340 Finally, I'd like to introduce you to each protocol folder that we've made and tell you about the result. 15 00:01:41,170 --> 00:01:44,390 This is the previous talk about HDMI. 16 00:01:44,590 --> 00:01:53,850 Hacking display made interesting at Bracket Europe and what the ATC at 44con and high def fuzzing at Defcon. 17 00:01:56,710 --> 00:02:07,190 This is the one day of the HDMI and it was the vulnerabilities of memory corruption type that occurred at CEC and DDC protocols. 18 00:02:10,560 --> 00:02:14,680 Now, let's talk about the HDMI protocols. 19 00:02:15,440 --> 00:02:26,440 Here, I will give you a brief description of the each protocol and the knowledge required to transmit the message or command that each protocol use. 20 00:02:26,900 --> 00:02:35,560 If you listen to this part, you will probably be able to send the message to your device that support HDMI. 21 00:02:39,150 --> 00:02:56,890 HDMI is provided for transmitting digital television audio-visual signals from DVD players, set-top box, and other audio-visual source to the television sets and projectors or other video displays. 22 00:02:57,890 --> 00:03:08,150 Maybe even without this explanation, you already used HDMI to connect your laptop to a TV or a beam projector. 23 00:03:08,190 --> 00:03:12,590 And also I connected my laptop with HDMI today. 24 00:03:14,070 --> 00:03:18,510 And HDMI has four separate channels. 25 00:03:18,510 --> 00:03:24,250 It is TMDS, DDC, CEC, and HEAC. 26 00:03:25,210 --> 00:03:36,090 At first, looking at the TMDS part of the figure, you can see the video and the audio data on both the input and the output part. 27 00:03:36,590 --> 00:03:40,590 TMDS is used to carry audio and video data. 28 00:03:41,870 --> 00:03:55,050 The DDC channel is used by an HDMI source to determine the capabilities or characteristics of the sink by the- by reading the EEDID data structure. 29 00:03:56,730 --> 00:04:07,150 HDMI source are expected to read the sink EEDID and to deliver the audio and video formats that are supported by the sink. 30 00:04:07,150 --> 00:04:17,550 In addition, HDMI sink are expected to detect info frames and to process the received audio and video data appropriately. 31 00:04:18,950 --> 00:04:21,870 The next one is CEC. 32 00:04:21,870 --> 00:04:34,750 CEC channel is optionally used for a higher level user functions such as automatic setup task or task associated with the infrared remote control users. 33 00:04:35,990 --> 00:04:49,990 The last one is the HEAC, which is the optionally used as a high-speed bidirectional data channel and stands for HDMI Ethernet and Audio Return Channel. 34 00:04:54,540 --> 00:05:01,800 The four protocols mentioned above are mapped from the actual HDMI pins as follows. 35 00:05:02,460 --> 00:05:07,580 TMDS is from 1 to 12, which is marked yellow. 36 00:05:07,800 --> 00:05:15,960 And pin 13 is the CEC and pin 14 is the utility line used by the HEAC. 37 00:05:17,240 --> 00:05:26,980 15 and 16 are SCL, SDA, and 17, 18, and 19 are internal ground, VCC, and HPD. 38 00:05:28,540 --> 00:05:38,560 Here we were interested in functions such as carry controls, status, and data information, rather than the video data transmission. 39 00:05:39,060 --> 00:05:43,400 In addition, the protocol supports the both directions. 40 00:05:43,900 --> 00:05:49,400 So today we are going to talk about the CEC and DDC protocols. 41 00:05:50,920 --> 00:05:53,720 The first one is CEC. 42 00:05:54,300 --> 00:05:58,160 CEC stands for Consumer Electronics Control. 43 00:05:58,580 --> 00:06:04,200 You can connect your laptop or smartphone to your TV using HDMI. 44 00:06:04,520 --> 00:06:13,140 Of course it's possible to connect multiple devices as shown in the picture if you have multiple HDMI cables. 45 00:06:13,340 --> 00:06:17,660 And you may want to control each devices. 46 00:06:17,720 --> 00:06:25,240 For example, you can adjust the volume of the home theater or changing the TV channel. 47 00:06:26,180 --> 00:06:35,080 The CEC protocol allows you to control each devices with a single remote control. 48 00:06:39,070 --> 00:06:49,270 CEC is a protocol that provides high level control functions between all of the various audio visual products in a user's environment. 49 00:06:49,690 --> 00:06:58,030 It provides a number of features designed to enhance the functionality of devices within an HDMI system. 50 00:06:58,610 --> 00:07:07,410 Because CEC provides functions in the user's environment, each manufacturer has a different brand name. 51 00:07:07,470 --> 00:07:15,030 So maybe any net plus or easy link, easy sync, rather than the CEC can be more familiar. 52 00:07:17,580 --> 00:07:22,180 And in HDMI, there are two types of the address. 53 00:07:22,180 --> 00:07:25,200 Physical address and logical address. 54 00:07:26,680 --> 00:07:32,600 And the address used by the CEC message is the logical address. 55 00:07:32,940 --> 00:07:43,660 However, CEC is a protocol based on a bus system, so therefore it cannot learn a certain physical connectivity of the network. 56 00:07:43,840 --> 00:07:52,620 So it uses the DDC protocol to locate physical addresses to device in the network. 57 00:07:53,880 --> 00:08:04,580 All CEC devices therefore have both physical and logical address, whereas non-CEC devices only has the physical address. 58 00:08:06,180 --> 00:08:09,440 The physical address is four digit long. 59 00:08:09,440 --> 00:08:13,040 It seems like the IPv4 address. 60 00:08:13,040 --> 00:08:16,640 And it has a five device deep hierarchy. 61 00:08:17,460 --> 00:08:27,480 For example, the root device TB has 0 0 0 0 and the connected device on TB have 1 0 0 0 and 2 0 0 0. 62 00:08:27,480 --> 00:08:36,500 In addition, the DVD and STB connected to the amplifier become 2 1 0 0 and 2 2 0 0. 63 00:08:37,180 --> 00:08:44,240 When a physical address is allocated like this, then it allocates a logical address. 64 00:08:47,900 --> 00:08:51,600 Logical address defines the device type. 65 00:08:51,880 --> 00:08:59,800 For example, TB is 0, a recording device is 1 2 or 9, depending on the device type. 66 00:09:01,700 --> 00:09:06,220 Logical address is allocated through the polling message. 67 00:09:06,620 --> 00:09:12,060 First, text the first address and send the polling message. 68 00:09:12,320 --> 00:09:19,520 If it is a recording device, it sends a polling message to the first of 1 2 and 9. 69 00:09:19,560 --> 00:09:21,580 Actually, it will be 1. 70 00:09:21,580 --> 00:09:26,440 And if polling is acknowledged, it takes the next address. 71 00:09:26,440 --> 00:09:32,660 And if not, it stops the procedure and retains that address. 72 00:09:32,940 --> 00:09:36,420 That is, it's logical address becomes 1. 73 00:09:39,760 --> 00:09:43,120 The CEC message frame has this structure. 74 00:09:43,300 --> 00:09:50,420 The first is the start bit, which is followed by the header block and the data blocks. 75 00:09:50,440 --> 00:09:55,440 And it is a special bit indicating the start. 76 00:09:56,520 --> 00:10:08,280 The header block and the data blocks are each composed of 10 bits, which is consists of 8 bits of information bits and 2 bits of the control bits. 77 00:10:08,880 --> 00:10:12,340 And the data block is optional block. 78 00:10:12,940 --> 00:10:18,480 Information bits and control bits are described in detail in the next slide. 79 00:10:21,630 --> 00:10:23,870 First is the header block. 80 00:10:24,470 --> 00:10:29,450 The information bits in the header block contain the logical address. 81 00:10:29,710 --> 00:10:35,470 The addresses of the initiator and destination are each 4 bits. 82 00:10:36,610 --> 00:10:42,950 And the control bit has the same format for both the header block and the data blocks. 83 00:10:43,170 --> 00:10:47,970 The control bit includes the EOM bit and the ACK bit. 84 00:10:49,490 --> 00:10:53,290 The EOM bit stands for end of message. 85 00:10:53,510 --> 00:10:58,630 If the current block is followed by one or more blocks, it becomes 0. 86 00:10:58,650 --> 00:11:03,650 And if the current block is the last one, it becomes 1. 87 00:11:04,670 --> 00:11:12,750 The ACK bit stands for acknowledge, which contains the value of the acknowledge of the data or header blocks. 88 00:11:14,550 --> 00:11:19,890 The data block also consists of information bits and control bits. 89 00:11:20,310 --> 00:11:25,150 The header block is essential but the data block is an optional block. 90 00:11:26,370 --> 00:11:37,730 The data block has data block 1 and data block 2, where data block 1 contains the OP code in the information bits and data block 2 contains the operand. 91 00:11:39,310 --> 00:11:43,810 The operand has a dependency on OP code. 92 00:11:44,750 --> 00:11:54,770 If the OP code is 32, which corresponds to the set menu language, the operand will contain the language what you want to set. 93 00:11:55,730 --> 00:12:03,010 Data block 1 is one block and data block 2 can be the multiple blocks depending on the OP code value. 94 00:12:03,970 --> 00:12:08,710 However, the maximum message size is 16 blocks. 95 00:12:09,030 --> 00:12:19,370 That is the message with the maximum length is one block of header and one block of the data block 1 and 14 blocks of the data block 2. 96 00:12:22,520 --> 00:12:25,660 The second protocol is TDC. 97 00:12:26,220 --> 00:12:29,380 TDC stands for display data channel. 98 00:12:29,540 --> 00:12:39,700 And it is used by the HDMI source to read the sync EEDID in order to discover the sync configuration and capabilities. 99 00:12:40,760 --> 00:12:52,260 More easily illustrated, when you connect the TV and the laptop with the HDMI, the sync TV sends the EEDID data to the source laptop. 100 00:12:55,100 --> 00:12:58,320 So what data does TDC send? 101 00:12:58,540 --> 00:13:04,040 It's called EEDID, extended display identification data. 102 00:13:04,420 --> 00:13:15,940 The EEDID is a metadata format for display devices to describe their capabilities to a video source such as graphics card or set up box. 103 00:13:16,660 --> 00:13:22,280 This format is defined by a standard published by the VESA. 104 00:13:23,720 --> 00:13:27,880 However, EEDID is for PC monitors. 105 00:13:28,600 --> 00:13:35,720 An EEDID is an extension of the EEDID used to illustrate more advanced features. 106 00:13:36,200 --> 00:13:49,960 For example, PC monitors generally does not support audio, so a traditional EEDID structure would not account for this, whereas an EEDID would. 107 00:13:50,160 --> 00:13:53,400 Therefore, it sends the EEDID data. 108 00:13:53,580 --> 00:14:00,400 The EEDID data consists of the EEDID 1.3 and CA extension. 109 00:14:02,940 --> 00:14:06,420 And they have the following structures. 110 00:14:06,480 --> 00:14:15,760 Because data sent by the fuzzer is also this EEDID data, so we need to know a little bit about the data structure. 111 00:14:16,500 --> 00:14:24,400 EEDID 1.3 includes information such as horizontal size, vertical size, and color characteristics. 112 00:14:24,400 --> 00:14:32,100 And there is also an extension flag, which means that extension data follows the EEDID structure. 113 00:14:34,940 --> 00:14:41,340 And if you- if you are not sure what the EEDID is yet, turn on your laptop. 114 00:14:41,560 --> 00:14:52,200 If your laptop is now connected to a TV or a monitor with HDMI, you can probably find EEDID data in your laptop. 115 00:14:52,780 --> 00:15:05,820 On Windows, it is stored in the registry, and on Ubuntu, it can be found in the path sys class DRM, and on Mac OS, you can check it through the IO registry. 116 00:15:09,960 --> 00:15:15,300 The HDMI transmits EEDID data over the I2C bus. 117 00:15:15,820 --> 00:15:19,920 As you know, I2C is a serial computer bus. 118 00:15:19,920 --> 00:15:31,060 And it is widely used for attaching lower speed peripheral ICs to processors and microcontrollers in short distance in troubled communication. 119 00:15:31,900 --> 00:15:39,960 I2C uses only two bidirectional open collector lines, SDA and SDL, put up with registers. 120 00:15:40,900 --> 00:15:48,900 Typical voltages used are 5 or 3.3, although systems with other voltages are permitted. 121 00:15:51,680 --> 00:15:56,340 We use Arduino to transmit the EEDID data directly. 122 00:15:57,080 --> 00:16:05,260 You can use other things, but you can easily use I2C slave mode with Arduino compared to the Raspberry Pi. 123 00:16:05,960 --> 00:16:11,080 You can connect the register and the wire to each pin as shown in the picture. 124 00:16:11,520 --> 00:16:20,700 The wires connected to the breadboard is in turn are SDL, SDA, ground, VCC, and HPD. 125 00:16:21,060 --> 00:16:25,960 And each line is connected to the pin that is mapped in the HDMI. 126 00:16:27,200 --> 00:16:31,860 With this connection, the hardware preparation is finished. 127 00:16:35,010 --> 00:16:43,750 So far, we have looked at a brief description of the CEC and the DDC protocols and its message. 128 00:16:44,050 --> 00:16:47,270 Now, I will use them to create a further. 129 00:16:50,450 --> 00:16:52,390 The first is CEC. 130 00:16:52,610 --> 00:16:57,350 Any device that supports CEC can be the target device. 131 00:16:57,750 --> 00:17:06,190 For example, smart TV, beam projector, set-top box, blu-ray, smart phone, and game controllers, and so on. 132 00:17:06,870 --> 00:17:12,950 In the case of a smart phone, it is highly likely to purchase an additional adapter. 133 00:17:13,330 --> 00:17:16,890 Make sure that the adapter also supports the CEC. 134 00:17:17,890 --> 00:17:28,630 And for CEC protocol, whether to support CEC rather than the type of the device is a more important factor to determining the target. 135 00:17:32,580 --> 00:17:39,580 For the CEC further, all you need is a USB CEC adapter and a HDMI cable. 136 00:17:39,960 --> 00:17:43,580 We will use the Pi serial for serial communication. 137 00:17:46,980 --> 00:17:52,260 Now, it's time to send the CEC message directly to the device. 138 00:17:52,520 --> 00:17:59,280 There is a USB CEC adapter communication library which is called LibCEC. 139 00:17:59,360 --> 00:18:01,500 It can be found in the GitHub. 140 00:18:01,880 --> 00:18:08,820 And if you have a USB CEC adapter created by Persec, you can send the CEC message. 141 00:18:09,180 --> 00:18:18,680 Of course, other adapters are also supported and if you are having trouble to buy a new adapter, you can use the Raspberry Pi. 142 00:18:21,370 --> 00:18:26,210 With LibCEC, you can send the CEC message as above. 143 00:18:26,490 --> 00:18:32,030 But this library is so well made that it can be drop our faulting data. 144 00:18:32,050 --> 00:18:35,730 So, we will not use this library when faulting. 145 00:18:36,350 --> 00:18:44,830 Since the adapter shown above is the USB CEC adapter, data can be transferred via the serial communication. 146 00:18:45,630 --> 00:18:48,210 Of course, you can use Pi serial. 147 00:18:49,310 --> 00:18:54,750 You can send a message with just three lines of the code as above. 148 00:18:55,290 --> 00:18:59,170 This is a command to power off the setup box. 149 00:19:02,140 --> 00:19:09,640 Let's first look at the code that sends messages to the CEC adapter without using the LibCEC library. 150 00:19:10,700 --> 00:19:13,980 Before that, you've probably seen this picture. 151 00:19:15,060 --> 00:19:22,680 When data is transferred using the adapter, one block is represented by four bytes. 152 00:19:23,060 --> 00:19:26,660 More precisely, the information bits in a block. 153 00:19:27,800 --> 00:19:31,880 This works for both the header block and the data blocks. 154 00:19:32,540 --> 00:19:40,540 The four bytes consists of messages typed, message code, message value, and message end. 155 00:19:40,960 --> 00:19:48,080 The actual data value contained in the information bits are stored in message value. 156 00:19:48,800 --> 00:19:55,380 Message start and message end are the bytes representing the beginning and end of a block . 157 00:19:55,420 --> 00:19:58,340 Respectively, FF and FE. 158 00:19:59,020 --> 00:20:04,060 Message code can be thought of as a control bit. 159 00:20:07,190 --> 00:20:15,770 Here, the message to be transmitted has a structure of message start, message code, message value, and message end. 160 00:20:15,930 --> 00:20:26,110 At this point, you can see that the message code is different, which can be found in the LibCEC code in CEC adapter message code. 161 00:20:27,410 --> 00:20:33,550 For basic message transmission, you need to know about four message codes in your code. 162 00:20:33,850 --> 00:20:40,190 In particular, OB and OC are message codes related to message transmit. 163 00:20:40,330 --> 00:20:44,970 And I said that the message code is similar to the control bit. 164 00:20:45,050 --> 00:20:51,230 For the E1 bit of the control bit, that is represented by OB and OC. 165 00:20:51,550 --> 00:20:54,610 And the AC bit is also similar. 166 00:20:57,790 --> 00:21:02,490 We create a fuzzer for the three parts of the CEC message frame. 167 00:21:02,490 --> 00:21:05,470 First is an OP code. 168 00:21:06,390 --> 00:21:11,950 3-6 was excluded because it is the OP code to power of the device. 169 00:21:11,950 --> 00:21:15,630 And the second is the operand. 170 00:21:15,630 --> 00:21:22,950 And we randomly selected a value from zero to FF to transmit the operand of 14 blocks. 171 00:21:23,050 --> 00:21:28,450 And the header block is fixed to the logical address of the target device. 172 00:21:29,950 --> 00:21:39,270 In the case of an OP code, to increase the probability of a crash, we use the list of OP code that are likely to cause vulnerabilities. 173 00:21:40,250 --> 00:21:43,130 And finally, the message length. 174 00:21:43,590 --> 00:21:50,650 In the case of the CEC protocol, the maximum message size is fixed to 16 blocks. 175 00:21:50,650 --> 00:21:54,010 That is 160 bits. 176 00:21:54,570 --> 00:22:03,970 In addition, each block is recognized as one block of header block and an OP code and operands in order. 177 00:22:04,670 --> 00:22:12,590 Therefore, data of various message sizes were transmitted including messages that exceeded the maximum size. 178 00:22:14,770 --> 00:22:17,590 Now it is the DDC protocol. 179 00:22:18,310 --> 00:22:22,350 The target device is an HDMI source device. 180 00:22:22,610 --> 00:22:25,370 Maybe you can probably guess the reason. 181 00:22:25,410 --> 00:22:33,230 Because the DDC protocol allows the sync device to send the EEDID data to the source device. 182 00:22:33,570 --> 00:22:39,270 Therefore, the source device, which is the device that received the data, was targeted. 183 00:22:39,990 --> 00:22:45,910 Source device includes desktops, laptops, set-top box, and smartphones. 184 00:22:48,750 --> 00:22:58,430 And we used the Arduino Mega 2560 and transmitted the data via the wire library provided by Arduino. 185 00:22:59,030 --> 00:23:05,690 Also, we cut and soldered the HDMI cable for more reliable data transmission. 186 00:23:07,890 --> 00:23:15,510 If you cut the HDMI cable, you can get 19 pins and a wire connected to each pin. 187 00:23:17,680 --> 00:23:39,500 And we connected the appropriate registers and wires to the required SCL, SDA, ground, VCC, and HPD locations and soldered them to make the same cable as the last picture and then connect each of the five jumper wires to the Arduino. 188 00:23:42,830 --> 00:23:52,930 Now, we can transfer the actual data through the wire library supported by Arduino for communication with I2C devices. 189 00:23:53,470 --> 00:24:01,950 The main functions for data transfer are begin on request, on receive, read, and write. 190 00:24:05,950 --> 00:24:09,430 Note that it uses a 32 byte buffer. 191 00:24:09,430 --> 00:24:13,190 Therefore, any communication should be within this limit. 192 00:24:13,570 --> 00:24:16,230 Exceeding bytes will be just dropped. 193 00:24:16,670 --> 00:24:21,990 But we will send the EDID value of 128 bytes. 194 00:24:21,990 --> 00:24:28,810 So, I modified buffer length in the header file to 128 as follows. 195 00:24:32,350 --> 00:24:37,590 As a result, EDID data can be transmitted as shown in the picture. 196 00:24:37,590 --> 00:24:48,110 On the left is a code written using Arduino IDE and on the right is the result of sending EDID data to the laptop via Arduino. 197 00:24:51,240 --> 00:24:54,280 And it will now send the EEDID data. 198 00:24:54,280 --> 00:24:58,460 It consists of EDID 1.3 and CA extension. 199 00:24:58,580 --> 00:25:01,580 It's the CA861D. 200 00:25:01,940 --> 00:25:13,740 At this time, if the value of the thread such as header, padding, and checksum, which are marked in red, are used well, the fuzzing effect can be enhanced. 201 00:25:16,880 --> 00:25:21,740 We created the data in the above three ways when mutating. 202 00:25:21,840 --> 00:25:33,700 First, it's a structure of EDID, and second, random among the structure that are likely to cause vulnerabilities, and finally, a random value for all data. 203 00:25:37,710 --> 00:25:40,710 And one more thing to note here. 204 00:25:40,710 --> 00:25:48,870 To fuzz through the HDMI cable, the process of connecting and disconnecting HDMI should be repeated. 205 00:25:49,270 --> 00:25:59,010 However, if you have to plug in and out every time you send data, it's very inefficient and it will not be called a fuzzer. 206 00:25:59,570 --> 00:26:02,910 This is confirmed by the HPD signal. 207 00:26:03,770 --> 00:26:11,630 When the 5 volts is applied to the sync TV, the sync sends the HPD high to the source. 208 00:26:11,650 --> 00:26:21,650 And then the source sends an EDID request to the sync, and as a result, the sync sends the EDID to the source. 209 00:26:24,080 --> 00:26:33,320 So, we repeatedly send low and high to HPD pin, giving the same effect as connecting and disconnecting HDMI. 210 00:26:37,430 --> 00:26:42,030 Now, let me tell you about the result we have obtained through our fuzzer. 211 00:26:44,630 --> 00:26:54,170 First, if you look at the CEC protocol, in the memcpy function, you can see a one byte stack overflow resulting in a memory leak. 212 00:26:55,850 --> 00:27:10,990 In closer look, the top part of the write function is the onTransact function in libHDMI CEC contains the header and data blocks we sent. 213 00:27:11,310 --> 00:27:17,170 And the read int32 and read C string functions are just that part. 214 00:27:18,370 --> 00:27:29,610 If you look at the onEventUpdate function in libHDMI CEC JNI, copy it to V8 using the way you received above. 215 00:27:29,810 --> 00:27:33,310 At this time, a one byte overflow occurs. 216 00:27:35,350 --> 00:27:43,290 And the following is the DDC, and you can see that the kernel panics and fails to reboot when you send the EDID data. 217 00:27:43,830 --> 00:27:49,330 Also, we can see that the value is modified to 61 that we sent. 218 00:27:52,670 --> 00:27:57,030 In fact, we want more influential data- influential results. 219 00:27:57,470 --> 00:28:04,770 But fuzzing with a real HDMI cable creates a problem of stability and speed. 220 00:28:05,230 --> 00:28:11,170 At the time, we thought that the graphics driver vulnerability is highly influential. 221 00:28:11,290 --> 00:28:16,750 So, we made a graphics driver fuzzer of HDMI on Ubuntu. 222 00:28:19,030 --> 00:28:31,810 So, I'd like to briefly introduce the Ubuntu DDC fuzzer that we- that The process of creating this fuzzer can be summarized in four main steps. 223 00:28:32,190 --> 00:28:39,050 First, with source code auditing, I found a part that has HDMI EDID data. 224 00:28:39,410 --> 00:28:51,650 We confirmed that the EDID data is stored in the second parameter of the DRM to prove DDC EDID function, which named buff, after calling this function. 225 00:28:53,920 --> 00:28:57,780 The second is hooking with KProofs. 226 00:28:57,780 --> 00:29:02,320 The KProofs is debugging mechanism for the Linux kernel. 227 00:29:02,520 --> 00:29:11,640 It enables you to dynamically hook into the kernel and allows you to do various actions through the callback function. 228 00:29:12,720 --> 00:29:15,980 The following source code is basic example. 229 00:29:16,600 --> 00:29:22,880 In ADDR field of KProof struct, you can set the address of function to break. 230 00:29:23,040 --> 00:29:31,040 And you can start with the symbol using the symbol name and offset field instead of the ADDR field. 231 00:29:32,000 --> 00:29:44,260 When the break point, what you set in the address field is hit, KProof called pre-handler and after that instruction is executed, it calls the post-handler. 232 00:29:45,560 --> 00:29:57,680 And it's handler's second parameter, which names Lex, it's pointing to the structure containing the registers saved when the break point was hit. 233 00:29:57,920 --> 00:30:01,640 So you can counter the register value with it. 234 00:30:05,100 --> 00:30:11,480 Actually, we want break when a function returns, so we use return proofs. 235 00:30:11,740 --> 00:30:17,020 It's the other type of proofs and also called KReproofs. 236 00:30:17,400 --> 00:30:23,140 And maybe K or Sims could be helpful for you to get all kernel symbols. 237 00:30:23,680 --> 00:30:27,620 Anyway, the code is similar to the KProofs. 238 00:30:28,040 --> 00:30:35,580 In the entry handler, we have saved the address of the buffer where the EDID data is stored. 239 00:30:35,980 --> 00:30:45,020 And before returning, that is after the EDID data is stored, we modified its value by accessing that address. 240 00:30:45,740 --> 00:30:55,300 In fact, we did not read or write the return value at RET handler, but instead changed the EDID value at the point of return. 241 00:30:56,280 --> 00:31:00,020 Now we can mutate the EDID data. 242 00:31:00,560 --> 00:31:05,000 But there is one more problem to be solved here. 243 00:31:05,080 --> 00:31:15,900 That is, calling this function interactively as if we had repeatedly sent HPD signal at the Arduino fuzzer part. 244 00:31:19,460 --> 00:31:23,840 I thought that using XRender would solve this problem easily. 245 00:31:23,840 --> 00:31:31,500 XRender is used to set the size, orientation, and reflection of the outputs for a screen. 246 00:31:31,840 --> 00:31:36,720 So we thought that EDID-related functions would be triggered. 247 00:31:36,960 --> 00:31:43,220 However, when I used XRender to create a fuzzer, I got too much noise. 248 00:31:43,240 --> 00:31:46,280 So we did it another way. 249 00:31:46,280 --> 00:31:48,540 And we checked the call stack. 250 00:31:50,480 --> 00:31:56,120 There are various tools to trace the call stack, and we used FTrace. 251 00:31:57,060 --> 00:32:07,360 FTrace is an internal tracer designed to help our developers and designers of systems to find what is going on inside the kernel. 252 00:32:08,260 --> 00:32:16,860 The files for using FTrace are in the past, syskernel debug tracing, and there are several types of the tracers. 253 00:32:17,400 --> 00:32:26,520 There are types that are defined in the file available tracers, and the traceable function list is in the file available filter functions. 254 00:32:27,300 --> 00:32:30,860 Trace results are stored in the file trace. 255 00:32:33,520 --> 00:32:42,380 First, we set the options to check the call stack of DRM do proof DDC EDID as shown in the multiple echo commands. 256 00:32:42,700 --> 00:32:46,220 And this will give you the result shown in the picture. 257 00:32:47,040 --> 00:32:56,180 The result shows that this function is called from the IOC tier, and I checked the source code for DRM IOC tier would get connected. 258 00:32:57,040 --> 00:33:00,580 Now, the final step is to call this one. 259 00:33:03,730 --> 00:33:13,690 And this is the lib DRM user space library for accessing the DRM on Linux that supports the IOC tier interface. 260 00:33:14,090 --> 00:33:19,190 And you can see the code for DRM would get connected in this library. 261 00:33:19,410 --> 00:33:22,970 So, we used it to call this function. 262 00:33:23,790 --> 00:33:28,430 As a result, we were able to complete the fuzzle. 263 00:33:31,100 --> 00:33:38,800 The presentation so far can be summarized in these pictures of two protocols and the each protocol fuzzles. 264 00:33:39,000 --> 00:33:41,480 And it is our future work. 265 00:33:41,860 --> 00:33:45,800 And source and images are as follows. 266 00:33:47,840 --> 00:33:50,560 Thank you for listening so far. 267 00:33:50,560 --> 00:33:54,880 And if you have any questions, please send me an email. 268 00:33:54,880 --> 00:33:56,240 Thank you so much.