entitled cracking nets of phone and other voice over IP technologies one difference about this particular slides that you have so if you need to contact me or email me after this presentation ask any questions please use team or at net witness calm today basically I'm going to show to you that even though we are going to extremely digital these days I mean you probably have voice over IP in your home the one thing you need to know is you're not safe from wiretap just because it's the latest and greatest technology it's all digital and one thing I'm going to show you today is actually you can capture over the network and you can also capture reconstruct reassemble and replay voice over IP we're going to try to do I'm going to show you you a good equation for doing up we're going to try to do it anyway I couldn't get the audio to exactly 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 and we'll see if that works or not out of this presentation is if you're at home you have your voice over IP or maybe you're at work you might want to be scared if you see the unmarked white van parked outside because they're still going to be able to on this is net to phone when you dial out this is from a packet capture when you hit the dial button on the next phone application this is the packet that gets sent out if you look in the red part Martin red that's actually the encoded phone number so it's not past in clear text and it's actually very easy to decode the phone number it took me a few hours but after doing a few operations the phone number eventually popped out and I'm going to go ahead and see what's going on and present the equation for that. Unfortunately, Netaphone got to me before I could present this. So I was on the phone yesterday with Vice President of Architecture at Netaphone and he informed me that this is proprietary information and therefore protected by law. So, we're not going to be able to show you this extremely simple operation to expose the phone number. So, moving on, I just had a PowerPoint malfunction, I'm sorry. So, we're going to go right into how to capture and replay voice over IP. So, we're going to go right into how to capture and replay voice over IP. Most voice over IP products do use what's called RTP. That's the real-time protocol. It's very simple. You're looking at the header. This is what's at the beginning of every RTP packet. And there are two things that we are interested in. The first one being the payload type. The payload type is going to tell you what audio codec was used and thusly that's what you're going to use to uncompress and replay the audio. Now, most of them are pretty simple. Some of them are pretty simple. Some of them are pretty simple. Some of them are pretty standard these days. I've seen on a lot of different products outside of Net-to-Phone. They use the common ones like ULAW or ADPCM or G.723. And these have all been defined by the standard. They're all static mappings based on this payload type. There are a dynamic range within the payload type that is only available to the vendor. The vendor can use whatever they want to use. In that case, you would just have to try various codecs or go contact the vendor and be able to get their uncompression algorithm and apply it to it. So but, usually, they use ‑‑ most of the products use some of the standard ones that are available to you. Now, the other thing that's important is the timestamp. Now, the timestamp's important because in Voice over IP communications, you do not transmit silence. So, in order to actually do a replay of the conversation from packet capture, timestamp becomes important because we need to add the silence back in so there's five steps here to do this and this can be done from any packet capture maybe they're using TCP dump or something like that my my demo today was done using wind dump since this is a Windows machine and just capturing packets from from a net to phone conversation this these five steps are actually fairly generic in that they should work for any product that is not encrypting their RTP traffic so and I've tested it on a lot of different applications as well as hardware devices and it works fairly well so the first the five steps are we need to reassemble the application strings we need to decompress the audio we need to fill in any silence gaps adjust the starting time and then we mix and we can play it back through our speakers the original source being a packet capture we can replay that and hear the conversation unfold we're going to go into each five steps in detail the first one is reassembling the application stream and this since RTP is UDP based we're going to reassemble the UDP streams based on the IP port IP port combination I want to basically create two linked lists I want to capture all the 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 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 both sides of the conversation there and I can manipulate it so we're going to end up with two linked lists two streams and we're going to work from there and then the second step once we have those linked lists we're going to decompress we're going to go through each packet in that list we're going to look at that payload type to see what codec was used and then we're going to decompress it now in this example the payload type was four so four means G 723 so we have called that codec to do the decompression and now our linked lists are two linked lists are filled with uncompressed audio and we can move on from there now if you're a Windows developer they actually make it rather easy you can just use the ACM API the audio codec the codec manager and it'll you'll be able to query any codecs that are installed on your computer and be able to do this all right the next step is we need to fill in those silence gaps since voice over IP doesn't transmit the silence now the time stamp is a little kind of vendor specific because the the RFC doesn't really tell you anything other than this is for the vendor to use as a timestamp it could be in any time interval in my example I'm just choosing milliseconds but it really it's up to the vendor to choose any time interval they want the first packet can start at any arbitrary number so that doesn't really tell you anything either so really the only information you can get out of this is the differences between each packet the differences in time between each packet and that's important then the first thing you need to do is you cycle through that linked list and you find the minimum number the minimum time interval and we're going to use that value and once we find it in this example you see 300 milliseconds was the minimum time interval between packets you look forward at the first packet between the first and second packet we noticed that 600 was there so what we have there is a missing packet we either missed it or there was silence and it wasn't transmitted so based on that we know we need to add in one packet of silence likewise between the second and third packet there you see we have a time interval increase of 900 whatever 900 is and that tells you since 300 is the minimum between packets and it's always a multiple by the way 300 is the minimum that means we need to insert two more so the end result in this example is we're adding in those packets to put in the silence otherwise if you were to play back this stream all you would hear is non-stop talking there would never be a break so that's important to do especially when you're going to do what we're doing and mixing both sides both streams together so that you hear the full conversation we're not done yet even though we have padded everything we got all the silence gaps filled in we need to adjust the late sending stream and what I mean by that is in if you do a capture of RTP typically you're going to see one side transmitting before you see the other side coming back to you so there is a time lag between those two streams and we need to adjust for it otherwise when we do the mix of the both of both streams to hear the conversation you're going to find everything's out of sync the streams would be in sync individually played but when you try to mix them together you're going to find that people are talking over each other and you're not going to be able to understand the conversation very well so what we do in this example you can see we have our stream on our stream to we notice that the first packet we capture is two seconds was seen two seconds after the first stream so what we're going to do is we're going to go ahead and what we need to do at that point is to fill in put in a little silence at the beginning of the late starting stream which is stream two since we noticed the first packet was two seconds after so we compare those and we figure out how many how much silence we need to add and we go ahead and we add that to the second stream so where we're at right now we've just we've got our reassembly of all our packets we decompressed all the audio we filled in the silence gaps in between all the packets in our link list and now we've just adjusted the starting time of one of the streams so that both streams should now theoretically if I played them both at the same time you should be able to hear the conversation unfold fairly well and you should be able to hear someone talking and then someone responding and it should mix together very well and that's exactly what this final step is we're going to just mix it mixing two uncompressed audio streams together is going to make sure that the audio is a rather simple operation in fact you're just going to be adding either the 8-bit or 16-bit quantities together to produce one single stream that will play back either through your speakers or you could save it off to a file save it off as a WAV file it's just uncompressed audio at this point and you could play that back so that's the entire algorithm how law enforcement could be sitting outside your house capturing a lot of audio and you could use your internet traffic your voice over IP traffic and then replaying it back later when they haul you off to court for whatever you guys did I'm not asking but now I've got a demo of the actual equation I actually worked for on a product called NetWitness and I'm going to show you basically how this was implemented and you can hear hopefully for yourself how it sounds again we didn't get the direct link so 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. This is when you click the dial button, and right here, you know, this is the block that I was pointing out before. This is just a hex dump of the first two packets we see, and that's actually where the encoded phone number was, 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. 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. All right, now for the good stuff, hopefully. This is the RTP stream. This was step one. This is where we had to reassemble. The packets, and you can see the two IP addresses involved here and the two port numbers. And basically, we have about 2,000 UDP packets that are in our link list that I was describing. And now we're going to go ahead and perform the other operations and replay the audio. So let's hope it works. Hello? Hey, Scott, it's Todd. I'm calling you with NetDefone right now. Oh, sounds like a regular phone call to me. Yeah, I wanted to see if you're going to DEF CON this year. It's in Vegas, isn't it? Of course I'm going. Well, guess what? I'm presenting this year, and I'm going to demo how to replay voice over IP. Really? What conversation are you going to use to replay? Well, I was going to use this one. You're capturing this conversation right now? Yeah. Okay. There you go. Hello? There you go. How'd that sound? Thanks, guys. That's all my time. I'll be outside if you want to ask me any questions. Thanks again.