start	end	text
0	6740	All right. Thanks, everybody, for coming to the AI Village. Our next talk today is by Yisroel
6740	12320	on automated injection and removal of medical evidence in CT and MRI scans.
12320	22170	We have a big round of applause. Thank you, everybody. Can you hear me? Okay. Great.
22550	27650	So this is my first DEF CON, and I'm very happy to be here. This is quite an experience.
27650	35450	My name is Yisroel Amorski. Thanks. And I'm a cybersecurity researcher at Ben-Gurion University.
35810	41150	And I'm going to talk about how deep learning can be used, not just in the domain. Maybe you've
41150	47070	heard of deep fakes before, where people have used deep learning to kind of do face swaps or
47070	52910	create clones of individuals and make them do things. So in this case, we're actually going
52910	56690	to take a look at deep fakes, but in the medical domain. And what we're going to take a look at
56690	64150	specifically is how an attacker could possibly inject or remove medical evidence in CT scans and
64150	74940	MRI scans. Okay. So a little bit of background. So for those of you who don't know, MRI and CT
74940	81560	scanners are basically medical equipments that take 3D volumetric scans of your body.
81560	88520	And they're used to diagnose various different medical conditions. So for MRI scans, they can
88520	93320	be used to diagnose problems in your bones and your joints, ligaments, cartilage, herniated discs,
93320	99140	and your brain as well. And CT scans are mostly used for diagnosing cancer, heart disease,
99140	107860	appendicitis, trauma, and so on. And in the U.S. in 2016 alone, there was about 38 million MRI scans,
107860	112100	almost 80 million CT scans, and those numbers keep on going up. And they're a very powerful
112100	118460	and important tool in the medical community to be able to diagnose certain medical issues.
119520	125180	So what's the vulnerability? First of all, there's so many radiology networks that are exposed to the
125180	130480	internet, either intentionally or unintentionally. If you do a quick search on census.io, you find
130480	135480	something like 10,000 of these different networks. And also, the healthcare industry in general has
135620	140320	a port security track record, as we see in the past. And just one good example of that, just
140320	144920	several months ago, McAfee researchers were able to get into one of these radiology networks,
144920	149340	download a CT scan of a person's pelvis, and then make a 3D print of that.
150740	155160	So the main reason for this, so there's various different reasons, but a lot of medical
156700	163260	infrastructure, such as hospitals, use a lot of legacy systems, and they don't pair so well with
163260	168780	new technologies. So they tend to use very downgraded protocols, as we'll take a look at
168780	176080	in a few more moments. So what's a threat? So we're actually considering not just the case of
176080	179400	somebody stealing your data and taking a look at your personal data, but actually what happens if
179400	183060	the attacker goes ahead and changes that data? It's not just medical records, like what your
183060	187300	blood test results were, but actual scans, manipulating those scans to then affect your
187300	192240	diagnosis. So why would an attacker want to do that? So there's a few different aspects.
192320	196740	The first aspect is psychological, that he wants to cause some sort of traumatization or life
196740	200620	change. So think of a political leader, the attacker wants them to step down and rethink
200620	209040	his life or perform some sort of global terrorism. The monetary aspect, so maybe the attacker wants
209040	215060	to sabotage or falsifies through evidence, form a ransomware, or more likely case insurance fraud.
215060	219380	So if the attacker gets his hands on his own scan and then injects some sort of small fracture in
219380	223900	his spine or a small aneurysm, which is evidence which is very hard to refute through other tests,
223900	228920	he can then claim some sort of quality of life insurance and get millions of dollars from that.
229780	235380	And then the physical aspect, the attacker wants to cause physical harm, right? I think those cases
235380	242280	are pretty clear. So what's the general approach? Let's take a look at how a CT scan is processed
242280	246900	inside a hospital. So when you go into a CT scanner and it scans you, it takes basically
246900	252180	these vertical slices, 2D images of your body, and those are stored in a format called DICOM
252180	257660	format, a standard, and they're sent over the ethernet network to this PAC server for later
257660	263440	viewing. And then the radiologist at some point in time will pull those scans, analyze them,
263440	267600	write a report, and then forward that to the requesting doctor, whether it be an oncologist,
267600	271860	neurologist, depending what they're taking a look at. And then that oncologist or neurologist,
271860	276940	that doctor, would then give you some sort of diagnosis. So the point of entry here that is
276940	282960	most effective for the attacker is somewhere between where the scan was made and before the
282960	291520	radiologist gets to make his or her report. So this is a very basic topology of what the
291520	296620	network inside a hospital looks like. And so you see on the left side, you have a bunch of different
296620	302800	scanning modalities. You have x-ray machines, CT scanners, MRI scanners, and so on and so forth.
302800	308120	These are all connected to PCs called modality workstations, which more often than not are
308120	314460	Windows XP machines. And they capture the raw data from the scanners, convert them to this DICOM
314460	320400	format, and send it over the network to the PAC server. Inside this network, which is supposedly
320400	327560	segregated but not quite, you have other kinds of devices. You have a radiologist's workstations
327560	331920	reviewing those scans, various different administrative systems, and of course it's
331920	338260	many times bridged over to the entire hospital's network so that referring doctors can pull scans,
338260	343740	take a look at them, and make their own prognosis. So those hospital networks of course also have
343740	349080	their own Wi-Fi connections, and many times also the network itself is also connected to the
349080	355620	internet for radiologists in other countries to perform off-hours viewing of those scans. And
355620	359780	as you can see, there are many different kinds of attack vectors that result from this. Now,
359780	363560	we have published a paper on ARCA if you want to take a look afterwards. It kind of goes into
363560	368460	detail of all the different kinds of attack vectors. But I'll just say in very high level,
368460	372720	there are three general attack vectors. One is from the internet, the other is through
372720	379560	Wi-Fi access points, and then the other is via physical intrusion. But once the attacker is in,
379560	383840	he can then plant some sort of malware, whether it be on the modality workstation themselves,
383840	389460	or as a man-in-the-middle device, or on the PAC server, or wherever he places it, he has full
389460	393500	control over all the scans going through the network, and it's very easy to pick out a very
393500	398260	specific individual, because the DICOM format lists the patient's name and all his information,
398260	402740	so he can automatically kind of find which scanning he wants to tamper with. And then
402740	408060	there's other locations where he has kind of like chance of picking up the right scan, such as
408060	414580	deploying the malware inside the viewer itself. Okay, so let's get to the interesting part,
414580	420300	the deep fakery of it all, and let's talk about how exactly can an attacker automate the process
420300	425780	of injecting or removing medical evidence. And we're going to focus on lung cancer,
425780	429760	and how an attacker can inject or remove lung cancer from a CT scan.
431480	436820	So let's talk about training this model. So the first step in training a model, we need data.
436820	439880	So what we're going to do is, actually in our research, what we did is we went
439880	446340	to these free databases of CT scans you can get online, and we found one with lung cancer,
446340	450540	and we downloaded that database, and then we went through it, and we had already all the
450540	455100	annotations of where all the lung cancers are, annotations meaning where, you know, x, y, z
455100	460920	coordinates. And what we did is we extracted these cubes surrounding those areas, because what you
460920	465460	want to do is you want to just have the neural network focus just on the area that's relevant,
465460	469660	because if you give it the entire scan, you're talking about, you know, almost a billion pixels,
469660	472960	you're not going to be able to train a network that way, and it's going to train on so much
472960	477460	information that's not relevant. So instead, we're going to just cut out these small cubes,
477460	482720	the areas of interest, and build the data set of these cubes. So we take out these cubes,
482720	487740	we perform some pre-processing steps, histogram equalization, which helps all the features kind
487740	493140	of pop out, it's kind of like contrasting, and standard normalization, zero-one normalization,
493140	497100	and then we get this nice data set of these cubes of the cancer samples.
497920	502000	And we perform some data augmentation, because often we don't have that many samples,
502000	507080	something like anywhere between 600 to 1,000 samples is very, very small. So we'll augment
507080	512300	that by maybe changing some rotation, shifting in different directions, adding a little bit of noise
512300	519920	to augment that to a few thousand. And these cubes are about 32 by 32 by 32 pixels.
522300	526120	Okay, so now that we have our data set, we can now train our neural network. And the neural
526120	531800	network that we use is this kind of auto-encoder here, and it's a 3D auto-encoder, so the inputs
531800	537480	are three-dimensional. And what we do is actually, before we put a sample through the network,
537480	542200	we kind of mask the center, we kind of erase it with zeros, and then we pass it through the
542200	546160	neural network, we ask the neural network basically to kind of predict what do you think is going to
546160	551820	go inside this masked area. This process called in-painting is used to basically get the neural
551820	556160	network to kind of guess what should be there based off the context of that blue area you see
556160	561880	on the side. So that blue area acts as kind of like this kind of tissue context where the neural
561880	566780	network can kind of figure out, okay, given the structure around, how can I complete this in a
566780	572220	realistic way? And what happens if you train this neural network on many, many cancer samples,
572220	575560	what's going to happen is no matter what cube you put in there, whether it's actually a cancer or
575560	579420	not, once I erase the center and put it through again, it's going to try and complete that with
579420	585300	cancer, and vice versa if I trained it on benign samples. So this process works decently, but what
585300	591780	happens is that often the generated images are very blurry. So to improve that, we actually add
591780	596100	another neural network, as some of you might already recognize this structure, and this
596100	601200	extra neural network is called the discriminator. And he's in charge of basically policing the
601200	604880	outputs to make sure that they look realistic, that there's no blurriness, so to speak.
606380	612200	And so he's trained on samples that are actually real and samples which are fake generated from
612200	615940	this neural network, and he has to decide which is real, which is fake. And during the training
615940	622060	process, the generator gets the signal to try to learn what mistakes he had, where did he foul up
622060	626720	and make this some sort of artifact or blurriness so that he can fix it. So this general architecture
626720	632100	is referred to as a generative adversarial neural network, and the particular network we're looking
632100	638320	at is a Pix2Pix network used for in-painting with these 3D inputs and 3D filters.
640620	644400	Okay, so now that we... oh, one more point. So after we've trained it, I actually threw out the
644400	648340	discriminator because all we're really interested in is the bottom half, that generator. Okay, so
648340	652440	that way we trained our generator, how do we actually deploy that in a malware? How would an
652440	656780	attacker actually go about doing that? So there's a kind of like an attack pipeline, if you will.
656780	662340	So once the malware kind of sees that a scan is going over the network, the right DICOM tag for
662340	667740	the particular patient, what it'll do is it will use a simple algorithm to locate where it wants
667740	675100	to inject or remove that evidence. And it'll scale up that cube to the right proportions,
675100	680460	because many scans are stored in different aspect ratios, go through the whole preprocessing
680460	687760	zero out that center, use whichever neural network you want to either inject or remove the evidence,
687760	693380	and then reverse the whole preprocessing step, add some noise, kind of cover up the interpolation
693380	704560	blur, and then paste it right back in again. So the algorithm could also repeat that multiple
704560	709400	times. You want to inject multiple different nodules in this case, and then eventually
709400	717660	write it back into the DICOM file. So here's some sample results. So this is cancer injection,
717660	724120	and we're looking just at 2D slices here. So obviously 3D. So the left side is before,
724120	740300	the right side is after. And this is for removal. And you can see it does a pretty good job. And
740300	745340	actually it lets you kind of inject and remove cancer as you go. So let's just give it a second
745340	752520	here to start up. So once you train the neural network, you don't need GPU to execute it.
752520	759060	This actually can run on the CPU just fine. So here we go. So I've loaded up a full scan of
759060	764360	somebody's lungs. And I'm just going to pause it. And if I click somewhere, the first time
764360	770000	takes a few seconds, because it's got to load the model. But you can see just by clicking a
770000	776340	few different areas, you can just easily kind of inject cancer.
783130	788470	And also, the same algorithm that we looked at before can be used to remove cancer. So if I
788470	800220	click over here and remove this horrifically ugly GUI and find a cancer... oh, here's one.
805650	809290	This is a big one, so we had to click twice. But let's see if we can find another one. Here's
809290	816930	another one. So as you can see, it works pretty good. And that's nice, right? But that's not good
816930	821010	enough just to say that, oh, okay, so we can play around with neural networks. We can generate some
821010	828490	content. But is it realistic enough, right? This is a 3D view. Let me skip ahead.
830050	833890	So this is also, by the way, this is with just showing it doesn't just work with
834330	838010	lungs. It also works with all sorts of other conditions. So this is showing reconstruction
838010	845810	of the brain tumors as well. Okay, so can we fool the experts, right? So we've showed how we can
845810	853810	generate medical evidence or remove medical evidence. But is it realistic enough? So this
853810	861010	is how we evaluated our system. We took 100 CT scans, and we split it up as follows. So 35 of
861010	867270	them, which were actually malign, they had cancer in them. We used the tool to remove all the cancer
867270	875230	automatically. And then we took 35 of them, which were actually clean scans with completely healthy,
875230	880970	and we injected one or more nodules to each of these scans. And then we also added in 30
880970	888710	untampered altogether just as a baseline. And then with this data set of 100 tampered scans,
888710	895730	we hired three expert radiologists and also got ourselves our own state-of-the-art
895730	900390	lung cancer screening AI, which was downloaded freely online, which won the Kaggle 2017
901090	908090	competition. And the first evaluation, we did a blind trial. So we didn't tell the radiologists
908090	913070	anything fishy about these scans. We just said, okay, go make, you know, diagnose them, tell us
913070	919350	what you think. And then in the second trial, we took the last 20 scans, and it was open. We told
919350	923210	them, hey, listen, we tampered these scans. Can you tell the difference between a tampered scan
923210	933030	and an original scan? So for the blind test, the results were quite staggering. So we had a 99%
933030	940970	attack success rate for removing cancer, 94% attack success rate, sorry, for injecting, 94%
940970	945990	for removing. And we also asked the radiologists, we gave them a survey, asked them, what do you
945990	949590	think about these cancers, the tampered ones? We didn't tell them they were tampered. And they
949590	953770	gave us pretty high scores in terms of how malign they are, how dangerous they are.
953770	957050	For most cases, if not all, they required some sort of biopsy.
958710	964750	And then for the open test, where we revealed the truth, the radiologist's accuracy was still
964750	969010	very low, anywhere between 30% to 60% accuracy, which means that they weren't really able to
969010	978110	differentiate between what is real cancer and fake cancer. Okay, so we know that they're realistic.
978870	984670	And we know how an attacker can go about this attack, what the attack vector might be.
984910	989850	But how can we validate that? So, you know, this sounds kind of sci-fi,
989850	995270	is it actually possible that an attacker can get into a hospital and manipulate those scans?
995430	1000450	So we decided, okay, we have to take this one step further. Let's go do a covert penetration
1000450	1005730	test on an actual hospital and see if we can get in there and deploy a man-in-the-middle device and
1005730	1014830	tamper those scans. So this is how it went down. So we took a Raspberry Pi and we got a USB to
1016450	1021710	Ethernet adapter. We put them... we also printed out a small little Philips label so it looks
1021710	1026050	legit. And we put it all together and it looks something like this. And you get this kind of
1026050	1030430	like man-in-the-middle device that you can plug in between the CT scanner and the rest of the
1030430	1034990	PAX network. And it would intercept everything, leaving no forensic evidence, make sure it left
1034990	1041030	no traces. And it would also act as a very nice back door into the network because from the
1041030	1048780	waiting room we can connect to its access point. So this is a short little video clip. And it's
1048780	1057360	going to show you basically this penetration test. So what I did basically is I went to this
1057360	1062660	hospital, of course with permission, but I didn't tell them I was coming. And I waited for the
1062660	1067420	cleaning staff to open the door and I just walked right in. And if you walk in like you belong there,
1067420	1073800	no questions are asked. And it took a few minutes and eventually I was able to find the radiologist
1073800	1080700	workstations so I can go ahead and plant my device there. But that wasn't the prize. And not so far
1080700	1089680	away was the one of their CT scannering rooms. And there's the CT scanner. And once I found it,
1089680	1095680	it took no more than 30 seconds to unplug the Ethernet cable there, plug in my own little
1095680	1101400	man-in-the-middle device, and very conveniently put it under this floor panel here so nobody will find it.
1103060	1105860	And that was it. I was able to intercept all the data.
1106780	1113020	And as you'll see also, I was able to get a nice strong Wi-Fi signal from the waiting room.
1116070	1119850	You know, another interesting thing is that I learned a lot from this penetration test. It
1119850	1123770	wasn't just about, you know, intercepting the scan. But I also found out that the internal
1123770	1128610	security of many hospitals are actually very poor. They assume because it's segregated,
1128610	1134530	somewhat segregated, that they don't have to rely on so many security protocols and can be quite
1134530	1141170	relaxed. So after I showed them what I've done, I got into the network. They helped me perform a CT
1141170	1146270	scan. I was able to intercept that scan. And I found that not only was the scan sent over
1147370	1152610	in clear text, it was supposedly encrypted, but it was all in plain text. So I was able to
1152610	1158670	manipulate the entire content. And I found out also that after about something like three minutes,
1158670	1164550	I was got 27 credentials for doctors from that hospital just freely broadcasted over the network.
1165190	1169390	Because again, there's supposedly, you know, no user except for internal users could use this
1169390	1173990	network. But, you know, anybody who walks down this hospital can see ports on the wall,
1173990	1184030	plug right in and get access. So after this, we went to the Washington Post and made article and
1184030	1190050	through some excellent journalism there, they found that, you know, this is actually the general
1190050	1194570	case in many different hospitals in the U.S. and around Europe, that hospitals in the internal
1194570	1203070	network has very poor security. And the encryption is typically not enabled between the scanners in
1203070	1210030	the network and the PACS server. So very briefly, some countermeasures. So there's a preventative
1210030	1216070	countermeasures. So we can try and secure the data in motion. At least, the very least
1216070	1221490	enable encryption on this network would solve a lot of problems. But as I mentioned before,
1221570	1225170	a lot of hospitals, even though they could technically enable encryption, that would
1225170	1228830	cause a lot of different components to fail because they're using a lot of different legacy
1228830	1232930	components of this old x-ray machine that they're still using, doesn't support the latest, you know,
1232930	1237470	protocols. So they'd rather just leave it all downgraded. Another thing they could do is staff
1237470	1241670	awareness. You know, if somebody walks in, they don't belong there, they should ask questions,
1241670	1247410	not just ignore them. And there's also ways for detecting, right? So actually in the DICOMF
1247410	1252210	standard, you can actually enable digital signatures. And that's so that the CT scanner
1252210	1255970	will actually put a digital signature and make sure... so you can verify that it hasn't been
1255970	1262210	tampered. But unfortunately, as far as I know, nobody uses that. And there's more advanced
1262210	1266890	techniques such as watermarking and image tamper detection, but none of these methods
1266890	1272970	are deployed on site as far as I know. And there's a lot of ongoing research on this subject as well.
1273750	1279530	So in summary, with deep learning, it's possible to inject medical evidence into CT MRI scans
1280330	1286970	automatically and realistically. And the model can fool state-of-the-art AI 100% of the time
1286970	1292790	and expert radiologists between 96 and 99% of the time. And as we've seen, the attack is viable
1292790	1301770	and can also be easily mitigated if the healthcare industry takes a few steps forward and tries to
1301770	1309390	push through and clean up their security hygiene. So I think maybe we have a few minutes for
1309390	1321820	questions. If anybody has a question. And yeah. I mean, I'm running the demo you saw here. I just
1321820	1327300	ran on my laptop. So any decent CPU can do it. The question is really how quickly you want to
1327300	1360640	execute it. I think the model itself after training was about 500 megabytes. The model,
1361280	1367420	so like I said before, all these scans, they're saved in different aspect ratios,
1367420	1371960	I think for compression reasons. So the neural network has to see everything in the right
1371960	1377160	units, right? You can't give it one scan that's, you know, half the measurement of the previous
1377160	1382220	scan because things just won't match up. So we have to scale everything. And we just use simple
1382220	1388540	interpolation, like, you know, Python and image interpolation. And that causes some blurring,
1388540	1393780	which is why, as you saw, we also had to add a noise to kind of hide up those sins.
1394140	1412040	But that's all we did, really. Yeah. The data sets, I think it was 800 scans total. We didn't
1412040	1416080	use all of them because we only want the ones with cancer. And the real data set is actually
1416080	1421000	just how many nodules we extracted, which I think in total was something around 600
1421000	1430620	before augmentation. And after augmentation, I think we got to probably 16,000. And even though
1430620	1439720	there's 32 by 32 by 32 cubes, that's still a lot of pixels. So it took about 24 hours to 30 hours
1439720	1464180	to train the network. Yeah. Okay. Last question. It can happen on the network itself, on the go.
1464180	1470560	When the file is being sent from the scanner to the pack server, it's in clear text. So the
1470560	1476080	Raspberry Pi that I had, it just captured it, changed the pixels, and sent it along.
1490660	1495520	You don't have to do it as every single packet goes by, because it just opens a TCP channel. So
1495520	1499760	you just kind of pretend, you know, as a classic man of metal tech, just gobble up all the data,
1499760	1505660	process it in your own time, take a minute or two, and then pass it along. Yeah.
1507200	1512200	Okay. So if anybody wants to come to the AI Unwind, you can play with the
1513000	1516700	little tool that I made and check it out and speak with me. All right. Thank you.
