1 00:00:00,000 --> 00:00:04,800 analysis platform, which is built in conjugation to Wireshark. 2 00:00:11,400 --> 00:00:12,620 A little bit introduction. 3 00:00:13,790 --> 00:00:15,260 My name is Nishant Sharma. 4 00:00:15,400 --> 00:00:17,360 I work for Pentester Academy. 5 00:00:18,420 --> 00:00:21,640 Before being a security researcher, I was a developer. 6 00:00:21,880 --> 00:00:25,260 I was developing Wi-Fi access points for enterprises, 7 00:00:25,440 --> 00:00:28,420 as well as the Wi-Fi security systems. 8 00:00:28,420 --> 00:00:31,180 I have a master's degree in InfoSec. 9 00:00:31,420 --> 00:00:34,780 And for the last couple of years, I have been presenting my research 10 00:00:34,780 --> 00:00:41,580 at Black Hat USA, Black Hat Asia, DemoLabs, HITB, and all the other venues. 11 00:00:42,340 --> 00:00:43,660 Here are my team members. 12 00:00:43,860 --> 00:00:45,040 Let me introduce them. 13 00:00:47,760 --> 00:00:48,640 Hello, everyone. 14 00:00:49,000 --> 00:00:50,500 My name is Ashish. 15 00:00:50,740 --> 00:00:55,120 I work for Pentester Academy as a senior security researcher. 16 00:00:55,900 --> 00:00:57,540 Before joining Pentester Academy, 17 00:00:57,540 --> 00:01:02,040 I've worked for law enforcement agencies as a cybercrime investigator. 18 00:01:04,260 --> 00:01:08,000 And I've been in this industry from last eight years. 19 00:01:08,280 --> 00:01:13,160 My work has been presented in Black Hat USA, Black Hat Asia, 20 00:01:14,040 --> 00:01:19,320 DEF CON USA, and this time in DEF CON China to present Wireshark. 21 00:01:21,360 --> 00:01:22,100 Hello, DEF CON. 22 00:01:22,620 --> 00:01:23,560 My name is Jeswin. 23 00:01:23,800 --> 00:01:27,280 I'm currently working as a security researcher at Pentester Academy. 24 00:01:27,540 --> 00:01:33,220 And my work has been presented at Black Hat Asia, USA, and DEF CON DemoLabs. 25 00:01:33,380 --> 00:01:35,460 And here I am to present Wireshark. 26 00:01:37,520 --> 00:01:40,700 So those of you who do not know about Pentester Academy, 27 00:01:41,280 --> 00:01:45,320 it's an online portal which is completely dedicated to security-related courses. 28 00:01:45,880 --> 00:01:48,280 As it is online and it is subscription-based, 29 00:01:48,520 --> 00:01:52,000 you can subscribe to it and you can access 40-plus of our courses 30 00:01:52,000 --> 00:01:54,200 which are completely focused on security. 31 00:01:54,860 --> 00:01:57,060 We also run attackdefense.com. 32 00:01:57,540 --> 00:02:00,760 Which is an online browser-based cyber range. 33 00:02:01,400 --> 00:02:06,280 Once you sign up for this, you can actually get access to 1,000-plus of labs 34 00:02:06,280 --> 00:02:08,440 which are spread over 65 categories. 35 00:02:09,600 --> 00:02:14,240 The reason for mentioning attackdefense here is because we even have a community section 36 00:02:14,240 --> 00:02:15,680 which is free for all. 37 00:02:15,840 --> 00:02:18,140 You guys can go and check those challenges out. 38 00:02:18,280 --> 00:02:19,360 You can play those for free. 39 00:02:20,740 --> 00:02:23,180 So now coming to the topic at hand, 40 00:02:23,720 --> 00:02:25,800 we are going to discuss Wireshark. 41 00:02:25,900 --> 00:02:27,520 But before diving into it, 42 00:02:27,540 --> 00:02:28,200 before going to the main tool, 43 00:02:28,400 --> 00:02:30,980 we are first going to cover the basics of VoIP. 44 00:02:31,400 --> 00:02:36,000 Then we will see how to recover or reconstruct the VoIP call. 45 00:02:36,740 --> 00:02:40,480 After that, we will take a look on the current state of open-source tools 46 00:02:40,480 --> 00:02:42,520 that are out there that you can use. 47 00:02:42,920 --> 00:02:46,880 And we will conclude the talk by introducing Wireshark, 48 00:02:47,000 --> 00:02:49,880 that is our contribution to the community and the field. 49 00:02:51,720 --> 00:02:53,640 When we talk about VoIP telephony, 50 00:02:54,320 --> 00:02:57,520 this is the thing that is going to eventually replace PSC. 51 00:02:57,540 --> 00:02:58,040 This is going to replace PSTN completely. 52 00:02:58,820 --> 00:03:00,620 PSTN is your classic phones. 53 00:03:00,980 --> 00:03:04,180 You know, you have your dedicated lines connected to exchanges. 54 00:03:04,720 --> 00:03:05,880 You pick up the phone. 55 00:03:05,960 --> 00:03:06,760 You dial the number. 56 00:03:07,340 --> 00:03:10,580 What it does in the back end is it reserves a circuit for you. 57 00:03:10,720 --> 00:03:13,080 And after, you know, the call is complete, 58 00:03:13,240 --> 00:03:14,960 only then the circuit is destroyed. 59 00:03:15,540 --> 00:03:17,520 Because you are reserving this circuit, 60 00:03:17,720 --> 00:03:19,640 it is not that efficient. 61 00:03:20,200 --> 00:03:23,580 Another reason why this is not the best solution 62 00:03:23,580 --> 00:03:26,080 is because when you are doing all of this, 63 00:03:26,160 --> 00:03:26,980 you have to do, 64 00:03:27,540 --> 00:03:30,100 analog to digital conversion two times. 65 00:03:30,900 --> 00:03:34,820 So because your VoIP run on IP, 66 00:03:35,060 --> 00:03:37,280 and so it can use packet switching. 67 00:03:37,600 --> 00:03:39,940 So that's the reason why most of the enterprises 68 00:03:39,940 --> 00:03:43,780 and now even telecom providers are moving toward your VoIP. 69 00:03:44,080 --> 00:03:46,460 We are not going to talk about proprietary protocols, 70 00:03:46,740 --> 00:03:51,240 but only the open source standards that are in making, 71 00:03:51,360 --> 00:03:54,140 and they are on the way to take over the industry as well. 72 00:03:54,140 --> 00:03:57,840 So we are going to talk about SIP in general. 73 00:03:57,980 --> 00:04:01,460 These are three protocols that you will learn about 74 00:04:01,460 --> 00:04:04,480 when we talk about the signaling protocols of VoIP. 75 00:04:04,620 --> 00:04:08,540 So VoIP has two major parts. 76 00:04:08,820 --> 00:04:11,680 One is the signaling, and the other one is the media carrier. 77 00:04:12,420 --> 00:04:15,140 Signaling defines when the phone will ring, 78 00:04:15,280 --> 00:04:17,120 when you will disconnect the call. 79 00:04:17,220 --> 00:04:20,080 All of that control operation is done by signaling protocol. 80 00:04:20,740 --> 00:04:22,960 The actual voice or the video, 81 00:04:23,100 --> 00:04:23,920 when you are making, 82 00:04:24,140 --> 00:04:26,940 the call is then handled by the media carrier, 83 00:04:27,180 --> 00:04:28,820 that is RTP in this case. 84 00:04:29,520 --> 00:04:32,160 So we are only going to focus on the first one here, 85 00:04:32,320 --> 00:04:36,920 that is, sorry, that is the SIP. 86 00:04:38,220 --> 00:04:40,400 And the other protocols are proprietary, 87 00:04:40,600 --> 00:04:42,760 so we are not going to talk a lot about them. 88 00:04:44,600 --> 00:04:46,940 SIP, or the Session Initiation Protocol, 89 00:04:47,280 --> 00:04:48,380 is the signaling one. 90 00:04:48,760 --> 00:04:50,160 It's a text-based protocol, 91 00:04:50,380 --> 00:04:54,020 and it supports your audio calls as well as video calls. 92 00:04:54,140 --> 00:04:55,580 So as I already mentioned, 93 00:04:55,760 --> 00:04:57,780 when we say it supports these calls, 94 00:04:58,000 --> 00:05:01,020 it is only being used for the controlling. 95 00:05:01,540 --> 00:05:04,400 It cannot carry your data or media. 96 00:05:05,000 --> 00:05:06,800 It can carry your SMSs, 97 00:05:06,800 --> 00:05:08,320 because they are text-based data, right? 98 00:05:08,420 --> 00:05:09,660 So it can work there. 99 00:05:10,400 --> 00:05:14,720 It is important to mention that SIP by default is not secure. 100 00:05:15,160 --> 00:05:17,860 It does not provide any kind of transport layer security. 101 00:05:18,340 --> 00:05:21,140 So if you want to secure your SIP communication, 102 00:05:21,360 --> 00:05:23,420 you have to use TLS with it. 103 00:05:24,140 --> 00:05:26,500 So just like you do for HTTP, right? 104 00:05:26,700 --> 00:05:30,540 You have to use SIP over your TLS. 105 00:05:32,620 --> 00:05:35,640 This is the model in which your VoIP telephony work, 106 00:05:35,860 --> 00:05:37,720 especially in SIP case. 107 00:05:38,840 --> 00:05:41,320 When you join the network or when you join the system, 108 00:05:41,500 --> 00:05:45,140 your phone will actually register to one of the servers, 109 00:05:45,360 --> 00:05:46,180 the VoIP servers, 110 00:05:46,900 --> 00:05:48,880 and that is done by using the subscribe message. 111 00:05:49,360 --> 00:05:50,880 So after that is done, 112 00:05:51,020 --> 00:05:53,800 if you want to place a call, you will be pushing 113 00:05:53,800 --> 00:05:57,600 a message to the server and then that message will be forwarded to the target 114 00:05:57,600 --> 00:06:03,200 party so that is how you will place a call when any other party want to call 115 00:06:03,200 --> 00:06:07,260 you you are going to get a notify message because you have subscribed to 116 00:06:07,260 --> 00:06:15,560 the service this is a simple floor chart of a call between two parties the first 117 00:06:15,560 --> 00:06:20,820 party when they initiate the call at an invite packet SIP invite packet is sent 118 00:06:20,820 --> 00:06:25,620 after the other party picks up it gets the acknowledge after that your media 119 00:06:25,620 --> 00:06:30,420 transfer takes place and a buy packet is sent by the party who disconnects the 120 00:06:30,420 --> 00:06:42,680 call so now these are the user agent servers which we can use any servers 121 00:06:42,680 --> 00:06:48,600 which you may like in our case we have used asterix because it's open source it 122 00:06:48,600 --> 00:06:50,800 has a very good documentation and 123 00:06:50,800 --> 00:07:00,640 that's the most popular one so and to place a call we need a soft phone or a 124 00:07:00,640 --> 00:07:05,200 hardware phone right so there are some commercial soft phones available and 125 00:07:05,200 --> 00:07:11,880 they do have a free version of that we have used micro shift to capture all the 126 00:07:11,880 --> 00:07:20,780 traffic right so and we have used asterix now so what is asterix now 127 00:07:21,760 --> 00:07:27,460 asterix now is the asterix server which will handle all the back-end stuff 128 00:07:27,460 --> 00:07:35,700 signaling and on our calling etc the free PBX will allow us to manage and 129 00:07:35,700 --> 00:07:45,040 control the asterix server using the graphical interface right to demonstrate 130 00:07:45,040 --> 00:07:50,760 different configurations we have taken the wipe traffic capture in the 131 00:07:50,780 --> 00:07:56,180 in this simple setup so this setup involves a scenario where there are two 132 00:07:56,180 --> 00:08:01,240 clients and a server and all of the void traffic is going through the server 133 00:08:02,300 --> 00:08:09,280 now when it comes to wipe setup to enforce security we can achieve that in 134 00:08:09,280 --> 00:08:14,860 different ways for example in one case we can have sip packets encrypted in 135 00:08:14,860 --> 00:08:19,560 another case we can have RTP packet encrypted so these are the four 136 00:08:20,780 --> 00:08:26,460 possible scenarios when it comes when we encounter wipe traffic analysis so the 137 00:08:26,460 --> 00:08:33,120 first one is sip and RTP where both sip as well as RTP packets are unencrypted 138 00:08:33,120 --> 00:08:40,580 the second case is sip over TLS and RTP and as the name suggests sip packets are 139 00:08:40,580 --> 00:08:46,180 sent over TLS and RTP packets are unencrypted in the third case we have 140 00:08:46,180 --> 00:08:50,760 sip packets unencrypted and SRTP is used instead of RTP 141 00:08:50,780 --> 00:08:58,020 and in fourth case we have sip packet sent over TLS and SRTP is used instead 142 00:08:58,020 --> 00:09:06,020 of RTP so we'll take a look at the first case which is sip and RTP so now 143 00:09:06,020 --> 00:09:11,380 sip as DP packets contain all of the information which is required to set up 144 00:09:11,380 --> 00:09:17,060 the RTP stream and if encryption is enabled the encryption key will also be 145 00:09:17,060 --> 00:09:18,740 present in the SDP packet 146 00:09:20,780 --> 00:09:25,880 TCP packets provide the statistics and control information of the RTP session 147 00:09:25,880 --> 00:09:34,680 and RTP packets carry the media so now wireshark has a really beautiful feature 148 00:09:34,680 --> 00:09:40,340 which allow us to analyze the flow sequence of wipe call so this is how the 149 00:09:40,340 --> 00:09:45,440 flow sequence of a wipe call between two client will look like so starting from 150 00:09:45,440 --> 00:09:50,360 the invite packet start how the call was initiated till the end of the call 151 00:09:50,780 --> 00:09:58,080 wireshark also has an option to play the wipe calls so we can easily play 152 00:09:58,080 --> 00:10:07,100 using RTP player of wireshark so as he explained if you are using sip plus RTP 153 00:10:07,100 --> 00:10:12,520 that's the simplest form that you can use there is no encryption if you have 154 00:10:12,520 --> 00:10:17,220 the packet capture your wireshark out of the box can actually reconstruct the 155 00:10:17,220 --> 00:10:20,160 call you can play the call so you know life is good 156 00:10:20,780 --> 00:10:26,620 but what if some part of the call is encrypted so in the second scenario when 157 00:10:26,620 --> 00:10:32,720 you use a sip plus SR TP your RTP packets are now encrypted so you can 158 00:10:32,720 --> 00:10:38,160 still see the SIP packets as you can see here you can also observe the key 159 00:10:38,160 --> 00:10:44,000 that is being used by SR TP to encrypt the traffic so we are talking about the 160 00:10:44,000 --> 00:10:48,920 media traffic here so whatever you are saying whatever the video is going all 161 00:10:48,920 --> 00:10:50,760 of that is encrypted but you are able to 162 00:10:50,780 --> 00:10:56,880 see the key but the problem is in this case now your wire shard cannot decrypt it it can see the 163 00:10:56,880 --> 00:11:04,260 key but it cannot decrypt it and if you look for rtp traffic instead of getting the rtp traffic 164 00:11:04,260 --> 00:11:10,120 you are going to see the srtp traffic now the issue is when you will try to reconstruct the call 165 00:11:10,780 --> 00:11:16,920 you will get something like this so this is how an encrypted protocol will look like because 166 00:11:16,920 --> 00:11:23,560 you know the data is randomized you should not be able to make any sense of waveform from it and 167 00:11:23,560 --> 00:11:27,900 you know this is doing it pretty well we cannot tell what kind of waveform it is 168 00:11:29,080 --> 00:11:34,220 what are other configurations in other configurations you can protect your sip 169 00:11:34,220 --> 00:11:41,380 by using the tls and you can leave the rtp out right so in that case you won't be able to see 170 00:11:41,380 --> 00:11:46,140 sip packets because they are over tls right you will be able to see tls traffic a lot 171 00:11:46,140 --> 00:11:46,900 so 172 00:11:47,220 --> 00:11:54,280 now in this case even when rtp is not encrypted you are not going to see it why because your 173 00:11:54,280 --> 00:12:01,600 wireshark actually relies on sip packets to figure out which udp packets are actually the rtp packets 174 00:12:02,080 --> 00:12:07,580 so because now it cannot see the sip packets it cannot tell the difference between a normal udp 175 00:12:07,580 --> 00:12:15,660 packet or your rtp packet but in this case if you observe the traffic you will find out that from 176 00:12:15,660 --> 00:12:21,940 one port there is a lot of udp packets and if you follow the stream you should be able to make 177 00:12:21,940 --> 00:12:28,740 sense out of it once that is done you can use decode as function of wireshark and by setting 178 00:12:28,740 --> 00:12:36,840 decode as to rtp you can still recover the call there you go right so this is the proper waveform 179 00:12:36,840 --> 00:12:43,320 and if you play it it will play you will be able to see listen whatever was you know whatever was 180 00:12:43,320 --> 00:12:43,660 passed 181 00:12:45,660 --> 00:12:51,960 so this is the super case of all right you have your encrypted sip and then you have your encrypted 182 00:12:51,960 --> 00:13:01,700 srtp so in this case because you know your your wireshark will not be able to see the sip or the 183 00:13:01,700 --> 00:13:09,420 rtp it's a little hard but the possibilities when you are using tls in this case is either 184 00:13:09,420 --> 00:13:15,500 going to be one of two either your tls handshake is going to use your diffie hellman exchange 185 00:13:15,660 --> 00:13:21,900 or it is going to use your rsa based handshake that is the private and public key thing right 186 00:13:22,380 --> 00:13:29,440 so if it is using dhe dhe is pretty secure you know if you have collected a passive traffic sample 187 00:13:29,440 --> 00:13:35,440 you cannot find out the key from it because dhe protects you against eavesdropping 188 00:13:36,780 --> 00:13:41,060 but if you can do active mitm attacks you can actually target these two 189 00:13:41,060 --> 00:13:44,920 but we are not covering the active side we are only talking about the passive side here 190 00:13:45,660 --> 00:13:49,860 this diagram actually explains how dhe works i am not going to go into details 191 00:13:50,320 --> 00:13:56,860 but it is here so that you guys can refer to it later similarly you have your rsa based public and 192 00:13:56,860 --> 00:14:02,560 private key pairs which are used so our observations when we were doing all of 193 00:14:02,560 --> 00:14:08,340 these experiments were that if dhe is used there is nothing you can do because we are only seeing 194 00:14:08,340 --> 00:14:15,580 the passive traffic right we don't want to do the active attacks when rsc is being used if you have 195 00:14:15,660 --> 00:14:22,440 the private key of the server that is being used for void transaction you can actually go ahead and 196 00:14:22,440 --> 00:14:28,440 decrypt all of this and wireshark has a functionality for this but before that you have to understand 197 00:14:28,440 --> 00:14:36,880 which of the method is being used so for that if you check your tls handshake you should be able to 198 00:14:36,880 --> 00:14:43,260 see something like this or you can see here right it will tell you if it is using the diffie hellman 199 00:14:43,820 --> 00:14:44,360 similarly 200 00:14:45,740 --> 00:14:53,640 of rsa you will be able to see rsa handshake so once that is done once you use your 201 00:14:53,640 --> 00:14:59,000 wireshark to decrypt this traffic you can go ahead and decode srtp as well 202 00:14:59,680 --> 00:15:08,700 but if your srtp is not decrypted it will again look like this so this is how it will look like in 203 00:15:08,700 --> 00:15:13,600 case of rsa so this is the field from where you will be able to tell if the rsa is being used 204 00:15:13,600 --> 00:15:14,660 or the dhe 205 00:15:15,660 --> 00:15:15,780 so the srtp is showing that you have already decrypted the ssl traffic 206 00:15:15,780 --> 00:15:16,880 traffic from the ssl part so if you want to see how it looks like before performing any action 207 00:15:16,880 --> 00:15:21,680 we should be able to anticipate if it is going to succeed or not right otherwise there is no 208 00:15:21,680 --> 00:15:27,820 reason of you know doing blind experiments so if dhe is there there is nothing we can do 209 00:15:29,000 --> 00:15:35,620 so now coming to the ssl part if you guys have already decrypted ssl traffic you already know 210 00:15:35,620 --> 00:15:36,120 about it 211 00:15:36,120 --> 00:15:41,160 from the edit preference option if you look for the protocols if you go to SSL 212 00:15:41,160 --> 00:15:46,040 protocols it actually gives you an option to put a private key there if you 213 00:15:46,040 --> 00:15:51,180 do that it will decrypt the traffic for you and once the SIP is decrypted you 214 00:15:51,180 --> 00:15:57,460 can see the SITP key and by using other tools you can try to decrypt it now the 215 00:15:57,460 --> 00:16:03,040 issue is there are two tools here and I'll let my colleague explain it that's 216 00:16:03,040 --> 00:16:12,440 actually really quick mon SRTP Decrypt is a tool to decrypt SRTP stream so this 217 00:16:12,440 --> 00:16:17,060 is the github repository and now let's take a look at how we can install SRTP 218 00:16:17,060 --> 00:16:22,260 Decrypt SRTP Decrypt requires certain libraries to be pre-installed on the 219 00:16:22,260 --> 00:16:27,300 system and once we have installed these libraries we can clone the repository 220 00:16:27,300 --> 00:16:31,740 and use the make to compile it now this is a big 221 00:16:31,740 --> 00:16:33,020 limitation of SRTP decrypt 222 00:16:33,020 --> 00:16:38,400 decrypt that it do require a Linux system with build tools installed to use make. 223 00:16:39,120 --> 00:16:45,820 Once we are done with the compilation, we'll have a ready to run SRTP decrypt binary. However, 224 00:16:46,080 --> 00:16:50,960 this binary is not smart enough to figure the encryption key on its own. 225 00:16:51,160 --> 00:16:58,220 So we do require to pass the encryption key as a parameter to the tool. We can 226 00:16:58,780 --> 00:17:02,260 find the encryption key in the crypto parameter of the STP packet. 227 00:17:03,100 --> 00:17:09,940 We also have to make a note of the UDP ports which were used by the SRTP stream. 228 00:17:11,180 --> 00:17:17,320 So let's take a look at how we can use the tool. So since we already have the key and the input 229 00:17:17,320 --> 00:17:22,920 file, we can directly feed it to the binary and it will generate an output in form of hexdump. 230 00:17:23,700 --> 00:17:30,520 This is how the hexdump would look like. We can then use wireshark to import the hexdump 231 00:17:31,120 --> 00:17:32,820 and recover the RTP. 232 00:17:33,020 --> 00:17:37,760 So we do have to specify the UDP port information here as well. 233 00:17:39,080 --> 00:17:47,500 So once the import has been completed, what you'll notice here is the timestamp as well as the IP 234 00:17:47,500 --> 00:17:54,340 address, both source and destination have been modified. This is because SRTP decrypt do not 235 00:17:54,340 --> 00:18:02,900 preserve the metadata. And in SRTP decrypt, the generated hexdump did not have any SIP packets. As a 236 00:18:03,020 --> 00:18:07,980 result, wireshark is unable to figure out that a UDP packet is actually an RTP packet. 237 00:18:08,260 --> 00:18:12,460 So you'll have to manually decode UDP packets RTP packet. 238 00:18:14,380 --> 00:18:21,360 Once we have decoded the UDP packets RTP packets, we can then perform stream analysis on it. 239 00:18:22,620 --> 00:18:26,400 And if we'll try to play the decrypted call, 240 00:18:27,120 --> 00:18:32,920 what what you'll notice here is the waveform is not visible. This is again because the metadata was 241 00:18:33,020 --> 00:18:39,020 not preserved by SRTP decrypt. However, if you click on the play button, you'll 242 00:18:39,020 --> 00:18:45,760 still be able to hear the voice. So as you saw, the issue with this tool is 243 00:18:45,760 --> 00:18:51,340 first you have to need a Linux system. You have the Linux system, now you have 244 00:18:51,340 --> 00:18:55,420 to install the build tools, you have to compile it, and after that only you can 245 00:18:55,420 --> 00:19:00,020 run it. And after going through this whole tedious process, in the end again 246 00:19:00,020 --> 00:19:03,680 the metadata was not preserved. And if you are into forensics and everything 247 00:19:03,680 --> 00:19:08,200 you know, right? IP addresses and timestamp is the most important thing. So 248 00:19:08,200 --> 00:19:14,920 we cannot lose them. Another tool that we have is the libSRTP. It was created by 249 00:19:14,920 --> 00:19:20,380 Cisco. It is available, it is open source. Just like the other tool, it also needs 250 00:19:20,380 --> 00:19:25,840 you to use Linux. Once you have your Linux, you can clone it and then you can 251 00:19:25,840 --> 00:19:29,900 do the configuring, make it, and after that it is 252 00:19:29,900 --> 00:19:30,000 ready to run. So that's it. Thank you. 253 00:19:30,020 --> 00:19:35,660 ready to use. Now just like the tool that we discussed about, the SRTP decrypt, this 254 00:19:35,660 --> 00:19:41,440 tool also does not know how to decrypt it automatically. So you have to feed it 255 00:19:41,440 --> 00:19:47,120 the key. And this one is even complex than the other one, because in this one 256 00:19:47,120 --> 00:19:53,960 you have to first filter out the stream that you want to decrypt. So whenever you 257 00:19:53,960 --> 00:19:58,920 are placing a VoIP call, whenever you are calling someone, there are always two 258 00:19:58,920 --> 00:19:59,380 streams. 259 00:20:00,020 --> 00:20:06,100 On one RTP stream, whatever you are saying, that data will go or that audio will go. On 260 00:20:06,100 --> 00:20:11,760 the other stream, the other party, whatever he is saying, that audio will come. So in 261 00:20:11,760 --> 00:20:16,360 this case, you have to first identify which stream you want to decrypt. You have to then 262 00:20:16,780 --> 00:20:22,680 find the corresponding key, copy that, and pass that to the tool, right? 263 00:20:23,520 --> 00:20:29,040 So this is the filtering part. You filter it, you export that stream as a PCAP, and 264 00:20:29,040 --> 00:20:30,000 now you can run. 265 00:20:30,000 --> 00:20:36,520 And after doing that, it will give you output in this format that is actually text. So you 266 00:20:36,520 --> 00:20:42,580 have to again make it into a PCAP format. And for that, we are using text to PCAP tool. 267 00:20:43,040 --> 00:20:47,660 So it is converting the timestamp that is in front of the packet. That's all it is doing. 268 00:20:47,940 --> 00:20:55,360 So when you use both of these in conjugation, after that, you are able to see the SRTP decrypted 269 00:20:55,360 --> 00:20:55,680 form. 270 00:20:56,680 --> 00:20:59,920 And once that is there, you have to then again decode. 271 00:21:00,000 --> 00:21:01,880 You can record it as your RTP. 272 00:21:02,620 --> 00:21:06,180 And once you do that, you can then see the waveform. 273 00:21:07,460 --> 00:21:08,380 This, right? 274 00:21:08,700 --> 00:21:14,140 But also, in this case, you are not able to preserve the IP addresses or the timestamps. 275 00:21:14,320 --> 00:21:15,680 So that's a big no-no. 276 00:21:15,800 --> 00:21:18,960 And you already you have already seen the process, right? 277 00:21:19,100 --> 00:21:19,880 It was . 278 00:21:20,540 --> 00:21:23,260 And the idea of making this tool, the wipe shark, right? 279 00:21:23,340 --> 00:21:29,880 It came when we were working on creating a new course for our company that was based on wipe security. 280 00:21:29,880 --> 00:21:29,980 It came when we were working on creating a new course for our company that was based on wipe security. 281 00:21:30,000 --> 00:21:42,780 So we were actually using these tools and that's when we realized that there should be something which is easier than these, which can be used by other people on platform of their choice, right? 282 00:21:42,860 --> 00:21:47,260 No one should be forced to use a platform which they don't like for some reason. 283 00:21:48,180 --> 00:21:55,880 Then there are other artifacts which are important when we talk about the security in VoIP, like your DTMF, the messages. 284 00:21:55,880 --> 00:22:04,980 And then one more function that you need is the exporting call function, which is then used to analyze the call in other softwares, right? 285 00:22:05,300 --> 00:22:17,920 So if you guys don't know about the DTMF, so whenever you call your credit card company or whenever you interact with any kind of IVR system, it asks you to press 1, 2, 3 on your dial pad, right? 286 00:22:17,960 --> 00:22:19,520 So that is DTMF. 287 00:22:19,620 --> 00:22:25,680 So whenever you are pressing 2, something like this is going through the route if you're using VoIP. 288 00:22:25,880 --> 00:22:28,540 If you're using your PSTN, then obviously that's different. 289 00:22:29,580 --> 00:22:38,380 Similarly, if you send SMSs over VoIP, your SIP protocol is going to carry those and this is how it will look. 290 00:22:40,060 --> 00:22:48,280 So now if you want to export the calls and if you want to do forensics on that, you need to convert it into the waveform. 291 00:22:48,800 --> 00:22:51,420 So my colleague will explain how to do that. 292 00:22:52,900 --> 00:22:55,740 So now we want to... 293 00:22:55,880 --> 00:22:58,600 We want to convert the RTP stream to WAV format. 294 00:22:58,940 --> 00:23:05,900 So there is one online service which we can use and convert the RTP stream to WAV. 295 00:23:06,480 --> 00:23:11,720 We just need to upload our PK file and submit it for the process. 296 00:23:11,960 --> 00:23:19,400 Then it will convert the RTP stream to the WAV and we can download it on our local system. 297 00:23:19,520 --> 00:23:25,320 Then we can play it using any media player such as VLC or Audacity, right? 298 00:23:26,280 --> 00:23:30,500 So if you are more concerned about our privacy, right? 299 00:23:30,560 --> 00:23:32,920 So we don't want to upload the PK app online. 300 00:23:33,600 --> 00:23:39,140 So there is a script written in Bash, right? 301 00:23:39,240 --> 00:23:41,460 And it uses Tshark and Shock. 302 00:23:42,080 --> 00:23:44,260 And that's the GitHub link. 303 00:23:44,420 --> 00:23:45,900 It does the same job. 304 00:23:47,880 --> 00:23:50,580 And that's the tool help option. 305 00:23:53,060 --> 00:23:55,160 So we need to make sure that... 306 00:23:55,160 --> 00:23:59,960 Before we run the script, we need to install Tshark and Socks on our system. 307 00:24:00,760 --> 00:24:07,920 Then we can run the script by passing as a first argument the PK app. 308 00:24:08,080 --> 00:24:12,340 And in the second argument, we can mention the output file name. 309 00:24:13,080 --> 00:24:18,780 And if you can notice in the snapshot, there's two files generated, right? 310 00:24:18,920 --> 00:24:21,060 So that's our WAV file. 311 00:24:22,900 --> 00:24:25,140 And if you notice in the directory... 312 00:24:25,160 --> 00:24:26,020 In the directory of the script. 313 00:24:26,220 --> 00:24:28,860 So before and after running the script. 314 00:24:29,780 --> 00:24:30,940 Before we can't... 315 00:24:30,940 --> 00:24:32,280 There is only two files, right? 316 00:24:32,320 --> 00:24:33,340 Because we haven't run the script. 317 00:24:33,620 --> 00:24:37,780 So after we run the script, there is a three file has been generated. 318 00:24:38,280 --> 00:24:42,640 And we can actually play it using any media player as I just said. 319 00:24:42,840 --> 00:24:44,680 And we can actually hear the call. 320 00:24:46,080 --> 00:24:47,700 So enough of problems now. 321 00:24:47,880 --> 00:24:49,200 Let's talk about the solution. 322 00:24:49,460 --> 00:24:50,600 That's the interesting part. 323 00:24:50,720 --> 00:24:53,120 And that is our contribution to this field. 324 00:24:55,160 --> 00:24:58,460 And that's where we bring in our tool, that is WipeShark. 325 00:24:58,620 --> 00:25:02,640 As you guys can guess easily that the Wipe part came from Wipe. 326 00:25:02,700 --> 00:25:05,620 And the Shark part is taken from Wireshark. 327 00:25:05,800 --> 00:25:10,200 Because the tool is created in form of the plugins of Wireshark. 328 00:25:10,520 --> 00:25:13,400 Now there's a reason and I'm going to explain it. 329 00:25:13,460 --> 00:25:18,660 Why instead of creating a separate tool, why we chose to go with this route. 330 00:25:19,940 --> 00:25:23,080 Wipeshark can decrypt your Wipe calls whenever possible. 331 00:25:23,380 --> 00:25:25,060 So by that I mean... 332 00:25:25,160 --> 00:25:31,600 Whenever it will be able to see the decryption keys or the encryption keys in your SIP packets, 333 00:25:31,900 --> 00:25:33,280 it will automatically decrypt it. 334 00:25:33,460 --> 00:25:35,220 It can run on live traffic. 335 00:25:35,640 --> 00:25:38,460 It has GPL license just like your Wireshark. 336 00:25:39,720 --> 00:25:42,900 So now the next question is, do we really need it? 337 00:25:43,600 --> 00:25:48,900 We talked about a lot of problems and some of them were the tools that we already have. 338 00:25:49,040 --> 00:25:50,600 They are cumbersome to use. 339 00:25:50,760 --> 00:25:52,760 Not everyone can use them. 340 00:25:52,900 --> 00:25:54,240 You have to install them. 341 00:25:54,240 --> 00:25:59,540 Then you have to go through the TDS process and then you can get the decrypted stream, right? 342 00:26:00,440 --> 00:26:03,780 Another thing was these were restricted to Linux systems. 343 00:26:03,980 --> 00:26:05,040 You have to use Linux. 344 00:26:05,820 --> 00:26:12,620 Because the process was so tedious, it is more likely for the users to make mistakes. 345 00:26:13,220 --> 00:26:18,120 Because you have to select the right key, then you have to select the right stream in some cases. 346 00:26:18,800 --> 00:26:23,920 And after doing that, they were not maintaining or retaining 347 00:26:24,240 --> 00:26:28,860 your metadata, that is your IP addresses and the timestamp, right? 348 00:26:29,320 --> 00:26:34,960 Another problem with those, as you already saw, is that the input that those tools take, 349 00:26:35,140 --> 00:26:37,000 that is not live traffic. 350 00:26:37,180 --> 00:26:41,660 That is a captured PCAP that is passed to them after manual processing, right? 351 00:26:41,880 --> 00:26:44,620 So our Wireshark can do all of this. 352 00:26:45,060 --> 00:26:50,160 And that's why we think it can actually help people who are doing wipe analysis. 353 00:26:51,720 --> 00:26:53,060 Why Wireshark plugins? 354 00:26:54,240 --> 00:26:55,560 Because we all love Wiresharks. 355 00:26:55,760 --> 00:27:01,700 Whoever is there in network analysis field, he has seen it, he has used it, and he knows 356 00:27:01,700 --> 00:27:03,600 the kind of power Wireshark has, right? 357 00:27:03,820 --> 00:27:09,860 So we decided if we create other tools, just like the other tools, you have to again install 358 00:27:09,860 --> 00:27:11,760 it and then it will become platform dependent. 359 00:27:12,180 --> 00:27:16,060 And then we have to also take care, because we are dealing in packets here, right? 360 00:27:16,140 --> 00:27:21,080 So packets can be in the magnitude of thousands and even, you know, hundreds of thousands. 361 00:27:21,380 --> 00:27:23,860 So why not to use Wireshark's specialty? 362 00:27:24,240 --> 00:27:26,700 They have created Wireshark only for this purpose. 363 00:27:27,680 --> 00:27:30,600 Another reason is we want this tool to be extensible. 364 00:27:31,040 --> 00:27:35,760 So instead of going for C or any other compiled language, we chose Lua. 365 00:27:36,160 --> 00:27:38,700 Lua is a very user-friendly language. 366 00:27:39,100 --> 00:27:41,640 It's more of a scripting language with power of C. 367 00:27:42,240 --> 00:27:46,440 So if you join any scripting language that you think, like your Python or something, 368 00:27:47,540 --> 00:27:50,580 it has the power of C and it has the flexibility of Python. 369 00:27:50,740 --> 00:27:54,220 And even in case of Python, if you want to run it, you need to, you know, you have to 370 00:27:54,220 --> 00:27:55,360 run it and interpret it. 371 00:27:55,520 --> 00:28:00,500 In this case, if you are using it in Wireshark plugins, you just need to paste the plugins 372 00:28:00,500 --> 00:28:03,060 in the plugins directory in Lua itself. 373 00:28:03,380 --> 00:28:04,740 You need not to compile it. 374 00:28:04,800 --> 00:28:05,740 You need not to do anything. 375 00:28:05,960 --> 00:28:07,460 It will run out of the box. 376 00:28:08,520 --> 00:28:12,840 And because your Wireshark is OS independent, so are our plugins. 377 00:28:13,120 --> 00:28:17,160 It will run on Windows, Mac, you know, Linux, you name it. 378 00:28:17,340 --> 00:28:22,040 On any platform on which you can run your Wireshark, our system will run. 379 00:28:22,280 --> 00:28:23,380 Thank you. 380 00:28:24,220 --> 00:28:27,500 So Wireshark plugins are basically of two types. 381 00:28:28,060 --> 00:28:29,300 One is the listener one. 382 00:28:29,400 --> 00:28:30,580 Other one is the dissector one. 383 00:28:30,920 --> 00:28:33,140 We are using both in our toolkit. 384 00:28:33,680 --> 00:28:38,040 And this is how the typical dissection takes place in Wireshark. 385 00:28:38,480 --> 00:28:39,820 You pass it packet. 386 00:28:40,020 --> 00:28:41,680 It has a chain of dissectors. 387 00:28:41,940 --> 00:28:45,280 So if you have used Wireshark, you know what I'm talking about. 388 00:28:45,400 --> 00:28:49,080 Because when you get the packet, you have these layered layers there, right? 389 00:28:49,140 --> 00:28:53,540 You have Ethernet layers, then the IP layer, then the TCP, and then the above layer like 390 00:28:53,540 --> 00:28:54,020 HTTP. 391 00:28:55,580 --> 00:28:58,100 So that is what exactly is happening there. 392 00:28:58,280 --> 00:29:02,160 So first, whenever the packet is captured, it is passed to Wireshark. 393 00:29:02,320 --> 00:29:08,420 The first plug-in or the first part to get this packet is the outermost layer. 394 00:29:08,760 --> 00:29:11,280 So in this case, it will be the Ethernet. 395 00:29:11,400 --> 00:29:15,780 So Ethernet header will be processed there, and the payload will be passed down to the 396 00:29:15,780 --> 00:29:17,260 second one in the chain. 397 00:29:17,460 --> 00:29:20,640 So in this case, you are chained plug-in swap. 398 00:29:21,460 --> 00:29:23,980 So our Wireshark is also plugged. 399 00:29:24,220 --> 00:29:25,220 It will be in the chain like this. 400 00:29:25,420 --> 00:29:29,640 It takes after once your UDP and TCP parser is done. 401 00:29:30,140 --> 00:29:39,800 So from TCP and UDP parser phase, it figures out if the packet is SIP, RTP, SRTP, or SDP. 402 00:29:39,980 --> 00:29:45,340 It will pass it to the Wireshark chain, and then Wireshark will do something which looks 403 00:29:45,340 --> 00:29:46,260 very complex here. 404 00:29:46,920 --> 00:29:48,840 I'm not going to explain all of this. 405 00:29:48,920 --> 00:29:52,600 We have a detailed research paper, which will be available on the GitHub repo. 406 00:29:52,800 --> 00:29:53,980 You can go through it. 407 00:29:53,980 --> 00:29:57,060 If you are interested in knowing the internal workings, you can refer to this. 408 00:29:57,260 --> 00:30:00,080 If you have any questions, we will be reachable on mail also. 409 00:30:01,380 --> 00:30:05,540 Similarly, this is the decryption routines for SIP traffic decryption. 410 00:30:06,820 --> 00:30:09,720 And this is how you install Wireshark. 411 00:30:10,180 --> 00:30:12,000 You just go to our GitHub repo. 412 00:30:12,180 --> 00:30:15,280 You copy it and just paste it in the plug-ins folder. 413 00:30:15,740 --> 00:30:20,920 And to find the plug-ins folder, just open your Wireshark, go to the help section. 414 00:30:21,200 --> 00:30:23,960 From there, you have to go to the about Wireshark. 415 00:30:23,960 --> 00:30:24,120 And now we have installed Wireshark. 416 00:30:24,520 --> 00:30:25,080 And folders. 417 00:30:25,960 --> 00:30:28,940 So, you will find personal plug-ins folder there. 418 00:30:29,420 --> 00:30:30,840 Just open that folder. 419 00:30:31,180 --> 00:30:32,340 Put our stuff there. 420 00:30:32,480 --> 00:30:34,020 And it will work out of the box. 421 00:30:34,520 --> 00:30:37,500 Yeah, you have to restart the Wireshark, not the whole system. 422 00:30:38,860 --> 00:30:42,740 So once that is done, suppose this is your SRTP traffic, right? 423 00:30:42,840 --> 00:30:44,780 So now we have installed Wireshark. 424 00:30:45,220 --> 00:30:46,720 This is your SRTP traffic. 425 00:30:48,020 --> 00:30:49,840 Just go to edit preferences. 426 00:30:50,200 --> 00:30:53,940 So if you guys have already decrypted WiFi traffic or SSL traffic, then you can start 427 00:30:53,940 --> 00:30:59,680 you know what i'm talking about you go to edit from edit you have preferences option from there 428 00:30:59,680 --> 00:31:04,660 in protocol section you have to look for wipe shark so that is the new entry that we have created 429 00:31:04,660 --> 00:31:08,860 once you install the plugin once you copy the plugins into the folder 430 00:31:10,320 --> 00:31:17,940 and once you tick the box there so there was this little box here this one right just tick it it is 431 00:31:17,940 --> 00:31:22,640 not ticked by default because you know if you don't want to decrypt it we also don't want to 432 00:31:22,640 --> 00:31:30,780 once you do that you click ok and there you go that's all you have to do to decrypt the RTP 433 00:31:30,780 --> 00:31:38,360 traffic and after that you can actually create waveform format now coming to the other problem 434 00:31:38,360 --> 00:31:45,760 that we had we want to export the call in a popular format audio format right so that you 435 00:31:45,760 --> 00:31:51,060 can use your audacity or other tools on it so for that we have provided this option here from the 436 00:31:51,060 --> 00:31:52,620 tools menu if you go to the tools menu you can see that we have a lot of options here so for that 437 00:31:52,620 --> 00:31:59,180 go to the wipe section you will see the export a peak wipe wave option and you can export it from 438 00:31:59,180 --> 00:32:04,900 there it will ask you if you want to define a custom location or the file prefix if you don't 439 00:32:04,900 --> 00:32:10,760 then it will use the default one and then it will export all the streams that are there in the 440 00:32:10,760 --> 00:32:17,000 pcap so we have also appended IP addresses of source and destination so that you can keep track 441 00:32:22,620 --> 00:32:28,600 of all of this one more thing that we wanted to be out there was something which can provide you 442 00:32:28,600 --> 00:32:34,520 summary of your wipe traffic so suppose you are capturing this traffic on a network router or 443 00:32:34,520 --> 00:32:40,520 switch right so now you are dealing with hundreds or thousands of calls so you want to know which 444 00:32:40,520 --> 00:32:46,680 people are placing the calls which numbers are there all of that is needed right so what we did 445 00:32:46,680 --> 00:32:52,380 we also created some more plugins which will do all of that for you so this one is the DTM 446 00:32:52,620 --> 00:32:59,140 F so anyone if he was using RTP which was the unencrypted version if he has passed anything on 447 00:32:59,140 --> 00:33:06,600 DTMF it will be logged and our plugin will show it in a pop-up right similarly you have your 448 00:33:06,600 --> 00:33:12,940 extensions so these extensions are actually the numbers so this one here the extension is the 449 00:33:12,940 --> 00:33:18,920 number if a username is associated with it that will also be shown with the IP address and also 450 00:33:18,920 --> 00:33:22,140 with the user agent user agent is the software 451 00:33:22,620 --> 00:33:28,260 that you are using to place the call now this information can help attackers in all of other 452 00:33:28,260 --> 00:33:36,520 ways also right so similarly we can see how many RTP packets were transferred which can help us to 453 00:33:37,240 --> 00:33:43,220 to quantify if it is an audio call or video call or how long it was right so all of the information 454 00:33:43,220 --> 00:33:47,520 that was needed from the security perspective that's the only thing that we have covered we 455 00:33:47,520 --> 00:33:52,340 haven't gone for the basic sip then again when you 456 00:33:52,620 --> 00:33:57,800 connect to the server the sip server you have to register to the server and just to make sure that 457 00:33:57,800 --> 00:34:02,800 no one can use your extension there is this password that you have to pass so if you want 458 00:34:02,800 --> 00:34:09,160 to brute force some users password just copy this string this one is hashcat compatible so 459 00:34:09,160 --> 00:34:13,980 you can just copy it and run hashcat on it and if the password is weak it will break 460 00:34:16,240 --> 00:34:22,020 we can also see the servers or the proxies that are being used for wipe the messages the 461 00:34:22,660 --> 00:34:29,400 sms's which are which were passed and the last part of the toolkit is to detect attacks so 462 00:34:29,400 --> 00:34:33,900 suppose someone is running some attacks on your setup and you have the traffic capture you want 463 00:34:33,900 --> 00:34:39,520 to know if some of the VoIP attacks are being launched first one is the brute forcing if 464 00:34:39,520 --> 00:34:44,440 someone is trying to brute force your password our plugin can actually detect that by checking 465 00:34:44,440 --> 00:34:51,900 the number of tries in a given threshold of time similarly invite flooding can be detected so 466 00:34:52,620 --> 00:34:59,060 invite flooding is like calling someone again and again so whenever you place a call an invite message 467 00:34:59,060 --> 00:35:06,120 is sent from the caller to the callee now think about it you send the same message like thousand 468 00:35:06,120 --> 00:35:12,480 times what will happen his phone will ring he will pick the phone up he will put the phone down 469 00:35:12,480 --> 00:35:19,200 the phone will again ring so it's kind of DOS or irritation attack right so it can detect that it 470 00:35:19,200 --> 00:35:21,800 can detect the message flooding if you are spamming someone 471 00:35:22,620 --> 00:35:30,760 and it can also see if someone is trying to do active mitm on your calls on the local network 472 00:35:31,620 --> 00:35:39,560 it can also detect if any unauthenticated user is there so now we will see a little bit demo of how 473 00:35:39,560 --> 00:35:46,480 to decrypt the srtp protocol and how to export the calls using our tool can we have the demo please 474 00:35:50,360 --> 00:35:51,660 yeah so there we go 475 00:35:52,620 --> 00:36:00,780 uh first one is to decrypt the srtp traffic you have this capture here which has sip plus srtp 476 00:36:00,780 --> 00:36:06,560 traffic so if you search for sip you should be able to see the packets but when you search for 477 00:36:06,560 --> 00:36:14,840 rtp you will be able to see the srtp traffic that is the encrypted one so what we are trying 478 00:36:14,840 --> 00:36:20,860 to do here is we are trying to reconstruct the rtp stream to listen to the audio and this is how it 479 00:36:22,620 --> 00:36:29,840 is encrypted right so now what we can do in this case is from edit just go to the preferences part 480 00:36:30,640 --> 00:36:34,500 from there in the protocols we have to look for wipe shark 481 00:36:35,620 --> 00:36:43,180 so once there just tick the small box and click OK now depending on the number of packets 482 00:36:43,180 --> 00:36:52,180 wire shark will take its time and it will give you the rtp packets so now with the click of this button 483 00:36:52,620 --> 00:36:58,320 you have actually decrypted srtp and if you try to reconstruct the stream you should be able to 484 00:36:58,320 --> 00:37:04,680 see the waveform in its proper form and you can play it so that's the first part and that's the 485 00:37:04,680 --> 00:37:11,440 major contribution that we think we have done all of further is like the bonus then the second part 486 00:37:11,440 --> 00:37:20,820 of this demo is in which we are exporting the wave files for each stream so that is also very easy you 487 00:37:20,820 --> 00:37:22,420 just need to go to the tools option 488 00:37:22,620 --> 00:37:29,260 from there go to wipe all the tools all the plugins you can find there this is again asking 489 00:37:29,260 --> 00:37:34,680 you if you want to change the file prefix or if you want to change the location once that is done 490 00:37:34,680 --> 00:37:44,900 it will export all the streams to this location with the prefix provided so that was our demo all 491 00:37:44,900 --> 00:37:50,480 of these plugins will be there our research paper will be there on our GitHub repository that is this 492 00:37:50,480 --> 00:37:51,840 one it is already 493 00:37:52,620 --> 00:37:58,680 not up yet it will be up after the talk we have a tool visiting cards you can take those if you want 494 00:37:58,680 --> 00:38:01,480 and if you have any questions I will be taking those now 495 00:38:17,020 --> 00:38:21,340 any questions related to sip rtp srtp anything is welcome 496 00:38:28,200 --> 00:38:34,680 so even if you think of something after the talk here is my email ID you can drop me a mail I will 497 00:38:34,680 --> 00:38:39,960 revert to the mail I'll be happy to help you with you know whatever question you have so that concludes 498 00:38:39,960 --> 00:38:45,620 our talk thank you for coming to our talk and thank you Defcon for giving us this opportunity thanks