Your organization, Alliance, recently set up a SIEM in the environment for better visibility and coverage. However, due to a lack of administrative staff and poor security hygiene, the environment is in disarray. The logging configuration is broken in some areas, logs are being overwritten, and new log sources are being added to the SIEM only gradually, creating a significant visibility gap.
Spawn the VM and wait around 1-2 minutes for the ELK services to start. Then either by connecting to the HTB VPN or using pwnbox, access the SIEM using http://ip:5601
The credentials for SIEM are elastic:hacktheblue
You have been given a threat hunt hypothesis as your first task.
Hypothesis: A threat actor has established persistence on one or more hosts within the environment by creating or modifying a scheduled task with a name designed to blend in with legitimate Windows tasks. Given the degraded logging posture, the task may have gone undetected and could be actively executing a malicious payload.
An operator on a Kali machine opened an RDP session to a domain workstation using a standard user’s account, then used it as a base for hands-on activity. From that workstation they downloaded a portable network scanner over PowerShell, unpacked it and ran it for initial reconnaissance. Persistence was a scheduled task whose name copies a legitimate-looking SQL check with a single dropped letter; the task creation itself was never logged, so it only surfaced as a launch failure on the central server. A binary sitting in a public user folder and run under the machine account on that server tied the task to its payload. Overwritten logon events hid the original RDP logon, so the entry point had to be rebuilt from Sysmon registry writes.
:5601, queried with ES|QL. Useful data streams are logs-system.security-*, logs-windows.sysmon_operational-*, logs-windows.powershell_operational-* and logs-winlog.* (TaskScheduler/Operational)alliance-central (server), alliance-ws04, alliance-ws07 (workstations) and admsrv01 (Linux, auth logs only)Timestamp note: ES stores UTC. Comparing
@timestampto a plain string returned nothing in ES|QL, so wrap literals inTO_DATETIME().
Visibility note: Security
4624logons stop after 2026-06-02 and no4698task-creation events exist. Plan for Sysmon, PowerShell and TaskScheduler logs instead.
Task creation was not audited, so hunt for task names in the Microsoft-Windows-TaskScheduler/Operational channel across all hosts and strip the \Microsoft\Windows\ paths. A correctly spelled SQL connectivity check task shows up on alliance-ws04 and alliance-ws07 on 2026-06-05, created through PowerShell. A near-identical name with one letter missing appears only on alliance-central, in event 332 where Task Scheduler failed to launch it. The 19-character format hint fits the misspelled variant.
FROM logs-* | WHERE message LIKE "*SQLConnectvityCheck*" | KEEP @timestamp, host.name, event.code, message | SORT @timestamp | LIMIT 10
Gotcha: The properly spelled task is the one that looks legitimate and shows creation activity, but the answer is the typo variant that only appears in an error event. Count the characters against the format hint.
From Q1 the task fired on alliance-central, so list its 4688 process creations and drop everything under C:\Windows, C:\Program Files and C:\ProgramData\Microsoft. A backup-style SQL executable runs out of a public user’s Pictures folder, nowhere near the SQL Server install directories, at 2026-06-09 22:37:53 UTC. The process runs as the machine account ALLIANCE-CENTRA$, which is how a scheduled task running as SYSTEM would appear. The link to the task is circumstantial (matching SQL theme, same host), not a logged parent-child relationship.
FROM logs-system.security-* | WHERE host.name=="alliance-central" AND event.code=="4688" AND NOT process.executable LIKE "C:\\Windows\\*" AND NOT process.executable LIKE "C:\\Program Files*" AND NOT process.executable LIKE "C:\\ProgramData\\Microsoft*" | KEEP @timestamp, process.executable, user.name | SORT @timestamp | LIMIT 100
Security 4624 has nothing after 2026-06-02, so chasing source IPs there goes nowhere. The attack week (06-09) is covered by Sysmon instead. An RDP session writes the client machine name to HKU\<SID>\Volatile Environment\<n>\CLIENTNAME when the session starts, and Sysmon event 13 records that write. Search for CLIENTNAME across Sysmon and take the first write for the attack session on alliance-ws07: 12:41:09 UTC on 2026-06-09. Winlogon event 7001 fires slightly earlier on the same host and is the logon itself, but the registry write is the value used here.
FROM logs-windows.sysmon_operational-* | WHERE message LIKE "*CLIENTNAME*" | KEEP @timestamp, host.name, registry.path, registry.data.strings | SORT @timestamp | LIMIT 200
Gotcha: The Winlogon
7001at 12:40:57 UTC onalliance-ws07is a few seconds before the accepted time. The registry write is the one the platform accepted.
The same CLIENTNAME value written in Q3 holds the name of the machine the RDP client ran on. It reads as a Kali default hostname, which is a clear outlier among the Alliance workstations.
FROM logs-windows.sysmon_operational-* | WHERE message LIKE "*CLIENTNAME*" | KEEP @timestamp, host.name, registry.path, registry.data.strings | SORT @timestamp | LIMIT 200
The CLIENTNAME key from Q3 sits under a user SID ending in -1107. Sysmon logged other values from the same Volatile Environment key, including USERNAME and USERDOMAIN, so query that SID’s keys to map it to an account. USERNAME is John.shepard and USERDOMAIN is ALLIANCE. The answer needs the domain\username format.
FROM logs-windows.sysmon_operational-* | WHERE registry.path LIKE "*-1107\\Volatile Environment\\USER*" | KEEP @timestamp, host.name, registry.path, registry.data.strings | SORT @timestamp | LIMIT 10
Script block logging on alliance-ws07 captured the full cradle as event 4104 at 2026-06-09 12:55:13 UTC, 14 minutes after the RDP session began, run by john.shepard. Filter the PowerShell Operational log for Invoke-WebRequest together with Expand-Archive: the script downloads a zip of SoftPerfect’s portable netscan, extracts it to a folder and launches the scanner from there. Variables and paths in the cradle follow the shape of the format hint.
FROM logs-windows.powershell_operational-*, logs-windows.powershell-*, logs-system.security-*, logs-windows.sysmon_operational-* | WHERE message LIKE "*Expand-Archive*" AND message LIKE "*Invoke-WebRequest*" AND event.code IN ("4104","4688","1") | KEEP @timestamp, host.name, event.code, message | SORT @timestamp | LIMIT 6
| Phase | Action |
|---|---|
| Persistence | Scheduled task with a name that mimics a legitimate SQL check; legitimately spelled variant created through PowerShell on two workstations on 2026-06-05 |
| Initial Access | RDP session from a host named kali to alliance-ws07 as john.shepard |
| Discovery | PowerShell cradle downloads, unpacks and runs a portable network scanner |
| Persistence | Typo-squatted task fails to launch on alliance-central (logged as event 332) |
| Execution | SQLBackup.exe runs from C:\Users\Public\Pictures on alliance-central under the machine account |
| Timestamp (UTC) | Event |
|---|---|
| 2026-06-05 | SQL connectivity check task created via PowerShell on alliance-ws04 and alliance-ws07 |
| 2026-06-09 12:40:57 | Winlogon 7001 on alliance-ws07 for the RDP session |
| 2026-06-09 12:41:09 | Sysmon 13: CLIENTNAME set to kali in the user’s Volatile Environment |
| 2026-06-09 12:55:13 | PowerShell 4104 on alliance-ws07: scanner download and execution cradle |
| 2026-06-09 22:37:53 | SQLBackup.exe process creation (4688) on alliance-central |
| Type | Value |
|---|---|
| Scheduled task | \SQLConnectvityCheck |
| File | C:\Users\Public\Pictures\SQLBackup.exe |
| RDP client name | kali |
| Account | ALLIANCE\john.shepard |
| Tool | SoftPerfect netscan_portable.zip |
| Technique | ID | Description |
|---|---|---|
| Scheduled Task/Job: Scheduled Task | T1053.005 | Persistence through a scheduled task |
| Masquerading: Masquerade Task or Service | T1036.004 | Task name copies a legitimate SQL check minus one letter |
| Masquerading | T1036 | Payload named like a SQL backup, placed in a public user folder |
| Remote Services: Remote Desktop Protocol | T1021.001 | RDP session from a host named kali |
| Valid Accounts: Domain Accounts | T1078.002 | RDP logon as john.shepard |
| Command and Scripting Interpreter: PowerShell | T1059.001 | PowerShell cradle for the scanner |
| Ingress Tool Transfer | T1105 | Scanner zip downloaded to the workstation |
| Network Service Discovery | T1046 | Portable network scanner used for initial recon |
Audit scheduled task creation, and keep the log long enough to matter. There were no 4698 events at all, so the task was only visible as a failure in the TaskScheduler channel and as a registry path in Sysmon. Enable Other Object Access Events auditing and forward Microsoft-Windows-TaskScheduler/Operational (events 106, 140, 141 and 332).
Alert on near-miss names of real tasks. Task and service names one edit away from a known-good name are cheap to detect by edit distance against an allowlist. A task that exists on two hosts under one spelling and fails on a third under another spelling should have drawn a ticket.
Sysmon registry events rebuild lost logons. With 4624 overwritten, CLIENTNAME writes under Volatile Environment still gave the client hostname and the account SID of the RDP session. Collect Sysmon event 13 for that key, and size Security log retention so logon events survive a week.
Flag executables running from Users\Public under machine accounts. A SQL-themed binary in a Pictures folder, launched as ALLIANCE-CENTRA$, stands out immediately against the Program Files paths of real SQL Server. A path-based rule on 4688 or Sysmon 1 would have caught it.
Script block logging paid off. The 4104 event preserved the full download-and-run cradle for the scanner, which is exactly the content missing everywhere else. Keep it on for every host, not just workstations.
The attacker got into the domain through one RDP session from a Kali machine, ran a scanner from PowerShell, and left a lookalike scheduled task and an oddly placed binary on the central server. What made this hunt hard was not the technique but the logging: the key evidence lived in registry writes and error events, not in the logs that would normally have answered the question.