Skip to content

Commit 2dbb572

Browse files
authored
Merge pull request #6 from microsoft/master
Synced from main
2 parents 12655dc + 9760cac commit 2dbb572

9 files changed

Lines changed: 32 additions & 32 deletions

File tree

AaronLocker/Create-Policies-AppLocker.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ if ($Rescan)
126126
}
127127

128128
####################################################################################################
129-
# Build AppLocker pub rule data for Exe files to blacklist if needed
129+
# Build AppLocker pub rule data for Exe files to DenyList if needed
130130
####################################################################################################
131-
if ( $Rescan -or !(Test-Path($ExeBlacklistData) ) )
131+
if ( $Rescan -or !(Test-Path($ExeDenyListData) ) )
132132
{
133133
# Create a hash collection for publisher information. Key on publisher name, product name, and binary name.
134134
# Add to collection if equivalent is not already in the collection.
135135
$pubCollection = @{}
136-
$exeFilesToBlacklist | foreach {
136+
$exeFilesToDenyList | foreach {
137137
$pub = (Get-AppLockerFileInformation "$_").Publisher
138138
if ($null -ne $pub)
139139
{
@@ -142,14 +142,14 @@ if ( $Rescan -or !(Test-Path($ExeBlacklistData) ) )
142142
}
143143
else
144144
{
145-
Write-Warning "UNABLE TO BUILD BLACKLIST RULE FOR $_"
145+
Write-Warning "UNABLE TO BUILD DENYLIST RULE FOR $_"
146146
}
147147
}
148148

149149
$pubCollection.Values |
150150
Select-Object PublisherName, ProductName, BinaryName |
151151
ConvertTo-Csv -NoTypeInformation |
152-
Out-File $ExeBlacklistData -Encoding unicode
152+
Out-File $ExeDenyListData -Encoding unicode
153153
}
154154

155155
####################################################################################################
@@ -166,10 +166,10 @@ if ( ! ( (Test-Path($windirTxt)) -and (Test-Path($PfTxt)) -and (Test-Path($Pf86T
166166
return
167167
}
168168

169-
if ( ! (Test-Path($ExeBlacklistData)) )
169+
if ( ! (Test-Path($ExeDenyListData)) )
170170
{
171171
$errMsg = "The following file is missing:`n" +
172-
"`t" + $ExeBlacklistData +"`n"
172+
"`t" + $ExeDenyListData +"`n"
173173
Write-Error $errMsg
174174
return
175175
}
@@ -243,16 +243,16 @@ $Wr_raw_PF | foreach {
243243
$xDocument = [xml](Get-Content $defRulesXml)
244244

245245
####################################################################################################
246-
# Incorporate data for EXE files to blacklist under Windir
246+
# Incorporate data for EXE files to DenyList under Windir
247247
####################################################################################################
248248

249-
# Incorporate the EXE blacklist into the document where the one PLACEHOLDER_WINDIR_EXEBLACKLIST
249+
# Incorporate the EXE DenyList into the document where the one PLACEHOLDER_WINDIR_EXEDENYLIST
250250
# placeholder is.
251-
$xPlaceholder = $xDocument.SelectNodes("//PLACEHOLDER_WINDIR_EXEBLACKLIST")[0]
251+
$xPlaceholder = $xDocument.SelectNodes("//PLACEHOLDER_WINDIR_EXEDENYLIST")[0]
252252
$xExcepts = $xPlaceholder.ParentNode
253253

254-
$csvExeBlacklistData = (Get-Content $ExeBlacklistData | ConvertFrom-Csv)
255-
$csvExeBlacklistData | foreach {
254+
$csvExeDenyListData = (Get-Content $ExeDenyListData | ConvertFrom-Csv)
255+
$csvExeDenyListData | foreach {
256256
# Create a FilePublisherCondition element with the publisher attributes
257257
$elem = $xDocument.CreateElement("FilePublisherCondition")
258258
$elem.SetAttribute("PublisherName", $_.PublisherName)
@@ -270,7 +270,7 @@ $csvExeBlacklistData | foreach {
270270
# Remove the placeholder element
271271
$xExcepts.RemoveChild($xPlaceholder) | Out-Null
272272

273-
Write-Host "Processing additional safe paths to whitelist..." -ForegroundColor Cyan
273+
Write-Host "Processing additional safe paths to AllowList..." -ForegroundColor Cyan
274274
# Incorporate authorized safe paths into the document
275275
# Add "allow" for Everyone for Exe, Dll, and Script rules
276276
$xRuleCollections = $xDocument.SelectNodes("//RuleCollection[@Type='Exe' or @Type='Script' or @Type='Dll']")
@@ -475,7 +475,7 @@ $signersToBuildRulesFor | foreach {
475475

476476
if ($publisher.ToLower().Contains("microsoft") -and $product.Length -eq 0 -and ($ruleCollection.Length -eq 0 -or $ruleCollection -eq "Exe"))
477477
{
478-
Write-Warning -Message ("Warning: Trusting all Microsoft-signed files is an overly-broad whitelisting strategy")
478+
Write-Warning -Message ("Warning: Trusting all Microsoft-signed files is an overly-broad AllowListing strategy")
479479
}
480480

481481
if ($ruleCollection)

AaronLocker/Create-Policies-WDAC.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,15 @@ Merge-CIPolicy -OutputFilePath $WDACAllowRulesXMLFile -PolicyPaths $WDACAllowRul
376376

377377

378378
###################################################################################################
379-
# Create block policy from Exe files to blacklist if needed. Merge the deny rules with the allow all example policy.
379+
# Create block policy from Exe files to DenyList if needed. Merge the deny rules with the allow all example policy.
380380
####################################################################################################
381381
if ( $Rescan -or !(Test-Path($WDACBlockPolicyXMLFile) ) )
382382
{
383383
Write-Host "Processing EXE files to block..." -ForegroundColor Cyan
384384
# Create a hash collection for publisher information. Key on publisher name, product name, and binary name.
385385
# Add to collection if equivalent is not already in the collection.
386386
$WDACExeFilesToBlock = @()
387-
$WDACExeFilesToBlock += $exeFilesToBlackList
387+
$WDACExeFilesToBlock += $exeFilesToDenyList
388388
$WDACBlockRules = & New-CIPolicyRule -DriverFilePath $WDACExeFilesToBlock -Level FilePublisher -Fallback FileName, Hash, FilePath -Deny
389389
New-CIPolicy -Rules $WDACBlockRules -FilePath $WDACBlockPolicyXMLFile -UserPEs -MultiplePolicyFormat
390390
}

AaronLocker/Create-Policies.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Sysinternals AccessChk is available here:
5050
or run .\Support\DownloadAccesschk.ps1, which downloads AccessChk.exe to the main AaronLocker directory.
5151
5252
.PARAMETER Rescan
53-
If this switch is set, this script scans the Windows and ProgramFiles directories for user-writable subdirectories, and captures data about EXE files to blacklist.
53+
If this switch is set, this script scans the Windows and ProgramFiles directories for user-writable subdirectories, and captures data about EXE files to DenyList.
5454
If the results from a previous scan are found in the expected location and this switch is not specified, the script does not perform those scans. If those results are not found, the script performs the scan even if this switch is not set.
5555
It is STRONGLY recommended that the scanning be performed with administrative rights.
5656
@@ -218,11 +218,11 @@ if (($Rescan) -and ($AppLockerOrWDAC -eq "WDAC") -and !($ProcessWDACLikeAppLocke
218218
# Process common custom inputs once before calling AppLocker- and WDAC-specific scripts
219219
####################################################################################################
220220
# Get Block List -- WDAC could potentially use recommended blocks policy instead? If so, move this back to AppLocker-specific script
221-
if ( $Rescan -or ( ($AppLockerOrWDAC -in "Both","AppLocker") -and !(Test-Path($ExeBlacklistData) ) ) -or ( ($AppLockerOrWDAC -in "Both","WDAC") ) )
221+
if ( $Rescan -or ( ($AppLockerOrWDAC -in "Both","AppLocker") -and !(Test-Path($ExeDenyListData) ) ) -or ( ($AppLockerOrWDAC -in "Both","WDAC") ) )
222222
{
223-
Write-Host "Get EXE files to blacklist for later processing..." -ForegroundColor Cyan
224-
# Get the EXE files to blacklist from the script that produces that list.
225-
$exeFilesToBlacklist = (& $ps1_GetExeFilesToBlacklist)
223+
Write-Host "Get EXE files to DenyList for later processing..." -ForegroundColor Cyan
224+
# Get the EXE files to DenyList from the script that produces that list.
225+
$exeFilesToDenyList = (& $ps1_GetExeFilesToDenyList)
226226
}
227227

228228
# Get additional authorized safe paths from the script that produces that list

AaronLocker/CustomizationInputs/GetExeFilesToBlacklist.ps1 renamed to AaronLocker/CustomizationInputs/GetExeFilesToDenyList.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Script used by Create-Policies.ps1 to identify EXE files that should be disallowed by AppLocker for non-admin use. Can be edited if necessary.
44
55
.DESCRIPTION
6-
This script outputs a list of file paths under %windir% that need to be specifically disallowed by whitelisting rules.
6+
This script outputs a list of file paths under %windir% that need to be specifically disallowed by AllowListing rules.
77
The list of files is consumed by Create-Policies.ps1, which builds the necessary AppLocker rules to block them.
88
You can edit this file as needed for your environment, although it is recommended that none of the programs
99
identified in this script be removed.
@@ -15,19 +15,19 @@ http://www.leeholmes.com/blog/2017/03/17/detecting-and-preventing-powershell-dow
1515
#>
1616

1717
# --------------------------------------------------------------------------------
18-
# Files used to bypass whitelisting:
18+
# Files used to bypass AllowListing:
1919

20-
# Find the multiple instances of .NET executables that have been identified as whitelist bypasses.
20+
# Find the multiple instances of .NET executables that have been identified as AllowList bypasses.
2121
# Create-Policies.ps1 will remove redundant information.
22-
$dotnetProgramsToBlacklist =
22+
$dotnetProgramsToDenyList =
2323
"InstallUtil.exe",
2424
"IEExec.exe",
2525
"RegAsm.exe",
2626
"RegSvcs.exe",
2727
"MSBuild.exe",
2828
"Microsoft.Workflow.Compiler.exe"
2929

30-
$dotnetProgramsToBlacklist | ForEach-Object {
30+
$dotnetProgramsToDenyList | ForEach-Object {
3131
Get-ChildItem -Path $env:windir\Microsoft.NET -Recurse -Include $_ | ForEach-Object { $_.FullName }
3232
}
3333

AaronLocker/Get-AppLockerEvents.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The -FromDateTime and -ToDateTime options enable you to limit events to time ran
1818
1919
Data from each event is turned into a line of tab-delimited CSV. Lines are sorted before being output.
2020
21-
Random-named temporary files created by PowerShell to test whitelisting policy are filtered out by default.
21+
Random-named temporary files created by PowerShell to test AllowListing policy are filtered out by default.
2222
2323
Use the -ComputerName parameter to name a remote computer from which to retrieve live-log events (default logs or event collectors).
2424
Use the -WarningOnly, -ErrorOnly, -AllowedOnly, or -AllEvents switches to retrieve events other than errors and warnings.
@@ -104,7 +104,7 @@ Can be used with -FromDateTime to specify a date/time range. Date/time specified
104104
If specified, does not report modern-app AutoNGEN files that are unsigned and in the user's profile.
105105
106106
.PARAMETER NoPSFilter
107-
If specified, does not try to filter out random-named PowerShell scripts used to determine whether whitelisting is in effect.
107+
If specified, does not try to filter out random-named PowerShell scripts used to determine whether AllowListing is in effect.
108108
109109
.PARAMETER NoFilteredMachines
110110
By default, this script outputs a single artificial "empty" event line for every machine for which all observed events were filtered out.
@@ -388,7 +388,7 @@ Write-Verbose "XPath filter = $filter"
388388
# Match AutoNGEN native image file path
389389
$AutoNGENPattern = "^(%OSDRIVE%|C:)\\Users\\[^\\]*\\AppData\\Local\\Packages\\.*\\NATIVEIMAGES\\.*\.NI\.(EXE|DLL)$"
390390

391-
# PowerShell script-policy-test file - PS creates files in user temp directory and tests against whitelisting policy to determine whether to run in ConstrainedLanguage mode.
391+
# PowerShell script-policy-test file - PS creates files in user temp directory and tests against AllowListing policy to determine whether to run in ConstrainedLanguage mode.
392392
# Filter out those test files by default.
393393
# Current implementation: match partial path of file in temp directory with form "XXXXXXXX.XXX.PS*" or "__PSScriptPolicyTest_XXXXXXXX.XXX.PS*"
394394
$PsPolicyTestPattern = "\\APPDATA\\LOCAL\\TEMP\\(__PSScriptPolicyTest_)?[A-Z0-9]{8}\.[A-Z0-9]{3}\.PS"

AaronLocker/Support/Config.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $scanResultsDir = [System.IO.Path]::Combine($rootDir, "ScanResults")
2828
####### INPUTS
2929

3030
# Script inputs
31-
$ps1_GetExeFilesToBlacklist = [System.IO.Path]::Combine($customizationInputsDir, "GetExeFilesToBlacklist.ps1")
31+
$ps1_GetExeFilesToDenyList = [System.IO.Path]::Combine($customizationInputsDir, "GetExeFilesToDenyList.ps1")
3232
$ps1_GetSafePathsToAllow = [System.IO.Path]::Combine($customizationInputsDir, "GetSafePathsToAllow.ps1")
3333
$ps1_UnsafePathsToBuildRulesFor = [System.IO.Path]::Combine($customizationInputsDir, "UnsafePathsToBuildRulesFor.ps1")
3434
$fname_TrustedSigners = "TrustedSigners.ps1"
@@ -42,8 +42,8 @@ $ps1_CreatePoliciesWDAC = [System.IO.Path]::Combine($rootDir, "Create-Po
4242
# File prefixes for AppLocker and WDAC
4343
$rulesFileBase = "AppLockerRules-"
4444
$WDACrulesFileBase = "WDACRules-"
45-
# Path to results from scanning files listed in GetExeFilesToBlacklist
46-
$ExeBlacklistData = [System.IO.Path]::Combine($scanResultsDir, "ExeBlacklistData.txt")
45+
# Path to results from scanning files listed in GetExeFilesToDenyList
46+
$ExeDenyListData = [System.IO.Path]::Combine($scanResultsDir, "ExeDenyListData.txt")
4747
# Paths to "full" results of all user-writable directories under Windir and the ProgramFiles directories.
4848
# Written to when Rescan enabled; used to create the next set of files
4949
$windirFullXml = [System.IO.Path]::Combine($scanResultsDir, "Writable_Full_windir.xml")
-2 Bytes
Binary file not shown.

Documentation/AaronLocker.docx

147 Bytes
Binary file not shown.

Documentation/Known Issues.docx

936 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)