Exploit database

GH-659357d4d9c2681926f82ea61040a963

sentinelblue/cve-2022-29072

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2022-29072

6 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files1
sentinelblue/cve-2022-29072Revision d3f04a56275f

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

scripts/Remove-7ZipHelpFile.ps1

PowerShell · 2,677 bytes
<# 
.SYNOPSIS
This script will check the 32 bit and 64 bit native installation directories for the 7zip.chm file and remove it.

.DESCRIPTION 
The CVE-2022-29072 mitigation strategy calls for removing the "7-zip.chm" (aka the help file) from an endpoint.
This simple script checks the default installation locations on either 32 bit or 64 bit systems and removes the file. 
A generic structure means this can be utilzied for multiple quick and easy removal jobs of files.

This is provided as-is without warranty or liability. Understand all scripts you run before you run them. :-)

.NOTES
Author: Ben
        Sentinel Blue - https://www.sentinelblue.com
Date: April 2022

#>

# Variables
$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 "############################"
}