You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PersistenceSniper/PersistenceSniper.psm1
+61-35Lines changed: 61 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
<#PSScriptInfo
2
2
3
-
.VERSION 1.17.0
3
+
.VERSION 1.17.1
4
4
5
5
.GUID 3ce01128-01f1-4503-8f7f-2e50deb56ebc
6
6
@@ -2012,12 +2012,13 @@ function Find-AllPersistence {
2012
2012
if ($exe-eq"*") {
2013
2013
continue
2014
2014
}
2015
-
2016
-
if ($exe-like"*.exe") {
2017
-
$exePath="C:\Windows\System32\$exe"
2015
+
2016
+
if (([System.IO.Path]::IsPathRooted([System.Environment]::ExpandEnvironmentVariables($exe))) -eq$false) {
2017
+
$exePath="C:\Windows\System32\$exe"
2018
2018
}
2019
-
else {
2020
-
$exePath="C:\Windows\System32\$exe.exe"
2019
+
else
2020
+
{
2021
+
$exePath=$exe
2021
2022
}
2022
2023
2023
2024
if ((Get-IfSafeExecutable$exePath) -EQ$false) {
@@ -2034,13 +2035,13 @@ function Find-AllPersistence {
2034
2035
if ($exesProp) {
2035
2036
$exes=$exesProp.'BootExecuteNoPnpSync'-split'\s+'
2036
2037
foreach ($exein$exes) {
2037
-
if ($exe-like"*.exe") {
2038
-
$exePath="C:\Windows\System32\$exe"
2038
+
if (([System.IO.Path]::IsPathRooted([System.Environment]::ExpandEnvironmentVariables($exe))) -eq$false) {
2039
+
$exePath="C:\Windows\System32\$exe"
2039
2040
}
2040
-
else {
2041
-
$exePath="C:\Windows\System32\$exe.exe"
2041
+
else
2042
+
{
2043
+
$exePath=$exe
2042
2044
}
2043
-
2044
2045
if ((Get-IfSafeExecutable$exePath) -EQ$false) {
2045
2046
Write-Verbose-Message "$hostname - [!] Found a potentially malicious entry in the HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecuteNoPnpSync property"
if (([System.IO.Path]::IsPathRooted([System.Environment]::ExpandEnvironmentVariables($exe))) -eq$false) {
2102
+
$exePath="C:\Windows\System32\$exe"
2103
+
}
2104
+
else
2105
+
{
2106
+
$exePath=$exe
2107
+
}
2108
+
2109
+
if ((Get-IfSafeExecutable$exePath) -EQ$false) {
2110
+
Write-Verbose-Message "$hostname - [!] Found a potentially malicious entry in the HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SetupExecuteNoPnpSync property"
$PersistenceObject=New-PersistenceObject-Hostname $hostname-Technique 'SetupExecuteNoPnpSync Binary'-Classification 'Uncatalogued Technique N.20'-Path $propPath-Value $exePath-AccessGained 'System'-Note 'The executables specified in the "SetupExecuteNoPnpSync" property of the HKLM\SYSTEM\CurrentControlSet\Control\Session Manager key are loaded by the OS before any other process, including EDRs.'-Reference 'https://github.com/rad9800/BootExecuteEDR'
I'd also like to give credits to my fellow mates at [@APTortellini](https://aptw.tf/about/) for the flood of ideas that helped it grow from a puny text-oriented script to a full-fledged Powershell module.
0 commit comments