BLACK HAT EUROPE 2021 — LONDON — An attack group known for cloud-specific campaigns targeting Amazon Web Services (AWS) credentials has recently expanded its toolkit to steal more credentials from targeted cloud systems and deploy new tactics to exploit containerized Kubernetes systems.
The TeamTNT group was first spotted in August 2020, Chris Doman, co-founder and CTO of Cado Security, said in a talk at this week's Black Hat Europe. He was looking at a feed of malware that summer when the group's logo caught his eye. The attackers' script was taking a root AWS credential file and sending it to their server; in doing so, they could gain the access key that would allow them to download files in S3, start and stop EC2 instances, and other functions.
Doman published a blog post about the group's activity, and the researchers learned the group was quite social. "You don't often get a situation where hackers actually send you a message," Cado Security co-founder and CEO James Campbell said in Cado's talk, noting that the attackers responded to the post saying, "there has never been a TeamTNT worm" and "It doesn't exist!"
But the attackers' activity did have a worming function, said Campbell, who added the attack vector revolves around APIs. "Essentially, what happens is attackers scan the IP range, they see open APIs, they compromise those machines, and then they do the same thing again, so the now-compromised machine goes and scans new IP ranges and compromises those, and so on."
TeamTNT does this to Kubernetes APIs that were unauthenticated and public-facing. They'll run several shell commands, bring down some scripts, and run processes, including a mass scan of other public IP ranges. They'll also look at a target's LAN ranges, so if one Kubernetes node is compromised, changes are good others are as well, if they are similarly configured, he added.
"If you do have misconfigured Kubernetes clusters out there, or vulnerable Kubernetes clusters, and they're public-facing, chances are they're probably already compromised. … It happens that quickly," Campbell said. The group picks on Docker APIs as well, he noted, adding there are log files that Kubernetes and Docker generate, so teams can see if they've been compromised.
After the group has compromised a network, one way TeamTNT maintains access is with the IRC bot, Doman said. "It's pretty classic stuff; they use the Tsunami IRC bot, and it just works." He connected to the attacker server last week and saw 221 clients connected in, meaning 220 victims and an attacker. TeamTNT also uses Weavescope, a legitimate Kubernetes administration tool that lets users stop and start containers. Attackers install it on hosts they compromise and look for open Weavescope installations to connect and compromise them.
In terms of privilege escalation and credential theft, the group still steals AWS credentials but is more sophisticated than it was last summer, said Doman. It targets the environment variables to a system, where there are passwords, and the Docker environment variables. As of a few months ago, the group scrapes the AWS metadata URL, which grants it the access to other data around the system.
The group has also expanded beyond AWS credentials to target credential files from Google Cloud Platform as well, Doman noted. TeamTNT also plans to include Azure in its targets, the attackers shared from a group Twitter account. "They are a lot more chatty than the average hackers," he said. These changes could be at least partly in response to defensive actions.
"They're finding it really tough now, because AWS is recognizing when they steal these keys very quickly," Doman added.
New tools added to their arsenal include Docker Escape, off GitHub, and Break Out the Box, which scrapes Google Cloud credentials and other metadata. Another tool, called Infection Monkey, is designed to tell which credentials are insecure. TeamTNT was running its own Infection Monkey server, compromising other networks, and pointing it back at its own server to learn more information about the target environments.
What Organizations Can Do
TeamTNT's goal in these campaigns is cryptomining, Campbell said, but he's more concerned about what the attackers could potentially do with the information they're able to access. The most obvious, he said, is data exfiltration.
"A lot of these containers have access to databases and sensitive information, file shares," he explained. "An attacker could obviously spend a little more time on these containers and start stealing some data. That could lead to ransom."
The attackers could also compromise uses, as many containers run Web applications or Web services. They could inject code in there and arrange drive-by downloads. "The world is your oyster," he quipped. If successful, the victim company could become the third-party risk as the result of its Kubernetes environment.
In the cloud, these attacks could enable TeamTNT to spin up or destroy resources, use their credentials to access other parts of the environment, and create accounts to achieve console access.
Doman advised organizations to use firewall rules to limit access to APIs, and consider using an allow-listed approach for their firewall ruleset. Teams should identify AWS credential files and delete them if not needed, and use least privilege when assigning roles. He also recommended reviewing network traffic for connections to mining pools or using the Stratum mining protocol. Businesses should also check developer machines, which have good control over production environments.
He and Campbell credited other organizations, such as Trend Micro and Intezer, with their additional work in researching TeamTNT, which has since last year become a subject of focus for many research teams.