Introduce your threat actor and the specific TTPs you are looking for. Who are they and what is their attribution and motivation. Provide an overview of a specific incident attributed to this attacker. (5 Points)
The actor we're doing is the APT called "BRONZE BUTLER". The main TTPs that we're focusing on are Screen Capture (T1113), Scheduled Task (T1053.002 and T1053.005) and Command and Scripting Interpreter: Powershell (T1059.001). The goal is to simulate Screen Capture and System Time Discovery through Scheduled Tasks. BRONZE BUTLER is a Chinese cyber espionage group that tends to target Japanese organizations affiliated with the government, biotechnology, electronic manufacturing and industrial chemistry. An example of a specific incident would be Operation ENDTRADE. The general flow of the attack involved spearphishing for malware delivery, the creation of decoy documents designed to be opened with flashy filenames, and the use of steganography to hide malware payloads in photos.
Create the conditions that generate the telemetry that are associated with at least three of your TTPs. This could be logs, active processes, strange use of powershell, files, callouts to specific IPs or DNS ,hashes etc…(5 points)
The condition we ended up using, specifically because our focus was with Task Scheduler, was to have Wazuh log any newly created scheduled tasks. All of our primary TTPs are focused around this, making it fairly simple to focus on. Alternatively, we could’ve logged powershell usage, and the use of specific executables that would be somewhat strange to open on a corporate PC. Sysmon was our method of collecting logs from task scheduler, which would then be integrated into the Wazuh dashboard through the agent installed on the targeted PC.
So for our detection tool we just used wazuh which required a bit of setup and configuration before we could do anything.
First we needed to install sysmon on our target machines
Note ensure the XML is already on your machine which can be found here
.\Sysmon.exe -accepteula -i .\sysmonconfig.xml
We are using the wks01 for the target which is already apart of the windows group on Wazuh. But going into the group configuration on the gui we need to add the following:
Now that the group has been set up we need to add rules to the local_rules.xml file and add proper rules that will cause Wazuh to pick up a scheduled task on any device within the windows group:
Heres what we added:
<group name="windows,sysmon,">
<rule id="115006" level="6">
<if_group>windows</if_group>
<field name="win.eventdata.ruleName" type="pcre2">^technique_id=T1053,technique_name=Scheduled Task$</field>
<field name="win.eventdata.eventType" type="pcre2">^CreateKey$</field>
<description>A Newly Scheduled Task has been Detected on $(win.system.computer)</description>
<mitre>
<id>T1053</id>
</mitre>
</rule>
<rule id="115007" level="0">
<if_sid>115006</if_sid>
<field name="win.eventdata.targetObject" type="pcre2">^HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\Schedule\\\\TaskCache\\\\Tree\\\\Microsoft\\\\Windows\\\\UpdateOrchestrator$</field>
<description>Suppression rule for scheduled task created by update orchestrator</description>
</rule>
</group>
Next, we configured the wks01 machine to scan for task that have been created and run on the machine. This is located in our ossec agent files at C:\Program Files (x86)\ossec-agent\active-response\bin\analyze-scheduled-task.cmd
Calling it analyze-scheduled-task.cmd we added:
@echo off
setlocal enableDelayedExpansion
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && SET OS=32BIT || SET OS=64BIT
if %OS%==32BIT (
SET logFile="%programfiles%\ossec-agent\logs\scheduled-tasks.log"
)
if %OS%==64BIT (
SET logFile="%programfiles(x86)%\ossec-agent\logs\scheduled-tasks.log"
)
set input=
for /f "delims=" %%a in ('powershell -command "$logInput = Read-Host; Write-Output $logInput"') do (
set input=%%a
)
powershell -command "$string = '%input%'; $match = select-string 'HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\Schedule\\\\TaskCache\\\\Tree.*\\\\(\S*)\\r\\n' -inputobject $string; $taskName = $match.Matches.groups[1].value; $task = Get-ScheduledTask | where TaskName -EQ $taskName; $jsonTask = $task.Actions | ConvertTo-Json -Compress; try{$stream = [System.IO.StreamWriter]::new( '%logFile%', $true );'{\"ScheduledTaskAR\": ' + $jsonTask + ', \"TaskName\": \"' + $taskName + '\"}' | ForEach-Object{ $stream.WriteLine( $_ ) }}finally{$stream.close()}; exit"
Located in the ossec folder under Program files(x86) look for a document called C:\Program Files (x86)\ossec-agent\local_internal_options.conf and add the following
wazuh_command.remote_commands=1
Lastly, we configured the ossec configuration files at /var/ossec/etc/ossec.conf
Once this has all been setup run the following command on wazuh
systemctl restart wazuh-manager
Also restart the Wazuh service through the services application on wks01
Task Scheduler Setup
The Tasks we chose to schedule mimicked some of the actions of our Threat Group. Overall, we had 3 tasks scheduled
Opens Snipping Tool (we’re using Snipping Tool as a proxy for something like CobaltStrike, because our Threat Group has taken screen captures on compromised machines
Closes Snipping Tool (Just a followup to the prior, so that there is some form of evasion)
Runs pingscript.ps1 and outputs the results to ping.txt on the Desktop (the script is below, but it just outputs any IPs that returned successful pings on the 172.16.150.0/24 network and the output file is sent to the Desktop for ease of access)
Lastly, If you were on a team, discuss who did what and any difficulties encountered in the project.(1 point)
For the work we split it up mostly into two different parts however we crossover here and there mostly in the cases of troubleshooting.
Attack (Max): I set up the scheduled tasks and did the research for our APT (BRONZE BUTLER) and the TTPs we chose. I also helped with the Wazuh/Sysmon initial configuration and troubleshooting.
Defence (Eric): I setup and configured the Wazuh agent’s rules, sysmon install, and local rules on both the Wazuh machine and wks01 target station.