Jim Rossiter

French Socksess Story: A Forensic Investigation Using Kusto Query Language

![https://nm0g0vqj.tinifycdn.com/photos/sockspic.png]

Author: Jim Rossiter


Overview

In this investigation, Kusto Query Language (KQL) is utilized to analyze a cyberattack involving a combination of phishing, credential dumping, data exfiltration, and extortion. The threat actor used sophisticated tactics, such as masquerading as a legitimate customer service email and exploiting vulnerabilities within the organization. The investigation traces the actor’s activity from the initial attack vector to the final stages of extortion.

Objectives:

  1. Investigate the email communication used in the attack.
  2. Identify compromised machines and user actions.
  3. Trace the malicious files, including their creation and usage.
  4. Highlight key IP addresses and domains involved in the attack.
  5. Showcase proficiency in KQL to perform complex correlation and analysis.

Section 1: Email and Communication Tracking

Code Highlights:

1. Tracking the Extortion Email

Email
| where subject == 'Pay up or the world will know your lies'

2. Identifying the Sender of the Extortion Email

Email
| where subject == 'Pay up or the world will know your lies'
| distinct sender

3. Recipient Information for Extortion Email

Email
| where subject == 'Pay up or the world will know your lies'
| distinct recipient
| lookup Employees on $left.recipient == $right.email_addr

Section 2: Process and File Activity

Code Highlights:

1. Reconnaissance on Internal Machines

ProcessEvents
| where hostname in ('SCHR-MACHINE', '9RGD-MACHINE')
| where timestamp between (datetime(2024-08-30T00:00:00Z) .. datetime(2024-08-31T00:00:00Z))

2. Detecting Use of Bitsadmin for Exfiltration

ProcessEvents
| where not(hostname in ('SCHR-MACHINE', '9RGD-MACHINE'))
| where process_commandline has 'bitsadmin'
| distinct username
| lookup Employees on $left.username == $right.username

3. Malicious File Usage by Mike Oz

ProcessEvents
| where username == 'mioz'
| where process_commandline has 'feetlover.rar'

Section 3: DNS and Network Activity

Code Highlights:

1. Tracking Malicious DNS Requests

PassiveDns
| where ip == '193.233.125.78'
| distinct domain

2. Identifying Suspicious Domains

PassiveDns
| where domain in ('thesockwhisperer.com', 'liarliarsocksonfire.net')
| distinct ip

3. Inbound Network Traffic from Malicious IPs

let hacker_ips = PassiveDns
| where domain in ('thesockwhisperer.com', 'liarliarsocksonfire.net')
| distinct ip;

InboundNetworkEvents
| where src_ip in (hacker_ips)

Section 4: Email and Network Correlation

Code Highlights:

1. Phishing Email Sent by Mike Oz

Email
| where sender == 'mike_oz@jusdechaussette.fr'
| where recipient in ('cho_cetkipu@jusdechaussette.fr','brooke_entoe@jusdechaussette.fr')
Email
| where sender == 'mike_oz@jusdechaussette.fr'
| where recipient in ('cho_cetkipu@jusdechaussette.fr','brooke_entoe@jusdechaussette.fr')
| distinct link
| lookup OutboundNetworkEvents on $left.link == $right.url

Section 5: File Creation and Exfiltration

Code Highlights:

1. Tracking File Creation by Mike Oz

FileCreationEvents
| where username == 'mioz'
| where timestamp between (datetime(2024-08-18T16:10:29Z) .. datetime(2024-08-18T16:58:29Z))

2. Tracking Network Traffic to Exfiltrate Data

InboundNetworkEvents
| where url contains 'holesinmysocks.jpeg'

Advanced Techniques

Correlation of Multiple Data Sources

Use of let Statements for Modular Queries:

let hacker_ips = PassiveDns
| where domain in ('thesockwhisperer.com', 'liarliarsocksonfire.net')
| distinct ip;
InboundNetworkEvents
| where src_ip in (hacker_ips)

Conclusion

This investigation demonstrates the ability to use Kusto Query Language (KQL) for comprehensive forensic analysis. The queries presented:

  1. Track malicious emails and phishing attempts.
  2. Identify compromised machines and exfiltrated files.
  3. Correlate network traffic and DNS activity to uncover the infrastructure used by the threat actor.
  4. Use advanced techniques such as modular queries, data correlation, and event tracking to build a detailed timeline of the attack.

Skills Demonstrated: