Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Trustwave SpiderLabs Uncovers Ov3r_Stealer Malware Spread via Phishing and Facebook Advertising. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

The Dexter Malware: Getting Your Hands Dirty

A very interesting piece of malware that targets Point of Sale systems has recently surfaced in the malware community. As a guy who frequently reverses malware that targets card data (aka. Track data), this caused me to take notice. Before I jump into the really interesting bits of the malware, I'd like to offer a few links to those that have already taken a look at this stuff. Seculert specifically were the ones that originally discovered, and named, the Dexter malware.

http://blog.seculert.com/2012/12/dexter-draining-blood-out-of-point-of.html

http://volatility-labs.blogspot.com/2012/12/unpacking-dexter-pos-memory-dump.html

So if you either haven't gotten a chance to read the above articles, or simply would like a refresher, here's what the malware does in a nutshell.

  • Injects itself into iexplore.exe
  • Ensures the iexplore.exe process restarts in the event that it is manually stopped
  • Ensures persistence via writes to the 'Run 'registry key
  • Scrapes track data through a very common method
  • Has a command and control structure with a remote host

That last bullet in particular really caught my eye. I can't remember the last time I saw a piece of malware that targeted Point of Sale systems that had a nice C&C structure to it. And that is where our story really begins…

So in looking at the underlying assembly of the malware, it becomes apparent that this sample is planning on talking to as many as seven different domains. It's also apparent that it's going to communicate over HTTP, via a POST request. Looking at the traffic that gets generated, we see something similar to the following:

10307_82c0a146-7a70-4983-afd2-4378b6160f5c

Now you might be thinking to yourself, "Geez, that's a lot of …stuff". And you'd be right. So lets break down that nice blob of data that's being sent over the wire. In total, we see the following ten different variables:

  • page
  • ump
  • unm
  • cnm
  • query
  • spec
  • opt
  • view
  • var
  • val

I'm going to focus on the last variable ('val') first, mainly because it's the easies to decode, and because it's one of the most important. We see that 'val' has a value of 'ZnJ0a2o=', which I'm sure you've all guessed by now is Base64 encoded. Once decoded, we see this value change to 'frtkj'. You might be thinking that this is also garbage, but it is, in fact, a key that is used to encode the remaining text in the POST request. Specifically, we see the following occur when each variable's data is decoded:

  1. The data is Base64 decoded
  2. Each character in the decoded string is xored sequentially against each character of the key we previously identified. In Ruby, it looks something like this:

"A".xor("f").xor("r").xor("t").xor("k").xor("j")

This results in the original content.

Know how this works, we can whip up a quick script to decode the entire string.

BSL_10157_7bbbd6e9-b232-408d-8aaa-6cd1b2573627

We can now easily determine when a number of the variable discovered actually contain.

  • page: Mutex string
  • ump: Track data
  • unm: Username
  • cnm: Hostname
  • query: Victim OS
  • spec: Processor type
  • opt: Unknown
  • view: List of all running processes on the victim
  • var: Some unique string. Appears to be constant for this sample
  • val: Random key that changes every time the malware restarts

So at this point we can see how the malware is communicating outbound to its master. However, that's only half of the puzzle. How is the malware receiving commands?

Well, the answer to that question comes in the form of the response Cookie. Specifically, the malware will set the 'response' cookie using the same technique (only in reverse) that we just witnessed. So basically, theserver takes the key from before, XORs each byte of the string against each character in the key, and Base64 encodes it. Dexter will then parse this data, and look for one of the following variables:

  • update- (Updates the malware with the specified argument)
  • checkin: (alters the delay between times the malware attempts to make POST requests to the master host)
  • scanin: (alters the delay between times the malware scrapes memory for track data)
  • uninstall (completely removes the malware)
  • download- (downloads and execute the specified argument)

I should point out that each variable has to start with the character '$' in order for the malware to look at it. We can see how the sevariables are checked in the following decompiled code:

8857_3dd124c8-2afd-484e-bfb9-27cee3bd1a5d

So at this point we can get a pretty clear picture of how this malware operates over the wire. The details of how this malware has gotten on these victim machines is still unclear, but please ensure that you are taking the necessary precautions to protect your system, with a special emphasis on Point of Sale boxes. Because really, nobody wants to become Dexter's next victim.

Latest SpiderLabs Blogs

Welcome to Adventures in Cybersecurity: The Defender Series

I’m happy to say I’m done chasing Microsoft certifications (AZ104/AZ500/SC100), and as a result, I’ve had the time to put some effort into a blog series that hopefully will entertain and inform you...

Read More

Trustwave SpiderLabs: Insights and Solutions to Defend Educational Institutions Against Cyber Threats

Security teams responsible for defending educational institutions at higher education and primary school levels often find themselves facing harsh lessons from threat actors who exploit the numerous...

Read More

Breakdown of Tycoon Phishing-as-a-Service System

Just weeks after Trustwave SpiderLabs reported on the Greatness phishing-as-a-service (PaaS) framework, SpiderLabs’ Email Security team is tracking another PaaS called Tycoon Group.

Read More