"Enter"a basıp içeriğe geçin

CVE-2022-29072 | 7-Zip Zafiyeti

Last updated on 17 Temmuz 2022

7 Zip ile birlikte gelen .chm dokümantasyon belgesi kullanılarak bilgisayarlar üzerinde yetkili hale gelinebilmektedir. İlgili zafiyet şuan için ilgili dosyanın silinmesi ile mümkün olarak gözükmekte. İlgili işlemi gerçekleştirebilmek adına aşağıdaki powershell scriptini kullanabilirsiniz.

Sunucu ve son kullanıcı bilgisayarlarında ilgili script task scheculere eklenerek belli aralıklar ile çalıştırılırsa faydalı olacaktır.

$fileLocations = [pscustomobject]@{
    "64bit" = "C:\Program Files\7-Zip\7-zip.chm"
    "32bit" = "C:\Program Files (x86)\7-Zip\7-zip.chm"
}
$fileName = '7-zip.chm'
$reason   = 'CVE-2022-29072'

try{
    Write-Host "############################"
    Write-Host "Removing '$fileName' due to $reason `n`r"
    
    if([System.Environment]::Is64BitOperatingSystem){
        if(Test-Path $fileLocations.'64bit'){
            Write-Host "File found at '$($fileLocations.'64bit')'"
            try{
                Remove-Item ($fileLocations.'64bit') -Force
            }catch{
                Write-Host "Error occured attempting to remove the file at $($fileLocations.'64bit')"
                $error[0]
            }
        }else{
            Write-Host "File not found at '$($fileLocations.'64bit')'"
        }
    }else{
        if(Test-Path $fileLocations.'32bit'){
            Write-Host "File found at '$($fileLocations.'32bit')'"
            try{
                Remove-Item ($fileLocations.'32bit') -Force
            }catch{
                Write-Host "Error occured attempting to remove the file at $($fileLocations.'32bit')"
                $error[0]
            }
        }else{
            Write-Host "File not found at '$($fileLocations.'32bit')'"
        }
    }
    
    if([System.Environment]::Is64BitOperatingSystem){
        if(!(Test-Path $fileLocations.'64bit')){
            Write-Host "File has been removed."
        }else{
            Write-Host "File has not been removed. Error occured."
        }
    }else{
        if(!(Test-Path $fileLocations.'32bit')){
            Write-Host "File has been removed."
            $Error[0]
        }else{
            Write-Host "File has not been removed. Error occured."
            $Error[0]
        }
    }
}catch{
    Write-Host "Error occured during file removal operation. Success not guaranteed."
    $error[0]

}finally{
    Write-Host "`n`rFinished at $(Get-Date)"
    Write-Host "############################"
}

Tek Yorum

  1. Savaş B
    Savaş B 9 Mart 2023

    Teşekkürler çok önemli bir bilgi, hemen verdiğiniz script ile açığı kurumumuzda kapatıyorum

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir