HaxRob Profile picture
Feb 28, 2024 19 tweets 8 min read Read on X
I recently found two very interesting Linux binaries uploaded to Virustotal.

I call this malware 'GTPDOOR'.

GTPDOOR is a 'magic/wakeup' packet backdoor that uses a novel C2 transport protocol: GTP (GPRS Tunnelling Protocol), silently listening on the GRX network (1/n) 🧵 Image
One version uploaded from 🇨🇳 has zero detections on VT. The other, uploaded from 🇮🇹 has just one detection.

These were uploaded 4 to 5 months ago.

(2/n)
Image
Image
As they binaries were not stripped, they contain some artifacts that give us an idea of the intended platforms they were to be run on - Very outdated Red Hat Linux machines.

Someone hasn't been keeping their systems up to date .. 🤔

(3/n)) Image
When run, the first thing GTPDOOR does is process-name stomps itself - changing it's process name to "[syslog]" - disguised as syslog invoked from the kernel.

It supresses child signals and then opens a raw socket.

(4/n) Image
The raw socket will allow the implant to receive UDP messages that hit the network interfaces.

It then matches those with destination port of 2123. This is the 3GPP standard port for the GTP-C protocol.

It then looks for only those that are of GTP_ECHO_REQUEST.

(5/n) Image
Before moving further, the message is authenticated - `idkey` must be supplied and correct. It's hardcoded, but as we will see later, it can be dynamically updated at runtime.

(6/n) Image
The payload of the message is then decrypted with the same key. This is a simple XOR cipher.

(7/n) Image
Next the message command type is read. There are different message types depending on the binary.

This is all documented in a blog post I've just whipped up.

(8/n)

doubleagent.net/telecommunicat…
Image
The packet format is something like this. IP/UDP/GTP/GTPDOOR.

For example, the tailing bytes (MESSAGE DATA) will contain a command to execute remotely.

Why use GTP for the C2 communications?

(9/n) Image
This implant looks like it is designed to sit on compromised hosts that directly touch the GRX network - these are the systems that communicate to other telecommunication operator networks via the GRX.

Examples include the 2/3G: eDNS, GGSN, SGSN,STP, 4G: PGW, DRA and more (10/n)
Let's cut the chase. This is almost certain to be attributed to the threat actor UNC1954 (Mandiant) or LightBasin (CrowdStrike).

This actor has used GTP-U (traffic plane / PDP Context) for covert tunnelling.

(11/n)



mandiant.com/resources/blog…
crowdstrike.com/blog/an-analys…
With this implant, the use the GTP port associated not with traffic plane (GTP-U), but control plane (GTP-C).

GRX firewalls have to allow these protocols to some of the systems described earlier, so the C2 traffic blends right in with other mobile network traffic. (12/n)

Again: Image
What makes magic / wakeup / port knocking backdoors so stealthy as they don't need to listen on any service.

These backdoors have been around since the 90s but they still are used because they are effective.

No listening services / open ports - just a process idle sitting and waiting for it's magic packet.

BPFDOOR was a recent one. It was also found in telco networks (although attributed to a different actor).

Read about that one here:



(13/n)sandflysecurity.com/blog/bpfdoor-a…
An interesting feature in one version of GTPDOOR a second raw socket that pulls in all TCP packets off the interface to inspect.

The implant beacons out a very particular TCP message to the source IP of every TCP message - except those listed in a defined ACL. WEIRD!

(14/n) Image
The TCP packet it beacons out has no data / payload. Just the TCP RST/ACK flags are set.

No data? Look closely. Super stealthy.... 🕵️🕵️‍♀️🕵️‍♂️

(15/n) Image
My best guess on what's going on here is this:

You send a TCP packet to ANY port on an infected host's GRX interface address.

Any beacon reply = confirmation implant running +

TCP urgent ptr flag == 1? dst port was open
TCP urgent ptr flag == 0? dst port was closed

They are hiding a message inside a TCP header. I think I read about this first in some old hacking book from the early 2000s. Was it "Counter Hack"?

Now there are some conditions for this beacon to be sent - An ACL "deny list" needs to be set - possibly to prevent beacons hitting the target network infrastructure.

If my theory is right here, then it could be possible to scan the entire GRX to find compromised servers / telco network operators?🤔

(16/n)
Here is a tcpdump capture of the probe message sent to port 22 which is open (SSH running).,

The received beacon TCP RST/ACK message has the urgent flag set.

This actor is known for it's stealth, and this is the perfect example.

(17/n) Image
I think I'll wrap this up now. A YARA rule can be found on my blog post on this backdoor for all you threat hunters.

I'm sure someone will come up with a much better one real soon.

Thanks for watching !🙏

(18/18)

doubleagent.net/telecommunicat…
Image
Oh yeah, I forgot to mention, there is a memory corruption vulnerability in there.

Any guesses on how to trigger it? 😆

(19/19) Image

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with HaxRob

HaxRob Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @haxrob

Jul 13
A relatively unknown but particularly stealthy technique to hide files on Linux hosts. On unhardened boxes, unprivileged users can conceal files from even the root user. Disk content remains in memory, hindering disk acquisition during forensic investigation. (1/7) 👇
Let's start with the most simple example. Select a mount namespace that is not used by systemd/init.

Migrate the current shell into that process's mount namespace and mount a tmpfs file system.

Anything that writes the mounted path is concealed from users on the host. (2/7) Image
As a bonus, commands in this shell will not be written to the history file as we mounted over the user's home directory.

No need to set HISTFILE=/dev/null.
Once the shell exits, artifacts evaporate. Nothing touches the disk.

Now how to do this as an unprivileged user? (3/7)
Read 7 tweets
Jun 2
Newer variants of the #BPFDoor has an interesting modification made that avoids detections looking for processes with raw sockets. The kernel reports SOCK_DGRAM rather then rather loud "SOCK_RAW". Here we have a sample found in the recent SKT telco breach. (1/20) Image
Perhaps it's only looking for UDP magic packets? Not so fast. Let's look at what changed.

BPF filter is used as before, but the socket is opened with type SOCK_DGRAM, but the protocol is ETH_P_IP.

What's the defined behaviour here?
(2/20) Image
man socket.7 gives some clues. It hints with AF_PACKET, the protocol may have priority over the socket type. So ETH_P_IP overrides SOCK_DGRAM. Also, the layer 2 (ethernet) frame will be removed. (3/x) Image
Read 23 tweets
May 28, 2024
When pairing your mobile phone to that Wifi / Bluetooth device and it forces you to grant it location permissions, pause for a moment to think who may be the beneficiaries of this information. Image
Case in point:

The Dyson app refuses to pair to their devices such as this fan/heater/air purifier - unless you give in and give them your location data.

This is a premium product at a high price point. Surely they are not monetising this ?

What’s the privacy policy say? … Image
Dyson disclose in the fine print that the app will continue to “collect and use data about your location in order to provide you with more relevant and personalised information.”

It’s a fan. A fan. Image
Read 15 tweets
Mar 26, 2024
If you needed yet another reason not to trust VPN providers or proxy services...

Here Facebook partnered with a bunch of companies to have root certificates installed on people's phones so they could intercept other app's traffic.

storage.courtlistener.com/recap/gov.usco…
Image
Here Facebook acquired Onavo and had quite a good run before the spyware got pulled from app stores.

At a $120 million dollar price point it's clear how much value they put on having the ability to intercept user's mobile traffic.

en.wikipedia.org/wiki/Onavo
Image
Checking the archived APK listing for "Onavo Protect" from 2019, likely just before it was pulled from the Play store, the description discloses some information on what they are up to, but then proceeds to gaslight the user.

apkpure.com/onavo-protect-…Image
Read 19 tweets
Feb 20, 2024
The Chinese APT contractor leak contained a few interesting files; namely:

- CDRs (Call Detail Records)
- LBS (Location Based Services) db records

Threat actors compromise telcos with the aim to obtain subscriber metadata to support IC objectives.

Some background: (1/5)🧵 Image
CDRs are primarily used for postpaid billing and reporting purposes. They are generated in various network elements and consolidated in mediation systems.

It's these central databases that are often targeted. Data for a subscriber is generated in many systems:

(2/5) Image
Looking at the leak data: For example, this one is from old school circuit switched 2G voice calls.

What's of value from an intelligence perspective is is who talked to who and from where. Origin of data likely from MSC CDRs.

(3/5)
Image
Image
Read 17 tweets
Feb 10, 2024
With the (fake) toothbrush botnet story still fresh, Colgate's connected Bluetooth toothbrush caught my eye on discount at the local supermarket.

"Hi there, let's get to know each other"

Sure, let's do this. What will we learn? (1/n) 👇 Image
Happy to see that the Android app has responsibly requested the minimum permissions for BLE scanning. I kind of was expecting it to request my location for this which it didn't. (2/n) Image
Pulling the .apk off the device, the AndroidManifest.xml indicates a few permissions that warrant further investigation. Let's assume (for now) location perms (when granted) are only for BLE scanning on older Android releases.

Still this doesn't feel quite right. (3/n) Image
Read 22 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(