CrowdStrike Bug Fix for Azure Stack HCI

19 Temmuz 2024 sabah saatlerinde ülkemizde (tabi ki global bir kriz) pek çok şirketin altyapısında çalışan CrodStrike şirketinin EDR,XDR ürününün agentları kaynaklı bir BSOD sorunu yaşandı. Sunucu ve istemcilerde görünen bu sorun nedeni ile pek çok şirket hizmet veremez duruma düştü. Bu sorun tüm Dünyada ki işletim sistemlerini etkilediği için ülkemiz ile beraber aslında Dünya çapında servis kesintileri yaşandı. Hatta o kadar ki Azure gibi kendi içerisinde de CS ürünü kullanan işletim sistemlerinde benzer şekilde kesintiler yaşandığını gördük. Özetle CS ve MS şirketlerinin birleştiği hemen hemen her noktada bu sorun yaşandı. Sorun hakkında daha fazla bilgi için aşağıdaki linki takip edebilirsiniz.

Dünya Genelinde Büyük Kriz! Crowdstrike Güncellemesi Alan Sistemler Çöktü! – ÇözümPark (cozumpark.com)

Peki gelelim konumuza, hem ülkemizde hem de Dünya da artık Azure Stack HCI sistemleri aktif kullanıldığı için böyle bir kriz ortamında Azure Stack HCI sunucuları üzerinde çalışan sanal makinelerde etkilendi. Eski Powershell MVP’ mi Yusuf Öztürk tarafından bu konuda çok güzel bir PS komut seti hazırlandı. Bizlerin müşterilere destek verdiği bir sırada kendisine emek verip zaman ayırıp böyle bir komut setini paylaştığı için teşekkür ediyorum. Bende blog sayfamdan kendisinin bu komut setini paylaşmak istiyorum.

Kaynak Kod

function Fix-CrowdStrikeBug {
    param (
        [Parameter(Mandatory = $true)]
        [string]$VMName,
		[Parameter(Mandatory = $false)]
        [SecureString]$Password
    )

    # Get VM
    $VM = Get-VM $VMName -ErrorAction SilentlyContinue

    # Check VM
    if ($VM -eq $null) {
        Write-Host "VM does not exist."
        return
    }

    # Check VM State
    $VMState = $VM.State
    if ($VMState -ne "Off") {
        Write-Host "Please turn off the VM."
        return
    }

    # Get Main VMDisk
    $VMDisk = $($VM | Get-VMHardDiskDrive)[0] | Get-VHD

    # Check VMDisk
    if ($VMDisk -eq $null) {
        Write-Host "No VHD found for VM."
        return
    }

    # Set VHDX Path
    $vhdxPath = $VMDisk.Path

    # Mount the VHDX
    Mount-VHD -Path $vhdxPath

    try {
        # Get the drive letter assigned to the mounted VHDX
        $driveLetter = (Get-DiskImage -ImagePath $vhdxPath | Get-Disk | Get-Partition | Get-Volume).DriveLetter
        $driveLetter = [string]$driveLetter

        if ([string]::IsNullOrEmpty($driveLetter)) {
            throw "Cannot access the disk. Maybe it's not a Windows VM?"
        }
		
		# Trim Drive Letter
		$driveLetter = $driveLetter.Trim()
		
		# Check BitLocker Status
		$bitLockerStatus = Get-BitLockerVolume -MountPoint "$($driveLetter):" -EA SilentlyContinue
		if ($bitLockerStatus.KeyProtector -ne $Null) {
			if ([string]::IsNullOrEmpty($password)) {
				throw "Please provide BitLocker password."
			}
            # Unlock BitLocker
			Unlock-BitLocker -MountPoint "$($driveLetter):" -Password $Password
        }

        # Construct the target directory path
        $targetDir = "$($driveLetter):\Windows\System32\drivers\CrowdStrike"


        # Check if the target directory exists
        if (-Not (Test-Path -Path $targetDir)) {
            throw "CrowdStrike directory does not exist. Maybe you are not affected by the bug?"
        }

        # Find and delete files matching the pattern
        Get-ChildItem -Path $targetDir -Filter "C-00000291*.sys" | Remove-Item -Force

        Write-Host "CrowdStrike bug fix applied successfully."
		Write-Host "Try VirtualMetric for Azure Stack HCI monitoring: https://www.virtualmetric.com"
    } catch {
        Write-Host $_
    } finally {
        # Dismount the VHDX
        Dismount-VHD -Path $vhdxPath
    }
}

# Example usage:
Fix-CrowdStrikeBug -VMName "VirtualMetric" 

Eğer sistemde bitlocker var ise bu update’ i kullanabilirsiniz

$SecureString = ConvertTo-SecureString "Password" -AsPlainText -Force
Fix-CrowdStrikeBug -VMName "VirtualMetric" -Password $SecureString


Kullanımı ise son derece basit;

Kaynak

https://www.linkedin.com/pulse/crowdstrike-bug-fix-azure-stack-hci-yusuf-%C3%B6zt%C3%BCrk-elw0e