Skip to content

Commit

Permalink
Move wow64 filesystem redirection to thread helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
itm4n committed Dec 28, 2024
1 parent 78a787e commit 26eb753
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/check/Configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,6 @@ function Invoke-ComServerImagePermissionCheck {

begin {
$AllResults = @()
$FsRedirectionValue = Disable-Wow64FileSystemRedirection
# Create a synchronized list that we will use to store file paths which were
# tested and are not vulnerable. This list will be populated by the threads,
# hence why we need to use thread-safe collection object.
Expand All @@ -969,10 +968,6 @@ function Invoke-ComServerImagePermissionCheck {
$CheckResult | Add-Member -MemberType "NoteProperty" -Name "Severity" -Value $(if ($AllResults.Count -gt 0) { $BaseSeverity } else { $script:SeverityLevel::None })
$CheckResult
}

end {
Restore-Wow64FileSystemRedirection -OldValue $FsRedirectionValue
}
}

function Invoke-ComServerGhostDllHijackingCheck {
Expand Down
5 changes: 5 additions & 0 deletions src/helper/AccessControl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ function Get-ModifiableComClassEntryImagePath {
)

begin {
$FsRedirectionValue = Disable-Wow64FileSystemRedirection
if ($null -eq $CheckedPaths) { $CheckedPaths = New-Object System.Collections.ArrayList }
}

Expand Down Expand Up @@ -451,6 +452,10 @@ function Get-ModifiableComClassEntryImagePath {
}
}
}

end {
Restore-Wow64FileSystemRedirection -OldValue $FsRedirectionValue
}
}

function Get-ModifiableApplicationFile {
Expand Down

0 comments on commit 26eb753

Please sign in to comment.