<?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: Gabriel Pavel</title>
    <description>The latest articles on DEV Community by Gabriel Pavel (@gabriel_pavel).</description>
    <link>https://dev.to/gabriel_pavel</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3743659%2Ff9eebdce-d288-44ab-afce-4d6a2d219641.jpg</url>
      <title>DEV Community: Gabriel Pavel</title>
      <link>https://dev.to/gabriel_pavel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gabriel_pavel"/>
    <language>en</language>
    <item>
      <title>The Config Rule Audit Your IR Playbook Is Missing</title>
      <dc:creator>Gabriel Pavel</dc:creator>
      <pubDate>Wed, 29 Apr 2026 19:40:25 +0000</pubDate>
      <link>https://dev.to/gabriel_pavel/the-config-rule-audit-your-ir-playbook-is-missing-10jd</link>
      <guid>https://dev.to/gabriel_pavel/the-config-rule-audit-your-ir-playbook-is-missing-10jd</guid>
      <description>&lt;p&gt;Your AWS compliance infrastructure can become a self-sustaining backdoor. Here's how the mechanic works, why standard IR misses it, and how to detect it in your own account.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pattern Everyone Trusts
&lt;/h2&gt;

&lt;p&gt;Mature AWS orgs run this: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;AWS Config rule detects non-compliant resource → SSM Automation fires → resource fixed. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's a Well-Architected recommendation. Security teams trust it. Almost nobody audits whether a given Config rule is enforcing the &lt;em&gt;right&lt;/em&gt; thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inversion in 8 Lines
&lt;/h2&gt;

&lt;p&gt;A custom Config rule's evaluation logic is a Lambda function returning &lt;code&gt;COMPLIANT&lt;/code&gt; or &lt;code&gt;NON_COMPLIANT&lt;/code&gt;. Flip the polarity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;invoking_event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;invokingEvent&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
      &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;invoking_event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;configurationItem&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;resourceName&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

      &lt;span class="n"&gt;has_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;check_bucket_policy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="c1"&gt;# Inverted: a bucket WITH a policy is "non-compliant"
&lt;/span&gt;      &lt;span class="n"&gt;compliance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;NON_COMPLIANT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;has_policy&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;COMPLIANT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;put_evaluation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;compliance&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pair this with an SSM Automation document that "remediates" by calling &lt;code&gt;DeleteBucketPolicy&lt;/code&gt;. You now have a self-healing loop &lt;em&gt;against&lt;/em&gt; hardening.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Loop
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Defender locks down an S3 bucket.&lt;/li&gt;
&lt;li&gt;Config flags it non-compliant.&lt;/li&gt;
&lt;li&gt;SSM removes the bucket policy.&lt;/li&gt;
&lt;li&gt;Defender re-hardens.&lt;/li&gt;
&lt;li&gt;Config flags it non-compliant again.&lt;/li&gt;
&lt;li&gt;SSM removes the policy again.&lt;/li&gt;
&lt;li&gt;Defender files a ticket about Terraform drift.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The misattribution is the real damage. Engineering spends hours debugging "conflicting automation" while the loop keeps firing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Standard IR Doesn't Catch It
&lt;/h2&gt;

&lt;p&gt;The cloud IR playbook is well-rehearsed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rotate access keys.&lt;/li&gt;
&lt;li&gt;Revoke active sessions.&lt;/li&gt;
&lt;li&gt;Delete the attacker's IAM user.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these touch the loop. AWS Config and SSM Automation execute under &lt;strong&gt;service roles&lt;/strong&gt;, not user credentials. The attacker can be fully evicted at the IAM layer and the harden→flip loop keeps running.&lt;/p&gt;

&lt;p&gt;There's a stealthier variant where instead of deploying a &lt;em&gt;new&lt;/em&gt; rogue rule, the attacker mutates the Lambda code and SSM document of an &lt;em&gt;existing&lt;/em&gt; customer-owned rule via &lt;code&gt;UpdateFunctionCode&lt;/code&gt; and &lt;code&gt;UpdateDocument&lt;/code&gt;. The rule name, creator, IAM roles, and tags stay pristine. From the outside it looks like the same rule the team has trusted for two years.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Honest Limitation
&lt;/h2&gt;

&lt;p&gt;The obvious objection: &lt;em&gt;"You need admin to deploy this in the first place."&lt;/em&gt; Correct. The threat model is &lt;strong&gt;post-eviction persistence&lt;/strong&gt;, not initial access. The whole point is that once the loop is in place, IR can rotate every credential and delete every IAM user, and the loop survives because it doesn't depend on any of them.&lt;/p&gt;

&lt;p&gt;Most organizations don't have "audit Config rule logic" on their IR runbook. That's the gap.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Check
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/gabrielPav/mirage" rel="noopener noreferrer"&gt;Mirage&lt;/a&gt; was built to scan for this exact class of abuse. It scores every Config rule in an account across seven heuristics. The strongest is behavioral:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An engineer hardens a resource, and SSM weakens the same resource within 5 minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The detector correlates &lt;code&gt;requestParameters&lt;/code&gt; from CloudTrail hardening events against &lt;code&gt;parameters.ResourceId&lt;/code&gt; of subsequent SSM executions. Time proximity alone isn't enough - the resource ID must match.&lt;/p&gt;

&lt;p&gt;It's read-only. &lt;code&gt;DescribeConfigRules&lt;/code&gt;, &lt;code&gt;GetFunction&lt;/code&gt;, &lt;code&gt;GetDocument&lt;/code&gt;, &lt;code&gt;cloudtrail:LookupEvents&lt;/code&gt;. No mutations. Safe to run anywhere.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
  mirage detect &lt;span class="nt"&gt;--verbose&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each suspicious rule is scored &lt;code&gt;CRITICAL&lt;/code&gt;, &lt;code&gt;HIGH&lt;/code&gt;, or &lt;code&gt;MEDIUM&lt;/code&gt; with the reason it was flagged. Takes about five minutes per region.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't run the offensive side anywhere but a sandbox.&lt;/strong&gt; The IAM target re-attaches &lt;code&gt;AdministratorAccess&lt;/code&gt;. The KMS target adds a wildcard principal policy. These are real persistence primitives.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;If your org runs AWS Config with auto-remediation and your IR runbook doesn't audit Config rule logic, your compliance pipeline is a credential-independent persistence vector. &lt;code&gt;mirage detect&lt;/code&gt; tells you if any rules are quietly enforcing the wrong thing.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/gabrielPav/mirage" rel="noopener noreferrer"&gt;github.com/gabrielPav/mirage&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cloudsecurity</category>
      <category>aws</category>
      <category>incidentresponse</category>
    </item>
  </channel>
</rss>
