<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Travis Green</title>
    <description></description>
    <link>http://travisgreen.net/</link>
    <atom:link href="http://travisgreen.net/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Tue, 24 Mar 2026 18:06:23 +0000</pubDate>
    <lastBuildDate>Tue, 24 Mar 2026 18:06:23 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>The Port Scoping Paradox: When Optimization Makes Things Slower</title>
        <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Port scoping in Suricata rules — a widely recommended optimization — can actually &lt;em&gt;increase&lt;/em&gt; CPU usage by 20-30% when the traffic you’re analyzing is already on the target ports. Here’s the story of how I discovered this counterintuitive behavior and what it means for rule development.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;the-setup-an-obvious-optimization&quot;&gt;The Setup: An “Obvious” Optimization&lt;/h2&gt;

&lt;p&gt;You’re writing Suricata detection rules for RDP brute force attacks. Your starting point looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-suricata&quot;&gt;alert tcp any any -&amp;gt; any any (
    msg:&quot;RDP Brute Force Attempt&quot;;
    content:&quot;|e0 00 00 00 00 00|Cookie|3a 20|&quot;;
    offset:5; depth:14;
    sid:7704787;
)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A colleague suggests what seems like an obvious win: “Why inspect every TCP connection? RDP runs on port 3389. Scope it to the port!”&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-suricata&quot;&gt;alert tcp any any -&amp;gt; any [3388,3389] (
    msg:&quot;RDP Brute Force Attempt&quot;;
    content:&quot;|e0 00 00 00 00 00|Cookie|3a 20|&quot;;
    offset:5; depth:14;
    sid:7704787;
)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The logic is bulletproof, right? Most traffic isn’t RDP — maybe 1% of connections. Port scoping filters out 99% of packets before any expensive pattern matching happens. You save 99% of CPU on these rules.&lt;/p&gt;

&lt;p&gt;Right?&lt;/p&gt;

&lt;h2 id=&quot;the-twist&quot;&gt;The Twist&lt;/h2&gt;

&lt;p&gt;We ran the numbers. Single-threaded profiling mode, 5 iterations for statistical confidence, 376,460 packets of real network traffic. Both rule variants evaluated &lt;strong&gt;the exact same packets&lt;/strong&gt; — “Checks” counts how many packets each rule fully evaluated.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Rule config&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Checks&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;CPU ticks&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Result&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any any&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;1,010&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;382,581&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Baseline&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[3388,3389]&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;1,010&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;496,132&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;+29.7% overhead&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;🔍 Critical insight:&lt;/strong&gt; Same checks (1,010), but port-scoped rules burned 113,551 extra CPU cycles doing the same work.&lt;/p&gt;

&lt;p&gt;Look at the Checks column: both configurations evaluated &lt;strong&gt;exactly the same 1,010 packets&lt;/strong&gt;. Port scoping did not prefilter anything. Because the test traffic was already RDP on port 3389, every packet matched the port condition — so the rule still ran on all 1,010 of them. The “optimization” never got to skip a single packet. It only added overhead to each one.&lt;/p&gt;

&lt;p&gt;The result: 113,551 extra CPU cycles for the same amount of work.&lt;/p&gt;

&lt;p&gt;I ran it again five times to be sure:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Iteration&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Overhead&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+26%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+37%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+32%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;4&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+26%&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;5&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+29%&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Coefficient of variation: 4.9% (anything under 10% is reliable). This wasn’t noise.&lt;/p&gt;

&lt;h2 id=&quot;why&quot;&gt;Why?&lt;/h2&gt;

&lt;p&gt;To understand what went wrong, you need to know what Suricata’s prefilter actually does.&lt;/p&gt;

&lt;h3 id=&quot;prefilter-uses-fast_pattern-not-ports&quot;&gt;Prefilter Uses fast_pattern, Not Ports&lt;/h3&gt;

&lt;p&gt;Suricata’s prefilter is built around &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fast_pattern&lt;/code&gt; — the content keyword that feeds the MPM (multi-pattern matching) engine. Only packets that hit a fast_pattern go on to full rule evaluation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port conditions aren’t part of prefilter.&lt;/strong&gt; They’re checked &lt;em&gt;during&lt;/em&gt; full rule evaluation, after MPM has already decided the packet is a candidate.&lt;/p&gt;

&lt;h3 id=&quot;what-port-scoping-actually-adds&quot;&gt;What Port Scoping Actually Adds&lt;/h3&gt;

&lt;p&gt;When you write &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any [3388,3389]&lt;/code&gt;, you’re not adding an early exit. You’re adding an extra check that runs inside every rule evaluation:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any any&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;MPM scan → hit on content&lt;/li&gt;
  &lt;li&gt;Rule evaluation → content check → match&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;With &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[3388,3389]&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;MPM scan → hit on content&lt;/li&gt;
  &lt;li&gt;Rule evaluation → &lt;strong&gt;port list traversal&lt;/strong&gt; → content check → match&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For packets on port 3389 that match the content (all 1,010 in our test), step 2 now does &lt;em&gt;more work&lt;/em&gt;, not less.&lt;/p&gt;

&lt;h3 id=&quot;the-port-matching-overhead&quot;&gt;The Port Matching Overhead&lt;/h3&gt;

&lt;p&gt;With &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any any&lt;/code&gt;, Suricata sees &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ANY_PORT&lt;/code&gt; and the compiler eliminates the check entirely. With a port list, a linked list must be traversed at runtime on every check:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compiled away:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// any any: optimized away by compiler — zero cost&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;port_spec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ANY_PORT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Runtime traversal:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// [3388,3389]: runtime traversal on every evaluation&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DetectPortRange&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port_spec&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;packet_port&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;low&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;packet_port&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The port list structure sits in L2/L3 cache, not the hot L1 cache where rule structures live. Every evaluation pays a cache miss to fetch it. Across 1,010 checks, the estimated ~120-240 cycles per lookup produces the 113,551 extra cycles we measured.&lt;/p&gt;

&lt;p&gt;The overhead breaks down to:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Source&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Share&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Detail&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Memory access penalty&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;~60%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Port list lives in L2/L3 cache; rule structures are hot in L1. Every lookup pays a ~100-200 cycle cache miss.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Function call overhead&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;~20%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;The compiler can optimize &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if (ANY)&lt;/code&gt; to nothing. Port list traversal is runtime data — it can’t be eliminated.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Conditional branch overhead&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;~20%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Extra branch instructions, potential mispredictions, loop bookkeeping.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;At the per-rule level for SID 7704787 the picture was even starker: 2,836 ticks per check without port scoping vs 8,420 with it — a +197% increase on a cold-cache run with only 2 checks. This is a worst-case result (no cache warmth), but it illustrates the mechanism clearly.&lt;/p&gt;

&lt;h2 id=&quot;the-break-even-point&quot;&gt;The Break-Even Point&lt;/h2&gt;

&lt;p&gt;The overhead is predictable enough to model. From the aggregate results above: 382,581 total ticks / 1,010 checks ≈ &lt;strong&gt;379 ticks&lt;/strong&gt; average baseline evaluation; (496,132 − 382,581) / 1,010 ≈ &lt;strong&gt;112 ticks&lt;/strong&gt; added overhead per check from port matching. The break-even is:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Break-even = T_base / (T_base + T_port)
           = 379 / (379 + 112)
           ≈ 77%
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Port scoping saves CPU only when fewer than &lt;strong&gt;~77% of your TCP traffic&lt;/strong&gt; is on the target ports. Plotted out:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Network&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;RDP %&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Effect&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Use scoping?&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;General internet monitoring&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;0.01%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+99.9% faster&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Yes&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Enterprise network&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;5%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+77% faster&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Yes&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Security lab (mixed)&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;50%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;+39% faster&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Yes&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;RDP-focused investigation&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;85%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;-11% slower&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;No&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Pure RDP capture&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;100%&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;-27% slower&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;No&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;practical-takeaways&quot;&gt;Practical Takeaways&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Port scoping works well when:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;You’re monitoring diverse production traffic (most common case)&lt;/li&gt;
  &lt;li&gt;The target protocol is rare (&amp;lt; ~80% of your TCP traffic)&lt;/li&gt;
  &lt;li&gt;You need to reduce false positives from rules triggering on wrong ports&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Port scoping hurts when:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;You’re replaying or analyzing targeted captures&lt;/li&gt;
  &lt;li&gt;Your traffic is already filtered (an RDP-only PCAP, a dedicated monitoring sensor)&lt;/li&gt;
  &lt;li&gt;Your rules are already lightweight and not consuming meaningful CPU&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For RDP brute force rules specifically, I landed on keeping &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any any&lt;/code&gt; because:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;We already have a solid &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fast_pattern&lt;/code&gt; for prefilter&lt;/li&gt;
  &lt;li&gt;The rules are already cheap (&amp;lt; 0.1% CPU in a 6,477-rule set)&lt;/li&gt;
  &lt;li&gt;RDP on non-standard ports is a real and common evasion technique&lt;/li&gt;
  &lt;li&gt;The profiling showed a 27% degradation with port scoping on &lt;strong&gt;this&lt;/strong&gt; traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;measure-dont-assume&quot;&gt;Measure, Don’t Assume&lt;/h2&gt;

&lt;p&gt;We assumed port scoping would save 90-95% CPU. The reality was -27%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before tuning rules:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Profile first:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;suricata -r test.pcap -S rules.rules --profile&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Find hot rules:&lt;/strong&gt; Check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rule_perf.log&lt;/code&gt; — ignore rules using &amp;lt; 0.1% CPU&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Know your traffic:&lt;/strong&gt; What % is actually on your target port?&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Test both ways:&lt;/strong&gt; Measure with and without scoping&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Deploy the faster one&lt;/strong&gt; — not the one that “should” be faster&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Port scoping isn’t wrong — it’s just situational. Documentation says it’s best practice, and for most environments it is. But “most” isn’t “all.”&lt;/p&gt;

&lt;p&gt;The difference between good detection engineering and great detection engineering is measuring your assumptions.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;em&gt;Test environment: Suricata (containerized), single-threaded profiling mode, 376k packet PCAP of real network traffic, 5 iterations, CV 4.9%.&lt;/em&gt;&lt;/p&gt;
</description>
        <pubDate>Thu, 12 Feb 2026 00:00:00 +0000</pubDate>
        <link>http://travisgreen.net/2026/02/12/port-scoping-paradox.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2026/02/12/port-scoping-paradox.html</guid>
        
        <category>suricata</category>
        
        <category>performance</category>
        
        <category>optimization</category>
        
        <category>detection-engineering</category>
        
        
      </item>
    
      <item>
        <title>CVE-2025-8088: WinRAR NTFS ADS Path Traversal Vulnerability Analysis</title>
        <description>&lt;h1 id=&quot;cve-2025-8088-winrar-ntfs-ads-path-traversal-vulnerability-analysis&quot;&gt;CVE-2025-8088: WinRAR NTFS ADS Path Traversal Vulnerability Analysis&lt;/h1&gt;
&lt;p&gt;I was catching up on the weekend’s news when I saw &lt;a href=&quot;https://www.welivesecurity.com/en/eset-research/update-winrar-tools-now-romcom-and-others-exploiting-zero-day-vulnerability/&quot;&gt;a fantastic report from ESET&lt;/a&gt; pop up covering (yet another) rar file path traversal vulnerability. At first it seemed like there wasn’t going to be any details to dig into given the reports are careful not to describe the vulnerability in too much detail as to deter copy cat attackers. Also, interestingly, there is a fake &lt;a href=&quot;https://github.com/jordan922/CVE-2025-8088/blob/main/CVE-2025-8088.py#L33&quot;&gt;poc on github&lt;/a&gt; which does not represent this CVE at all but I assume the author couldn’t resist the call of sweet sweet SEO (much like this author). However, I did find one of the file hashes in a &lt;a href=&quot;https://app.any.run/tasks/d8654a4c-260b-4b54-bfef-410be70367ab&quot;&gt;sample submitted to any.run&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fantastic! Let’s go!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, it seemed like nothing had happened as there were no obvious malicious network traffic generated, but on deeper inspection of any.run’s report, I noticed a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lnk&lt;/code&gt; file was launched in the “behavior activities” view.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/cve-2025-8088/starts_new.png&quot; alt=&quot;starts new process&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This led me to look closer at the rar file iteslf and sure enough…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/cve-2025-8088/rar_bytes.png&quot; alt=&quot;rar bytes&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here we can see the malicious bytes in action. According to &lt;a href=&quot;https://www.rarlab.com/technote.htm&quot;&gt;rarlab.com&lt;/a&gt; STM section is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NTFS alternate data stream&lt;/code&gt; so sure enough that matches the reported details from ESET.&lt;/p&gt;

&lt;p&gt;From there, it was simple to create yara &amp;amp; suricata detection to find the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/\x00\x00\x03STM.{2}\x3a[^\x00]*\x2e\x2e\x5c&lt;/code&gt; in network and file bytes.&lt;/p&gt;

&lt;h2 id=&quot;suricata-rules&quot;&gt;suricata rules:&lt;/h2&gt;
&lt;p&gt;Thanks to James Emery-Callcott of Emerging Threats for adding a more durable path traversal PCRE: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/\x2e\x2e\x5c/&lt;/code&gt; =&amp;gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/^.{0,10}(?:\x2f|\x5c|%5[Cc]|%2[Ff])?(?:(?:\x2e|%2[Ee]){1,2}(?:\x2f|\x5c|%5[Cc]|%2[Ff]){1,}){2,}/&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# note {,64} prevents runaway pcre, tune as desired
alert http $EXTERNAL_NET any -&amp;gt; $HOME_NET any (msg:&quot;CORELIGHT EXPLOIT RAR File ADS Path Traversal Inbound via HTTP (CVE-2025-8088)&quot;; flow:established,to_client; http.response_body; content:&quot;STM&quot;; fast_pattern; pcre:&quot;/^.{2}\x3a[^\x00]{0,64}(?:\x2f|\x5c|%5[Cc]|%2[Ff])?(?:(?:\x2e|%2[Ee]){1,2}(?:\x2f|\x5c|%5[Cc]|%2[Ff]){1,}){2,}/R&quot;; reference:url,travisgreen.net/2025/08/11/CVE-2025-8088.html; classtype:bad-unknown; sid:7704721; rev:1;)

alert http2 $EXTERNAL_NET any -&amp;gt; $HOME_NET any (msg:&quot;CORELIGHT EXPLOIT RAR File ADS Path Traversal Inbound via HTTP2 (CVE-2025-8088)&quot;; flow:established,to_client; http.response_body; content:&quot;STM&quot;; fast_pattern; pcre:&quot;/^.{2}\x3a[^\x00]{0,64}(?:\x2f|\x5c|%5[Cc]|%2[Ff])?(?:(?:\x2e|%2[Ee]){1,2}(?:\x2f|\x5c|%5[Cc]|%2[Ff]){1,}){2,}/R&quot;; reference:url,travisgreen.net/2025/08/11/CVE-2025-8088.html; classtype:bad-unknown; sid:7704722; rev:1;)

alert tcp $EXTERNAL_NET any -&amp;gt; $HOME_NET any (msg:&quot;CORELIGHT EXPLOIT RAR File ADS Path Traversal Inbound via raw tcp (CVE-2025-8088)&quot;; app-layer-protocol:!http; app-layer-protocol:!http2; content:&quot;|00 00 03|STM&quot;; fast_pattern; pcre:&quot;/^.{2}\x3a[^\x00]{0,64}(?:\x2f|\x5c|%5[Cc]|%2[Ff])?(?:(?:\x2e|%2[Ee]){1,2}(?:\x2f|\x5c|%5[Cc]|%2[Ff]){1,}){2,}/R&quot;; threshold:type limit, seconds 600, count 1, track by_src; reference:url,travisgreen.net/2025/08/11/CVE-2025-8088.html; classtype:bad-unknown; sid:7704723; rev:1;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;yara-rule&quot;&gt;yara rule:&lt;/h2&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rule CVE_2025_8088_rar_ADS_traversal {
   meta:
        description = &quot;Detects CVE-2025-8088 WinRAR NTFS ADS path traversal exploitation&quot;
        author = &quot;Travis Green &amp;lt;travis.green@corelight.com&amp;gt;&quot;
        reference = &quot;https://www.welivesecurity.com/en/eset-research/update-winrar-tools-now-romcom-and-others-exploiting-zero-day-vulnerability/&quot;
        date = &quot;2025-08-11&quot;
        version = &quot;1.0&quot;
        hash1 = &quot;107f3d1fe28b67397d21a6acca5b6b35def1aeb62a67bc10109bd73d567f9806&quot;
        tlp = &quot;WHITE&quot;
   strings:
        $x1 = &quot;STM&quot; fullword ascii
        $x2 = &quot;..\\\\&quot; fullword ascii
        $x3 = /STM..\x3a[^\x00]*\x2e\x2e\x5c/ ascii
   condition:
        uint16(0) == 0x6152 and 3 of ($x*)
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There’s certainly much much more to be said about the file that is launched and TTPs around the campaign, but this will have to do for today. Also, shout out to Winrar developers, you have an amazing track record considering it’s been around more than 30 years..&lt;/p&gt;
</description>
        <pubDate>Mon, 11 Aug 2025 00:00:00 +0000</pubDate>
        <link>http://travisgreen.net/2025/08/11/CVE-2025-8088.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2025/08/11/CVE-2025-8088.html</guid>
        
        <category>cve</category>
        
        <category>vulnerability</category>
        
        <category>winrar</category>
        
        <category>CVE-2025-8088</category>
        
        <category>path-traversal</category>
        
        <category>malware-analysis</category>
        
        
      </item>
    
      <item>
        <title>Setting impacket &amp; Metasploit to use SMB2</title>
        <description>&lt;p&gt;When testing detection capabilities in my Active Directory lab, I ran into a common issue: impacket tools default to SMB3, but I needed to generate SMB2 traffic for detection rule development. Here’s how to force both impacket and Metasploit to use SMB2 instead.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;

&lt;p&gt;Modern security tools like impacket automatically negotiate the highest SMB protocol version (usually SMB3), which makes it difficult to test detection rules specifically designed for SMB2 traffic patterns.&lt;/p&gt;

&lt;h2 id=&quot;solution-1-impacket-configuration&quot;&gt;Solution 1: Impacket Configuration&lt;/h2&gt;

&lt;p&gt;For impacket tools, you need to modify the SMB dialect preference in the source code:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;impacket/smbconnection.py&lt;/code&gt; (around line 79)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Change the preferredDialect parameter to force SMB2:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# Find this section in smbconnection.py
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;preferredDialect&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SMB2_DIALECT_002&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SMB2_DIALECT_21&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SMB2_DIALECT_30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SMB2_DIALECT_311&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt;
    &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_SMBConnection&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;smb3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SMB3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_remoteName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_remoteHost&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_myName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hostType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                    &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_sess_port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_timeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;preferredDialect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SMB2_DIALECT_21&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#                                                                 ^^^^^^^^^^^^^^^^
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;#                                                                 Force SMB2 here
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Available SMB2 constants:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SMB2_DIALECT_002&lt;/code&gt; - SMB 2.0.2&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SMB2_DIALECT_21&lt;/code&gt; - SMB 2.1 (recommended)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;solution-2-metasploit-configuration&quot;&gt;Solution 2: Metasploit Configuration&lt;/h2&gt;

&lt;p&gt;For Metasploit modules, disable SMB encryption to force protocol downgrade:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-msf&quot;&gt;msf6 exploit(windows/smb/psexec) &amp;gt; set SMB::AlwaysEncrypt false
SMB::AlwaysEncrypt =&amp;gt; false
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;verification&quot;&gt;Verification&lt;/h2&gt;

&lt;p&gt;After making these changes, you can verify the SMB version using network capture tools like Wireshark or tcpdump to confirm SMB2 negotiation packets.&lt;/p&gt;

&lt;p&gt;These modifications ensure your red team tools generate the specific SMB2 traffic needed for detection rule testing. Just remember to document these changes for your team - and hope attackers &lt;del&gt;don’t&lt;/del&gt; do read your blog! 😉&lt;/p&gt;
</description>
        <pubDate>Tue, 29 Jul 2025 00:00:00 +0000</pubDate>
        <link>http://travisgreen.net/2025/07/29/smb2-impacket-msf.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2025/07/29/smb2-impacket-msf.html</guid>
        
        <category>smb</category>
        
        <category>impacket</category>
        
        <category>metasploit</category>
        
        
      </item>
    
      <item>
        <title>Hunting for browser extension abuse</title>
        <description>&lt;p&gt;I came across a funny thing while digging into discord stealers. It seems the world of discord stealers is very much in the business of cryptocurrency theft, and as a result of many crypto wallets being browser extensions, we see these class of attacks frequently looking for these browser extensions to inject malicious javascript. I’ve introduced a new set to the TGI HUNT rules to detect these browser extension ID strings in HTTP.&lt;/p&gt;

&lt;p&gt;For example, here is &lt;a href=&quot;https://github.com/Yxxtsuu/1336-V3/blob/c32a0f68b502cf17aa7b6e63ec9ff919593dfa5c/utils/crypto.js#L98&quot;&gt;1336 stealer v3&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/20250416.1.png&quot; alt=&quot;Browser Extension Abuse&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To enumerate any new javascript inbound or identifying browser extension information outbound, I’ve introduce &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;browser-extensions.rules&lt;/code&gt; available on the TGI HUNT git repo: https://github.com/travisbgreen/hunting-rules/&lt;/p&gt;
</description>
        <pubDate>Tue, 15 Apr 2025 00:00:00 +0000</pubDate>
        <link>http://travisgreen.net/2025/04/15/browser-extension-abuse.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2025/04/15/browser-extension-abuse.html</guid>
        
        <category>malware</category>
        
        <category>javascript</category>
        
        
      </item>
    
      <item>
        <title>Arbitrary File Read in Jenkins via args4j (CVE-2024-23897)</title>
        <description>&lt;h1 id=&quot;arbitrary-file-read-in-jenkins-via-args4j-cve-2024-23897---is-this-another-log4j&quot;&gt;Arbitrary File Read in Jenkins via args4j (CVE-2024-23897) - is this another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log4j&lt;/code&gt;?&lt;/h1&gt;
&lt;p&gt;Please note that this analysis covers the vulnerability of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@&lt;/code&gt; expansion, not the entire attack chain possible from &lt;a href=&quot;https://www.jenkins.io/security/advisory/2024-01-24/&quot;&gt;the advisory&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;background&quot;&gt;Background&lt;/h3&gt;
&lt;p&gt;The hot thing in the cyber security press this morning (25 JAN 2024) is a vulnerability in Jenkins allowing attackers to read arbitrary files. Jenkins has had a few &lt;a href=&quot;https://www.cvedetails.com/vulnerability-list/vendor_id-15865/product_id-34004/Jenkins-Jenkins.html&quot;&gt;vulnerabilities&lt;/a&gt; over the years, likely due to its incredible popularity and &lt;a href=&quot;https://6sense.com/tech/continuos-integration/jenkins-market-share&quot;&gt;dominant marketshare&lt;/a&gt; in the CI/CD space inviting much code analysis and scrutiny.&lt;/p&gt;

&lt;p&gt;The large market share along with the sensitive nature the data make it a hugely popular target among attackers. If successful, attackers can pivot into an organization’s cloud infrastructure using the highly privileged and long lasting accounts contained within.&lt;/p&gt;

&lt;p&gt;When a vulnerability is released for Jenkins, we potentially have a very big issue on our hands, &lt;strong&gt;but is that the case for CVE-2024-23897?&lt;/strong&gt; Let’s dig in.&lt;/p&gt;

&lt;h3 id=&quot;the-announcement&quot;&gt;The Announcement&lt;/h3&gt;
&lt;p&gt;Per Jenkins:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;“This command parser has a feature that replaces an @ character followed by a file path in an argument with the file’s contents (expandAtFiles). This feature is enabled by default and Jenkins 2.441 and earlier, LTS 2.426.2 and earlier does not disable it.”
Jenkins 2.442, LTS 2.426.3 disables the command parser feature that replaces an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@&lt;/code&gt; character followed by a file path in an argument with the file’s contents for CLI commands.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;the-code&quot;&gt;The Code&lt;/h3&gt;
&lt;p&gt;Examining &lt;a href=&quot;https://github.com/jenkinsci/jenkins/commit/554f03782057c499c49bbb06575f0d28b5200edb&quot;&gt;the patch&lt;/a&gt; we can see that they have added &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ALLOW_AT_SYNTAX&lt;/code&gt; to allow/disallow what was called out in the announcement as the vulnerable code path, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@&lt;/code&gt; file expansion. Also, we can follow the bread crumbs in that code to identify the vulnerable code in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args4j&lt;/code&gt; &lt;a href=&quot;https://github.com/kohsuke/args4j/blob/b819bd367a70fe102f7a7cab628c2e9f080705fe/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L556&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/CVE-2024-23897/patch.png&quot; alt=&quot;patch&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here we have the logic from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args4j&lt;/code&gt; where we test the first character for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@&lt;/code&gt;-ness, and read all the lines of the file if true:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/CVE-2024-23897/readalllines.png&quot; alt=&quot;arg4j&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;the-vulnerability&quot;&gt;The Vulnerability&lt;/h3&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@&lt;/code&gt; expansion seems like a convenient feature to launch java applications from the command line using a file full of arguments instead of each argument separately, and I’m not sure I’m comfortable calling it a vulnerability per se. &lt;strong&gt;This vulnerability is due to arbitrary user input arriving at a command line argument.&lt;/strong&gt; It is important to highlight the difference between this and a wildcard expansion vulnerability, which IMO is much worse due to their arbitrary and unpredictable nature.&lt;/p&gt;

&lt;h3 id=&quot;impact&quot;&gt;Impact&lt;/h3&gt;
&lt;p&gt;Do other software projects use this library in a vulnerable way? A &lt;a href=&quot;https://github.com/search?q=%22import+org.kohsuke.args4j.CmdLineParser%3B%22+path%3A*.java++NOT+is%3Aarchived&amp;amp;type=Code&amp;amp;ref=advsearch&amp;amp;l=&amp;amp;l=&amp;amp;p=3&quot;&gt;github search&lt;/a&gt; reveals that is a pretty popular library, but a quick survey of search results shows most of the importers of this are command line utilities intended to interact with larger projects like these &lt;a href=&quot;https://github.com/search?q=%22import+org.kohsuke.args4j.CmdLineParser%3B%22+path%3A*.java++NOT+is%3Aarchived+minecraft&amp;amp;type=code&amp;amp;ref=advsearch&quot;&gt;minecraft utilities&lt;/a&gt;, or are unlikely to the allow rich user interaction via web interface that Jenkins does (such as &lt;a href=&quot;https://github.com/search?q=%22import+org.kohsuke.args4j.CmdLineParser%3B%22+path%3A*.java++NOT+is%3Aarchived+stratum&amp;amp;type=code&amp;amp;ref=advsearch&quot;&gt;stratum-proxy&lt;/a&gt;)&lt;/p&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;For these reasons I don’t think we have another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log4j&lt;/code&gt; type mega-bug in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args4j&lt;/code&gt;, but rather a fairly straightforward input validation / surprise feature problem that is likely only to be exploited by authenticated users in Jenkins, and will have limited impact in other software utilizing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;args4j&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;No LLMs were harmed in the writing of this blog post.&lt;/p&gt;
</description>
        <pubDate>Thu, 25 Jan 2024 12:00:00 +0000</pubDate>
        <link>http://travisgreen.net/2024/01/25/jenkins-arg4j-CVE-2024-23897.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2024/01/25/jenkins-arg4j-CVE-2024-23897.html</guid>
        
        <category>jenkins</category>
        
        <category>args4j</category>
        
        <category>CVE-2024-23897</category>
        
        
      </item>
    
      <item>
        <title>TGI HUNT Ruleset Update</title>
        <description>&lt;h1 id=&quot;tgi-hunt---update-january-2024&quot;&gt;TGI HUNT - Update January 2024&lt;/h1&gt;
&lt;p&gt;Hey all, I’ve decided to start being more verbose about this project’s activity in the hope of generating more feedback from people checking it out.&lt;/p&gt;

&lt;h3 id=&quot;documentation&quot;&gt;Documentation&lt;/h3&gt;
&lt;p&gt;Documentation will slowly appear in the ruleset as reference links to this site. If there is a particular rule you’d like to know more about, simply open a github issue &lt;a href=&quot;https://github.com/travisbgreen/hunting-rules/issues/new/choose&quot;&gt;here&lt;/a&gt; and I will bump it to the top of the doumentation queue.&lt;/p&gt;

&lt;h3 id=&quot;ruleset-housekeeping&quot;&gt;Ruleset Housekeeping&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;cleaned up spacing&lt;/li&gt;
  &lt;li&gt;removed some obsolete encoding rules&lt;/li&gt;
  &lt;li&gt;renamed &amp;amp; simplified &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2610338&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;removed previously disabled JA3 rules&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;new-rules&quot;&gt;New Rules&lt;/h3&gt;

&lt;h5 id=&quot;xmrigcc-donation-mining-pool-domain&quot;&gt;xmrigCC Donation Mining Pool Domain&lt;/h5&gt;
&lt;p&gt;I found this domain while examining torminer. It is a hardcoded domain found in &lt;a href=&quot;https://github.com/Bendr0id/xmrigCC/blob/e3ea3139ac57c546a312ce5b699fa7caf2edf6f6/src/net/strategies/DonateStrategy.cpp#L53&quot;&gt;xmrigCC source code&lt;/a&gt;&lt;/p&gt;

&lt;h5 id=&quot;suspicious-string-inbound-b64-downloadstring&quot;&gt;Suspicious String Inbound (b64 DownloadString)&lt;/h5&gt;
&lt;p&gt;This was found analyzing malicious powershell downloading an exe file per CrackMapExec web delivery of implant&lt;/p&gt;

&lt;h5 id=&quot;powershellexe-inbound-to-sql-utf-16le&quot;&gt;Powershell.exe Inbound to SQL (UTF-16LE)&lt;/h5&gt;
&lt;p&gt;This was found surveying MSSQL attack techniques in Metasploit and CrackMapExec&lt;/p&gt;

&lt;h5 id=&quot;mssql-antivirus-error&quot;&gt;MSSQL Antivirus Error&lt;/h5&gt;
&lt;p&gt;This error was observed during adversary simulation against MSSQL, when the MSSQL antivirus found something naughty and refused the query/command&lt;/p&gt;

&lt;h5 id=&quot;malicious-shell-script-artifact-inbound&quot;&gt;Malicious Shell Script Artifact Inbound&lt;/h5&gt;
&lt;p&gt;These artifacts were observed when a compromised system reached out for a script containing these lines, which are meant to disable command logging at the bash terminal. For example PEASS-ng, a local privesc utility, &lt;a href=&quot;https://github.com/carlospolop/PEASS-ng/blob/46612a23aad2e0039a731a8826a0654ac6b48655/linPEAS/builder/linpeas_parts/linpeas_base.sh#L991&quot;&gt;uses this technique&lt;/a&gt;.&lt;/p&gt;

&lt;h5 id=&quot;mssql-configuration-changed-message&quot;&gt;MSSQL Configuration Changed Message&lt;/h5&gt;
&lt;p&gt;This is the output of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sp_configure&lt;/code&gt; MSSQL stored procedure, which occurs when using any of the Metasploit techniques to execute on MSSQL.&lt;/p&gt;

&lt;h5 id=&quot;mssql-blocked-stored-procedure-message&quot;&gt;MSSQL Blocked Stored Procedure Message&lt;/h5&gt;
&lt;p&gt;Observed in MSSQL when using Metasploit&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Server blocked access to procedure ‘sys.xp_cmdshell’ of component ‘xp_cmdshell’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘xp_cmdshell’ by using sp_configure. For more information about enabling ‘xp_cmdshell’, search for ‘xp_cmdshell’ in SQL Server Books Online.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5 id=&quot;mssql-generic-xp_cmdshell&quot;&gt;MSSQL Generic xp_cmdshell&lt;/h5&gt;
&lt;p&gt;This is a generic &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xp_cmdshell&lt;/code&gt; string observed across many red team &lt;a href=&quot;https://github.com/search?q=%22exec+master..xp_cmdshell%22&amp;amp;type=code&quot;&gt;github repos&lt;/a&gt;&lt;/p&gt;

&lt;h5 id=&quot;base64-encoded-exe-file-in-dns&quot;&gt;Base64 Encoded EXE File in DNS&lt;/h5&gt;
&lt;p&gt;This came up in my daily reading, and I found an example from the venerable &lt;a href=&quot;https://blog.didierstevens.com/2019/08/07/downloading-executables-over-dns-capture-files/&quot;&gt;Didier Stevens&lt;/a&gt;. Note that I didn’t specify TXT record type here.&lt;/p&gt;
</description>
        <pubDate>Tue, 23 Jan 2024 09:30:00 +0000</pubDate>
        <link>http://travisgreen.net/updates/20240123</link>
        <guid isPermaLink="true">http://travisgreen.net/updates/20240123</guid>
        
        <category>suricata</category>
        
        <category>hunting</category>
        
        <category>ruleset</category>
        
        
        <category>suricata</category>
        
      </item>
    
      <item>
        <title>Easily Assemble Regular Expressions</title>
        <description>&lt;style&gt;
  code {
    white-space : pre-wrap !important;
    word-break: break-word;
  }
&lt;/style&gt;

&lt;h1 id=&quot;list-to-regular-expression&quot;&gt;List to regular expression&lt;/h1&gt;

&lt;p&gt;Have you ever encountered a list like this and thought “I wish I could easily create a regex to cover all these possible values”?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/regex.1.png&quot; alt=&quot;@ymzkei5&quot; /&gt;
&lt;a href=&quot;https://twitter.com/ymzkei5/status/1469765165348704256&quot;&gt;source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have a linux based method to share which makes this task easy by leveraging an incredible Perl module called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Regexp::Assemble&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;step-1---create-a-list&quot;&gt;Step 1 - create a list&lt;/h2&gt;
&lt;p&gt;In our example, We’d like to capture all the possible values behind the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;${&lt;/code&gt; characters (we’ll deal with the leading characters later), so our first step is to list the values in a text document:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;k8s
main
sys
lower
web
env
upper
date
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;step-2---assemble&quot;&gt;Step 2 - assemble&lt;/h2&gt;

&lt;p&gt;Copy the following to a file (in this example it is named &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;regex_assemble.pl&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;#!/usr/bin/perl
use strict;
use Regexp::Assemble;
 
 my $ra = Regexp::Assemble-&amp;gt;new;
 while (&amp;lt;&amp;gt;)
 {
   $ra-&amp;gt;add($_);
   }
   print $ra-&amp;gt;as_string() . &quot;\n&quot;;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note: you may need to &lt;a href=&quot;https://www.howtoinstall.me/ubuntu/18-04/libregexp-assemble-perl/&quot;&gt;install the Perl module&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, we can copy our list to the clipboard and paste it into the STDIN of the invocation of our Perl script (note single quote):&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ echo &apos;k8s
&amp;gt; main
&amp;gt; sys
&amp;gt; lower
&amp;gt; web
&amp;gt; env
&amp;gt; upper
&amp;gt; date
&amp;gt; :
&amp;gt; &apos; | perl ~/scripts/regex_assemble.pl
(?:(?:low|upp)er|(?:k8|sy)s|date|main|env|web|:)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Notice the output:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(?:(?:low|upp)er|(?:k8|sy)s|date|main|env|web|:)&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;step-3---refinement&quot;&gt;Step 3 - refinement&lt;/h1&gt;
&lt;p&gt;Now we can add logic to account for preceeding characters&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j[ndi]*&lt;/code&gt; will match the preceeding characters, note that this uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0 or more of this character class&lt;/code&gt; logic and not a string match, a stylistic choice for readablity to cover partial strings: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jn${..&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jnd${&lt;/code&gt;, …&lt;/p&gt;

&lt;p&gt;Also, it seems every string following &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;${&lt;/code&gt; also follows with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:&lt;/code&gt; character, so we add:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;j[ndi]*\${(?:(?:low|upp)er|(?:k8|sy)s|date|main|env|web|:):&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;step-4---use&quot;&gt;Step 4 - use&lt;/h1&gt;
&lt;p&gt;In my case, I’m writing a &lt;a href=&quot;https://github.com/travisbgreen/hunting-rules&quot;&gt;hunting rule&lt;/a&gt; for use in investigating URL payloads, so a suricata rule using this regex would look like this:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert http $HOME_NET any -&amp;gt; any any (msg:&quot;TGI HUNT Possible Log4shell Obfuscation Technique&quot;; flow:established; http.uri; content:&quot;${&quot;; fast_pattern; pcre:&quot;/j[ndi]*\${(?:(?:low|upp)er|(?:k8|sy)s|date|main|env|web|:):/i&quot;; reference:url,twitter.com/ymzkei5/status/1469765165348704256; classtype:bad-unknown; sid:2610828; rev:1;)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And a quick check shows that it is working:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ ~/scripts/suri.hunting.sh
3/2/2022 -- 11:58:01 - &amp;lt;Notice&amp;gt; - This is Suricata version 6.0.2 RELEASE running in USER mode
&amp;lt;...&amp;gt;
3/2/2022 -- 11:58:01 - &amp;lt;Info&amp;gt; - Alerts: 1
3/2/2022 -- 11:58:01 - &amp;lt;Info&amp;gt; - cleaning up signature grouping structure... complete
02/02/2022-15:10:56.628683  [**] [1:2610828:1] TGI HUNT Possible Log4shell Obfuscation Technique [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.96.175.18:39376 -&amp;gt; 1.1.1.1:80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hope that helps, and feel free to &lt;a href=&quot;https://twitter.com/travisbgreen&quot;&gt;@&lt;/a&gt; me with feedback.&lt;/p&gt;

</description>
        <pubDate>Thu, 03 Feb 2022 11:02:00 +0000</pubDate>
        <link>http://travisgreen.net/2022/02/03/easily-assemble-regular-expressions.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2022/02/03/easily-assemble-regular-expressions.html</guid>
        
        
      </item>
    
      <item>
        <title>Behavorial xbits with Suricata</title>
        <description>&lt;h2 id=&quot;the-setting&quot;&gt;The Setting:&lt;/h2&gt;
&lt;p&gt;While attempting to build detection for &lt;a href=&quot;https://twitter.com/benkow_/status/1415797114794397701&quot;&gt;DeepRats&lt;/a&gt; as revealed by &lt;a href=&quot;https://twitter.com/benkow_/&quot;&gt;@benkow_&lt;/a&gt;, I managed to have (what I think) is a pretty good idea about using xbits. I’ll admit its a bit basic but I think sometimes the best ideas are deceivingly simple.&lt;/p&gt;

&lt;h2 id=&quot;the-idea&quot;&gt;The Idea:&lt;/h2&gt;
&lt;p&gt;1.) observe potentially malicious behavior, set an xbit&lt;br /&gt;
2.) observe another potentially malicious behavior, set another xbit&lt;br /&gt;
3.) build detection consisting of a good fast_pattern match and xbits checks&lt;/p&gt;

&lt;p&gt;Example (edited for clarity, full working example &lt;a href=&quot;https://gist.github.com/travisbgreen/1be982e3fc6e4e7a809a0fc5f12d5caa&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;

&lt;p&gt;IP check xbits set here:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert tls $HOME_NET any -&amp;gt; $EXTERNAL_NET any (msg:&quot;ET POLICY IP Check Domain (myexternalip .com in TLS SNI)&quot;; flow:established,to_server; tls.sni; content:&quot;myexternalip.com&quot;; endswith; nocase; xbits:set,ET.ipcheck,track ip_src; classtype:policy-violation; sid:7704131; rev:1;)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert tls $HOME_NET any -&amp;gt; $EXTERNAL_NET any (msg:&quot;ET POLICY IP Check Domain (freegeoip .live in TLS SNI)&quot;; flow:established,to_server; tls.sni; content:&quot;freegeoip.live&quot;; endswith; nocase; xbits:set,ET.ipcheck,track ip_src; xbits:set,ET.ipcheck,track ip_src; classtype:policy-violation; sid:7704132; rev:1;)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Known abused storage as dropper site xbit set here:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert tls $HOME_NET any -&amp;gt; $EXTERNAL_NET any (msg:&quot;ET POLICY IPFS Domain (storage.snark .art in TLS SNI)&quot;; flow:established,to_server; tls.sni; content:&quot;myexternalip.com&quot;; endswith; nocase; xbits:set,ET.dropsite,track ip_src;  classtype:policy-violation; sid:7704133; rev:1;)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Tor &amp;amp; final detection:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert tcp any ![21,25,110,143,443,465,587,636,989:995,5061,5222,8443] -&amp;gt; any any (msg:&quot;ET MALWARE Possible DarkRats Tor Traffic&quot;; flow:established,from_server; content:&quot;|06 03 55 04 03|&quot;; pcre:&quot;/^.{2}www\.[0-9a-z]{8,20}\.com[01]/Rs&quot;; content:&quot;|06 03 55 04 03|&quot;; distance:0; pcre:&quot;/^.{2}www\.[0-9a-z]{8,20}\.net/Rs&quot;; xbits:isset,ET.ipcheck,track ip_dst; xbits:isset,ET.dropsite,track ip_dst; classtype:trojan-activity; sid:7704134; rev:1;)&lt;/code&gt;&lt;br /&gt;
Note: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;track ip_dst&lt;/code&gt; here because this detects the Tor RESPONSE traffic.&lt;/p&gt;

&lt;p&gt;The final sig could probably also be a great HUNTING sig.
Other HUNTING sig ideas:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Tor -&amp;gt; coinmining&lt;/li&gt;
  &lt;li&gt;IP Check -&amp;gt; HTTP POST&lt;/li&gt;
  &lt;li&gt;IP Check -&amp;gt; HTTP to frequently abused TLD&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://twitter.com/travisbgreen/&quot;&gt;tweet me&lt;/a&gt; your ideas!&lt;/p&gt;
</description>
        <pubDate>Thu, 22 Jul 2021 09:30:00 +0000</pubDate>
        <link>http://travisgreen.net/2021/07/22/behavioral-xbits.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2021/07/22/behavioral-xbits.html</guid>
        
        
      </item>
    
      <item>
        <title>2032936 - Suspected Sliver DNS CnC FP Report</title>
        <description>&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;It appears that SMTP MTAs and SMTP spam gateways utilizing &lt;a href=&quot;https://support.dnsimple.com/articles/dkim-record/&quot;&gt;DKIM&lt;/a&gt; sometimes make many &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_domainkey&lt;/code&gt; DNS TXT requests, which occasionally generate a false positive alert (FP) for rule 2032936. The cause of these alerts is a bit of inexact rule logic, which sometimes matches legitimate requests greater than a certain length that start with the underscore character: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;content:&quot;_&quot;; depth:1; content:&quot;_domainkey&quot;; distance:8;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For example, this non-malicious request generates a FP:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_conversica._domainkey.servicios.redactado.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This example request would also generate a FP since distance:8; is not restricted to any bytes by the “within” keyword:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_asdfasdfasdfasdfasdfasdfasdfasdfasdf._domainkey.example.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here is an example of the malicious sliver CnC traffic which is the target of the original detection logic:
&lt;img src=&quot;/assets/img/20210518.1.png&quot; alt=&quot;malicious DNS TXT request&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;analysis&quot;&gt;Analysis&lt;/h2&gt;

&lt;p&gt;We can refer to the sliver source code (convenient!) &lt;a href=&quot;https://github.com/BishopFox/sliver/&quot;&gt;on github&lt;/a&gt; and search for the string “_domainkey” to find out the purpose and details of this traffic. Doing this reveals some lovely documentation on &lt;a href=&quot;https://github.com/BishopFox/sliver/blob/672c0e29d07313fcc3d093d2c6b742659e574e07/server/c2/udp-dns.go#L254&quot;&gt;line 254&lt;/a&gt; which explains the first part of the domain name is a nonce. The purpose of this nonce is to generate a unique name for the DNS request so if a DNS server has been configured to ignore a record’s TTL and always cache the name, we still have reason to perform recursion because it has never seen that unique domain name before.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/20210518.5.png&quot; alt=&quot;sliver source code snippet&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The format of the nonce is an underscore character followed by a string of the length defined in &lt;a href=&quot;https://github.com/BishopFox/sliver/blob/672c0e29d07313fcc3d093d2c6b742659e574e07/implant/sliver/transports/udp-dns.go#L66&quot;&gt;nonceStdSize&lt;/a&gt; at line 66, containing random characters from the variable named &lt;a href=&quot;https://github.com/BishopFox/sliver/blob/672c0e29d07313fcc3d093d2c6b742659e574e07/implant/sliver/transports/udp-dns.go#L75&quot;&gt;dnsCharSet&lt;/a&gt; at line 77. 
&lt;img src=&quot;/assets/img/20210518.4.png&quot; alt=&quot;sliver source code snippet&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;modification&quot;&gt;Modification&lt;/h2&gt;

&lt;p&gt;With this information we can update the rule logic to be more specific to this pattern and eliminate most FP.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;content:&quot;_&quot;; depth:1; content:&quot;_domainkey&quot;; distance:8;&lt;/code&gt;&lt;br /&gt;
becomes&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;content:&quot;_&quot;; depth:1; pcre:&quot;/^[a-z0-9_]{6}[^a-z0-9_]/R&quot;; content:&quot;_domainkey&quot;; distance:8;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We’ve added a PCRE with a relative (“/R”) modifier to ensure the next 6 characters after the underscore are from variable dnsCharSet. With these changes we should dramatically reduce the number of false positives (but not entirely eliminate them, for example in the case of: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_123456._domain.example.com&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;original rule:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert dns any any -&amp;gt; any any (msg:&quot;ET TROJAN Suspected Sliver DNS CnC (original)&quot;; content:&quot;|00 10 00 01|&quot;; isdataat:!1,relative; content:&quot;|00 10 00 01|&quot;; isdataat:!1,relative; dns_query; content:&quot;_&quot;; depth:1; content:&quot;_domainkey&quot;; distance:8; fast_pattern; reference:url,github.com/BishopFox/sliver; classtype:trojan-activity; sid:2032936; rev:1;)&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;becomes:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;alert dns any any -&amp;gt; any any (msg:&quot;ET TROJAN Suspected Sliver DNS CnC (modified)&quot;; content:&quot;|00 10 00 01|&quot;; isdataat:!1,relative; content:&quot;|00 10 00 01|&quot;; isdataat:!1,relative; dns_query; content:&quot;_&quot;; depth:1; pcre:&quot;/^[a-z0-9_]{6}[^a-z0-9_]/R&quot;; content:&quot;_domainkey&quot;; distance:8; fast_pattern; reference:url,github.com/BishopFox/sliver; classtype:trojan-activity; sid:9999999; rev:2;)&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;verify&quot;&gt;Verify&lt;/h2&gt;

&lt;p&gt;Next we verify that our fix is good (if we have the luxury of pcap). Truth be told, I had a few small mistakes to fix and that is quite common for me.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/20210518.3.png&quot; alt=&quot;fast log snippet&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;The last thing to do is to submit to the mailing list and enjoy that sweet sweet open source community karma. Could we make this detection logic more precise? Probably, but we might risk creating a false negative by using too exact logic or including incorrect assumptions in our logic. Therefore we seek balance. Shout out to the BishopFox team for creating such a masterfully executed tool.&lt;/p&gt;

&lt;p&gt;Please &lt;a href=&quot;https://twitter.com/travisbgreen/&quot;&gt;DM me&lt;/a&gt; with any rule analysis or FP/TP analysis requests.&lt;/p&gt;
</description>
        <pubDate>Tue, 18 May 2021 13:32:00 +0000</pubDate>
        <link>http://travisgreen.net/2021/05/18/2032936-suspected-sliver-dns-cnc-fp-report.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2021/05/18/2032936-suspected-sliver-dns-cnc-fp-report.html</guid>
        
        <category>fp</category>
        
        <category>emergingthreats</category>
        
        
      </item>
    
      <item>
        <title>Cobalt Group Report</title>
        <description>&lt;h1 id=&quot;cobalt-group-report&quot;&gt;Cobalt Group Report&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Update/correction&lt;/strong&gt;
It has been brought to my attention that the attribution of this activity to cobalt group is not ironclad, it may change in the future.&lt;/p&gt;

&lt;p&gt;Recently an excellent report by &lt;a href=&quot;https://research.checkpoint.com/cobalt-group-returns-to-kazakhstan/&quot;&gt;Checkpoint&lt;/a&gt; was published explaining recent developments of the Cobalt Group threat actor group. The Checkpoint report covers a lot of interesting TTPs and the evolution of techniques and procedures, but for now we will focus on detecting the unique C2 used by the group.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://attack.mitre.org/groups/G0080/&quot;&gt;Cobalt Group&lt;/a&gt; recap:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;financially motivated&lt;/li&gt;
  &lt;li&gt;targets eastern EU and central Asian banks&lt;/li&gt;
  &lt;li&gt;leader arrested in 2018&lt;/li&gt;
  &lt;li&gt;RU language decoy doc downloads &amp;amp; executes cobalt strike beacon via squibbly2&lt;/li&gt;
  &lt;li&gt;known to pivot from victim’s email account to infect others to exploit trust&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;c2---the-interesting-bits&quot;&gt;C2 - The Interesting Bits&lt;/h2&gt;
&lt;p&gt;First we see the O365 Malleable C2 Profile as mentioned in the report, and as usual Cobalt Strike does an impressive job of masquerading its C2 as legitimate traffic.&lt;/p&gt;

&lt;h3 id=&quot;http-request&quot;&gt;HTTP Request:&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/cg_owa.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;First we have a long URL with legitimate looking /owa/ path and convincing parameters, but with no Referer this would have to be the first request, which seems odd. Also we have a Cookie header, again with no Referer; where did the cookie come from if this is the first request? There would be no chance for a server to respond with Set-Cookie, so this jumps out as odd.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hunting sig idea: detect Cookie header with no Referer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We have a legitimate but ancient user agent string, and a dotted quad IP address. Cobalt strike is known for using a fake HTTP Host header, why do we not see that here? Looking at the source code mentioned in the article, we see that line 33 is commented out by default in this profile.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/cg_line33.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Further down in the file at line 93 we see what is really going on here. The real C2 data is contained within wla42= GET parameter.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/cg_line93.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;All of the other static fields defined here would make for great detection strings, but would catch users of this exact profile only, and only in the default configuration.&lt;/p&gt;

&lt;h3 id=&quot;http-response&quot;&gt;HTTP Response:&lt;/h3&gt;
&lt;p&gt;We also see a lot of nice custom X- headers in the request convincing us of its legitimacy. One thing that jumps out as odd in the server response is that it is serving no data (Content-Length: 0). Could we build a hunting signature based on this?&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hunting sig idea 1: detect Content-Length: 0 and HTTP 200&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;From this information we can build these two signatures:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;alert http &lt;span class=&quot;nv&quot;&gt;$HOME_NET&lt;/span&gt; any -&amp;gt; &lt;span class=&quot;nv&quot;&gt;$EXTERNAL_NET&lt;/span&gt; any &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;msg:&lt;span class=&quot;s2&quot;&gt;&quot;TGI TROJAN Cobalt Strike
 Malleable C2 Request (Cobalt Group O365 Profile)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; flow:established,to_server&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 http.uri&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;/owa/?wa=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; startswith&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;&amp;amp;path=/calendar&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 endswith&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; http.header_names&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:!&lt;span class=&quot;s2&quot;&gt;&quot;Referer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;Cookie&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 http.cookie&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;MicrosoftApplicationsTelemetryDeviceId=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; startswith&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 content:&lt;span class=&quot;s2&quot;&gt;&quot;|3b|ClientId=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; distance:0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;|3b|MSPAuth=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; distance:0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 content:&lt;span class=&quot;s2&quot;&gt;&quot;|3b|xid=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; distance:0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;|3b|wla42=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; distance:0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 reference:md5,a26722fc7e5882b5a273239cddfe755f&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 reference:url,attack.mitre.org/groups/G0080/&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  classtype:trojan-activity&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 sid:1003918&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; rev:1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 

alert http &lt;span class=&quot;nv&quot;&gt;$EXTERNAL_NET&lt;/span&gt; any -&amp;gt; &lt;span class=&quot;nv&quot;&gt;$HOME_NET&lt;/span&gt; any &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;msg:&lt;span class=&quot;s2&quot;&gt;&quot;TGI TROJAN Cobalt Strike
 Malleable C2 Response (Cobalt Group O365 Profile)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 flow:established,to_client&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; http.header&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 content:&lt;span class=&quot;s2&quot;&gt;&quot;16723708fc9|0d 0a|X-CalculatedBETarget|3a 20|BY2PR06MB549.namprd06&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 content:&lt;span class=&quot;s2&quot;&gt;&quot;X-FEServer|3a 20|CY4PR02CA0010&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; distance:0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
 reference:md5,a26722fc7e5882b5a273239cddfe755f&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 reference:url,attack.mitre.org/groups/G0080/&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; classtype:trojan-activity&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 sid:1003919&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; rev:1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;additional-sample&quot;&gt;Additional Sample&lt;/h3&gt;
&lt;p&gt;Additional samples have come to light which show another malleable C2 profile being used, this time mimicing YouTube activity:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/cg_yt.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here we see the fake HTTP Host common to Cobalt Strike Beacon. Also, interestingly we also have a null response from the server, but because the C2 profile pads the response, we do not see “Content-Length: 0” header in the response, instead we have “content=’’” for our empty response.&lt;/p&gt;

&lt;p&gt;For these, we can detect with:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;alert http &lt;span class=&quot;nv&quot;&gt;$HOME_NET&lt;/span&gt; any -&amp;gt; &lt;span class=&quot;nv&quot;&gt;$EXTERNAL_NET&lt;/span&gt; any &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;msg:&lt;span class=&quot;s2&quot;&gt;&quot;TGI TROJAN Cobalt Strike
 Malleable C2 Request (Cobalt Group YouTube Profile)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 flow:established,to_server&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; http.uri&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;/watch?v=&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; http.header_names&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 content:!&lt;span class=&quot;s2&quot;&gt;&quot;Referer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;Cookie&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 reference:md5,69c6e302cc4394cae7ed8c6f7b288e92&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 reference:url,attack.mitre.org/groups/G0080/&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; classtype:trojan-activity&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 sid:1003920&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; rev:1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

alert http &lt;span class=&quot;nv&quot;&gt;$EXTERNAL_NET&lt;/span&gt; any -&amp;gt; &lt;span class=&quot;nv&quot;&gt;$HOME_NET&lt;/span&gt; any &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;msg:&lt;span class=&quot;s2&quot;&gt;&quot;TGI TROJAN Cobalt Strike
 Malleable C2 Response (Cobalt Group YouTube Profile)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 flow:established,to_client&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; http.header&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;Frontend Proxy|0d
 0a|Set-Cookie|3a 20|YSC=LT4ZGGSgKoE|3b|&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; fast_pattern&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;X-FEServer|3a
 20|CY4PR02CA0010&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; distance:0&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; reference:md5,69c6e302cc4394cae7ed8c6f7b288e92&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 reference:url,attack.mitre.org/groups/G0080/&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; classtype:trojan-activity&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 sid:1003921&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; rev:1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;signatures-for-threat-hunting&quot;&gt;Signatures for Threat Hunting&lt;/h3&gt;
&lt;p&gt;If we implemented either of the proposed hunting sigs above, we would probably end up wading through huge amounts of alerts with potentially bad traffic somewhere in there, i.e. the proverbial needle in a haystack. Perhaps there is a way we can combine these two together to produce a less daunting haystack?&lt;/p&gt;

&lt;p&gt;Consider the following:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;alert http &lt;span class=&quot;nv&quot;&gt;$HOME_NET&lt;/span&gt; any -&amp;gt; &lt;span class=&quot;nv&quot;&gt;$EXTERNAL_NET&lt;/span&gt; any &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;msg:&lt;span class=&quot;s2&quot;&gt;&quot;TGI HUNT Possible Cobalt
 Strike Malleable C2 Null Response (Flowbit Set)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; flow:established,to_server&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 http.header_names&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:!&lt;span class=&quot;s2&quot;&gt;&quot;Referer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;Cookie&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 flowbits:set,hunt.cs_null_response&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; flowbits:noalert&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; threshold:type limit,
 track by_src, seconds 60, count 1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; classtype:trojan-activity&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; sid:2610202&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 rev:1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

alert http &lt;span class=&quot;nv&quot;&gt;$EXTERNAL_NET&lt;/span&gt; any -&amp;gt; &lt;span class=&quot;nv&quot;&gt;$HOME_NET&lt;/span&gt; any &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;msg:&lt;span class=&quot;s2&quot;&gt;&quot;TGI HUNT Possible Cobalt
 Strike Malleable C2 Null Response&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; flow:established,to_client&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 http.stat_code&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; content:&lt;span class=&quot;s2&quot;&gt;&quot;200&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; bsize:3&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; pkt_data&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
 content:&lt;span class=&quot;s2&quot;&gt;&quot;Content-Length:|20|0|0d 0a|&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; fast_pattern&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
 flowbits:isset,hunt.cs_null_response&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; threshold:type limit, track by_src,
 seconds 60, count 1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; classtype:trojan-activity&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; sid:2610203&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; rev:1&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here we are setting a flowbit on any HTTP request that has a Cookie set, but lacks the Referer header. Then we detect any HTTP 200 responses for 0 content length, then also check if the flowbit has been set by our previous sig. The end result is a strong indicator that further investigation is warranted. The caveat here is that these are signatures that will consume high amount of resources. In the first case, every request with a Cookie header will be inspected, and in the second case, any traffic with “Content-Length: 0” will be inspected. So these would not be great signatures for production use where network traffic is of any significant volume.&lt;/p&gt;

&lt;p&gt;You can find these hunting sigs and more @ https://github.com/travisbgreen/hunting-rules&lt;/p&gt;

&lt;p&gt;Comments? Suggestions? DMs open: &lt;a href=&quot;https://twitter.com/travisbgreen&quot;&gt;@travisbgreen&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Fri, 13 Sep 2019 12:09:00 +0000</pubDate>
        <link>http://travisgreen.net/2019/09/13/cobalt-group-report.html</link>
        <guid isPermaLink="true">http://travisgreen.net/2019/09/13/cobalt-group-report.html</guid>
        
        
      </item>
    
  </channel>
</rss>
