Heimdal Security Blog

BPFdoor Has the Capacity to Bypass Firewalls

A new Linux malware dubbed BPFdoor has been recently identified. Its targets have been Linux and Solaris systems and what’s more, is that it has passed unnoticed for over 5 years.

More Details on the BPFdoor Malware

BPF can be described as a Linux/Unix backdoor that lets hackers establish a connection to a Linux shell remotely and was detailed in a report by DoublePulsar and also in a report by Sandfly Security. This way, threat actors can further achieve access to a device that is compromised.

This malware shows the following features:

Because BPFDoor doesn’t open any inbound network ports, doesn’t use an outbound C2, and it renames its own process in Linux (so ps aux, for example, will show a friendly name) it is highly evasive.

Source

The malware is also a passive backdoor. What does that mean? It can monitor one or more ports for incoming packets from one or more hosts, which threat actors can use to remotely execute commands on the infiltrated network.

A Berkeley Packet Filter sniffer is employed by this backdoor which operates at the network layer interface. This way, it can see any network traffic as well as transmit packets to any destination. This also triggers its capacity to bypass firewalls.

The malware is suited for Solaris SPARC and Linux systems as well as it can be ported to BSD, according to BleepingComputer following a statement from Craig Rowland, Sandfly Security’s founder.

Also, Kevin Beaumont from DoublePulsar, says that a “magic” password is employed for the implant’s actions control purposes.

Operators have access to a tool which allows communication to the implants, using a password, which allows features such as remotely executing commands. This works over internal and internet networks.

Source

Only ICMP, UDP, and TCP packets are parsed by BPFdoor, which looks for a certain data value. But what makes BPFdoor noticeable is its capacity to monitor any port for the magic packet. This happens even with ports employed by legitimate services, for instance, FTP or SSH.

In the case when the TCP and UDP packets include this “magic” data the backdoor looks for and a valid password, BPFdoor starts performing a supported command, for example, bind or reverse shell configuration.

Below there is a representation of BPFdoor’s process:

Image Source

Kevin Beaumont also managed to identify BPFdoor activity on networks belonging to organizations from different locations like the U.S., South Korea, Hong Kong, Turkey, India, Vietnam, and Myanmar, according to BleepingComputer. He found 11 Speedtest servers compromised by this malware.

BPFdoor and Its Anti-Evasion Techniques

According to the Sandfly Security’s report previously mentioned, here are the anti-evasion techniques BFPdoor uses:

A reason why these anti-evasion techniques are employed could be that the threat actors intend to achieve binary protection if its deletion happens not to work, according to Craig Rowland.

The interesting part about this is the timestomp happens by the forked process before the main process tries to delete the binary. We assume this is a failsafe mechanism. If the implant should fail to load and not delete itself from /dev/shm/kdmtmpflush then the file left behind will have an innocuous looking time on it that masks when it was created. It would also make incident response harder if you are looking for recently created files (this one looks like it was created 14 years ago).

Source

BPF’s Commands and Detection

Another analysis on this backdoor comes from Tristan Pourcelot, highlighting the hardcoded names the malware employs to match command strings inside relevant packets. These are:

Renaming the binary to appear as a normal Linux daemon using the options below is one of BPFdoor’s tactics for avoiding discovery:

Image Source

The BPFdoor is updated on a regular basis according to Pourcelot, and each release comes with distinct names for processes, files, and commands.

There were discovered at least 21 BFPdoor’s versions on VirusTotal. The backdoor managed to go undetected for a long time, the implant’s detection rate improving though after Beaumont, Rowland, and Pourcelot’s reports.

It Seems to Be Made in China

PwC researchers associated the BPFdoor with a China-based actor named Red Menshen (formerly Red Dev 18).

Red Menshen (formerly Red Dev 18) deployed its bespoke BPFDoor malware to multiple organisations in the Asia Pacific region, including telecommunication providers based in several countries. (…) We also identified that the threat actor sends commands to BPFDoor victims via Virtual Private Servers (VPSs) hosted at a well-known provider, and that these VPSs, in turn, are administered via compromised routers based in Taiwan, which the threat actor uses as VPN tunnels.

Source

If you liked this article, follow us on LinkedInTwitterFacebookYoutube, and Instagram for more cybersecurity news and topics.