r/PowerShell • u/the_lazy_sysadmin • Oct 20 '26
Script Sharing EoL Dependency Auditing Script For Vulnerability Remediation Work
I've been doing a bit of vulnerability remediation work this past year or so, and I got tired of 'scream tests' across multiple environments, and was unable to affectively find a way to use something like Dependency Walker in a set-it-and-forget-it kind of way, so I built out the following:
https://github.com/cmcalgher/EoL-Dependency-Auditing
This will set the auditing-side of ACL's on specified .DLL files (configured in the CSV's), and will then allow you to parse through the last 24 hours of the security event log to pull instances of processes that touched/acted on those .DLLs.
When ran on individual machines, it will spit out a CSV with a handful of columns, that can be fed into whatever formatting/reporting you see fit.
Internally at the org I work for, we were pretty much immediately able to write off Visual C++ 2012 as accepted risk on our fully up to date on-prem Exchange SE servers, for example. Would Exchange keep working if we had ripped that off? Would we have to restore corrupted DBs? Not sure, but with how many Exchange processes were using those Visual C++ 2012 .DLL's, I'm glad I didn't have to find out.
The above was inspired by the following Microsoft article, detailing how to audit VC++ usage in coding projects:
https://learn.microsoft.com/en-us/cpp/windows/redist-version-auditing?view=msvc-170
2
u/uptimefordays Oct 20 '26
Solid approach, using 4663 auditing to see what’s actually touching EoL VC++/.NET/SQL DLLs before you rip them out beats guessing and hoping nothing breaks. Couple things I’d change if you keep working on it:
c:\temp\...instead of reading the CSVs from$PSScriptRootso the ones in the repo don’t actually get used until you copy them over manually. Worth fixing.Enable-DependencyEventsadds an audit rule every run with no check if it’s already there. Run this on a schedule (like the README suggests) and you’ll stack duplicate ACEs on every matching file.Also:
-Actionwith[ValidateSet(...)]so a typo doesn’t just silently do nothing, andSupportsShouldProcesson the ACL-setting function so people can-WhatIfbefore it touches prod.Good idea overall, just needs some hardening.
1
u/ILoveAppSec Oct 21 '26
The scream-test grind is real. One thing worth adding to the output: EOL does not mean unpatchable. End of life means upstream stopped shipping fixes, not that a fix cannot be applied, known CVEs can be backported onto the exact EOL version you run. So rather than marking everything EOL as a forced replace, separating truly dead from old-but-still-patchable would help. What does it key the version off, file metadata or the manifest?
3
u/uptimefordays Oct 20 '26
Consider just
$auditRuleinstead ofreturn $auditRuleon line 60. They behave identically: return only adds an early exit, and PowerShell emits all uncaptured output either way. Dropping it avoids implying this is the function’s only output. (Classes are the exception, where return is required.)2
u/RR1904 Oct 20 '26
This is an excellent idea. Thank you for sharing!
1
u/[deleted] Oct 20 '26
[removed] — view removed comment