And we're doing the 11 o'clock talk. It's you guys right here. And the talk is basically... Oops. Inside Look at a Chinese Operational Relay Network with MTU and Earl. All right, guys, kick it off. Thanks. All right. Hello, everyone. As he just said, we're going to be going over what we call Meeting Mac, or the longer name, an inside look at a PRC-based operational relay network. A quick overview. We're going to obviously introduce ourselves and what we did. We're going to talk about some secrets discovery in Docker, which was the source of all of our stuff. We're going to talk about the finding that we found super interesting, go through all of their databases, access keys, passwords, all that good stuff. How they made their infrastructure work and what their infrastructure was made to provide to their users. By way of introduction, I'm Michael Torres, also known as MTU, and I am just another dude... You're working on it, or do you need me to do something? Do you need me to do something? Okay. As long as you get it fixed. I guess I'm... The slides are not up. Just keep on talking, I guess. Well, I'm going to try to restart the show. Slide it over to the right. Go back to regular view. Maybe slide it over that way. No? No? All right. That's right. I'm going to have a duplicate, yeah. With a view. This is not ideal. Let me try. Sorry about that. We'll go quick for... Just... Yeah. All right, sounds good. So yeah, Michael, another dude. Hi, and I'm Zane. I'm a dude. I will apologize about my voice. It is gone. How does this work? Cool. So I'm going to talk about kind of the... I'm going to talk a little bit about the research we did and kind of how we got from where we were to meeting Mac, as Michael kind of hinted at. So originally this research was kind of thought about at DEF CON 32. We watched a demo for the Docker exploitation framework, which showed that you can identify whiteouted files in container images. Which is basically if you delete a file from your image, it still exists in the full image tarball. I thought that'd be super interesting to look into and find what kind of secrets people are publishing to Docker Hub inside of their containers. So, you know, things like the .env, passwords, SSH keys, and the like. The display's not working, so it's okay. I need to see the next slide. So yeah, sorry, we don't have the slides up here either. So starting off with scanning at scale, we were actually in our hotel room at DEF CON last year and we wrote like the world's worst version of Truffle Hog to try to identify these secrets in Docker containers. I need to see. Sorry about this, guys. It's all good? No, I don't know. So yeah, we started basically regexing through all of these containers with our crappy version of Truffle Hog, downloading as many copies of images as we could. We started to get a lot of things like cloud provider API keys, Binance keys, databases, which was kind of an interesting one. People would have database backups in their Docker containers, which was super fun to look at, as well as the credentials to reach their production SQL containers. So we started to get a lot of... yeah, sorry. We started to get a lot of data. At the bottom, if you can see the slides now, we had 240,000 total Elasticsearch indexes for our found data. A lot of that is going to be like false positives and it's going to be like example keys and stuff like that. But it's just the two of us. We have short attention span. Hi, everybody. Sorry about the technical difficulties. Video in this kind of a format is a real pain in the butt. Did anybody come when DEF CON was at Caesars a number of years ago, the year that it was a really good time with the video? Video is hard. New place, we've got a great staff that's working their butt off to make sure that we don't have these kinds of issues this year. I got confidence that we're going to be good. These gentlemen got a little bit off their game. Let's give them a big welcome. Let's have them start again and relax. Yeah. Awesome. Are we going back to the intro slide? Start wherever you want to. Your slides work. Get back on your game. Give your best shit. Have a good time, all right? Yeah. Do you want me to start again? Yeah. I mean, sure. You can introduce yourself. All right. So let's try this again. So like I mentioned, inside look at a PRC operational relay network. My name is Michael Torres. I'm just another dude. We're going to go over the research we started on how to find secrets in Docker Hub images. We're going to talk about the relay network we discovered, including credentials, the cloud providers they were abusing, their domain names, IP addresses, email addresses, all that fun stuff. Cool. Yeah, and once again, I am a dude. So yeah, I was inspired by the Docker exploitation framework from DEF CON last year. They gave a demo on this cool tool that they made, but the most interesting thing that we saw was the ability to check for whiteouted data in the container overlay FS image. And so we wanted to start scanning at the biggest scale we could to identify whiteouted data. So data that people had in their container images that they thought they had deleted and it's still there. So we started in our hotel room scanning at scale. We wrote, like I said, a terrible version of Truffle Hog that's just going to regex for this whiteouted data in the images. Unfortunately, we didn't get that many findings. I think we got like a total of five while we were at DEF CON. So we quickly pivoted to looking for more broad API keys, SSH keys, passwords, and the like. And we were getting a lot of data. At the bottom, 240,000 total findings. A lot of that's going to be false positives, so example keys and stuff like that. And we were getting a lot of interesting info like database backups to include a production SQL server owned by an online casino with the credentials for it. So that was kind of cool. We have a short attention span that's allotted out a lot of false positives. We're not going to look through 240,000 total findings by ourselves. So we start looking into optimizing our tools so we can get less false positives. But that's a lot of work. We were seeing a lot of the same stuff over and over again. And it's only so exciting seeing the same crypto trading bots for the 10th time that morning. In the middle of our testing, we were pulling I think 5,000 containers a day. So we quickly had to get the Docker premium accounts to not be rate limited to I think the free tier is like 200 image pulls a day. And we were hitting a lot more than that. You can see in the middle of our scanning, this is about the three month period that we were pulling a boatload of containers from Docker Hub. They announced, and we have a link to the article, they announced that they're going to be rate limiting the premium tier accounts to I think it was 50,000 pulls a month. Which coincidentally was about what we were hitting. We have no idea if that was because of us, but we like to think we may have played a little part in it. So yeah, that was just a fun little slide. But we're still getting a bunch of data that we don't know what to do with because it's just too much. I had previously done some work identifying publicly accessible private Git repositories. So a lot of the times, it's like a Google dork. You can look for a .git on a website and you'll go to mycoolwebsite.com forward slash .git. You can wgit tech R that and 12 hours later because you just downloaded a bunch of tiny files, you can do a Git restore and you have their private Git repository that is publicly accessible. I'm not sure how people are messing that up. I'm thinking it's like small businesses that hire a developer to make them a website and then they just, you know, Git clone and then deploy it. But we wanted to start, instead of looking at the broad like regex scale, start looking for .git slash config. So then we could identify if there was like a private repository inside of this container. So a little background on how to containerize an application if somebody here has never containerized an app. If you Google search how to containerize an application, Docker provides a nice little workshop. And the TLDR of it is that they want you to do a Git clone from your repository. You'll create a Docker file. Inside your Docker file, you'll base it off of, you know, a normal image, so like from Ubuntu. And then do a copy dot dot. Copy dot dot is really cool because it will pull in everything. It makes sense. That's exactly what you're telling it to do. But it will also pull in hidden files and directories. So that's how people are putting their .envs inside of their containers. But for what we're looking at, it's pulling in the .git folder directory structure from that previous Git clone that they did. So, you know, like the CI pipeline would do a build push job. It's going to clone your repository. It's going to build your container, copy in everything, including your repository, and then push it to Docker Hub. So if you have a private repo and then you're pushing to a public Docker image, that's no good. There's some other interesting things in here. In the .git config, like I said, it will have the remote URL. So you can query that to identify if it's a private repository or not. But inside of that, you can also identify the CI job token that was used to push to Docker Hub and to do your CI job. Those are short-lived for the length of the job. And then generally, you know, it would also need write permissions to do anything fun with. But some users are using their personal access tokens with rewrite permissions to do their CI pipelines, which would then push their credentials to their private repo to their public Docker image. So we have a demo. I'm not sure if it'll play on here. Can you help me? So, yeah. While he gets that up, we have a demo showing basically if you know a container is going to be updated, you can scan that container on Docker Hub, wait for an update to happen, grab the credentials. Oh, that's wrong screen. Sorry about that. Just keep talking. Then you can grab the credentials and if they're using their personal access token, you actually then have write permission to their private repository, which will have the added benefit of once you push to that private repository, it'll kick off another CI job that you can then, you know, have your code that you've pushed to their repo inside of their public Docker image. So depending on, you know, how important their code base is or how popular that image is, that could be pretty nasty. So right here, we're just, you know, scanning for the change in Docker Hub. And then we're, I think, just going to write to the README file that, you know, we have write access to the repo. So that was just a cool thing that we had seen while trying to identify like vulnerabilities or anything that we could do with all of this data. Start talking. I don't know what slide it is. So on this slide, we're going to go over some of the metrics. So in total, we pulled a little over 80,000 containers during this three-month time period starting last August. Once we started looking just for the private Git repositories, about 15,000 of them contained Git metadata and 1,500 of those were for non-public Git repos. That's basically anything that wasn't returning a status code 200. So we're looking for 404s on GitHub. If it's a private repo, it will, you know, if it's private, it will show that it's just a 404. We also got some redirects for like Git at company name.com. So some companies, their private internal Gits were being pushed to their public container images, which was also fun. Some of the more notable stuff that we saw was there was an enterprise branch of an Apache open source project that had their private repository stored in their public container. A Russian dash cam manufacturer and a security vendor's private detection rules. We had reported as much as we could for all of these findings. Unfortunately, nobody ever responded. And we even emailed the, like, last commit author from the Git log. So it was super easy to report. I don't know if you'll be able to see it on this slide as it's being presented, but on the left-hand side is just some of our Elasticsearch findings. We have the very top one is actually a personal access token. So going back a few slides for that demo of the CI job to push to Docker Hub. If they're using their personal access tokens for that job, in theory, then you would have write access to the repository. On the right-hand side, those are all of the status codes and the percentage of the total findings for the containers containing private or non-public Git repositories. So just a cool metric. All right, we're going to start talking. That was the background on the research we did, how we did it, and how we got to finding Mac. There was one Docker Hub user that was pushing multiple containers a day. They were doing a lot of updates, and we kept getting flags for it because they had private Git repositories in it. So our automated tooling would alert us that we got new findings. And from our initial look at these container images, it looked like this user was actually just using Docker containers as free cloud storage, which is a cool idea. They had a boatload of data labeled like backups that they were just pushing. So we started looking into it a little bit more because I thought it was a funny idea to use Docker as free cloud storage. It led us to identifying three other Docker users that were doing similar things and kind of tied them all together, spanning across 38 total repositories, meaning like container images on those accounts. There was hundreds of image tags per container. So a couple gigs per container. You know, you got a couple hundred tags per container. It's a lot of data for us to look through. So we saw it, and we thought it was kind of neat, but didn't look too far into it. Here's a Discord message. I like to go to bed pretty early, so Michael was up at 10.40 p.m. I'd probably been asleep for a few hours. But he had taken another look at these containers because we just kept getting hits on them. And it looked like they were using the data in the containers, pointed to them using this to spin up and down some cloud infrastructure to proxy traffic, and it was redirecting to the great firewall. So that piqued our interest almost immediately. It was super interesting. So we wanted to look more into these containers and see what we could learn about their infrastructure. Here is kind of a high-level view of what we think their infrastructure looks like after several months of research on all of this data. Starting on the left, they have a couple different providers that they use for storage. So Docker Hub is not the only free cloud storage you can use. They were also using Mega and GitHub repos actually to store data. Then in the middle, we are kind of going to go over the compute that they're using in a few slides. But they have like traditional VMs and then more like serverless compute. So they were using stuff like GitHub Actions. We have the databases on the right-hand side as well. And then we're going to go a little bit more in depth on all of these services and how they were used. But we're going to go over first what we found and what we believe it is. So with a somewhat high confidence, we believe it to be a PRC-based operational relay box network. And that's basically a bunch of stuff proxying for bad actors. There's a Google link for Chinese Nexus actors using similar networks to do malicious things on the internet. So you can read that if you would like. We believe there's more than one person involved in the development and operations of this infrastructure. We observed messages in their database backups in these containers between multiple personas. They're using this weird .rec file format that we couldn't figure out what the note-taking app or whatever was creating them. So we would actually love if anybody knows what it is. And it's been in development since 2022. Last year, like I said, they were updating almost daily, several times a day. The last update that we saw was in June of this year, so that's the last time we've looked at any of this data. With a medium confidence, it's used to proxy web traffic, manage social media accounts, and otherwise do sort of anonymous browsing. They also have some tooling to create and manage the social media accounts, pointing us to that. Low confidence. Unfortunately, these guys aren't in their database or in their backups putting proof that they're doing malicious things, which would have been really cool for us. But we did see they have tooling and proof that they had one malicious PyPy package. That is a virus total link to the package. It is no longer on PyPy, but you can still go and analyze that package, as well as a Cobalt Strike listener log. It looked like it was more for a test, but shows that the infrastructure was in place to use those things. So the network tunneling protocols that they were using, they used NPS for their node hub C2 infrastructure. And then on the bottom right, we have a little screen grab of them modifying the FRP fingerprint. They changed all the key names on that. And then they used a couple of different providers to obscure their C2 destination IPs. And then they also, yeah, they had the full VMs for, you know, serverless and full VM access. And then, as promised, we're going to start going over some of the domains and other juicy tidbits that we got from their data dumps. So the top three are their main, like, hub domains. We've defanged them, but those are them. The bottom one, or the middle one, sorry, the private services are a little interesting. They have this GitHub repo access domain where if you know their private repositories, because they've made them public, and you know the directory structure of them, you can actually browse that domain and get the files from their Git repos, which is kind of interesting. And then they had their own file hosting for tooling and scripts that they would pull down when setting up infrastructure, as well as the workstations. The bottom ones are the, like, miscellaneous that we didn't see a lot of information about, but they were sort of interesting. The top one being, you know, Cracked Cobalt Strike. So, pointing to them using this infrastructure for more nefarious things, but... As far as data persistence, Zane mentioned earlier, they have a lot of different cloud services they were saving data to. Probably the largest by volume was TerraCloud. They had a WebDAV share set up there. Obviously, Docker Hub Images, that's how we got our initial access. They were all about uploading data there. GitHub repositories, Hugging Face Spaces, Backblaze Buckets, and one instance of a OneDrive. And then the screenshots here are their configs and things like that for those services, so you can kind of see how they pieced it together and how they thought about their data backup strategy. Just as a little tidbit off of that, if you didn't know, OneDrive authentication tokens are JSON web tokens, which means you can decode them and get a little bit of additional information out of them. So we went ahead and did that. That bottom left screenshot has an email address that ends, like the host name is host.ac.cn. A little bit of Googling says that that's a shared domain for a lot of university systems in the People's Republic of China. So I'm not sure that that's a real email address that can tie back to a person, but it's still kind of interesting. And then on the right side of the slide, you can see an IP address that is probably a legitimate home IP address based on the ASN. I want to say it went back to China Telecom or something like that. The most exciting part for us was access to these credentials. On the right there, you can see that they were nice enough to give us an SSH config that included the path to the SSH key to use to access their nodes as the root user. They also had that SSH key, so if we wanted to, we could have logged in to all of their things as root. So great security practices there. Even if we didn't have their SSH key, they also lettered passwords all throughout their code and their notes and all of that. So we were able to figure out that they followed a pretty standard template for all of their passwords. You can see it there, but A, B, some characters that we're not going to tell you, an at sign, and then a letter corresponding to the username. So for the user temp0230, the letter was a T. For coral86, it was a capital C and a capital O. There's a hash there. It has a special little salt. If you want to try to crack it, then you'll have their actual passwords. Like I said earlier, that password is used for emails, their domain management accounts, their social media, basically just everywhere that you can put a password in. That was how they were generating their passwords. That wasn't it. They also had just plain text API keys all throughout their notes and through their code. You can see the top players there are definitely Heroku and GitHub. Heroku for running their exit nodes, if you want to call them that, for their network. GitHub for cloning all these things into GitHub repositories for more data backups. Sort of of interest at the bottom there, you can see they had a grok key and an xai key. They were using those to, as we'll talk about later, help them develop this service, because who doesn't love a little AI-assisted development? But if you're in the People's Republic of China, a lot of those systems are blocked. So they were using their own network to do that kind of thing. Emails. Like I said earlier, they had a lot of emails. Definitely at least 50, probably more. There were a lot. And as Zane mentioned, our note-taking system is roughly Discord, a Google Doc, and also Notepad on one of our computers. So finding out all of the email addresses we saw was a hard challenge. But those ones on the slide are definitely the most frequent that we saw throughout. They also had tooling to create new email addresses on common free email service providers, so Outlook and Gmail. They also had social media accounts. They had two Twitter accounts, two Facebook accounts. On the slide, you can see a screenshot of Coral86's Twitter account. That is the only activity on his Twitter account, so I guess they're just all about Pokemon. That still isn't the total story of all of their credentials. They also had an API to serve credentials to either themselves or their users, depending on how they architected their system. You can see the list of things they provided for there. One note of interest is they don't just have API keys in there. You can also see they have browser cookies and browser fingerprints, so they don't stop at just put a session ID in there and use the session cookie. They actually persist what the browser fingerprint should be so they don't get detected either by malicious account detections for the infrastructure they're spinning up, or if they stole a session ID from a user, they can impersonate the fingerprint of that browser as well in a sort of automated fashion. More on the services they offered to the users of this network. They organized those services into what they called workgroups. The big ones were the social workgroup, which is Headless Chrome. We suspect it was used to manage their social media accounts. Their op stations, which had Visual Studio Code Web and TTYD, which is just a website that is a terminal on the target box. They had a scraper workgroup, which via calling third -party APIs and just using its own exit would scrape a website and give you back , I want to say, both the contents in raw form and also take screenshots if you asked it to. And then all nodes would run SSH and VNC, presumably for administrative purposes. So the way that they would access these nodes is their central hub server would do a reverse port forward . So the pattern would be that you'd have your three-digit node ID, so, you know, node 1, 2, 3. And then the last two numbers on the port would be the service you're going to. So port 22, SSH, that's kind of an obvious one, so 1, 2, 3, 22 would let you SSH to node 1, 2, 3. You can see the list of services there. The sort of interesting callout is port 90 down there. If you go to it, you'd get a bounce from the great firewall basically saying, like, this website isn't registered, you're not allowed to go to it. It's probably an actual service, but I couldn't tell you what it is because I can't access it. More on node numbering. They had in their notes for us nice documentation on how they assign those numbers to nodes. It looks like they break them down by the type of runner, the type of cloud provider they're running on. So, like, HuggingFace is 42X. On the left there, you can see the config for one of their HuggingFace nodes. You can see their HuggingFace API key, the repo they're running, and a couple other bits of information about it. You can also see in the bottom right screenshot, if it's big enough, I don't know if it is for you guys, but the workgroups that were assigned to nodes were also specific to where they were running. So the HuggingFace node, for example, is always in the Chrome workgroup, not anything else. As Zane mentioned previously, we did discover that they had one malicious PIP package that they'd upload called PTMPL. It downloaded a script from one of their domains, which is how we were able to find it on VirusTotal, and just executed it. So, good old-fashioned malicious PIP package, nothing too fancy there. It also had this post install hook that's up on the slide of, again, just download something from the internet and run it as a Python script. You can see on the bottom there, me sharing it with Zane and him looking at it on his phone and saying, I don't know, it's just Python, man. And then when we looked at it more, he did say, yeah, no, that's real bad. As a treat, we also found out that they were running something called BTPanel, which is sort of a People's Republic of China native cPanel equivalent. So we did a little vulnerability research on that. It is a Python Flask web app, and we were able to find two instances where if you were man-in-the-middle, you could get a remote code execution as root, one of which is patched, that first one, where they would download a PAM module, a pluggable authentication module over plain text. So you could just give them a malicious PAM module, and that will execute as root the next time someone tries to log into the system. And then their update and install script also fetches some RPMs and some tarballs over HTTP, and it's an update or install script, so it runs as root, so you can, again, get code execution through that. That one is still not patched as of July. It might be patched now, I don't know, I haven't checked since then. And then the third class of vulnerabilities, because it's really two, is that they implemented multi-factor auth, just that, well, they didn't implement multi-factor auth, I think is the key there. They used the same time-based one-time password key for all users, so if you registered with their panel, you could just sign up your authenticator, and then you know the authentication code for every user of that panel. And then their one-time password for SSH access is actually just a static credential, so if you get it once, it'll be valid until the heat death of the universe, I suppose, or a bit before the flip on the computer. And then there is a lot of weird memory safety stuff that just looks hinky, but we didn't decide to look into more. If you want more details on BT panel and what it looks like from a security standpoint, I did a blog post in collaboration with SSD Disclosure with the link at the bottom there. So I hinted at this earlier, turns out vibe coding also is alive and well for people trying to spin up infrastructure like this. In their backups, they had database logs and just chat logs with large language models for assistance in trying to dev out this network, the system they built. Part of the cool part for them, I guess, is because they'd already built parts of the network. They could use it to access models and APIs that are not available within the People's Republic of China, so like open AI models, they could access those even though there's an IP block if you're in the People's Republic of China. Some of those logs are in simplified Chinese, which we just threw in Google Translate. I can't read simplified Chinese, and some were in English. And there's low amounts of evidence, one piece of evidence suggesting that they were using Cursor specifically for their development. Here's some screenshots of their chat logs. I hope it's big enough that you can see it, but I sort of doubt it. If you pull up the slide later, you can see on the left, they're asking for help developing a new feature for their network. In the middle there, they're asking the chatbot how to set up their directory so Cursor can best help them develop new services. And then on the right, I want to say they were talking through new ideas of services to offer through their infrastructure. So, some kind of amusing bits there. Summing it all up, Zane mentioned earlier the last update we saw to a Mac container was on the 20th of June. They did implement encryption finally for their data, but because we already knew their password generation scheme, we could just decrypt it and access it again. So that was cool for us that we'd gotten in early enough to make their encryption worthless. It did include new Git repos and some new email addresses. And as far as takeaways, if you're publishing to Docker, you probably want to make sure that they're not public containers because a lot of Docker containers contain information that is meant to be secret. Git files, like we mentioned, we found a bunch of API keys, so many crypto trading bots, so, so many. We did report that to Docker with the recommendation of have a default Docker ignore, I think. They never really responded. They confirmed receipt, and then we didn't hear from them until we told them we were presenting. We also reported to GitHub and GitLab, as Zane mentioned, that they include the credentials in the .git config by default, and it'd be great if they could implement a change to not have a plain text credential on the file system. They also never responded, or said that they didn't view it as an issue because it's a configuration problem, which it is. And then the final takeaway is, like, the cloud's not just for good guys. People are using cloud platforms, including free tiers, to build out infrastructure that will be used to attack or even just do weird social media stuff on the internet, like that Pokemon tweet. And that's all we got. We'll be available for questions or comments or just to chat off to the side. Thank you all for coming.