1 00:00:01,600 --> 00:00:07,200 Hello, everyone, and welcome to my talk, Breathless, A Tall Tale of a CPAP Machine. 2 00:00:07,200 --> 00:00:14,220 For those that don't know me, I am Vee, but a little bit more about myself. 3 00:00:14,220 --> 00:00:19,320 I'm an assistant professor in Norway, specifically in digital forensics and incident response. 4 00:00:19,320 --> 00:00:23,880 I'm a very proud cyborg with a long-standing implant since 19. 5 00:00:24,200 --> 00:00:29,080 I did digital forensics and incident response for a long time, still doing it. 6 00:00:29,080 --> 00:00:30,760 I do cyber threat intelligence. 7 00:00:30,760 --> 00:00:36,720 I also like to do some OSINT and find information specifically about medical devices that I'm looking at. 8 00:00:36,720 --> 00:00:39,160 There is a wealth of information out there. 9 00:00:39,160 --> 00:00:49,240 I'm also very passionate about patient rights, specifically being a patient myself, advocating for those that don't have a voice or feel they don't have a voice. 10 00:00:49,640 --> 00:00:54,280 That's currently what I'm doing a lot of in Norway is physician education. 11 00:00:54,280 --> 00:01:07,700 Now, I'm also a proud mom of two little girls, albeit not that little girl, no, that little anymore, but they are absolutely kick-ass, and they will soon be presenting one day similar work that mom does. 12 00:01:08,400 --> 00:01:11,640 Now, what exactly are we going to be talking about today? 13 00:01:11,640 --> 00:01:21,340 Well, the foundation of how I look at medical devices is looking at it by using my scientific process, which is medical device forensics. 14 00:01:21,900 --> 00:01:25,520 This is made up and visualized in a triangle. 15 00:01:25,520 --> 00:01:30,060 A triangle is one of the strongest engineering shapes there is. 16 00:01:30,360 --> 00:01:34,400 I realized that looking at a medical device, I couldn't just look with one lens. 17 00:01:34,400 --> 00:01:39,440 I had to look through multiple lenses to get a holistic picture of what was happening on the device. 18 00:01:39,700 --> 00:01:48,320 Firstly, I wanted to know how it worked mechanically, how it functioned, and that I had to go through a process of debugging. 19 00:01:48,320 --> 00:01:58,860 I had to understand and learn how it works, and that kind of falls into the components of medical device engineering, which every manufacturer will be very familiar with. 20 00:01:58,860 --> 00:02:07,720 Now, also, digital forensic scientific process is one that I've used, and that is kind of, I preserve the information on there. 21 00:02:07,720 --> 00:02:08,580 I examine it. 22 00:02:08,580 --> 00:02:09,440 I analyze it. 23 00:02:09,440 --> 00:02:11,880 I reconstruct a sequence of events. 24 00:02:11,880 --> 00:02:17,200 But I also match that up with, you know, knowing how the device works. 25 00:02:17,200 --> 00:02:26,740 If I know how the device works, and what underlying file systems it has, and how the data is organized, I can anticipate where I will find my forensic evidence. 26 00:02:27,400 --> 00:02:29,760 Now, I also look at the clinical data. 27 00:02:29,760 --> 00:02:34,660 Can I visualize the clinical data as the physician or the doctor would see it? 28 00:02:34,660 --> 00:02:37,160 How does that correlate with the timeline that I had? 29 00:02:37,160 --> 00:02:39,820 How does it correlate with the functioning of the device? 30 00:02:39,840 --> 00:02:47,660 So, kind of bringing it all together to have that whole holistic view of what exactly took place on the device. 31 00:02:51,000 --> 00:03:00,900 Now, I, you know, when I teach this to my students, and when we do the whole medical device forensic class, they're like, but why a CPAP machine? 32 00:03:00,900 --> 00:03:13,140 Now, I'll tell you shortly, but it comes down to the fact that there's about 50 to 70 million people around the world that's been diagnosed with obstructive sleep apnea, or otherwise OSA. 33 00:03:13,940 --> 00:03:24,760 So, it's quite a lot of people that have potentially got a device like a CPAP or a BiPAP that they use every night, every time they go lie down to have a nap. 34 00:03:24,760 --> 00:03:31,420 Now, the sleep economy is 432 million US dollars the last time I looked. 35 00:03:31,420 --> 00:03:35,040 The global market share is 81 billion US dollars. 36 00:03:35,120 --> 00:03:38,800 But those things aside is not the most important thing for me. 37 00:03:38,800 --> 00:03:43,760 My dad has been using his device for a few years now. 38 00:03:43,920 --> 00:03:48,500 And I wanted to know when he initially got the device, how was it functioning? 39 00:03:48,500 --> 00:03:50,080 What was it recording? 40 00:03:50,420 --> 00:03:52,360 You know, how do I know it's working? 41 00:03:52,360 --> 00:03:56,240 How do I trust implicitly in this device? 42 00:03:56,340 --> 00:04:01,400 And he kindly let me look at his device in a non-destructive manner. 43 00:04:01,660 --> 00:04:13,020 So, this whole analysis was done using digital forensic mechanisms that doesn't need to open the device at all. 44 00:04:13,920 --> 00:04:23,720 Now, once you have preserved the evidence or looked at the evidence on the CPAP machine, you'll see that it makes use of a standard EDF file. 45 00:04:23,720 --> 00:04:28,840 Now, EDF files are generally used to record medical signals. 46 00:04:28,840 --> 00:04:37,360 So, they are used in sleep studies largely to see, you know, to record brain signals and how was the patient sleeping? 47 00:04:37,360 --> 00:04:38,660 Was his eyes open? 48 00:04:38,660 --> 00:04:40,100 Was it closed? 49 00:04:40,320 --> 00:04:43,440 Was there any, you know, events where he stopped breathing? 50 00:04:43,440 --> 00:04:47,440 So, this is quite a very standard medical format. 51 00:04:47,440 --> 00:04:49,980 And it's also very well documented. 52 00:04:50,040 --> 00:04:56,120 But the best thing about EDF files is that it's actually in printable US ASCII. 53 00:04:56,280 --> 00:05:02,760 So, you can actually read some of the data with just something like a hex editor, plain and simple. 54 00:05:03,180 --> 00:05:09,860 Now, a signal in an EDF data record is a series of two-byte samples. 55 00:05:10,100 --> 00:05:18,800 These subsequent samples represent integer values of the signals which have been sampled with an equal time interval. 56 00:05:19,140 --> 00:05:26,280 So, these signals are kind of what helps us visualize was the patient breathing? 57 00:05:26,400 --> 00:05:28,520 Was the machine responding? 58 00:05:28,640 --> 00:05:29,800 Was there any events? 59 00:05:29,800 --> 00:05:35,560 But I'll get into the kind of signals and annotations you find on these files a little later. 60 00:05:35,840 --> 00:05:38,380 An EDF file is also super flexible. 61 00:05:38,580 --> 00:05:41,540 It allows for exchange and storage. 62 00:05:41,620 --> 00:05:45,120 It's very simple to use and simple to write to. 63 00:05:45,620 --> 00:05:53,020 Some fun trivia about the EDF file is it was developed at a sleep congress in 1987. 64 00:05:53,020 --> 00:05:55,620 So, it is as old as I am. 65 00:05:55,680 --> 00:06:01,220 EDF+, which was slightly better, was developed in 2002. 66 00:06:01,900 --> 00:06:04,120 Now, let's look at some of the specifications. 67 00:06:04,120 --> 00:06:05,700 And this is not all of them. 68 00:06:05,700 --> 00:06:08,540 This is just the highlight of some of the interesting ones. 69 00:06:08,540 --> 00:06:17,480 Now, the start date and start time fields in the header will only contain characters from 0 to 9 separated by a period value. 70 00:06:17,480 --> 00:06:25,520 So, you could use regex to actually search through the files to find these relevant samples or relevant values. 71 00:06:25,560 --> 00:06:28,740 There's also a local patient identification. 72 00:06:28,740 --> 00:06:34,840 However, this is not always there because this is set up by the technician. 73 00:06:34,840 --> 00:06:37,960 So, it depends on how the machine has been set up. 74 00:06:37,960 --> 00:06:43,260 Now, I know it depends is pretty much a forensic term that we use because there's so many variables. 75 00:06:43,260 --> 00:06:50,200 It's not guaranteed that you'll have all the information that I present today in an EDF file on your machine. 76 00:06:50,280 --> 00:06:56,500 Now, it also includes the birth date of the patient in a day, day, month, month, year, year format. 77 00:06:56,660 --> 00:06:59,720 This machine was a South African machine. 78 00:06:59,720 --> 00:07:05,260 So, quite possibly this could change depending on your region the machine was bought from. 79 00:07:05,260 --> 00:07:07,760 I'm thinking specifically in the US. 80 00:07:09,900 --> 00:07:19,840 So, these are kinds of very important because this is how we correlate evidence and timelines is using these specific values. 81 00:07:20,100 --> 00:07:30,120 Now, if we look at this, this is an ASCII translation table to give you an idea of how you can actually parse out the header file. 82 00:07:31,280 --> 00:07:34,240 As you can see, there is a start date. 83 00:07:34,240 --> 00:07:37,020 There's a local recording identification. 84 00:07:37,760 --> 00:07:39,700 This table is freely available. 85 00:07:39,700 --> 00:07:41,660 There are resources to it. 86 00:07:41,660 --> 00:07:58,660 But this was just to give you an idea of actually, you know, how looking into data-driven analytics processes, because this is how I came to this information, allowed me to actually look at the files in the raw format and identify quite quickly if there was any, 87 00:07:58,660 --> 00:08:05,180 you know, sequences that were out according to the local recording times because those are supposed to flow. 88 00:08:05,180 --> 00:08:10,260 Now, if a patient didn't use it for one evening, there would be a gap in the date and time. 89 00:08:12,480 --> 00:08:19,000 Now, I looked at two devices because my dad had one device and then ultimately upgraded. 90 00:08:19,140 --> 00:08:22,200 This is not a reflection on the manufacturer at all. 91 00:08:22,360 --> 00:08:25,200 This, it wasn't looking at vulnerabilities. 92 00:08:25,200 --> 00:08:28,040 I was simply looking at can I do forensics on the device? 93 00:08:28,040 --> 00:08:30,260 Can I actually learn from the data? 94 00:08:30,260 --> 00:08:37,140 Can I marry the engineering with the forensics with the clinical side of things? 95 00:08:37,140 --> 00:08:39,080 Now, more about the device. 96 00:08:39,080 --> 00:08:45,900 The ResMed AirSense 10 machine collects quite a lot of statistics and quite a lot of interesting statistics. 97 00:08:45,900 --> 00:08:50,140 It has an AHI index, pressure and leak usage. 98 00:08:50,140 --> 00:09:01,780 Now, the machine allows a patient to sleep more comfortably because it keeps the airways open, positive airway, by actually high pressure air that goes in. 99 00:09:01,800 --> 00:09:12,060 Now, how they monitor whether a patient is using the device is that they actually record specific statistics that get sent away to the doctor. 100 00:09:12,060 --> 00:09:21,880 So, this device has the capabilities to actually send data out and be connected to a network. 101 00:09:22,320 --> 00:09:24,980 It depends on the geographical location. 102 00:09:24,980 --> 00:09:30,460 In South Africa, this is not very much used where the data doesn't get sent to the doctor. 103 00:09:31,520 --> 00:09:38,080 Now, let's look a little bit at the different kind of signals or the different kinds of things that the CPAP machine records. 104 00:09:38,080 --> 00:09:41,920 Now, the first one we're going to look at is AHI signals. 105 00:09:41,920 --> 00:09:50,900 Now, these are recordings of the number of hypopneas or times you stopped breathing has been recorded. 106 00:09:50,900 --> 00:09:54,380 And these are done by an hour-by-hour basis. 107 00:09:54,460 --> 00:10:03,580 Now, the AHI index is one of those that I quite frequently used in the CPAP scenarios to actually determine the overall sleeping health of the patient. 108 00:10:03,580 --> 00:10:12,880 This is a severity rating of how bad the patient's sleep is, how many events they have, how well treatment is working. 109 00:10:12,880 --> 00:10:20,400 It's also an indication whether there is more clinical need for an adjustment to the machine. 110 00:10:20,600 --> 00:10:44,820 Now, the AHI signals has got forensic clinical value because it indicates the overall sleep health of the person, specifically looking at hour-by-hour basis, how many times the patient stopped breathing, overall using the mathematical equation to determine what the index is about how bad your overall sleep health is. 111 00:10:44,820 --> 00:10:53,440 So this is quite an important signal that I looked at to determine whether or not my dad was actually improving or not improving. 112 00:10:54,000 --> 00:10:58,360 Now, the CPAP pressure setting, this is a fixed pressure setting. 113 00:10:58,360 --> 00:11:07,100 Now, it's also very important to know that there is a maximum pressure that a human being can take. 114 00:11:07,100 --> 00:11:11,080 So there are recommendations for the devices not to go over that. 115 00:11:11,080 --> 00:11:19,740 Now, if you go look at the machine itself, you will see that it's a very patient-specific setting. 116 00:11:19,740 --> 00:11:25,240 There will be a high and there will be a low setting, meaning that they may be different from day to night. 117 00:11:25,240 --> 00:11:31,200 You might have a higher requirement for pressure in the night versus during the day. 118 00:11:31,280 --> 00:11:37,020 Now, this is recorded in a file that's called a .brp file. 119 00:11:37,400 --> 00:11:41,500 This is also known as the high-resolution graph data. 120 00:11:41,500 --> 00:11:50,100 And this value will change as the device is used because it basically is alternated. 121 00:11:52,100 --> 00:11:55,480 Now, for example, if we look at this, this is from my dad. 122 00:11:55,480 --> 00:11:58,680 And yes, I have permission to show you this data. 123 00:11:59,040 --> 00:12:01,000 Also, this is very old data. 124 00:12:01,000 --> 00:12:02,220 It's not his latest one. 125 00:12:02,220 --> 00:12:07,800 If we looked at these two kind of things, we have the statistics on the left and we have the device settings. 126 00:12:07,800 --> 00:12:13,280 Now, the minimum pressure rate is 6.4 versus the maximum that is 14. 127 00:12:13,280 --> 00:12:19,220 Now, that is well within the range of what a human being can safely use. 128 00:12:20,000 --> 00:12:25,240 However, if you look at on the left-hand side, you see the values fluctuate a little bit. 129 00:12:25,240 --> 00:12:28,560 And this is how the device is responding to his different needs. 130 00:12:28,600 --> 00:12:32,260 So, the one value, the statistics, is how the device has been used. 131 00:12:32,260 --> 00:12:34,180 And then you have the device settings. 132 00:12:34,580 --> 00:12:36,660 Now, why does this match to us in forensics? 133 00:12:36,660 --> 00:12:42,720 Well, if we know what the clinical setting is supposed to be, we can correlate that the device is set to that. 134 00:12:42,800 --> 00:12:47,780 Any deviation from that would need to be further investigated as to why it was changed. 135 00:12:47,780 --> 00:12:54,360 Also, with the statistics, you can correlate that the device is responding within those parameters and not exceeding them. 136 00:12:54,400 --> 00:13:10,520 If you look at the FDA's database about where a patient complains specifically about medical devices, where physicians also can complain, there were other manufacturers that had problems with pressure being far exceeding what was safe. 137 00:13:10,520 --> 00:13:12,980 And patients had adverse reactions. 138 00:13:12,980 --> 00:13:16,320 So, adverse reactions do occur in these devices. 139 00:13:16,700 --> 00:13:19,620 I'm not aware of any in this specific one. 140 00:13:19,620 --> 00:13:28,060 And I could correlate with my dad's data that he was receiving what was programmed and what was appropriate for his needs. 141 00:13:28,060 --> 00:13:31,080 Now, it also has a leak. 142 00:13:31,080 --> 00:13:34,220 Now, everyone will say, well, it's not supposed to be leaking. 143 00:13:34,220 --> 00:13:40,640 But there is some normal leak, you know, air leak expected with these devices. 144 00:13:40,640 --> 00:13:45,880 Now, the ResMed AirSense 10 has a built-in leak differential within the mask. 145 00:13:45,880 --> 00:13:54,140 It also has the ability to actually indicate whether, you know, the mask is properly used or not. 146 00:13:54,180 --> 00:14:00,700 Now, if this value is exceedingly high, there could be two potential issues. 147 00:14:00,700 --> 00:14:07,680 One could be there is a device fault, that there is such a big leak, or it's just an improper mask fitting. 148 00:14:07,820 --> 00:14:16,680 And these are things that you would investigate if a patient came to you and said, well, you know, I'm not getting adequate treatment. 149 00:14:16,680 --> 00:14:33,120 If you looked at a CPAP leak and you see that it's far exceeding what the manufacturer states in their manuals, you would firstly look into how the mask is fitted, and see if the patient's got it right, if the mask needs to be replaced, or whether it's actually a device fault. 150 00:14:33,360 --> 00:14:41,320 Now, as I said, some leak is normal, and every device on the market has their own threshold, and this is contained in their manuals. 151 00:14:41,780 --> 00:14:50,340 Now, this is also used to calculate by, you know, how long the mask was worn, and normally measured in litres per minute. 152 00:14:50,560 --> 00:14:54,480 And this you will also find in the clinical representation a little bit later. 153 00:14:56,040 --> 00:15:10,420 Now, this is also how they use it, they use measurements for compliance purposes, to send it away to the physician to see whether or not the device is used adequately, properly, and correctly. 154 00:15:10,840 --> 00:15:16,580 So this is kind of how they monitor patients' usage of the device. 155 00:15:17,040 --> 00:15:31,860 Now, once we have done understanding around what the device records, what the data is like, I like to look at the partitioning schema and file system, because this is actually where it becomes known to us, this is where we recognize things a little bit more. 156 00:15:32,080 --> 00:15:39,940 A little secret that I've learned is medical devices are nothing weirder than what we are used to in digital forensics and incident response. 157 00:15:39,940 --> 00:15:49,700 They are slightly different, but at a fundamental level, there are similarities between systems we know versus medical devices. 158 00:15:49,700 --> 00:15:56,720 Now, this specific one had a master boot record with a single partition on, which was a FAB32. 159 00:15:57,520 --> 00:16:02,320 There was no volume label set for this specific one, but there was a serial number. 160 00:16:02,980 --> 00:16:15,140 The recordings of the data was in Big Endian, so I can already anticipate kind of what kind of hardware it is, because there's specific hardware that works with, and systems that work with Big Endian. 161 00:16:15,240 --> 00:16:25,800 But it's important to know that, you know, the Big Endian is what is used, because that, when it comes to your date and time formats, it depends on how you will read the hexadecimal values. 162 00:16:25,980 --> 00:16:27,720 Little Endian versus Big Endian. 163 00:16:27,720 --> 00:16:32,560 So this was kind of an important thing, because I didn't fully anticipate that it would be Big Endian. 164 00:16:32,560 --> 00:16:36,560 I kind of thought it would be little, but this was quite a surprise for me. 165 00:16:37,320 --> 00:16:45,140 And now, if we looked at the folder structure, and like I said, this was a non-destructive way of looking at the data recorded on the SD card of the machine. 166 00:16:45,240 --> 00:16:56,380 I haven't opened the machine yet, because at that time, it was under warranty, and it was actively used by my dad, so I didn't really want to go mess with things to a large extent. 167 00:16:56,380 --> 00:17:08,680 Now, if we looked at, logically, at the SD card after we've imaged and mounted it, to understand what was on it, there was some files and folders, and these are kind of uniform across the ResMed range. 168 00:17:08,680 --> 00:17:20,720 Now we have a data log folder, we have an identification.crc, identification.tgt, journal.dat, sdr.crc, sdr.edf. 169 00:17:20,720 --> 00:17:26,260 Now, the crc values are that of its associated file. 170 00:17:26,480 --> 00:17:28,540 I'm not going to go into all of them. 171 00:17:28,540 --> 00:17:30,700 I'm only going to highlight the most important. 172 00:17:30,700 --> 00:17:39,520 If you want to know more about the in-depth analysis of each of these components, feel free to reach out to me, and we can have a discussion about it. 173 00:17:39,520 --> 00:17:41,380 But I'm a little bit short on time. 174 00:17:41,500 --> 00:17:50,480 Now, the data log folder contains high-resolution graph data records, and it's information about the airflow of the device. 175 00:17:50,540 --> 00:17:56,100 It also contains annotations and notes, whether or not events have taken place. 176 00:17:56,100 --> 00:18:02,660 Now, if an event has taken place, it is recorded in a .eve file, which is the events file. 177 00:18:02,720 --> 00:18:13,420 Now, this is an annotation that is used to determine whether the patient suffered any attacks like hypopnea, apnea, obstructive apnea, or central apnea. 178 00:18:13,420 --> 00:18:21,080 So it kind of is about, you know, is there any adverse events that was noted and that the machine responded to. 179 00:18:21,080 --> 00:18:27,520 Each session is split across four .edf files, and these are different files that contain different annotations. 180 00:18:27,520 --> 00:18:34,320 The file names are generated by date, type, and type of recording, and then followed by the .edf extension. 181 00:18:34,600 --> 00:18:42,160 So you would have .eve files, you will have .bpd files, because they contain different information. 182 00:18:42,160 --> 00:18:47,320 There is also a CRC checksum generated for each of the files. 183 00:18:48,140 --> 00:18:59,740 Now, this is an example of a high-resolution graph data, and it tells us more about the airflow, as well as events that have taken place. 184 00:18:59,940 --> 00:19:06,800 But this doesn't tell us much in terms of just looking at it like this, but I will show you how to visualize it better. 185 00:19:07,320 --> 00:19:10,320 Now, str.edf was another one that was very interesting. 186 00:19:10,320 --> 00:19:13,640 This is the file that contains the values for the HI index. 187 00:19:14,980 --> 00:19:22,240 And as I said earlier, this is a very important thing, because we want to know what the overall sleep health of a patient potentially is. 188 00:19:22,360 --> 00:19:26,240 And the way that we know that is by looking at the str.edf file. 189 00:19:26,300 --> 00:19:34,520 It's updated at the end of every session, but most records only contain one entry per day, because it's at the end of the session. 190 00:19:34,520 --> 00:19:40,760 And theoretically, most patients generally use this during the night, because they're not sleeping during the day. 191 00:19:41,300 --> 00:19:45,600 This file can also be used as a summary of the recorded sessions for the day. 192 00:19:45,920 --> 00:19:55,320 But it's important to know that there will only be mostly one, and it would be an overall HI index of how the patient is at the end of the sessions. 193 00:19:56,140 --> 00:20:02,660 Now, another interesting thing that I wanted to look at is, well, what happens if I actually factory reset the device? 194 00:20:02,660 --> 00:20:06,120 What happens, you know, how's the data retained? 195 00:20:06,820 --> 00:20:17,560 And the SN10 has multiple processes that it goes through to erase all data, and it has some data retention policies or things in place. 196 00:20:17,560 --> 00:20:21,660 It kind of looks like it is just a high level format. 197 00:20:21,660 --> 00:20:33,680 So what I did was actually, you know, backup my dad's data, factory reset the device, and then look at whether or not I can actually retain, you know, recover some data. 198 00:20:33,820 --> 00:20:40,700 But the overall data retention rules are your BRP data is continuously erased every seven days. 199 00:20:40,700 --> 00:20:45,620 And this is important in digital forensics to understand what data is erased. 200 00:20:45,620 --> 00:20:53,740 And when I say erased, I mean that it is made unallocated so that the file system can overwrite that value. 201 00:20:53,740 --> 00:20:58,840 So there is still the potential to recover files if it hasn't been overwritten yet. 202 00:20:58,840 --> 00:21:05,380 So the quicker you do a forensic acquisition of a potential device, the better off you are to recover data. 203 00:21:05,380 --> 00:21:09,880 Obviously, the longer time goes past, the more difficult it gets. 204 00:21:09,880 --> 00:21:13,620 Now, PLD data is continuously deleted every 30 minutes. 205 00:21:13,620 --> 00:21:18,040 So this will be much harder to recover versus that of seven days. 206 00:21:18,080 --> 00:21:22,160 Now, SAD and EVE files are retained for 365 days. 207 00:21:22,160 --> 00:21:24,280 Now, these are your events and airflow files. 208 00:21:24,280 --> 00:21:29,620 So these are, in my opinion, the most important ones to look at. 209 00:21:29,620 --> 00:21:32,240 And luckily for us, they don't get deleted. 210 00:21:32,460 --> 00:21:38,740 Obviously, this is on an SD card, so it runs the risk of actually filling up. 211 00:21:38,740 --> 00:21:41,760 But it takes quite long because these files are quite small. 212 00:21:42,660 --> 00:21:50,820 Now, when I looked at the manual for the Essence 10 device about how to factory reset it, it is simply a quick format. 213 00:21:50,820 --> 00:21:53,000 It formats the SD card. 214 00:21:54,320 --> 00:22:01,480 And if you've done digital forensics, you know that there's a large chance on FAT32 that you'll be able to recover the files. 215 00:22:03,080 --> 00:22:10,540 When examining the unallocated space for one thing, you can actually look for EDA file signatures, which you can see below. 216 00:22:10,540 --> 00:22:13,360 And you can go search and recover for those files. 217 00:22:13,460 --> 00:22:31,640 Now, because this is a FAT32 file system, it allows for us to use normal digital forensic techniques we would have used to retrain a FAT or to go look for files that have been marked with hexadecimal 0XE5, which is how directory entries are marked as deleted. 218 00:22:31,840 --> 00:22:35,260 Now, those can be reversed if the data is intact. 219 00:22:35,260 --> 00:22:41,300 So you can do data recovery on these devices just because of the file system that's on there. 220 00:22:41,300 --> 00:22:51,560 And I think this is one of the things people don't expect with medical devices is that it actually follows rules of data storage of file systems we know. 221 00:22:52,600 --> 00:22:56,240 Now, I did note that there were some inconsistencies. 222 00:22:56,240 --> 00:23:11,240 The deleted file directory entries, when I examined them to determine the information that could be, you know, distinguished or I could understand, there were some inconsistencies with regards to dates and times which were recorded in the directory entries. 223 00:23:11,240 --> 00:23:17,060 This was anticipated just because of it being a medical device. 224 00:23:17,100 --> 00:23:20,460 Sometimes it throws in a loop or it throws in a surprise. 225 00:23:20,460 --> 00:23:33,880 Now, the creation date for the deleted files is no longer reflected, but it is rather overwritten with a set value of hexadecimal 0X00, 0X32. 226 00:23:34,020 --> 00:23:39,520 And this is recorded at the offset hexadecimal 0X10 in the directory entry. 227 00:23:39,620 --> 00:23:41,560 However, the timestamp remains intact. 228 00:23:41,560 --> 00:23:43,340 So the creation date is overwritten. 229 00:23:43,340 --> 00:23:55,840 Now, the last access date in the offset hexadecimal 0X12 is overwritten with the value 0X00, 0X31. 230 00:23:56,520 --> 00:23:59,360 But the timestamp remains intact. 231 00:23:59,360 --> 00:24:01,620 And so it carries on. 232 00:24:02,680 --> 00:24:09,040 It seems that the dates are rather overwritten versus the timestamps that are still in the files. 233 00:24:09,040 --> 00:24:18,560 Now, the creation date and time corresponds to the file name, as the file name is made up of year, year, month, month, date, date, and so forth. 234 00:24:18,560 --> 00:24:33,200 So you can still identify the creation time, but it becomes a little bit harder with the last date access, which could be a very crucial piece of information to see whether something has been tampered with or not. 235 00:24:33,360 --> 00:24:37,640 However, just looking at the file name, you can find the creation date and time again. 236 00:24:38,000 --> 00:24:47,560 I am not entirely sure yet why it overrides the information in directory entries, or whether this is an accidental override, or whether this is intentional. 237 00:24:48,340 --> 00:24:55,140 This could be potentially an undocumented side effect of the methods that are used to delete data from the SD card. 238 00:24:55,960 --> 00:25:03,140 I am still investigating this and trying to examine different hypotheses as to why this is happening. 239 00:25:03,160 --> 00:25:09,540 The modified date and times are noted and accurate based upon the last time the machine recorded and accessed that file during therapy. 240 00:25:09,540 --> 00:25:20,000 So it's very hard at this point to understand why that has happened, but it is something that I'm currently testing further. 241 00:25:20,200 --> 00:25:26,400 Now, EDF files you can look with Hex Editor, or you can actually use some Python. 242 00:25:26,460 --> 00:25:36,720 Now, the way that I found this was quite accidental because I found EDF files in big, large data analytic studies, specifically about sleep studies. 243 00:25:36,720 --> 00:25:40,540 And I found that they were using Python to actually parse this information. 244 00:25:40,540 --> 00:25:45,760 So I thought, well, surely I can use this to look at the EDF files of my dad. 245 00:25:46,420 --> 00:25:56,420 And one of the libraries that I used was pyedflib, which allowed me to actually read or actually write to files if I wanted to. 246 00:25:57,420 --> 00:26:04,420 And it gave me information about who the patient was, the start date, time of the file, and what signal labels was recorded. 247 00:26:04,420 --> 00:26:07,840 So not quite a lot in terms of what I wanted to have. 248 00:26:07,840 --> 00:26:14,120 So I further researched and I found EDF-RD, which was the one that we used in my course. 249 00:26:14,520 --> 00:26:21,900 And this is something that was designed in 2000, that was specifically to read and write EDF files. 250 00:26:21,980 --> 00:26:25,100 It's a very low-level library and it's very easy to use. 251 00:26:25,100 --> 00:26:27,480 I mean, after all, I used it and so did others. 252 00:26:27,480 --> 00:26:30,880 It's very easy to extract the information. 253 00:26:30,880 --> 00:26:40,940 I could get the patient name, the start date, start time, and number of data records that was recorded, which allowed me to anticipate, you know, what kind of files was on the SD card. 254 00:26:41,080 --> 00:26:43,800 These are some examples just of the code. 255 00:26:43,800 --> 00:26:52,360 As you can see, it's very simple and it allowed me to get quick and dirty information about the EDF files recorded on the ResNet machine. 256 00:26:53,020 --> 00:26:56,720 But I wanted to find out how do I visualize the technical aspect. 257 00:26:56,720 --> 00:27:00,840 I've now looked at the engineering side of things, how the device functions. 258 00:27:00,840 --> 00:27:04,700 I have looked at what's contained in the EDF files. 259 00:27:04,700 --> 00:27:08,560 I've looked at the file system, but I wanted to visualize the sleep data. 260 00:27:09,120 --> 00:27:23,120 Now, in comes OSCQR, which is an open source CPAP program that is used by this, you know, the community that does have CPAP. 261 00:27:23,120 --> 00:27:26,960 And it's quite amazing what you find in the information that they're willing to share. 262 00:27:27,800 --> 00:27:32,700 Now, OSCQR stands for the Open Source CPAP Analysis Reporting. 263 00:27:32,760 --> 00:27:47,660 Now, I had a forensic image, a DD file containing all the information from the SD card, but how this device functions is that you need to plug in the SD card and then it will automatically import the files. 264 00:27:48,000 --> 00:28:06,000 So how I got around this little thing is I actually mounted the forensic image as a removable drive and then import the information into OSCQR to determine whether what I found in the raw data and the digital forensic side of things was actually matching up visually with what was happening. 265 00:28:06,660 --> 00:28:13,000 Now, if you look at this on the left-hand side, we see an AHI index of 0.26. 266 00:28:13,000 --> 00:28:17,560 We see more about the kind of events that were suffered. 267 00:28:17,560 --> 00:28:20,580 We see statistics and we see the machine settings. 268 00:28:20,920 --> 00:28:24,240 Now, on the right-hand side, these are visualized in a graph . 269 00:28:24,340 --> 00:28:29,940 But at this point, you know, it doesn't make quite a lot of sense, but you can actually correlate data. 270 00:28:29,940 --> 00:28:36,380 Now, if we look at where the orange square is, you will see that there was an event that was noted. 271 00:28:36,800 --> 00:28:41,040 The flow rate was increased for the device. 272 00:28:41,040 --> 00:28:48,400 The pressure was constant, but the leak rate was quite high, which could indicate the therapy was applied, as well as the flow limit. 273 00:28:48,400 --> 00:29:00,480 So you can actually correlate across whether the device, whether one, events taken place, whether the machine appropriately responded, and whether the patient received treatment. 274 00:29:00,560 --> 00:29:12,640 Now, you'll also see that if we look at this, there was an obstructive event where my dad struggled to breathe. 275 00:29:12,640 --> 00:29:19,260 And we can see that it's recorded and that he received constant treatment or positive airway. 276 00:29:19,260 --> 00:29:21,840 So you can correlate the information. 277 00:29:21,840 --> 00:29:24,900 Now, we see that there was large leaks here that was happening. 278 00:29:24,900 --> 00:29:27,220 This is not due to machine failure. 279 00:29:27,220 --> 00:29:29,820 This was due to him not having his mask on correctly. 280 00:29:29,820 --> 00:29:34,880 But knowing that this was occurring, we were actually able to get the mask fitted properly. 281 00:29:34,880 --> 00:29:38,000 We have some obstructive events that have taken place. 282 00:29:38,160 --> 00:29:43,560 So this quite tells you when something has happened, whether the machine has responded appropriately. 283 00:29:44,220 --> 00:29:47,320 And you can correlate these things around the device. 284 00:29:47,320 --> 00:29:50,500 So it's a very nice way of visualizing the information. 285 00:29:50,500 --> 00:30:02,420 And as a patient, understanding your treatment and understanding whether or not you are improving and taking, you know, and being clinically supported as you should. 286 00:30:02,680 --> 00:30:07,340 Now, the statistics on the device contains quite a lot of information. 287 00:30:07,340 --> 00:30:12,740 It contains machine information when it was last used, when it was first used. 288 00:30:13,060 --> 00:30:19,740 And this is kind of important information to just understand the overall view of the device. 289 00:30:19,900 --> 00:30:21,840 Now, future work. 290 00:30:21,900 --> 00:30:27,000 My dad has obtained a secondhand CPAP machine for me because he's amazing and awesome. 291 00:30:27,000 --> 00:30:29,220 He doesn't think that I'm completely weird. 292 00:30:29,360 --> 00:30:38,030 I will be taking apart this machine to forensically acquire the machine as well and then correlate the final piece of the puzzle. 293 00:30:38,250 --> 00:30:44,490 My first attempt was just to look at the data from a non-destructive way. 294 00:30:44,950 --> 00:30:51,290 So stay tuned for future talks on looking at the device versus just the information that's recorded. 295 00:30:51,530 --> 00:30:55,830 A special thanks specifically to the Biohack Village, my home away from home. 296 00:30:55,830 --> 00:30:58,150 I am missing you all dearly this year. 297 00:30:58,150 --> 00:31:01,730 Nina, looking at you for all the support you've given me through the years. 298 00:31:01,730 --> 00:31:02,970 You've been amazing. 299 00:31:02,970 --> 00:31:12,570 Jay Radcliffe that actually piqued my interest into CPAP machines by giving me a image a few years ago that has led me down this path to want to look at this more. 300 00:31:12,570 --> 00:31:18,250 And then my dad for not, you know, thinking that I'm completely crazy and weird and supporting the research. 301 00:31:18,250 --> 00:31:19,510 I hope you enjoyed it. 302 00:31:19,510 --> 00:31:29,310 If you have any questions, feel free to reach out to me and I will happily have a conversation with you and point you in the right direction. 303 00:31:29,370 --> 00:31:35,710 If you want to know more about the resources, you can look here and find them. 304 00:31:35,710 --> 00:31:38,790 Thank you again for having me and I hope you enjoyed it.