<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amr Khaled on Medium]]></title>
        <description><![CDATA[Stories by Amr Khaled on Medium]]></description>
        <link>https://medium.com/@AmrKhaled?source=rss-1bd5b9c27f35------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IFd7bLdbXCXAnFi0gzbNpQ.jpeg</url>
            <title>Stories by Amr Khaled on Medium</title>
            <link>https://medium.com/@AmrKhaled?source=rss-1bd5b9c27f35------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 21:46:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@AmrKhaled/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[BAM and DAM: What They Prove and What They Don’t]]></title>
            <link>https://medium.com/@AmrKhaled/bam-and-dam-what-they-prove-and-what-they-dont-bf91db9d5b9d?source=rss-1bd5b9c27f35------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf91db9d5b9d</guid>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[windows-forensics]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Amr Khaled]]></dc:creator>
            <pubDate>Wed, 14 Oct 2026 19:30:30 GMT</pubDate>
            <atom:updated>2026-10-14T19:30:30.958Z</atom:updated>
            <content:encoded><![CDATA[<p>The Background Activity Moderator (BAM) and Desktop Activity Moderator (DAM) are Windows power-management components that throttle application activity. As a side effect, they record the full path of executed programs and their last execution time, per user SID, in the registry.</p><pre>HKLM\SYSTEM\CurrentControlSet\Services\bam\State\UserSettings\&lt;SID&gt;<br>HKLM\SYSTEM\CurrentControlSet\Services\dam\State\UserSettings\&lt;SID&gt;</pre><p>Each value name is an executable path (in \Device\HarddiskVolumeN\... form), and the data begins with an 8-byte FILETIME in UTC. That makes both keys a fast way to answer &quot;did this program run, and when?&quot; This article covers what the artifacts can and cannot tell you, with a short test you can run to verify each point yourself.</p><h3>Overview</h3><p>BAM and DAM entries are a convenient source of execution evidence, but they are narrower and shorter-lived than many examiners assume. Before relying on either artifact in a report, three questions need answers: how long entries last, what an empty DAM key does and does not mean, and which executions BAM never records.</p><h3>Key points</h3><ul><li><strong>Retention.</strong> Entries are pruned at boot after about seven days by default, and the threshold can be changed.</li><li><strong>Empty DAM.</strong> An empty or missing dam tree is expected on hardware without Modern Standby and is not evidence of deletion.</li><li><strong>Coverage gaps.</strong> Executables run from removable media or network shares, and many console applications, may leave no BAM entry.</li></ul><p>Each point below draws on published research and on a test on a Windows 10 virtual machine. In the screenshots, only the evidence is left readable. Validate these findings on your own build before citing them in casework.</p><h3>1. Short retention</h3><p>BAM records are typically short-lived. By default, BAM uses a retention period of approximately seven days. This is the default for most Windows systems, but it may be overridden by the UserSettingsLifetimeMs setting under Control\Session Manager\BAM where present. No equivalent setting is documented for DAM. Available evidence suggests that DAM entries are also typically cleared after about seven days.</p><p>Maxim Suhanov’s reverse engineering of bam.sys explains where the setting lives. UserSettingsLifetimeMs is a DWORD (in milliseconds) under HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BAM. It does not exist by default, and when it is missing the driver uses a hardcoded 0x240C8400 ms, which is exactly 7 days. Three details matter for examiners:</p><ul><li>Expired entries were observed being removed <strong>at boot</strong>, so entries older than the threshold can persist on a system that has not rebooted.</li><li>Entries for executables that no longer exist on disk are also removed at boot.</li><li>Entries whose third DWORD is non-zero (a user-managed throttling state) are not expired.</li></ul><h3>Lab walkthrough: shortening the retention window</h3><p><strong>Why we created the key.</strong> On a stock install, neither the BAM key under Session Manager nor the UserSettingsLifetimeMs value exists, so BAM prunes entries older than seven days at boot. Waiting more than a week for each test run is impractical. We created the key and set the value to 300000 ms (5 minutes) so the retention behavior could be observed within minutes. This is a lab shortcut, not a default state. On a normal system the key is absent and the 7-day fallback applies. If an examiner finds this key on a case system, its value and last-write time are worth recording, because they change how far back BAM can reach.</p><p>Environment: Windows 10 VM, Registry Explorer v2.1.0, elevated PowerShell. The machine clock is UTC+3, while BAM and Registry Explorer show UTC. In every screenshot, only the evidence is left readable and everything else is blurred.</p><p><strong>Confirm the default.</strong> Test-Path &quot;HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\BAM&quot; returns False: the key and the UserSettingsLifetimeMs value do not exist by default, so the 7-day fallback applies.</p><p><strong>Create the key and a 5-minute value.</strong> The value is in milliseconds (300000 ms = 5 minutes). If PowerShell returns “Access denied”, run it as SYSTEM.</p><pre>New-Item -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\BAM&quot; -Force New-ItemProperty -Path &quot;HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\BAM&quot; -Name UserSettingsLifetimeMs -PropertyType DWord -Value 300000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MWJH35iKjky4UjSKL15mxQ.png" /></figure><p><strong>Verify the key in Registry Explorer.</strong> The value is a REG_DWORD of 300000. The raw bytes E0-93-04-00 are little-endian for 0x000493E0, which is 300,000. The key&#39;s last-write time dates the change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KC6U3LxKFSR-z1Yobgig_w.png" /></figure><p><strong>Generate an execution and check before the reboot.</strong> Note the time, launch notepad.exe and close it. notepad.exe was recorded at 21:56:21 UTC. Open bam\State\UserSettings\&lt;SID&gt; in Registry Explorer at about 22:01 UTC, roughly five minutes later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SWtQBtNwpJZD3u7SX3q9uA.png" /></figure><p><strong>Reboot</strong> the VM and reload the SYSTEM hive.</p><p><strong>Check after the reboot.</strong> notepad.exe is gone. The list was scrolled to the bottom, so the last visible row is the last entry.</p><p><strong>Clean up.</strong> Remove the value we added by running Remove-ItemProperty &quot;HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\BAM&quot; -Name UserSettingsLifetimeMs</p><h3>2. An empty dam key is not evidence of deletion</h3><p>On a desktop workstation without Modern Standby, the dam key commonly exists but holds no execution entries. An empty key on such a system is expected behavior, not tampering. On a live system, run powercfg /a to list supported sleep states and confirm whether the hardware supports Modern Standby.</p><p><strong>Test it:</strong> run powercfg /a and note whether Modern Standby is listed as unavailable, then inspect the dam key. If you have a laptop with Modern Standby, compare its dam key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*Ud8T-I_PVs1qj1DEeEdg0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*mmTb3nj7q-d7MVg8r8WgbA.png" /></figure><p>the dam key exists, but it has no subkeys, so there is no State\UserSettings tree and no execution entries. Its values are the driver&#39;s service configuration (ImagePath = system32\drivers\dam.sys), and its last-write time matches many other untouched service keys. By contrast, bam had a State\UserSettings\&lt;SID&gt; subtree with entries. This is consistent with a machine without Modern Standby, and it is not evidence of deletion.</p><h3>3. BAM does not capture every execution</h3><p>BAM records can provide strong evidence that a program executed, but they do not capture every execution. Common exceptions include executables launched from USB drives or network shares, while console applications may also fail to generate BAM entries reliably.</p><h3>Console applications</h3><p>Suhanov saw the same behavior: console applications started from a command-line session produced no BAM entry, and the driver functions that write entries were never called. He did not identify the cause. The removable-media and network-share exceptions, by contrast, are explained in the driver, which checks the device type of the executable’s location before creating an entry.</p><ol><li><strong>launched directly in its own window</strong></li></ol><p>Note the time. In File Explorer, go to C:\Windows\System32 and double-click whoami.exe. The console window will flash and close, which is fine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J1GQBzmunQ0_WPguDlYWaQ.png" /></figure><p>Reload the hive, a whoami.exe entry should appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*In-so1RNByA2vXEBfZYGGQ.png" /></figure><p>2. <strong>launched from an existing shell</strong></p><p>Note the time. Open cmd.exe (Win+R, cmd) and run hostname.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*C3Wx-v2yuHi0XkEIHni-XA.png" /></figure><p>Reload the hive and check. The expectation is an entry for cmd.exe but none for hostname.exe. If cmd.exe already has an entry, its timestamp should have updated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZojUhU4iXUurZj04blzO_Q.png" /></figure><p>Repeat from PowerShell with a different tool if you want to cover both shells.</p><p>A BAM entry supports “it ran.” Its absence does not prove “it didn’t.” Bound the time window, read DAM in context, and corroborate with Prefetch, Amcache, ShimCache and event logs.</p><p>Thank you for reading. Feedback and results from your own builds are welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf91db9d5b9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>