Skip to content

Instantly share code, notes, and snippets.

@secdev02
Created November 20, 2025 20:27
Show Gist options
  • Select an option

  • Save secdev02/055eea4d4356d1bb48540cf22f7f5c95 to your computer and use it in GitHub Desktop.

Select an option

Save secdev02/055eea4d4356d1bb48540cf22f7f5c95 to your computer and use it in GitHub Desktop.
Hunt for Certificates with Private key - Could be sus
# Simple list of all certificates with private keys
Write-Host "=== All Certificates with Private Keys ===" -ForegroundColor Green
$certs = @()
$certs += Get-ChildItem -Path Cert:\LocalMachine -Recurse | Where-Object { $_.HasPrivateKey }
$certs += Get-ChildItem -Path Cert:\CurrentUser -Recurse | Where-Object { $_.HasPrivateKey }
$certs | Select-Object Subject, Thumbprint | Format-Table -AutoSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment