1 00:00:01,760 --> 00:00:09,220 entitled cracking nets of phone and other voice over IP technologies one difference about this 2 00:00:09,220 --> 00:00:14,040 particular slides that you have so if you need to contact me or email me after this presentation 3 00:00:14,040 --> 00:00:23,540 ask any questions please use team or at net witness calm today basically I'm going to show 4 00:00:23,540 --> 00:00:30,880 to you that even though we are going to extremely digital these days I mean you probably have voice 5 00:00:30,880 --> 00:00:36,480 over IP in your home the one thing you need to know is you're not safe from wiretap just because 6 00:00:36,480 --> 00:00:41,020 it's the latest and greatest technology it's all digital and one thing I'm going to show you today 7 00:00:41,020 --> 00:00:48,800 is actually you can capture over the network and you can also capture reconstruct reassemble and 8 00:00:48,800 --> 00:00:53,440 replay voice over IP we're going to try to do I'm going to show you 9 00:00:53,440 --> 00:00:53,520 you 10 00:00:53,520 --> 00:00:58,440 a good equation for doing up we're going to try to do it anyway I couldn't get the audio to exactly 11 00:00:58,440 --> 00:01:04,380 work I don't have a direct feed but I'm going to try anyway to hold the mic up to the to the laptop 12 00:01:04,380 --> 00:01:09,100 and we'll see if that works or not out of this presentation is if you're at home you have your 13 00:01:09,100 --> 00:01:14,240 voice over IP or maybe you're at work you might want to be scared if you see the unmarked white 14 00:01:14,240 --> 00:01:21,980 van parked outside because they're still going to be able to on this is net to phone when you dial 15 00:01:21,980 --> 00:01:23,200 out this is 16 00:01:23,520 --> 00:01:24,280 from a packet capture 17 00:01:24,280 --> 00:01:31,320 when you hit the dial button on the next phone application this is the packet that gets sent out if you 18 00:01:31,320 --> 00:01:38,420 look in the red part Martin red that's actually the encoded phone number so it's not past in clear 19 00:01:38,420 --> 00:01:47,300 text and it's actually very easy to decode the phone number it took me a few hours but after doing a 20 00:01:47,300 --> 00:01:53,500 few operations the phone number eventually popped out and I'm going to go ahead and see what's going on 21 00:01:53,500 --> 00:02:02,540 and present the equation for that. Unfortunately, Netaphone got to me before I could present 22 00:02:02,540 --> 00:02:09,140 this. So I was on the phone yesterday with Vice President of Architecture at Netaphone 23 00:02:09,580 --> 00:02:16,660 and he informed me that this is proprietary information and therefore protected by law. 24 00:02:16,660 --> 00:02:23,560 So, we're not going to be able to show you this extremely simple operation to expose 25 00:02:24,480 --> 00:02:41,540 the phone number. So, moving on, I just had a PowerPoint malfunction, I'm sorry. So, we're 26 00:02:41,540 --> 00:02:46,220 going to go right into how to capture and replay voice over IP. 27 00:02:46,320 --> 00:02:46,640 So, we're going to go right into how to capture and replay voice over IP. 28 00:02:47,580 --> 00:02:52,520 Most voice over IP products do use what's called RTP. That's the real-time protocol. 29 00:02:52,700 --> 00:02:57,760 It's very simple. You're looking at the header. This is what's at the beginning of every RTP 30 00:02:57,760 --> 00:03:04,080 packet. And there are two things that we are interested in. The first one being the payload 31 00:03:04,080 --> 00:03:11,240 type. The payload type is going to tell you what audio codec was used and thusly that's 32 00:03:11,240 --> 00:03:16,620 what you're going to use to uncompress and replay the audio. Now, most of them are pretty 33 00:03:16,620 --> 00:03:16,640 simple. Some of them are pretty simple. Some of them are pretty simple. Some of them are 34 00:03:16,640 --> 00:03:21,460 pretty standard these days. I've seen on a lot of different products outside of Net-to-Phone. 35 00:03:22,020 --> 00:03:28,660 They use the common ones like ULAW or ADPCM or G.723. And these have all been defined 36 00:03:28,660 --> 00:03:34,720 by the standard. They're all static mappings based on this payload type. There are a dynamic 37 00:03:34,720 --> 00:03:41,040 range within the payload type that is only available to the vendor. The vendor can use 38 00:03:41,040 --> 00:03:46,580 whatever they want to use. In that case, you would just have to try various codecs or go 39 00:03:46,580 --> 00:03:52,720 contact the vendor and be able to get their uncompression algorithm and apply it to it. 40 00:03:53,140 --> 00:03:57,340 So but, usually, they use ‑‑ most of the products use some of the standard ones 41 00:03:57,340 --> 00:04:02,480 that are available to you. Now, the other thing that's important is the timestamp. Now, 42 00:04:02,480 --> 00:04:07,660 the timestamp's important because in Voice over IP communications, you do not transmit 43 00:04:07,660 --> 00:04:14,820 silence. So, in order to actually do a replay of the conversation from packet capture, timestamp 44 00:04:14,820 --> 00:04:21,360 becomes important because we need to add the silence back in so there's five 45 00:04:21,360 --> 00:04:26,120 steps here to do this and this can be done from any packet capture maybe they're 46 00:04:26,120 --> 00:04:32,500 using TCP dump or something like that my my demo today was done using wind dump 47 00:04:32,500 --> 00:04:37,120 since this is a Windows machine and just capturing packets from from a net to 48 00:04:37,120 --> 00:04:43,000 phone conversation this these five steps are actually fairly generic in that they 49 00:04:43,000 --> 00:04:48,900 should work for any product that is not encrypting their RTP traffic so and I've 50 00:04:48,900 --> 00:04:53,080 tested it on a lot of different applications as well as hardware devices 51 00:04:53,080 --> 00:04:58,340 and it works fairly well so the first the five steps are we need to 52 00:04:58,340 --> 00:05:04,200 reassemble the application strings we need to decompress the audio we need to 53 00:05:04,200 --> 00:05:09,420 fill in any silence gaps adjust the starting time and then we mix and we can 54 00:05:09,420 --> 00:05:12,880 play it back through our speakers the original source 55 00:05:12,880 --> 00:05:16,720 being a packet capture we can replay that and hear the conversation unfold 56 00:05:16,720 --> 00:05:22,020 we're going to go into each five steps in detail the first one is reassembling 57 00:05:22,020 --> 00:05:27,280 the application stream and this since RTP is UDP based we're going to 58 00:05:27,280 --> 00:05:32,800 reassemble the UDP streams based on the IP port IP port combination I want to 59 00:05:32,800 --> 00:05:37,360 basically create two linked lists I want to capture all the packets that are going 60 00:05:37,360 --> 00:05:41,220 to the server and then likewise I want all the packs coming back from the 61 00:05:41,220 --> 00:05:42,860 server so I hear so I have a lot of packets that are going to the server and then likewise I want all the packs coming back from the server so I hear so I have 62 00:05:42,880 --> 00:05:47,440 both sides of the conversation there and I can manipulate it so we're going 63 00:05:47,440 --> 00:05:51,340 to end up with two linked lists two streams and we're going to work from 64 00:05:51,340 --> 00:05:56,860 there and then the second step once we have those linked lists we're going to 65 00:05:56,860 --> 00:06:00,520 decompress we're going to go through each packet in that list we're going to 66 00:06:00,520 --> 00:06:04,860 look at that payload type to see what codec was used and then we're going to 67 00:06:06,200 --> 00:06:12,420 decompress it now in this example the payload type was four so four means G 68 00:06:12,880 --> 00:06:17,980 723 so we have called that codec to do the decompression and now our linked 69 00:06:17,980 --> 00:06:21,860 lists are two linked lists are filled with uncompressed audio and we can move 70 00:06:21,860 --> 00:06:25,700 on from there now if you're a Windows developer they actually make it rather 71 00:06:25,700 --> 00:06:32,680 easy you can just use the ACM API the audio codec the codec manager and it'll 72 00:06:32,680 --> 00:06:35,840 you'll be able to query any codecs that are installed on your computer and be 73 00:06:35,840 --> 00:06:42,440 able to do this all right the next step is we need to fill in those silence gaps 74 00:06:42,440 --> 00:06:48,120 since voice over IP doesn't transmit the silence now the time stamp is a 75 00:06:48,120 --> 00:06:54,440 little kind of vendor specific because the the RFC doesn't really tell you 76 00:06:54,440 --> 00:06:59,420 anything other than this is for the vendor to use as a timestamp it could be 77 00:06:59,420 --> 00:07:05,280 in any time interval in my example I'm just choosing milliseconds but it really 78 00:07:05,280 --> 00:07:09,840 it's up to the vendor to choose any time interval they want the first packet can 79 00:07:09,840 --> 00:07:12,420 start at any arbitrary number so that doesn't 80 00:07:12,440 --> 00:07:16,000 really tell you anything either so really the only information you can get 81 00:07:16,000 --> 00:07:20,500 out of this is the differences between each packet the differences in time 82 00:07:20,500 --> 00:07:24,480 between each packet and that's important then the first thing you need 83 00:07:24,480 --> 00:07:30,200 to do is you cycle through that linked list and you find the minimum number the 84 00:07:30,200 --> 00:07:34,940 minimum time interval and we're going to use that value and once we find it in 85 00:07:34,940 --> 00:07:39,480 this example you see 300 milliseconds was the minimum time interval between 86 00:07:39,480 --> 00:07:40,140 packets 87 00:07:42,440 --> 00:07:46,340 you look forward at the first packet between the first and second packet we 88 00:07:46,340 --> 00:07:51,620 noticed that 600 was there so what we have there is a missing packet we either 89 00:07:51,620 --> 00:07:56,420 missed it or there was silence and it wasn't transmitted so based on that we 90 00:07:56,420 --> 00:08:01,160 know we need to add in one packet of silence likewise between the second and 91 00:08:01,160 --> 00:08:05,300 third packet there you see we have a time interval increase of 900 whatever 92 00:08:05,300 --> 00:08:11,060 900 is and that tells you since 300 is the minimum between packets and it's 93 00:08:11,060 --> 00:08:12,360 always a multiple by the way 94 00:08:12,440 --> 00:08:18,340 300 is the minimum that means we need to insert two more so the end result in 95 00:08:18,340 --> 00:08:23,580 this example is we're adding in those packets to put in the silence otherwise 96 00:08:24,280 --> 00:08:30,360 if you were to play back this stream all you would hear is non-stop talking there 97 00:08:30,360 --> 00:08:34,260 would never be a break so that's important to do especially when you're 98 00:08:34,260 --> 00:08:39,140 going to do what we're doing and mixing both sides both streams together so that 99 00:08:39,140 --> 00:08:40,300 you hear the full conversation 100 00:08:43,280 --> 00:08:47,860 we're not done yet even though we have padded everything we got all the silence 101 00:08:47,860 --> 00:08:54,800 gaps filled in we need to adjust the late sending stream and what I mean by 102 00:08:54,800 --> 00:08:59,420 that is in if you do a capture of RTP typically you're going to see one side 103 00:09:00,280 --> 00:09:05,040 transmitting before you see the other side coming back to you so there is a 104 00:09:05,040 --> 00:09:10,060 time lag between those two streams and we need to adjust for it otherwise when 105 00:09:10,060 --> 00:09:12,240 we do the mix of the both of both streams 106 00:09:12,440 --> 00:09:18,140 to hear the conversation you're going to find everything's out of sync the 107 00:09:18,140 --> 00:09:21,440 streams would be in sync individually played but when you try to mix them 108 00:09:21,440 --> 00:09:24,460 together you're going to find that people are talking over each other and 109 00:09:24,460 --> 00:09:27,420 you're not going to be able to understand the conversation very well so 110 00:09:27,420 --> 00:09:33,060 what we do in this example you can see we have our stream on our stream to we 111 00:09:33,060 --> 00:09:38,260 notice that the first packet we capture is two seconds was seen two seconds 112 00:09:38,260 --> 00:09:42,420 after the first stream so what we're going to do is we're going to go ahead and 113 00:09:42,440 --> 00:09:48,020 what we need to do at that point is to fill in put in a little silence at the 114 00:09:48,020 --> 00:09:52,180 beginning of the late starting stream which is stream two since we noticed the 115 00:09:52,180 --> 00:09:57,420 first packet was two seconds after so we compare those and we figure out how 116 00:09:57,420 --> 00:10:00,680 many how much silence we need to add and we go ahead and we add that to the 117 00:10:00,680 --> 00:10:07,660 second stream so where we're at right now we've just we've got our reassembly 118 00:10:07,660 --> 00:10:11,940 of all our packets we decompressed all the audio we filled in the silence gaps 119 00:10:12,440 --> 00:10:17,120 in between all the packets in our link list and now we've just adjusted the 120 00:10:17,660 --> 00:10:21,320 starting time of one of the streams so that both streams should now 121 00:10:21,320 --> 00:10:25,620 theoretically if I played them both at the same time you should be able to hear 122 00:10:25,620 --> 00:10:30,160 the conversation unfold fairly well and you should be able to hear someone 123 00:10:30,160 --> 00:10:35,240 talking and then someone responding and it should mix together very well and 124 00:10:35,240 --> 00:10:40,120 that's exactly what this final step is we're going to just mix it mixing two 125 00:10:40,120 --> 00:10:42,420 uncompressed audio streams together is going to make sure that the audio is 126 00:10:42,420 --> 00:10:47,100 a rather simple operation in fact you're just going to be adding either the 127 00:10:47,100 --> 00:10:52,860 8-bit or 16-bit quantities together to produce one single stream that will 128 00:10:52,860 --> 00:10:56,960 play back either through your speakers or you could save it off to a file save 129 00:10:56,960 --> 00:11:00,680 it off as a WAV file it's just uncompressed audio at this point and you 130 00:11:00,680 --> 00:11:09,260 could play that back so that's the entire algorithm how law enforcement 131 00:11:09,260 --> 00:11:12,400 could be sitting outside your house capturing a lot of audio and you could 132 00:11:12,420 --> 00:11:16,960 use your internet traffic your voice over IP traffic and then replaying it 133 00:11:16,960 --> 00:11:21,160 back later when they haul you off to court for whatever you guys did I'm not 134 00:11:21,160 --> 00:11:27,800 asking but now I've got a demo of the actual equation I actually worked for on 135 00:11:27,800 --> 00:11:33,220 a product called NetWitness and I'm going to show you basically how this was 136 00:11:33,220 --> 00:11:39,200 implemented and you can hear hopefully for yourself how it sounds again we 137 00:11:39,200 --> 00:11:41,380 didn't get the direct link so 138 00:11:42,520 --> 00:11:51,740 it's questionable. Now the first thing I want to show you is not the RTP stream, but I'm going to show you the net-to-phone dial-up connection. 139 00:11:52,380 --> 00:11:59,740 This is when you click the dial button, and right here, you know, this is the block that I was pointing out before. 140 00:12:00,200 --> 00:12:06,760 This is just a hex dump of the first two packets we see, and that's actually where the encoded phone number was, 141 00:12:06,760 --> 00:12:14,720 and you can see up here, that's the actual digits that I dialed. So the equation I can't tell you about, it does work. 142 00:12:15,060 --> 00:12:23,000 Please don't call that phone number. It's some Jamaican guy. I just made it up. Probably wouldn't be happy if everyone called him. 143 00:12:27,840 --> 00:12:35,580 All right, now for the good stuff, hopefully. This is the RTP stream. This was step one. This is where we had to reassemble. 144 00:12:35,580 --> 00:12:41,500 The packets, and you can see the two IP addresses involved here and the two port numbers. 145 00:12:42,080 --> 00:12:49,400 And basically, we have about 2,000 UDP packets that are in our link list that I was describing. 146 00:12:49,700 --> 00:12:56,760 And now we're going to go ahead and perform the other operations and replay the audio. So let's hope it works. 147 00:13:05,580 --> 00:13:05,860 Hello? 148 00:13:06,680 --> 00:13:09,940 Hey, Scott, it's Todd. I'm calling you with NetDefone right now. 149 00:13:10,740 --> 00:13:12,920 Oh, sounds like a regular phone call to me. 150 00:13:13,600 --> 00:13:16,220 Yeah, I wanted to see if you're going to DEF CON this year. 151 00:13:16,920 --> 00:13:19,040 It's in Vegas, isn't it? Of course I'm going. 152 00:13:19,880 --> 00:13:24,260 Well, guess what? I'm presenting this year, and I'm going to demo how to replay voice over IP. 153 00:13:25,400 --> 00:13:27,840 Really? What conversation are you going to use to replay? 154 00:13:28,940 --> 00:13:30,300 Well, I was going to use this one. 155 00:13:31,340 --> 00:13:33,060 You're capturing this conversation right now? 156 00:13:33,580 --> 00:13:33,980 Yeah. 157 00:13:34,180 --> 00:13:34,580 Okay. 158 00:13:35,580 --> 00:13:35,760 There you go. 159 00:13:36,960 --> 00:13:37,320 Hello? 160 00:13:39,040 --> 00:13:40,320 There you go. How'd that sound? 161 00:13:43,960 --> 00:13:48,660 Thanks, guys. That's all my time. I'll be outside if you want to ask me any questions. Thanks again.