İçindekiler

    Yazıyı Dinle

    Hazır
    Tarayıcınızın yerleşik ses sentezi özelliğini kullanır.

    Yazı Boyutu

    Küçük Aa
    Normal Aa
    Büyük Aa
    Çok Büyük Aa

    Kaydet

    📑

    Bu makaleyi daha sonra okumak için kaydedin

    Windows GPO Tabanlı Uygulama Engelleme: Kullanıcı Bağlamında Güvenlik Sertleştirmesi

    Yazıyı dinlemek için oynat butonuna tıklayın

    Strateji Özeti

    Bu yapılandırma, Kullanıcı Bağlamında Uygulama Engelleme stratejisi ile LOLBins ve bilinen kötü amaçlı yazılımların çalıştırılmasını engelleyerek saldırı yüzeyini minimize eder.

    Temel GPO Yapılandırması

    1. Yeni GPO Oluşturma

    # PowerShell ile GPO oluşturma
    New-GPO -Name "W11-User-Application-Blocking" -Comment "LOLBins ve malware engellemesi"
    
    # OU'ya bağlama
    New-GPLink -Name "W11-User-Application-Blocking" `
               -Target "OU=Users,DC=contoso,DC=local" `
               -LinkEnabled Yes `
               -Order 1
    

    2. Loopback Processing Yapılandırması

    Computer Configuration → Policies → Administrative Templates → System → Group Policy
    → "Configure user Group Policy loopback processing mode" = Enabled (Merge mode)
    

     Security Filtering Yapılandırması

    PowerShell ile Güvenlik Filtreleme

    # GPO Security Filtering ayarlama
    $GPO = Get-GPO -Name "W11-User-Application-Blocking"
    
    # Varsayılan "Authenticated Users" kaldır
    Set-GPPermission -Name $GPO.DisplayName `
                      -TargetName "Authenticated Users" `
                      -TargetType Group `
                      -PermissionLevel None
    
    # Standart kullanıcıları ekle
    Set-GPPermission -Name $GPO.DisplayName `
                      -TargetName "Domain Users" `
                      -TargetType Group `
                      -PermissionLevel GpoApply
    
    # Local Users ekle (SID kullanarak)
    Set-GPPermission -Name $GPO.DisplayName `
                      -TargetName "S-1-5-32-545" `
                      -TargetType Group `
                      -PermissionLevel GpoApply
    
    # Hariç tutulacak gruplar (Read only izni)
    $ExcludedGroups = @(
        "Domain Admins",
        "Enterprise Admins",
        "IT-Helpdesk",
        "Security-Admins"
    )
    
    foreach ($group in $ExcludedGroups) {
        Set-GPPermission -Name $GPO.DisplayName `
                          -TargetName $group `
                          -TargetType Group `
                          -PermissionLevel GpoRead
    }
    

    Engellenecek Uygulamalar Listesi

    Kategorize Edilmiş Engelleme Listesi

    # Tam engelleme listesi
    $BlockedApplications = @{
        # Script Motorları ve Shell'ler
        "ScriptEngines" = @(
            "powershell.exe",
            "pwsh.exe",
            "powershell_ise.exe",
            "wscript.exe",
            "cscript.exe",
            "mshta.exe",
            "cmd.exe",
            "bash.exe",
            "wsl.exe"
        )
        
        # İndirme/C2 LOLBins
        "DownloadC2" = @(
            "bitsadmin.exe",
            "certutil.exe",
            "curl.exe",
            "ftp.exe",
            "tftp.exe",
            "xwizard.exe"
        )
        
        # Kurulum/Proxy-Execution
        "ProxyExecution" = @(
            "msiexec.exe",
            "installutil.exe",
            "regsvr32.exe",
            "rundll32.exe"
        )
        
        # Persistence/Lateral Movement
        "PersistenceLateral" = @(
            "schtasks.exe",
            "wmic.exe",
            "winrs.exe",
            "cmdkey.exe",
            "reg.exe"
        )
        
        # Bilinen Malware/Araçlar
        "KnownMalware" = @(
            "agenttesla.exe",
            "darkcomet.exe",
            "havoc.exe",
            "masscan.exe",
            "meterpreter.exe",
            "mimikatz.exe",
            "mimilib.dll",
            "msfvenom.exe",
            "mythic.exe",
            "nanocore.exe",
            "ncat.exe",
            "netcat.exe",
            "nmap.exe",
            "nping.exe",
            "pathping.exe",
            "pcalua.exe",
            "pubprn.vbs",
            "remcos.exe",
            "revenge_rat.exe",
            "sekurlsa.exe",
            "sliver.exe",
            "teamserver.exe",
            "token.exe",
            "vbc.exe",
            "wevtutil.exe",
            "winexe.exe",
            "wusa.exe",
            "xwizard.exe",
            "wlrmdr.exe",
            "zmap.exe"
        )
    }
    

    GPO Registry Ayarları

    Registry.pol Dosyası Oluşturma

    function Create-AppBlockingRegistry {
        param(
            [string]$GPOName = "W11-User-Application-Blocking"
        )
        
        $regPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"
        
        # Komut satırı erişimini engelle
        Set-GPRegistryValue -Name $GPOName `
            -Key $regPath `
            -ValueName "DisableCMD" `
            -Type DWORD `
            -Value 2
        
        # Registry editörlerini engelle
        Set-GPRegistryValue -Name $GPOName `
            -Key $regPath `
            -ValueName "DisableRegistryTools" `
            -Type DWORD `
            -Value 1
        
        # Run menüsünü devre dışı bırak
        Set-GPRegistryValue -Name $GPOName `
            -Key $regPath `
            -ValueName "NoRun" `
            -Type DWORD `
            -Value 1
    }
    

    Software Restriction Policies (SRP) Yapılandırması

    PowerShell ile SRP Oluşturma

    function Configure-SoftwareRestrictionPolicies {
        param(
            [string]$GPOName = "W11-User-Application-Blocking"
        )
        
        # SRP için temel path
        $srpPath = "HKLM\SOFTWARE\Policies\Microsoft\Windows\Safer\CodeIdentifiers"
        
        # Varsayılan güvenlik seviyesi (Unrestricted)
        Set-GPRegistryValue -Name $GPOName `
            -Key $srpPath `
            -ValueName "DefaultLevel" `
            -Type DWORD `
            -Value 262144
        
        # Her bir engellenecek uygulama için hash rule oluştur
        $ruleGuid = 0
        foreach ($category in $BlockedApplications.Keys) {
            foreach ($app in $BlockedApplications[$category]) {
                $ruleGuid++
                $guidString = "{" + [guid]::NewGuid().ToString().ToUpper() + "}"
                
                # Path rule oluştur
                $rulePath = "$srpPath\0\Paths\$guidString"
                
                Set-GPRegistryValue -Name $GPOName `
                    -Key $rulePath `
                    -ValueName "ItemData" `
                    -Type String `
                    -Value "*\$app"
                
                Set-GPRegistryValue -Name $GPOName `
                    -Key $rulePath `
                    -ValueName "SaferFlags" `
                    -Type DWORD `
                    -Value 0
            }
        }
    }
    

    ADMX Template Oluşturma

    Custom ADMX Template

    <?xml version="1.0" encoding="utf-8"?>
    <policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       revision="1.0"
                       schemaVersion="1.0"
                       xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
      
      <policyNamespaces>
        <target prefix="w11block" namespace="Microsoft.Policies.W11ApplicationBlocking" />
      </policyNamespaces>
      
      <resources minRequiredRevision="1.0" />
      
      <categories>
        <category name="W11_App_Blocking" displayName="$(string.W11_App_Blocking)">
          <parentCategory ref="windows:System" />
        </category>
      </categories>
      
      <policies>
        <policy name="BlockLOLBins" 
                class="User" 
                displayName="$(string.BlockLOLBins)"
                explainText="$(string.BlockLOLBins_Help)"
                key="Software\Policies\W11Block"
                valueName="BlockLOLBins">
          <parentCategory ref="W11_App_Blocking" />
          <supportedOn ref="windows:SUPPORTED_Windows_10_0" />
          <enabledValue>
            <decimal value="1" />
          </enabledValue>
          <disabledValue>
            <decimal value="0" />
          </disabledValue>
        </policy>
      </policies>
    </policyDefinitions>
    

    Test ve Doğrulama

    Test Script'i

    function Test-ApplicationBlocking {
        [CmdletBinding()]
        param(
            [string]$TestUser = "testuser@domain.local"
        )
        
        # Test edilecek uygulamalar
        $testApps = @(
            @{Name="PowerShell"; Path="powershell.exe"; Command="-NoProfile -Command Write-Host 'Test'"},
            @{Name="CMD"; Path="cmd.exe"; Command="/c echo Test"},
            @{Name="CertUtil"; Path="certutil.exe"; Command="-?"}
        )
        
        Write-Host "Testing Application Blocking for: $TestUser" -ForegroundColor Cyan
        Write-Host "=" * 50
        
        foreach ($app in $testApps) {
            try {
                # RunAs ile test
                $credential = Get-Credential -UserName $TestUser
                $process = Start-Process -FilePath $app.Path `
                                        -ArgumentList $app.Command `
                                        -Credential $credential `
                                        -PassThru `
                                        -Wait `
                                        -ErrorAction Stop
                
                if ($process.ExitCode -eq 0) {
                    Write-Host "❌ $($app.Name): NOT BLOCKED" -ForegroundColor Red
                } else {
                    Write-Host "✅ $($app.Name): BLOCKED" -ForegroundColor Green
                }
            }
            catch {
                Write-Host "✅ $($app.Name): BLOCKED (Exception)" -ForegroundColor Green
            }
        }
    }
    

    Rollback Planı

    Acil Durum Geri Alma

    function Emergency-Rollback {
        param(
            [string]$GPOName = "W11-User-Application-Blocking"
        )
        
        # GPO'yu devre dışı bırak
        $GPO = Get-GPO -Name $GPOName
        $GPO.GpoStatus = "AllSettingsDisabled"
        
        # GPO linklerini kaldır
        Get-GPOReport -Name $GPOName -ReportType Xml | 
            Select-Xml -XPath "//LinksTo/SOMPath" | 
            ForEach-Object {
                Remove-GPLink -Name $GPOName -Target $_.Node.InnerText -Confirm:$false
            }
        
        # Kullanıcılarda zorla güncelleme
        Invoke-Command -ComputerName (Get-ADComputer -Filter *).Name -ScriptBlock {
            gpupdate /force
        }
        
        Write-Host "Emergency rollback completed!" -ForegroundColor Yellow
    }
    

    Monitoring ve Raporlama

    Event Log İzleme

    # AppLocker/SRP event monitoring
    function Get-BlockedApplicationEvents {
        param(
            [int]$Hours = 24
        )
        
        $startTime = (Get-Date).AddHours(-$Hours)
        
        # Event ID'ler
        # 865: SRP blocked
        # 866: SRP warning
        # 8003: AppLocker blocked
        
        Get-WinEvent -FilterHashtable @{
            LogName = 'Application'
            ID = 865, 866, 8003
            StartTime = $startTime
        } | Select-Object TimeCreated, Id, Message, UserId |
            Export-Csv "BlockedApps_$(Get-Date -Format 'yyyyMMdd').csv"
    }
    

    Önemli Uyarılar

    Kritik Dikkat Edilmesi Gerekenler

    1. rundll32.exe Engelleme

      • Birçok sistem fonksiyonu rundll32 kullanır
      • Engellemeden önce kapsamlı test yapın
      • Alternatif: Yalnızca belirli DLL'lere izin verin
    2. msiexec.exe Kısıtlaması

      • Windows Update'ler etkilenebilir
      • SCCM/Intune dağıtımları bozulabilir
      • Çözüm: Sistem hesapları için istisna
    3. wevtutil.exe

      • Log toplama sistemleri etkilenebilir
      • SIEM entegrasyonları kontrol edilmeli

    İleri Seviye Yapılandırmalar

    AppLocker ile Entegrasyon

    <AppLockerPolicy Version="1">
      <RuleCollection Type="Exe" EnforcementMode="Enabled">
        <FilePublisherRule Id="a61c8b3c-a27f-4c8b-8e8a-8b4e62d8565f" 
                           Name="MICROSOFT WINDOWS OPERATING SYSTEM" 
                           Description="" 
                           UserOrGroupSid="S-1-1-0" 
                           Action="Allow">
          <Conditions>
            <FilePublisherCondition PublisherName="O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US" 
                                    ProductName="MICROSOFT® WINDOWS® OPERATING SYSTEM" 
                                    BinaryName="*">
              <BinaryVersionRange LowSection="*" HighSection="*"/>
            </FilePublisherCondition>
          </Conditions>
          <Exceptions>
            <!-- LOLBins exception listesi -->
            <FilePathCondition Path="%SYSTEM32%\certutil.exe"/>
            <FilePathCondition Path="%SYSTEM32%\bitsadmin.exe"/>
          </Exceptions>
        </FilePublisherRule>
      </RuleCollection>
    </AppLockerPolicy>
    

    Sonuç ve Öneriler

    Bu GPO tabanlı uygulama engelleme stratejisi:

    • ✅ Kullanıcı seviyesinde güçlü kontrol sağlar
    • ✅ LOLBins saldırı vektörlerini minimize eder
    • ✅ MITRE ATT&CK T1218 tekniklerini engeller
    • ✅ Zero Trust prensipleriyle uyumludur

    Kritik Başarı Faktörleri:

    1. Test ortamında kapsamlı validasyon
    2. Kademeli dağıtım stratejisi
    3. İstisna yönetimi prosedürleri
    4. Sürekli monitoring ve iyileştirme
    Önceki Yazı Windows 11 Güvenlik Duvarı LOLBin Engelleme Script'i
    Windows 11 Güvenlik Duvarı LOLBin Engelleme Script'i

    Bu PowerShell script'i, Windows 11 sistemlerinde&nbsp;Living Off the Land Binari...

    Sonraki Yazı Linux Ortam Değişkenleri Rehberi
    Linux Ortam Değişkenleri Rehberi

    Bu podcast, bir siber g&uuml;venlik uzmanı tarafından kaleme alınmış ve "OS...