1 00:00:00,000 --> 00:00:03,080 I hope you are doing great and safe. 2 00:00:03,660 --> 00:00:17,840 First of all, before starting my presentation, I would like to thank the organizers, sponsors, Omar Santos and yet another security community, Yass, for their support. 3 00:00:19,800 --> 00:00:27,300 This is my honor to speak at Defcon Writing Village, and I'm really excited about this. 4 00:00:27,300 --> 00:00:41,780 So, this talk, I think, is really interesting because we are going to take a look at the mobile network, which is used by mobile operators and many other entities all around the world. 5 00:00:41,940 --> 00:00:56,400 This area of test contains many, many valuable information like user location, user unique information and phone number related data. 6 00:00:56,400 --> 00:01:10,700 The important thing in this talk is that we are going to review all possible bypassing methods because I think you may hear much about Telecom and SS7 vulnerabilities and hacking. 7 00:01:11,000 --> 00:01:18,880 So, the purposes of this talk are to address all those bypassing techniques from a Red Teamer perspective. 8 00:01:19,160 --> 00:01:22,700 If you are ready, let's get started. 9 00:01:25,410 --> 00:01:29,370 So, first I want to introduce myself. 10 00:01:29,370 --> 00:01:42,630 I'm Ali Abdullahi, a cybersecurity enthusiast with over eight years of experience in a variety of fields trying to make the world a safer place. 11 00:01:42,950 --> 00:01:48,030 I'm an instructor at Hacking9 and an active researcher and bug hunter. 12 00:01:48,050 --> 00:02:06,830 I'm a regular speaker and trainer at famous cybersecurity and hacking global conferences like COCON, TyphoonCon, Texas Cyber Summit, OAS, AppSec Days, Confidence, and this year proudly announced that I accept Red Team Village. 13 00:02:06,830 --> 00:02:11,070 I'm a speaker and trainer at Aerospace and AppSec Villages. 14 00:02:15,640 --> 00:02:30,280 As you can see, there are many security incidents and news about vulnerabilities and hacking mobile infrastructures, including protocols, communications, and interconnections. 15 00:02:30,280 --> 00:02:44,440 In the top left corner, there is news regarding attacking financial organizations and the ATM infection by exploiting SS7 protocol. 16 00:02:45,900 --> 00:02:54,940 In this case, hackers tried to intercept authorized payment phone SMS to exploit them. 17 00:02:55,560 --> 00:03:13,540 So, because one of the most usable attacks in SMS interception and spoofing, in the lower left corner, you can see a news about abusing telecom protocol to target UK Metrobank in 2019. 18 00:03:14,340 --> 00:03:24,020 In this scenario, hackers tracked and intercepted text messages to gain unauthorized access to banking accounts. 19 00:03:24,020 --> 00:03:39,720 In the top right corner, you can find another news regarding fixing SS7 and telecom vulnerabilities in US, which would be very helpful to secure the communications and subscribers' private info. 20 00:03:40,340 --> 00:03:53,700 So, the last one is news about sending tweets via SMS, which patched by Twitter to avoid unwanted and harmful tweets and combating malicious actors. 21 00:03:56,480 --> 00:04:11,860 So, now the question is that what types of attacks and vulnerabilities threaten mobile networks and subscribers and why they are important to red teamers? 22 00:04:11,860 --> 00:04:18,440 So, the first possible attack category is subscriber data leakage. 23 00:04:19,500 --> 00:04:27,680 Actually, subscriber data leakage is a vital part for red teamers to set up their next steps and scenarios. 24 00:04:27,680 --> 00:04:34,220 In this part of the scenarios, they will retrieve subscribers in C number and other stuff. 25 00:04:34,220 --> 00:04:50,860 Next one is network data leakage, which is very important for a teamer to understand what's happening inside mobile core network and what kind of devices are in place there. 26 00:04:50,860 --> 00:04:56,580 Finding mobile subscribers' location is one of the most critical issues. 27 00:04:57,780 --> 00:05:24,420 So, based on this attack, criminals can retrieve subscribers' CGI or Cell Global Identifier and convert it to MCC, Mobile Country Code, MNC, Mobile Network Code, and LAC or Lack Location Area Code and Cell ID or CID to find the actual sector which the subscriber connected to. 28 00:05:25,240 --> 00:05:31,120 Sniffing is the next scenario which points to voice and SMS interceptions. 29 00:05:31,780 --> 00:05:48,000 Spoofing is another test case, which is very interesting because if you want to take advantage of it as a red teamer, you may perform a call with fake caller ID or send a SMS via fake number. 30 00:05:48,340 --> 00:05:50,780 The last attack category is fraud. 31 00:05:50,780 --> 00:05:58,040 Red teamers can perform malicious uses to requests, call redirection, SIM card profile swapping, etc. 32 00:05:58,100 --> 00:06:01,700 to done fraud attack categories. 33 00:06:05,610 --> 00:06:11,290 Now, we are starting our bypassing journey one by one. 34 00:06:11,290 --> 00:06:17,670 So, first of all, we are going to talk about radio segment, which is the most accessible part of a mobile network. 35 00:06:17,670 --> 00:06:27,150 As you can see here, we have a big picture of radio access network or RAN in different technologies. 36 00:06:27,150 --> 00:06:38,450 BTS in 2G or GSM, NodeB in 3G or UMTS technology, and eNodeB in 4G or LTE networks. 37 00:06:38,450 --> 00:06:54,950 So, there is a connection between cell towers to the core networks and based on your traffic type, means voice or data, the data passed through to CS core or circuit switch network or packet switch network. 38 00:07:00,810 --> 00:07:05,050 In this picture, we have 5G architecture. 39 00:07:05,050 --> 00:07:17,450 Most of elements are different, but from a red teamer point of view, security flaws and opportunities in traditional technologies still available here. 40 00:07:17,590 --> 00:07:30,150 Please note that 5G has its own vulnerabilities and because of IP backbone and software usage in this generation, many other doors open to hackers. 41 00:07:35,860 --> 00:07:43,580 Now we are going to review all possible vectors for a red teamer when facing with a mobile network. 42 00:07:43,700 --> 00:07:56,380 First is mobile RAN, radio access network, so red teamer needs to be in radio field and needs to have some sort of tools like hardware and software. 43 00:07:56,380 --> 00:08:00,000 Second is signaling network or CS. 44 00:08:00,500 --> 00:08:05,400 So to do this, red teamer needs to have access to the signaling network. 45 00:08:05,500 --> 00:08:20,260 Red teamer can buy the access from dark web even or officially from telco providers all around the world or based on the contract retrieved from the network owner. 46 00:08:20,600 --> 00:08:30,620 Data network is more easier because most of attacks can perform from the internet and some of them from a signaling point. 47 00:08:35,110 --> 00:08:45,850 Okay, now we are going to review security mechanisms in radio access network or radio security. 48 00:08:45,850 --> 00:08:51,470 The first one is mobile device registration using IMEI. 49 00:08:51,810 --> 00:08:58,490 Second is enabling ciphering algorithms to fight against interception and man-in-the-middle. 50 00:08:58,490 --> 00:09:12,750 Third item is using only LTE or LTE advanced or some other advanced mobile technologies instead of traditional mobile core networks in 2G and UMTS. 51 00:09:15,060 --> 00:09:29,340 So as you can see here, this is the big picture of a radio access network and you can see it is in LTE generation, fourth generation. 52 00:09:29,960 --> 00:09:40,860 Radio access network in this technology called EUTRAN or Evolve EUTRAN and the inode beads are here. 53 00:09:40,860 --> 00:09:50,180 They are connected to each other using X2 interfaces and they are connected to the core network using S1 interfaces. 54 00:09:54,060 --> 00:09:59,800 Okay, why using IMEI policies? 55 00:10:00,980 --> 00:10:20,300 Actually to fight against phone smuggling, lawful and security monitoring, tracking stolen devices and criminals are the most usage of mobile device registration or IMEI based policies. 56 00:10:22,620 --> 00:10:42,880 Okay, now with the help of Motorola phone C115 and C118 and OSMOCOM BB software, we can set an invalid or fake or even duplicate IMEI and set up a call to test network reactions. 57 00:10:42,880 --> 00:10:47,720 So this is the bypass, the first bypass in radio access network. 58 00:10:48,880 --> 00:10:57,080 According to the screenshot here, network sends identity request to my phone and the type of identity was IMEI. 59 00:11:00,130 --> 00:11:06,290 So I replied to it using an invalid IMEI set to all zero. 60 00:11:12,390 --> 00:11:19,550 So the network accepted my invalid IMEI because ciphering procedure is completed. 61 00:11:28,920 --> 00:11:50,180 So there are some types of ciphering keys like KC, SRS and random number in radio access network which harden the radio network to avoid active sniffing and they always store in HLR or HSS in core network. 62 00:11:50,480 --> 00:12:04,020 HLR or HSS as subscriber database has components called AUC or authentication center which responsible for ciphering and authentication procedures. 63 00:12:10,010 --> 00:12:21,770 To bypass and get these information, we are going to targeting AUC in HLR or HSS by abusing SS7 and signaling access as a Roman partner. 64 00:12:21,770 --> 00:12:42,590 As you can see, I sent a malicious SS7 map SAI or send authentication info to targeted core network from SS7 network to retrieve ciphering information and the network respond me via RAND, SRS and KC values in clear text. 65 00:12:49,720 --> 00:13:09,320 Another security mechanism is using advanced technologies to bring highest quality and performance, having more security and privacy in core and radio segments and other factors like voice over LTE, VoLTE, flexibility, etc. 66 00:13:15,190 --> 00:13:24,250 Okay, so let's review first round of bypassing method. 67 00:13:24,250 --> 00:13:33,630 Totally, there is a general way and it is downgrading subscribers to traditional technologies like 3G and 2G which are vulnerable. 68 00:13:33,630 --> 00:13:38,470 To perform downgrading, we need to use a signal jammer. 69 00:13:43,270 --> 00:13:45,990 Security in circuit-search network. 70 00:13:46,550 --> 00:13:57,950 There are two main security solutions in this segment of network and the first is using SMS home routing and the second one is signaling firewall. 71 00:14:01,380 --> 00:14:18,540 Home routing acts as a proxy and the definition of home router is to hiding subscriber EMC number which is very valuable information to perform other hacking scenarios from a red teamer perspective. 72 00:14:18,540 --> 00:14:30,180 As you can see, red teamer requests to receive EMC number from HLR HSS and the HSS responds with real value. 73 00:14:30,180 --> 00:14:34,380 However, home router changes the value with a fake one. 74 00:14:39,920 --> 00:14:46,040 So, the main issue is that how we can detect if home routing is enabled or not. 75 00:14:46,920 --> 00:14:56,340 Just need to send two or more malicious SS7 messages like send routing info for SM or SRI for SM. 76 00:14:56,480 --> 00:15:02,880 If you receive different responses, it means that SMS home routing is in place. 77 00:15:03,520 --> 00:15:24,780 As you can see here, red teamer or our tester sends two different messages or the same message two times and responses are different as you can see. 78 00:15:24,780 --> 00:15:38,980 And the main issue is SMS router here because in both cases, HLR HSS responds with a real number. 79 00:15:38,980 --> 00:15:43,640 However, SMS router changes the actual value. 80 00:15:47,800 --> 00:15:55,860 In telecommunications, we have three types of GTs or global title which act as IP address. 81 00:15:56,080 --> 00:16:03,000 MSISTN consists of MCC or Mobile Country Code, NDC and SN. 82 00:16:03,220 --> 00:16:09,900 EMC consists of MCC, MNC or Mobile Network Code and MSIN. 83 00:16:09,900 --> 00:16:14,260 MGT consists of MCC, NDC and MSIN. 84 00:16:14,260 --> 00:16:27,600 As you can see, red teamer can use MGT number and a valid random EMC number to request other information regarding the targeted mobile number and it's really easy. 85 00:16:33,890 --> 00:16:35,510 Signaling firewall. 86 00:16:35,970 --> 00:16:43,390 Mobile operators use signaling firewall to protect their signaling infrastructure. 87 00:16:43,390 --> 00:16:48,410 Signal packet inspection, filtering, white and blacklisting. 88 00:16:57,080 --> 00:17:00,280 Bypassing signaling firewall. 89 00:17:00,280 --> 00:17:06,360 So to bypass these kind of firewalls, we need just to play with TCAP. 90 00:17:08,280 --> 00:17:10,120 What is TCAP? 91 00:17:10,120 --> 00:17:15,900 TCAP is a SS7 sub-protocol and it's like TCP. 92 00:17:15,940 --> 00:17:32,080 TCAP enables the deployment of advanced intelligent network services by supporting non-circuit related information exchange between signaling points using the SSCP connectionless service. 93 00:17:32,280 --> 00:18:00,600 TCAP provides the framework to retrieve information or invoke remote operations that offers the means for end users in the SS7 network to query another end office and act as the software interface between an SS7 point and database services in order to obtain data from the SS7 network. 94 00:18:10,900 --> 00:18:21,900 To perform bypassing, we need to remove application context name from TCAP or sending double operation message. 95 00:18:22,960 --> 00:18:33,020 The application context name or ACN is used for all supported ITU TCAP messages except abort message. 96 00:18:33,020 --> 00:18:37,720 No attempt to retrieve the ACN is made for abort messages. 97 00:18:37,720 --> 00:18:52,400 All other supported messages may have a dialogue portion containing dialogue request, unidirectional dialogue, and dialogue response PDU from which the ACN is retrieved. 98 00:18:52,460 --> 00:18:59,900 If no dialogue portion is detected, then the ACN is assumed to be none. 99 00:18:59,900 --> 00:19:09,320 The TCAP opcode based routing feature attempts to find the opcode in all supported TCAP messages except abort. 100 00:19:11,680 --> 00:19:24,900 These messages must contain invoke or return result, stand for last or not last as the first component. 101 00:19:24,900 --> 00:19:28,300 If not, the opcode is assumed to be none. 102 00:19:29,500 --> 00:19:38,060 So, removing application context name from TCAP message. 103 00:19:38,060 --> 00:19:49,200 To start the procedure, we need to remove dialogue request section from all malicious SS7 messages. 104 00:19:50,320 --> 00:20:01,380 Then, there will not be application context name to point to malicious SS7 map message or mobile application part message. 105 00:20:07,190 --> 00:20:13,810 So, this is the second bypassing method, sending double operation message. 106 00:20:15,940 --> 00:20:20,180 Actually, most of signaling firewall block or accept 107 00:20:24,290 --> 00:20:27,050 a message based on message type. 108 00:20:27,470 --> 00:20:33,330 So, each signaling message has its own opcode and it's a vital number. 109 00:20:43,190 --> 00:20:51,510 According to the picture, Red Team is trying to put a legitimate SS7 map message opcode in the first step. 110 00:20:52,470 --> 00:20:55,730 So, it seems a legitimate one. 111 00:20:55,870 --> 00:20:59,830 And then, put a malicious SS7 map message. 112 00:21:02,320 --> 00:21:10,240 So, signaling firewall check just the first operation code which is pointing to a legitimate operation. 113 00:21:15,520 --> 00:21:33,200 After that, the component inside the core network reply to signaling firewall or actually our Red Teamer here in this scenario and trying to keep session which is legitimate and valid. 114 00:21:33,580 --> 00:21:38,820 And ask to send the message again. 115 00:21:38,920 --> 00:21:46,560 So, our Red Teamer says thanks and this is what he wants. 116 00:21:47,400 --> 00:21:54,080 And still, the whole session is still available and legitimate as well. 117 00:21:54,080 --> 00:22:11,670 So, HL or HSS or signaling point inside our core network will respond with real subscriber EMSI number and network information. 118 00:22:11,670 --> 00:22:16,890 And this is what actually our Red Teamer wants. 119 00:22:19,400 --> 00:22:34,660 As I mentioned, in past several years, mobile network operator and telecom providers turn against telecom and especially SS7 attacks and enable many security mechanisms. 120 00:22:35,400 --> 00:22:43,840 In this talk, I tried to explain all possible bypassing techniques in all network segments in telecom infrastructures. 121 00:22:44,060 --> 00:22:53,500 We must consider that Red Teaming is very important because in these networks, we are dealing with millions of user private data. 122 00:22:54,020 --> 00:23:03,160 Be careful that blind hardening and buying security appliances or software because they are not fair enough. 123 00:23:03,160 --> 00:23:08,940 We must have behavior analysis and continuous monitoring as complementary solutions. 124 00:23:10,640 --> 00:23:13,480 Thank you very much for your attention. 125 00:23:13,480 --> 00:23:17,200 I'm still available for any questions. 126 00:23:17,680 --> 00:23:21,980 I hope you enjoyed this talk and please in touch with me.