Let's give Andrew a big round of applause and welcome him to the DEF CON stage. Thank you. Thanks so much. Wow. Yeah, not a lot of interest in this talk I can tell. I'm Andrew Brandt. Firewalls under fire, it's the story of a five-year campaign by threat actors who attack firewalls in order to access the customers and the networks that those firewalls protect. So this talk is perhaps a little less technical than you might expect from a DEF CON talk. But telling the story and its aftermath is a big part of this research. But keep your phone cameras handy. Where there's relevant research, and I wrote most of it for Sophos when I was there, I've put in QR codes that link to that. So no Rickrolls, I promise. A little bit about myself. So I do a lot of things. Today I work as the principal threat researcher for a company called Netcraft. But through the time frame of this research, I was doing that role at Sophos. I'm also helping out at Malware Village downstairs. So please drop in if you are interested in watching talks or doing workshops on learning how to do malware analysis. And I'm doing a lot of other side projects. I do tech policy. I recruit and train candidates for elected office through an organization I run called Elect More Hackers. And I maintain retrocomputing gear for the largest retrocomputing museum in North America at the University of Colorado Boulder called the Media Archeology Lab. So a little bit about the context of where XOPS is in the big scheme of Sophos. So this was the team I was the first member of at Sophos. It serves as a connection hub between teams that do malware research, EDR, MDR, incident response and security operations. So because it sits at the intersection of all of these groups, it acts as sort of internal threat intel fusion center. And it's always good to know a little bit about who's who in a story. So here's your play bill. Of course there's Sophos, but the rest of the security industry plays a supporting role as well. On the adversary list, there are several individuals, a few companies and a university based in Chengdu, the capital of China's central province of Sichuan. And of course one of the big players is this guy, the XG firewall as well as a few other firewalls. So the attacks that this research covers encompass what I call three phases or epics of activity. Beginning as far back as 2018 when Sophos itself was a victim of a cyber intrusion. The second phase begins in 2020 when a series of public attacks induces Sophos to tell the world about what they knew about what was happening. And then finally, the attacks enter a third phase in which threat actors didn't make big public splashes but targeted just a few customers at a time. By then, the attackers knew who they wanted and what they were looking for. And even though Sophos published this information last Halloween, it's important to note that attacks like these have not stopped. They continue against every major firewall vendor even today. So a big part of Sophos' response to these attacks was to reveal what the company knew as quickly as possible. We call this radical transparency and we believe it's just a natural good for the industry to talk about what's gone wrong because if you don't talk about what's gone wrong, you can't learn from it and fix it. So beginning with the first big public attack, nicknamed ASNAROC, EXOPS published five major reports that went into extraordinary detail about the methods, tooling and to the extent possible, the targeting used by the attackers. Each of these describes one or more CVEs and how the attackers used them. And then finally Pacific Rim ties them all together and contextualizes them. So Sophos called the attack campaign Pacific Rim and part of the reason for that was practical because a lot of the targeted attacks hit organizations in the Asia Pacific region. And part of it was also based on these code names that you see that security operations folks gave and assigned to each successive attack. Each of which referenced a part of the world sometimes known as the ring of fire where tectonic plates meet and earthquakes and volcanoes often form. So let's start at the very beginning with an attack called Cloud Snooper. And to start, I want to highlight this diagram. It's the coolest one I've ever seen. It was created by one of Sophos' senior threat analysts, Sergei Shevchenko. It describes an attack against an Amazon AWS cloud server using tooling that gives the attackers an ability to covertly steal information and to exfiltrate it, piggybacked on what looks like to a normal web application firewall as regular web traffic. The attackers managed to plant a root kit and a tool that inspects inbound packets onto this cloud server. When a correctly crafted packet arrives, like the wolf in sheep's clothing at the bottom left, it enters the compromised server, steals data and then retransmits the stolen data right through the same TCP connection that the packet used to enter the server, the web application firewall never knowing the difference. So the story begins, as many good stories do, with some weird stuff going on in a sales department. Sophos had recently acquired a company in India called CyberRoam whose technology would eventually become the Sophos SFOS, the operating system underlying the firewall. While still onboarding the new company, Sophos Security Operations discovers a device scanning the internal network. It turns out to be a small computer, like the one shown here, attached to the back of a TV monitor that displays a sales team leader board in their bullpen. So digging deeper, SecOps discovers that this computer contains malware, such as ghost rat, utilities to probe the internal network and a very unusual connection to a cloud server. Following this bread crumb trail, leading from the compromised computer, the security team discovers the connection to a server the CyberRoam team uses for storing sensitive information, which leads them to discover the root kit and its payload, which named itself the not at all suspicious name Snoopy. Snoopy is the deep packet inspection engine that enables the cloud Snoopy to work. It does this by doing something incredibly simple, watching for specific source port numbers of inbound packets. So source ports and TCP connections, most of you probably know, are usually ephemeral, meaning they can be completely random and they usually have no significance. But in this case, the source port is the coded instruction for Snoopy. So as I mentioned, the tool steals information. But Sergey and another analyst, Tim Easton, discovered that the Snoopy tool seems to be a work in progress. It has some broken functions. But more importantly, it isn't the only thing the team finds. Between the cloud server and the machine in the Sophos office, analysts find at least 11 different malware. Oddly, one of them is a DLL meant to run on Windows computers, even though both the cloud server and the box that was connected to the leaderboard TV run Linux. When the team disassembles the Snoopy tool, they discover that it helpfully prints out all sorts of useful debug messages in Chinese. And although the tool encrypts its C2 traffic, part of the method that it uses to perform that encryption involves hashing the value of the phrase, replace with your password. And the C2s that Snoopy communicates with seem to be named as a reference to the country TLD for Nepal. A country we know China is, has particular interest in. And a weirdly specific collegiate activity. College smooch. Sophos doesn't initially disclose this attack. About 18 months after I joined the company, Sergey brings me a write-up that describes a really interesting targeted attack that's very complex but actually doesn't tell me the target. I edit the piece, produce it for the blog, Sophos publishes it and it all happens just before the COVID pandemic changes everything in the world. Which then leads us directly into the beginning of the mass attack phase of the Pacific Rim campaign. Where instead of attacking Sophos itself, an unknown adversary begins to target Sophos firewalls everywhere. And it begins when a customer calls tech support and sends Sophos this screen shot that shows something unexpected inside their Sophos XG firewall user interface. The text in the box that's highlighted here normally should contain an address of a machine used to remotely manage the firewall. But as you can see, the box contains what looks like Linux commands to change the working directory to temp and then to retrieve something from a URL that begins with Sophos firewall update dot com. So this begins the attack that I named Asnorock. And after the initial response to nail down the attack, a postmortem analysis reveals that in fact, Sophos had been given the precise attack method one day before the attack began as a bug bounty. Seems like they wanted to get paid before someone launched the attack. So as the security operations and the engineering teams worked to devise a solution, which does receive its bounty by the way, an unknown attacker begins exploiting the bug to strike every Sophos firewall that they could find facing the public Internet. So that same day, I'm asked to help Sophos communicate the attack to the world. And three days after the attack begins, XOPS publishes the first of two blog posts linked here to describe the attack in detail. So I can't go into all of the attack detail of Asnorock because there's so much. But the attacker's little personal details and touches stood out to me. For one thing, they go to the trouble to register domains with Sophos in the name just before the attack. Then they use those domains to launch the attack, which is a SQL injection vulnerability to execute arbitrary code. That code downloads and runs a Linux script that changes the internal workings of the firewall. It also drops a payload called to own that steals local configuration data and stores it in a file called info dot XG. The attacker is either some kind of fashionista or reads urban dictionary because they encrypt the data with the password Gucci. As in, no problem dog, it's all Gucci. Sophos firewalls also have this ability to automatically apply small updates or fixes without user intervention. They get the name hot fix. A hot fix can also clean up files left behind after an update or anything else. So one thing I hadn't seen before was this thing called a dead man switch. The attacker dropped a completely empty file into the firewall and then monitored it. And if some process like a hot fix deletes that file, it triggered an action by calling a different URL, Ragnarok from Asgard, which is either a hat tip to Norse mythology or more likely a reference to the sequence of events that led to the destruction of the home city of both Marvel's supervillain Loki and his brother Thor, the legendary city of the Norse gods as depicted in the movie Thor Ragnarok, except this was a Ragnarok from Asgard. That was kind of weird. This Ragnarok in this case is a ransomware attack against any Windows computers on the land side of the firewall. So literally that's the ransomware's name. Ragnarok. The attack would leverage eternal blue and double pulsar to deploy a ransomware executable which the attackers ironically and probably not coincidentally named hot fix. And by the way, just a few months before Asnarok, an attack involving Citrix ADC servers deploys the same ransomware using almost the same method. Now, most ransomware of this era has a built‑in safety to prevent the creator or operator accidentally nuking their laptop. The safety usually prevents the ransomware from running if the computer's localization settings are set to Russian. This is the first ransomware I had seen that had added Chinese to this safety measure. Now, the good news is that the eternal blue and double pulsar exploit combo that they used only worked well against Windows 7 computers of which there were a diminishing number still running as Windows 7 end of life was in January of that year. And Windows update inoculated newer OSes against it. So the ransomware didn't ever execute as far as we could tell. The ransom note Ragnarok would drop had it executed called itself very hot fix. Okay, Ragnarok master, we get it. You know what Sophos calls its firewall patches and you're big on puns. Yuck, yuck, yuck. So Sophos gets its first big break just a week and a half after Asnarok hits. The Ragnarok from Asgard domain was hosted on a server in the Netherlands and the Dutch seized not only the domain but the physical server that the attackers controlled. Sophos asked to transfer the domain to them and they set it up as a sinkhole where they could host it and monitor everything that connects into it. That revealed something very interesting. Based on the user agent strings and other fingerprinting of those inbound connections, Sophos discovers that a bunch of different small business and home routers and firewalls of different models from different manufacturers were all connecting to this website. So it was at this point that Sophos decides it's time to strike back. So security operations engineers a tool that they call the implant or just the kernel implant. It's designed to retrieve logs and files that unexpectedly drop into the firewall's file system. And it's stealthy. It doesn't appear on the list of running processes. Only firewalls that pique the team's interest get the implant. For instance, just hypothetically, if you happen to register a new firewall to a free web mail account on 163.com and it connects back to Sophos from an IP address range that maps to central China, it might get someone's attention not like anything like that would ever happen . So security operations starts to take a closer look at some of these suspicious firewalls. The implant gives Sophos the ability to virtually look over the attacker's shoulder as they're working. When the company could deploy hot fixes to every other ‑‑ every firewall in the world other than the ones that the attackers were using. And they figure out, for instance, which firewall was the first one to deploy the ASNAROC exploit. The initial deployment happens weeks before the bug bounty and the start of the big ASNAROC attack so they drop the implant on that machine first and it immediately pays off. They discover new exploitable vulnerabilities the attacker is testing and then tests and samples of malicious code that the exploits are meant to deliver. So summer 2020 rolls around. Take yourself back. We're all locked down in our homes trying to find a way to enjoy socializing over Zoom. But another mass attack begins. The official name for this attack is the bookmark feature buffer overflow. Too long. Sophos nicknames the attack Baha. And Baha is pretty unique. Unlike with ASNAROC, Sophos sees a variety of payloads, new capabilities like the ability to wipe whole logs or delete individual lines from the logs. Attackers begin to experiment with targeting specific firewalls and by now they have apparently reverse engineered the ASNAROC hot fix repairs and found a workaround for that, too, so they're doing that again. A telemetry hunt reveals that this new exploit, new, was being tested before ASNAROC. And by this point, Sophos has gotten really good at deploying hot fixes, patching nearly all devices, but there are still a few zombie firewalls abandoned running in some closet somewhere whose admins aren't responding to e‑mails or phone calls. And dealing with this digital detritus, the bare metal equivalent of abandoned ware becomes a burdensome chore because the attackers start taking advantage of those machines. So one of the threat hunts points to not just one but a whole cluster of firewalls, some virtual machines, some bare metal, but all of which are set up, and this is the scientific technical term, weird. They also appear to have been registered with non‑corporate e‑mail accounts and normally firewalls are there to protect devices inside a LAN, but in many cases with these devices there was no LAN or anything resembling a real network. Most of the devices were registered to someone whose e‑mail address begins with GBIGMAO. I did a search for a GBIGMAO and I did find this 120‑foot tall statue that was built in Henan province a few years ago. I also found a quote from the dean of the China's Mao Zedong research center. He said to the Guardian newspaper, in contemporary China Mao Zedong represents the embodiment of fairness and justice. Which seems pretty ironic given what this GBIGMAO was doing. Is it the embodiment of fairness or justice to engage in the online equivalent of a smash and grab burglary? So as these hunts continue and the team finds more devices that seem like they are being used as exploit development platforms, they start to notice some odd behavior. One of the bare metal firewalls they are watching had previously been purchased by a professor at USC, a techie university in, you guessed it, Chengdu. This box seems to be checking into SOPHOS from IP addresses in more than one far‑flung location. Seeming to bounce back and forth instantly between Chengdu and Hong Kong 1,400 kilometers away. Now I'm pretty sure that they haven't invented a Star Trek transporter. So it looks like this person is experimenting using a network that's intermittently connected to a VPN. And one of the email addresses used to register some of the cluster starts with T Stark. So wait, Tony Stark? This guy puts himself on par with the billionaire industrialist who invented Iron Man and went on to become a Marvel superhero as his hacker handle? Stay humble, bro. At this point you have to wonder if these threat actors are more in danger from the FBI or Disney's IP lawyers. But T Stark is no slacker. The SOPHOS implant discovers a copy of the root kit on one of the firewalls he controls. Again, the SOPHOS team rapidly rolls out hot fixes that will prevent the root kit from running on any firewall but doesn't roll them out to the growing number of firewalls the team assumes is under hostile control. It seems to work because nobody ever sees this root kit deployed anywhere else. Win NTI is closely associated with a threat actor more commonly known as APT41 whose interests include industrial and other espionage. There must be something in the water in Chengdu because Chengdu appears to be a nexus for APT41 activity. Isn't that cute? There's a Win T the Pooh Malmon that was created for me by our malware village sponsor, Lena Yu. So then a week later another weird thing happens on one of the T Stark firewalls. The implant unexpectedly discovers programs that only run on Apple Mac computers and on iPhones and other iOS devices. And that Apple stuff planted on the firewall, here's another interesting story. A week and a half after Sophos finds them, the security firm Valexity publishes a report on malware that they call insomnia that they say is being used in a wider campaign that they've nicknamed Evil Eye. And get this, Evil Eye's goal is to target certain kinds of organizations that support the Uyghur diaspora. Uyghurs as a group have come under increasing oppression by the government of China. Sophos and Valexity talk, share samples, and it turns out that the Apple malware is in fact related to the ones Valexity wrote up. Except that the Sophos samples came from firewalls that were being used by organizations who support the Tibetan diaspora. Huh. I wonder what the connection is there. Okay. Last big mass attack. Near the end of 2020 someone exploits a bug on the soon to be end of life cyber room devices. Remember this is the company that Sophos bought. The exploit gets used to create a new admin level account on every cyber room device called cyber support. Sophos rushes the product to end of life, end of story. Eight months later France's ANSI cyber security agency publishes a statement attributing this cyber room attack to APT31, another China based threat actor group. So after the cyber room incident Sophos never again sees an attack on all of its products or all of its customers all at once. Every subsequent attack against an XG firewall is targeted at specific organizations and that targeting becomes increasingly narrow as time goes on. So let's jump ahead to spring of 2022. Once again Sophos gets a bug bounty submission for a pre-authentication remote code execution bug. The bounty submitter who wishes to remain anonymous claims to be located in Japan. But the IP addresses that they use in communication with the bug bounty program trace back to China. And once again the bug gets used in an attack the very next day after the bug bounty submission. This is starting to become routine. So I named this campaign personal panda because it did seem to be targeted at very specific groups or countries that are part of China's sphere of influence and also because I'm a fan of old school Depeche mode and the lyrics just kind of work. So personal panda involved two CVEs, an exploit to break into the firewall and another to use open SSL to get root. Sophos responsibly disclosed the vulnerability to open SSL and they patched it right away. But while many organizations targeted in the personal panda attacks appear to be the focus of China's so‑called belt and road initiative, some of the victimology paralleled what we saw in the evil eye insomnia attacks. So some of the payloads deployed during personal panda contained some, again, technical term, weird stuff. One thing was this bogus certificate authority cert that was forged to look like it had been signed by Fortinet. I checked with my fellow cyber threat alliance counterparts at Fortinet and they say it was definitely not theirs. Why would they do this? One might speculate laziness. Well, we went to all this trouble to hand craft this artisanal certificate for a different attack. But yeah, we'll just reuse it. But actually we don't really know why. It was just weird. That cert was embedded into a malware that was called Lib Sophos.SO. It was deployed to two firewalls that were protecting a very high‑level government office in a country in that region. And the malware could perform machine‑in‑the‑middle TLS decryption , essentially stripping the HTTPS off of web traffic so it could sniff and steal passwords. Sophos shared the sample with the U.K.'s national cyber security center and they write up their own analysis linked here and they nickname it pygmy goat, which is actually kind of deceptively cute because this pygmy goat is pretty seriously sophisticated. And as with all of these incidents, the security operation teams goes hunting to see if it was deployed elsewhere and they found the firewall. Where it was tested belongs to our old friend T. Stark. T. Stark had tested this same file, like binary equal same file, that was deployed on the Sophos customer's firewalls. And he also had an earlier build called libgoat.so, earning him a new avatar since he created the goatiest malware of all time. Meanwhile, Vellexity comes back to Sophos. They were called in to investigate this campaign which they called drifting cloud. Their investigation reveals a C2 IP address that Sophos didn't have. Pivoting that search off of that C2, Sophos finds another single firewall running something else totally unique. A Linux binary compiled from security firm Bishop Fox's sliver adversary emulation framework which is similar to MITRE's caldera or, you know, cobalt strike which everyone uses but these guys just have to be different. And the team also observes the threat actor attempt to flash UFE boot kit code onto a bare metal firewall that the threat actor controls. Kaspersky first documented this boot kit called vector EDK. The boot kit never successfully deploys and the owner never again attempts to flash it. Another incident involved a country in the region that has its own nuclear power industry. Attackers targeted firewalls protecting both their nuclear regulatory commission and their main national supplier for the nuclear energy industry. The attack led to the discovery of a new exploit which we called covert channels. And in this case the attackers had installed an array of malware and dual use tools on firewalls. The covert channel exploit works by delivering modified Java jars to firewalls. These Trojan eyes jars add back door functionality. I wrote up the attacks for the X ops blog that October. The report detailed how sec ops had found eight different malware samples on firewalls including a metasploit module, termite malware, ghost rat again, other tools and a custom Trojan written in Go. In one of the attacks the adversary embedded this malware called termite into the Trojan eyes jar and then used it to replace an existing jar with the same name that was on the firewall. Termite is devious. It scrapes stored credentials that are stored locally in the firewall and then attempts to access internal domain controllers by reusing those captured credentials to try to log in. It marks a turning point because this was the first time the team had seen attackers probe civilian infrastructure because it was water and power utilities that these firewalls were protecting. Covert channels attacks were also notable for their variety. In spring 2023 a threat actor targeted a government‑owned supply company in the region. The attack left behind a socks proxy server, Linux executable password sniffers and a rat. And to illustrate this I put a couple of pictures of rats in socks. A threat actor in a May 2023 attack gained persistence and kind of a boring tool. It was just a really simple web shell. But they used a really interesting technique. This tool called PLT hook. The attacker uses the tool to put the remote shell into a file system partition that's usually reserved for storing the firmware updates during a firmware upgrade so they don't get wiped out. Sec ops later finds a binary equal copy of this tooling on a firewall known to be controlled by a threat actor that was already under surveillance. And this is where the Pacific Rim story ends. Not because the attacks ended, but because Sophos needed to find a place to stop. Which necessarily raises the question, where do we as an industry, as a nation, go from here? ASNAROC and the attacks that followed did lasting harm. Not all firewalls could be fixed. After ASNAROC the FBI put out this notice asking the public for its help finding the people behind that first mass attack. In the Pacific Rim appendix, sec ops curated a list of 206 serious firewall vulnerabilities through 2023. The CVSS score for 92 of them, 44 percent, have a strong score of 9.8 or higher. Increasingly these firewalls are being turned into relays, ORBs or operational relay beacons used to route traffic so attacks appear to come from somewhere else. So let that sink in for a second. The adversaries are using our own firewalls to conduct our attacks, to conduct attacks against us. And if it seems like things are accelerating, it's because by every measure they are. This isn't even a complete list of just the major incidents in the past month. Even this week news was breaking about another possible zero day in a firewall device being used to deploy ransomware. 130 new CVEs per day and 80 percent year over year rise in the known exploited vulnerabilities. More than half of which are just from this year. And it's only August. There's four more months of this to go. This problem isn't new. In 2022, my former colleague, Kristen Del Rosso, compared the raw number of known bugs in CVE to China's CNVD and found that the Chinese repository seemed to contain more entries overall. But she struggled to do this research because over and over and over again she found herself blocked from conducting this comparison, being locked out of connecting to the website. So we did some OSINT and it revealed mailing list posts made eight years earlier by someone using a particular handle, GBIGMAO. And this GBIGMAO has the same fixation with firewall vulnerabilities, but he seems a little bit more idealistic. He wants to fix these bugs quickly, not abuse them. But this is GBIGMAO today. We know his name. It's Guan Tianfeng. He's a 30‑year‑old employee of a company called Sichuan Silence Information Technology Co. And for his efforts, he earned a $10 million reward for just his bounty on his head. This bright young man, he was once so idealistic, he'll never be able to leave China again without risking arrest. And I can't help but wonder, was it worth it? This industry, all of us who work in it, we're caught in the crossfire of a struggle between great powers. I mean, I would like China's government to stop its adversarial and destructive path, just like I want my own nation to act in good faith. The only real permanent solution to this problem is diplomacy. But we can't do that right now. So what must we as an industry do in the meantime? So there's a lot of pride in doing a job well. And much of it in this industry is well deserved. But pride doesn't serve us in this moment. None of us alone can fix everything. So maybe we just do what we can do right now. It might be the form of mutual aid. The infosec industry is mature enough to run its own ISAC or some other way not to share everything but to communicate in a safe and open way to protect those who protect everyone else. As an industry, we share a sacred trust with our customers and with each other to protect the vulnerable and to safeguard that which we're entrusted to defend. There's really only one way to counter this threat. And it's together. And that's my talk. I want to make sure that I thank all of these folks from Sophos who did the majority of this research, my former colleagues, as well as these researchers from Fullexity, Recorded Future and all these other government agencies and many more who were not willing to be named but who contributed in one way or another to helping us understand the scope of this. If you do have questions about this, as I said, I'm no longer with Sophos but they've set up this e‑mail address, Pacific Rim at Sophos.com. And feel free to just e‑mail them if you want to follow up. But thank you so much for your time. I'm so grateful for your attendance here today.