Skip to main content
Back
IntrusionAWS
6 min read

Cloud Snooper rootkit tunnelling commands through allowed ports on AWS servers

Victim
An unnamed organization with Linux and Windows servers on Amazon EC2
When
Not stated; disclosed February 2020Disclosed Feb 25, 2020
Entry
Unconfirmed. SophosLabs names a break-in through SSH protected with password authentication as a working theory.

SophosLabs investigated Linux and Windows EC2 instances whose security groups allowed only inbound HTTP and HTTPS, yet one Linux server listened on two other ports. A kernel module on several Linux hosts read commands from the source port of packets sent to the web ports and rewrote its replies to look like web traffic, and Gh0st-based backdoors on Linux and Windows polled a command server. How the attackers got in is unconfirmed, and no source says any data was taken.

What happened

External Parties
Command Server
SophosLabs
Internet
Internet-Facing Linux Servers
Windows Server
Linux Web Server
Backdoor
Kernel Packet Hook
Gh0st-Based Poller
Windows EC2 Instance
Service Backdoor

Replaying the Cloud Snooper intrusion, disclosed Feb 2020

  1. 1

    Entry (unconfirmed)

    Date not stated

    The attackers get into Linux and Windows EC2 instances. How is unconfirmed; SophosLabs names a break-in through SSH protected with password authentication as a working theory.

  2. 2

    Implants in the operating system

    Date not stated

    A kernel module with inbound and outbound packet hooks and several backdoors are planted on Linux instances, and a Gh0st-based backdoor service on a Windows instance. How root was obtained is not stated.

  3. 3

    Commands through the allowed web ports

    Date not stated

    Packets sent to the web ports carry a command in their source port. The kernel hook acts on it, and the replies leave with their source port rewritten to the web port or the DNS port, so they pass as web traffic.

  4. 4

    Outbound command channel

    Date not stated

    Gh0st-based backdoors on a Linux instance and on the Windows instance open outbound connections to a command server on port 443 and poll it for commands, only in configured days and hours.

Impact

Several Linux EC2 instances carried a kernel rootkit and backdoors, and one Windows instance a backdoor service, giving the operators remote shell, file access and proxying. No source says any data was taken.

Outcome

Allowed ports carried the command channel

No cloud-provider control reaches a rootkit or a backdoor service inside your instance's operating system, and stateful security groups let the rewritten replies out on every cloud. The controls that decide this chain are the security group rules themselves. Keep SSH closed to the internet, which caps the entry theory the sources name. Admit the web ports only from the security group of an Application Load Balancer, which limits what reaches the kernel to the load balancer's own connections where one stands in front of the servers. Give the servers no outbound rule to the internet, so the pollers cannot reach their command server. The sources do not say which of these settings were in place beyond the HTTP and HTTPS rules.

Could this have been prevented?

In hindsight, not as a whole. 1 control would have refused a step outright, and 2 controls would have limited one. 3 steps have no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.

1
Prevented
2
Contained
3
Not covered

How it could have been prevented

The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.

External Parties
Command Server
SophosLabs
Internet
Internet-Facing Linux Servers
Windows Server
Linux Web Server
Backdoor
Kernel Packet Hook
Gh0st-Based Poller
Windows EC2 Instance
Service Backdoor

Replaying the Cloud Snooper intrusion, disclosed Feb 2020

1 · Entry (unconfirmed)

1 Contained3 on other clouds

2 · Implants in the operating system

2 Not covered

3 · Commands through the allowed web ports

1 Contained1 Not covered6 on other clouds

4 · Outbound command channel

1 Prevented3 on other clouds

Key facts

  • SophosLabs found that the security groups allowed only inbound HTTP and HTTPS, yet a compromised Linux server listened for connections on two non-standard ports
  • A kernel module hooked the inbound and outbound packets of several Linux hosts and read a command from the source port of packets sent to the allowed web ports
  • The module rewrote the source port of the replies to the web port or, for UDP, to the DNS port, so the replies left through the security groups as web traffic
  • Backdoors were found on one Windows system and on multiple Linux hosts; Gh0st-based variants on both polled one command infrastructure on port 443
  • How the attackers first got in was unconfirmed; SophosLabs named SSH protected with password authentication as a working theory
  • No source said that any data was taken; the report said only that the backdoor may be used to steal sensitive data

Sources

Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.

  1. 1.
    Cloud Snooper Attack Bypasses AWS Security MeasuresSophosLabs · Mar 1, 2020 · ResearchEstate (EC2 Linux and Windows instances, security groups), rootkit and covert channel, SSH redirection, reply rewriting, backdoors, Gh0st-based pollers, discovery, entry-vector theory, attribution reasoning, recommendations
  2. 2.
    'Cloud Snooper' Attack Bypasses Firewall Security MeasuresSophos · Feb 25, 2020 · ResearchDisclosure, summary of the covert channel, entry-vector theory, recommendations
  3. 3.
    State-Sponsored Cyberspies Use Sophisticated Server Firewall Bypass TechniqueSecurityWeek · Feb 25, 2020 · NewsDisclosure date, scope (one Windows system, several Linux hosts), entry-vector theory

The estate in the replay is illustrative and drawn at the level of attack stages; the victim's real environment is not public. Verdicts describe what a control does when it is in place before the incident. They are not an assessment of the victim's security program.

More cloud attack breakdowns

All breakdowns