Good morning, everyone. I am very honored to be able to be on the DevCon stage today. Maybe you can feel it. Just like when I first participated in DevCon many years ago, I felt that the style and culture of DevCon was very different from the academic meetings I used to attend, especially the academic meetings I attended in China. For example, there was no leadership instructions, and there was no academic support. So I mentioned in the opening video of DevCon that we really hope that DevCon can bring some new culture and ideas to China. You have also seen the translation next to it in the past two days. Of course, I did this translation myself. Our foreign speakers, their PPTs, are some of the volunteers I organized. Mainly some of our PhD students did some translation. One of the PhD students sent me his own feelings. I think at this point, we, DevCon China, have already done it. In the past few days, he has already experienced what it means to be a hacker in the process of communicating with foreign speakers. It is probably the curiosity and passion for technology, the yearning for freedom, and the pursuit of perfection. From this point of view, I think DevCon China has really achieved the integration of the hacker spirit and Chinese culture. Today, I mainly want to share with you some of the research we have done recently. From the outside, attacking the inside. Here, we mainly use the latest or already widely accepted standard It is called cross-domain, cross-domain resource sharing. The main work is done by my PhD student, Chen Jianjun. But in fact, there is also a cooperation from other units, including Jiang Jian from SIP Security, also a former student of mine, Dr. Wan Tao from Huawei Jiangda, Dr. Chen Shuo from Microsoft, Professor Warren Paxson from UC Berkeley, and Professor Yang Ming from Fudan University. Our work will be published in August this year. What is this specific work? Let's take a look at the current attack scene. The attackers' attacks on the internet are usually made by firewalls. Even a simple address conversion can make such an attack impossible. A very intuitive idea is whether it is possible to attack through the web. For example, right-wing users click on a website. This is a website attacked by hackers. Then through JavaScript, the attacker's script is loaded into the user's browser. Then the user's browser attacks the internet. Of course, if you are familiar with web security, you may be very clear. Now, browsers have restrictions on cross-border resource visits. The most common strategy is SOP, which stands for Same-Origin Policy. In the general sense of SOP, we can imagine that it restricts cross-border visits. At least you can't read resources from other sources. But just like safety, performance, and functionality, they are often a pair of contradictions. In many cases, developers still need cross-border visits. So there are all kinds of ways to get around. One of them is JSON-P, which is more common in recent years. You may have heard of it. JSON-P makes it very convenient for developers, but it also brings a lot of problems. In recent years, it has become a standard. For example, cross-border resource sharing. Now mainstream browsers have achieved this standard. And most mainstream websites already have this feature. You can say that cross-border is a feature that provides managers with cross-border visits. At the same time, it protects the security of resource sharing. But in recent research, we found that it is not as safe as it was originally designed. Because of the cross-border feature, you can access internal resources through the browser, including creating a new file, deleting some files in your file server, and even getting a share on the internal web server. In the past, there were some loopholes blocked by firewalls in the internal network. For example, there was a loophole in Strikes 2. Even if there is such a loophole in the internal network, the attacker can't get in. But now, with cross-border, such an attack may become a reality. I am a professor at Tsinghua University. As a professor, Jason Street just mentioned, I only gave one corner of the truth. The remaining three corners... Let's welcome my student, Chen Jianjun. Chen Jianjun is a Ph.D. student at Tsinghua University. He is my first Ph.D. student. He is about to graduate. His next step is to go to Berkeley for a Ph.D. He has already achieved a great success in the four top universities in the academic circle. Today, let's welcome Chen Jianjun to share with us the research on the cross-border attack on the internal network. Jianjun. It is a great honor to be here at DEVCON. I would like to share with you the article that is about to be published on User-Lead Security. I will talk about the details in four aspects. First, I will talk about the background of the web and cross-border. Then, I will talk about the security issues of the three cores. Then, I will talk about the security situation of the cores in a real website. Finally, I will talk about how to defend against such issues. First, let's look at the background of the web. Since we are talking about the security of the web, let's talk about the synchronization strategy. The synchronization strategy defines a circle. It is composed of three groups, which are the protocol, domain name and port. Generally speaking, the synchronization strategy is that it is isolated from two different circles. One circle cannot operate the data of another circle. It cannot cross-circle. For example, A.com cannot operate the data of B.com. However, this is just a misunderstanding of DOM. SOP has different restrictions on different network resources. Let's look at the details. For example, in this place, A.com wants to send a request to B.com and read the resource response of B.com. How will the synchronization strategy restrict it? It is not that it cannot be visited at all. It can be sent. A.com can send a request to B.com, but it cannot read the response. Why do I say it is a misunderstanding of DOM? It can be sent. For example, here is a simple example. A.com's HTML file is automatically submitted to B.com. It can also automatically click on the form request and send the request to B.com. This is a POST request. What kind of harm does this bring? It brings two harms. The first one is the attack of CSRF. As mentioned in the previous report, you used the login CSRF attack on my account. Let's talk about the principle of the CSRF attack. First, the victim logged into his own bank website and set a KUKA in the browser. Second, when he logged into the bank and operated the bank website, he wanted to check the information and accidentally visited the attacker's website. However, due to the restriction of the synchronization strategy, even if he visited the attacker's website, he couldn't read the information directly from the DOM. This is the restriction of the synchronization strategy. However, the request is not restricted by the synchronization strategy. The attacker can send a POST request to the bank website through his own website, through the browser operated by JavaScript. In this request, KUKA is used. KUKA will be automatically added to each request. In this way, the user's KUKA is included in the POST request. Then, when the KUKA verifies the origin of the request through the bank website, he thinks that the request was done by the victim himself. So he executed this operation and transferred the bill to the attacker's account. The second type of attack is the HTML form protocol attack. This attack means that the attacker can use the victim's browser to cross-protocol attack. For example, he wants to attack an SMTP server, an email server. First, the victim accidentally clicked a link, right? Then, the JavaScript in this link sends a POST request to the user's browser. In this POST request, the attacker can construct the body of the request to construct some SMTP commands in it. In this process, due to the strong tolerance of many services, he will ignore the unknown commands and execute the SMTP commands he knows in it. In this way, he can use the user's browser to send an email to the email server. Maybe this email server is in the user's network and can cross-network and cross-protocol attack. As we mentioned earlier, SOP has two parts. One is cross-development. It can be allowed to send, but it can't be read. It can be allowed to send, but the harm is the attack of CSF, HFPA. But it can't be read. This affects the web and limits the development of the web. Many times, the web needs a language to read other languages. For example, an e-commerce website may want to read a package information of a courier company and then track a package on its own website. How does this function work? It needs a cross-source reading information. In order to achieve this cross-source reading, but SOP doesn't allow it, the developers came up with some ad-hoc solutions. The JSONP solution was first proposed in 2005. This solution is very dangerous. JSONP brings a series of security issues. The most prominent security issue is that JSONP itself does not have an anti-counterfeiting mechanism. It can't say which website I want to visit and which website I don't want to visit. In order to solve this problem, the JSONP solution came up with CORS. In Chinese, CORS stands for cross-source sharing. It is an anti-counterfeiting mechanism that shows authorization. Its principle is to generate an anti-counterfeiting strategy to limit the scope of SOP. In 2009, this protocol was supported by all browsers. In 2014, it became W3C's standard. This is how the protocol works. It is quite simple. It is divided into three steps. For example, now the browser has loaded a Javascript from A.com. After that, Javascript will issue a cross-source request. For example, I want to issue a cross-source request to B.com. During this process, the browser will add an origin header to the request to mark that the source code is from A.com. Then the server will generate an anti-counterfeiting strategy based on the request's origin, which is called access-control-alone-origin, and put it in the corresponding header to show that I am allowed to visit A.com. After the browser sees the corresponding header, it will compare the origin of the request to see if the corresponding strategy is consistent. If it is consistent, it will allow the Javascript to be read. If it is inconsistent, it will not allow the Javascript to be read. The principle is very simple. It is divided into three steps. But Quartz also provides some more detailed control, including method, header, and credentials. Including cookies and the like. For example, here is a simple example. When XHR sends a request, it allows the user to customize the method, customize the header, and customize whether to bring a cookie. But what is the problem with this? It is too flexible. It is too flexible for the web. It may damage some applications' CSR defense. Some applications rely on the customized header to do CSR defense. So Quartz divides the request into two categories. One is a simple request, and the other is a non-simple request. A simple request can be sent directly. Just like the previous process, the request can be sent directly. It is not harmful to the server. I will go directly to the request, and then you return me the visit policy. But a non-simple request is not safe. It cannot be sent directly. It requires an additional verification operation. How to judge whether a request is simple or not? There are three conditions. These three conditions look complicated. The principle is simple. It is the white list mechanism. The request header must be in the white list. The request method must be in the white list. The content type value must also be in the white list. What if it is a non-simple request? How to do it? Since the request cannot be sent directly, I will send a preflight request first. This request is safe. There is no user-created header. It is a header built in the browser. It tells the server that I am going to send this request later. There is a dangerous request. Will you let me send it? Then the server says you can send it. Then it checks whether this strategy is allowed to be sent. Then it performs this real operation. It is equivalent to adding a part of the request process. It is divided into two parts. One is preflight. The other is a real interview. What kind of problems may arise with such a cross mechanism? Here we found three problems. The first is that it is too relaxed to send the front end. It may cause security issues. Just now we talked about the request to automatically submit a post. It has caused a huge security threat to the current web. Such as the attack of CSF and HLPA. But when CORS designed the XHR interface, it is hidden and relaxed the forwarding front end. It can give the attacker a more flexible front end and bring some new security issues. We found that using this new security front end can bring four types of attacks. The first type of attack is that it can attack the second-level protocol services of the internal network to create and delete the internal network files. It can also attack the code execution loopholes of the internal network to get the files of the internal network server. It can also attack the CSF loopholes that could not be used before. It can even speculate the privacy information of any website. These loopholes are not only the loopholes of the service end, but also the loopholes of the browser. So in March, we have... In March, we have... I can't synchronize. In March, we have reported the loopholes to the browser manufacturers. But the browser manufacturers haven't fixed it yet. We reported it to Chrome, Firefox, Safari, Edge and IE. The main problem is that it may bring some destructive effects to the current web. If it needs to be fixed, it may have side effects. So it is difficult for them to fix it. They ask us not to reveal the details of the loopholes on DiverCon China to check if our PPT is safe. So they attach great importance to this issue. We also agree with their advice. But what we can do now can't let you down. So let's play a video. Please let the staff play the video. On the left is a browser. On the right is a remote attacker. The user on the left refreshes the browser. The attacker on the right gets the server. This is the attack effect. Now let's talk about the key points of today's talk. The first one is the risk of trust. The safety issue caused by the risk of trust. The core function of the course requires a user to trust another user to share the data. Of course, this kind of trust may increase the risk of attack. A website may not have a security loop. But it has a security loop in the trust area. In this way, the attacker can use the security loop in the trust area to attack the security loop in the trust area indirectly. Here we find that there are two types of risk of trust. The first type is the HTTPS trust HTTP. HTTPS can provide confidential and complete protection for the network communication. Even if the network is not safe, it can ensure that the middleman in the network cannot read the data in it. But if an HTTPS website trusts an HTTP website, the attacker can first hijack the HTTP website. Then through the HTTP website, send a request to read the resources of the HTTPS website. Here is a diagram of the process. When the victim visits another website, the attacker enters an iframe and forces the victim to visit the HTTP example.com. Then the attacker hijacks the HTTP example.com and enters some malicious JavaScript. Then the JavaScript sends the request to the HTTPS server. The HTTPS server is obviously from the HTTP example.com. I trust it. It returns the resources. Then the attacker's JavaScript gets the content. Then it can send the content to the attacker. This is the effect of the middleman hijacking the HTTPS website. The second type of reliance, which is risky, is the reliance on other fields. For example, the reliance on all subsidiary fields. The danger of this is that a subsidiary field's CSS may affect the security of the main field. For example, we found a case here. This is mail.riu. Its main field has a very strong security defense. It deploys CSP, HTTP Owing, Cookie, to prevent this CSS and provide a loophole reward. But its subsidiary field does not deploy CSP and does not provide a loophole reward. So it is very easy to find a subsidiary field's CSS. But its main field trusts all subsidiary fields. So we found such a loophole to use this subsidiary field's CSS to read sensitive information on the main field. The second one is that it trusts the third party's domain. It may bring a security risk. As I just said, even if your domain is safe, it cannot guarantee that your information is not leaked. Because you may have a security problem with the third party's reliance. We found a case here. A Korean e-commerce website has expired its trusted domain name. The attacker can register the expired domain name to carry out the attack. The third problem is the complexity of the course strategy. We found that four types of course strategies are prone to misconfiguration. We know that the core of the course is to generate a network control strategy at the service end to guide the browser to expand the SOP limit and achieve cross-domain sharing. But if the course strategy is wrong and the generation is wrong, it may lead to the trust of an attacker to achieve the SOP bypass. As for the misconfiguration of the course, there have been a lot of research by researchers. Here we summarize the previous research and find some new cases of misconfiguration. Let's watch a video on how to bypass the SOP limit to read the information on the SOHU video website. This loophole has been broken. So it has been fixed. Let's look at the SOHU video. This is a website of Alex Top, ranked 5th in China and 14th in the world. We can see that there is only one acquisition address in the acquisition address. Right? Only one acquisition address. Then let's visit the attacker's evildoing.com. We find that it has become two acquisition addresses and can read the user's information. Let's see if it has become two user addresses. We find that it can not only read the user's information but also write information to the user's account. So this is a very serious hazard. Let's see why there is a misconfiguration of the course strategy. What may happen? First of all, the strategy of the course is that the access control alone origin allows the configuration of the value. There are two standards for the course. One is the W3C standard, and the other is the WG standard. The WG standard is a standard launched by several browser manufacturers. In the W3C standard, the access control alone origin can be an origin list, or a NOR, or a signal. But in the WG standard, it can only be a single origin, or a NOR, or a signal. And in all the browsers, all the browsers we tested followed the WG standard. That is to say, only such a configuration, a green configuration, is legal. And the other two configurations are all wrong. We found that many websites did not notice this. The issue of the origin configuration actually includes some large websites with the origin configuration. And although this configuration cannot cause security issues, it is indeed a misconfiguration. Uh... So, if a website wants to share data to multiple regions, what should it do? I just want to be able to share data to A.com and B.com at the same time. Then we must have a dynamic access control strategy. In this dynamic process, we found that in fact, security issues are very easy to occur. We have four types of security issues. The first type of security issue is... We have five types of security issues. The first type of security issue is... Many websites when configuring this configuration strategy, there is an example here, which is a configuration of NGX. Directly add this access control to this NGX. Alone origin, ATP origin. It is equivalent to reflection of any origin header. This can achieve the effect of functionality. However, the harm is that it trusts any language. It is equivalent to the SOP of the browser. It completely fails. Any language can be read directly. This configuration is also the highest in our discovery. is also the highest in our discovery. In 2016, someone did for X-top 1 million. a statistic for X-top 1 million. The result of the measurement is that there is a problem in each of the 10 websites that configure the course. that configure the course. And in our recent measurement, there is a configuration that comes out with this problem. Although this configuration does not look obvious, but in fact, it is very harmful and it is very easy to have this problem. The problem with the previous configuration is that it does not do any training. What is the origin header? What is the origin header I allow? Then there is a more advanced error method, that is, I take a look at this origin header I take a look at this origin header whether it is the origin header I want. whether it is the origin header For example, here is a configuration of NGX. Is this configuration safe? This is obviously not safe for us. It is that there is a lack of an end service at the last place. Then the attacker can add a .evil.com .evil.com to realize the bypassing strategy. The example we just demonstrated in the video is the example of the search video that made this mistake. The search video we put this loophole because the search itself does not have a safe response center we reported this loophole to them through freebuff. But they fixed this problem but did not fix it well. What is the reason for not fixing it well? The first error avoidance jumped into the second error pit. What is the second error pit? I can't see its misconfiguration. This is me on stackoverflow to see a configuration method recommended by others. I see this because the previous configuration said you do not have the example.com there is a security issue. Then I will check whether you are at the end of the example.com right? But this is also problematic. What may be the problem? The attacker can send such a attack example.com It is also at the end of the example.com But this domain can be registered by the attacker. So it is also not safe. We also reported this error pit to him. I haven't seen if it has been fixed. It was reported a few days ago. Then this did not transfer the last two types did not transfer this point. Many websites will check when they hold the origin they will use the positive expression to check. When they write the positive expression they did not transfer this point. This causes this point to be replaced by any alphabet. Because in the positive expression a point is a common match. So it can cause a security issue. We also found that there are websites that even have purple-wearing matching. We found that as long as the host from the origin is a self-proclaimed purple-wearing host, it is allowed. We talked about the five types of matching earlier. Then we will look at the second category of questions. The first one is the x-control we just talked about. There can be three types of questions in The first one is in RFC 6454 where it is defined as if a language comes from a private domain, then the query origin cannot directly show the domain. I will set it to this one. But it didn't define what is a private sensitive domain. Local documents are considered a private sensitive domain. Is there anything else? So when many websites are doing this hyper app, that is, when mixing apps, it allows this... Because the hyper app needs this ATM25 to do the interface. It will allow this... JavaScript will send a request directly from the local file. The output is a lore. It allows this lore to read. But it brings... We found that in the actual browser, this lore can be forged by any website. Through this iframe sandbox script. This means that all trustable lore websites are not safe. It is also a trustable website. The yellow one is our POC. This kind of lore example has also caused a lot of security issues in history. For example, in 2016, Facebook Messenger was discovered. Because of this trustable lore, any user can read it. And any attacker can read Facebook Messenger's chat message. The third category is... Let's see what kind of problems the signal might bring. The signal in the course allows any desire. It looks very intuitive. But it allows any desire. It is too loose. The course has another rule. The signal can't be used with Cookies. It can't be used at the same time. This means that the signal can only be shared in public. It doesn't need authentic resources. If you want to bring Cookies to visit this resource, you can't use the signal. And all browsers follow this standard. As long as you match this configuration, it is considered unsafe. It will refuse to say that this configuration is a false configuration. In the actual website, we found that many websites didn't notice that this configuration is a false configuration. Including some big websites. For example, security.harvard.edu. It is not the security department. It is the information security department of Harvard. There is still no configuration. The problem is that there is no configuration team. What is more interesting is that we found that there is a framework. Because the configuration signal and true will be wrong, the framework will take the initiative to convert the signal and true into a reflection-friendly orange. The reflection-friendly orange we mentioned earlier is very dangerous. We tested 11 mainstream frameworks. We found that there are 8. If the user directly matches the signal and true in this configuration, it will take the initiative to reflect it into a reflection-friendly orange. The fourth problem is the security problem caused by the course and cache. For example, there is a resource server, c.com. It wants to share data with a.com and b.com at the same time. If the user first visits c.com via a.com, and then c.com returns and says, I allow a.com, you are in my list. Then the user... But this response will be delayed by the middle cache. It may be a browser cache or a transparent cache in the middle. So if b.com also wants to visit the resources of c.com, but it will be detected by this cache. Then the feedback is to allow a.com to save the content before. This a.com obviously does not match the b.com issued by the request. This leads to the failure of the b.com in the later visit. This leads to a failure of the function of the course. For this kind of situation, the ATP protocol provides the VeryHeader to solve this problem. When you set up the VeryOriginHeader in the response to guide the cache, you have to drag the origin into the cache key. Of course, we found that many websites, when developing anti-cache control strategies, did not match the VeryOriginHeader. Now we have found a bunch of mis-configuration problems. Let's take a look at the real website. What kind of security problems may there be on the real website? What will the security situation be like? We are going to do a measurement in four parts. First, we select the target. We select a website with 50,000 AlexTurps as our measurement target, because it is a highly influential website. Then we extract their domain name from the 50,000 websites. We extracted 90 million domain names. The data comes from the passive DNS data provided by 360 Internet Security Union. Then we dynamically detect the configuration of the course for each domain name. Why do we have to detect it dynamically, instead of scanning it directly? Mainly because the anti-cache control strategy of the course does not return to each response directly. Because it needs to be dynamically generated. Only if your OriginHeader hits its anti-cache control strategy, will it return. If you don't have an OriginHeader, or OriginHeader does not hit its anti-cache control strategy, it will not return. So we need to take the initiative to detect it. For example, here we are going to detect if the service end has the configuration to allow NOR to visit. We set the OriginNOR in the request, and then see if it returns the access control, along OriginNOR, such a value. The result of the test is that we found that 480,000 domain names are configured to the course. Basically, it covers every website of X50,000. Among them, 130,000 are configured to have a problem, which is about 27.5%. So this problem is widespread on the Internet. This kind of... Electro 50,000 is relatively safe. Not to mention other websites that are not on this list. So how to prevent this kind of loophole? We reported all the security problems we found to the relevant manufacturers. Some manufacturers have already fixed it, such as Sohu. Some are still being fixed. For such a problem, how to prevent it? This problem is divided into two aspects. One is the overloading of the course. The other is the problem of read configuration. For overloading, we reported to the Chrome browser, Firefox browser. They haven't released the fix yet, but one of the preventive measures they want to do is to prohibit external websites from visiting the internal network. That is, cross-network is not allowed. Use the browser as a jump board to visit the internal network. As for the problem of misconfiguration, we found that... Of course, we can blame the developers for not noticing it. Of course, the developers have to bear a lot of responsibility. Another big responsibility is that the course has a lot of weird cases, such as the case of Nord. Many websites do not clearly write this standard. Many website developers do not know there is such a weird case. So it's best to clarify all kinds of security risks in this standard. And what the website manager can do is check if your course configuration has this problem. We provide a source tool, which is the course scanner. You can use this to scan a website to see if it is safe. This is a screenshot. We scanned the top 100 websites, and we found a lot of misconfiguration. You are welcome to download and use this tool. Since I used this tool, I don't find bugs every day at work. There are too many bugs, because there are too many misconfigurations. I can't handle it. So you are welcome to use this tool. You can definitely find a lot of security issues. To sum up, there are three types of problems with the course. The first one is that it may cause security issues for the internal network due to its too lenient forwarding. This is not detailed, but it is a very important contribution to our work. Maybe we will talk about this specific security issue in the next session. The second type of problem is that the course brings new people's dependence and new people's security risks. The third type is that there are a lot of corollary cases in the course. There are a lot of misconfigurations in the actual website, which brings new security issues. This is my report. Thank you.