Data Protection Advisor: Handmatige probleemoplossing voor Apache Log4j beveiligingslekken in Windows PowerShell-script (CVE-2021-44228, CVE-2021-45046)

Summary: Dit artikel bevat instructies voor een handmatige oplossing van een DPA Agent die wordt uitgevoerd op een Microsoft Windows-knooppunt dat wordt beïnvloed door de Apache Log4j beveiligingslekken (CVE-2021-44228 en CVE-2021-45046). ...

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

Deze oplossing omvat het gebruik van een Windows PowerShell-script dat native Windows-scriptopdrachten gebruikt.

Deze instructies kunnen worden toegepast op elk type Windows DPA-installatie, inclusief de DPA-applicatie, DPA Datastore en Standalone DPA Agent (alleen geïnstalleerd op een server of op een ander type applicatieserver).

Zie het onderstaande Dell beveiligingsadvies voor meer informatie over de Apache Log4j beveiligingslekken:

Neem voor vragen of hulp bij deze instructies contact op met De Technische Support van Dell.

Stappen voor handmatige probleemoplossing:

Opmerking:

  • Voor deze instructies moet PowerShell op de Windows-installatie zijn geïnstalleerd en dat deze beschikbaar is (standaard).
  • Windows Administrator-rechten en -toegang zijn vereist.

 

  1. Download het tekstbestand dat is gekoppeld aan dit KB-artikel, log4j_jndiremoval.txt.

Opmerking: U kunt ook de volledige tekst van het log4j_jndiremoval.txt-bestand aan het einde van deze instructies vinden, die in een tekstbestand kan worden gekopieerd en geplakt.

  1. Kopieer of verplaats het tekstbestand naar het betreffende Windows-knooppunt.
  2. Wijzig de naam van het tekstbestand en wijzig de bestandsextensie van .txt in .ps1. Opmerking: Mogelijk moet u naar de mapopties van Windows Verkenner gaan, weergeven en het selectievakje inschakelen om "bestandsnaamuitbreidingen" weer te geven voordat u het bestand een nieuwe naam geeft.
  3. Open een Windows PowerShell-venster. Klik in het menu op Zoeken en typ PowerShell. "Windows PowerShell" zou moeten worden weergegeven. Klik met de rechtermuisknop op Windows PowerShell en selecteer 'Als administrator uitvoeren'.

pic_01.JPG

 

  1. Stop de DPA Agent-service. Doe dit met behulp van de Windows Services snap-in of vanaf de opdrachtregel met behulp van de Windows PowerShell.

Als dit in het Windows PowerShell-venster een Agent-installatie is op de DPA applicatie of DPA Datastore, is de opdracht:

dpa agent stop

In het Windows PowerShell-venster, als dit een Standalone DPA Agent-installatie is, is de opdracht:

\dpa stop

Voorbeeld:   
C:\Program Files\EMC\DPA\agent\etc\dpa stop

  1. Wijzig in het Windows PowerShell-venster mappen in de directory met het scriptbestand.

pic_03.JPG

 

  1. Voer het script uit in het PowerShell-venster met behulp van de optie Verify, die de betreffende bestanden scant en controleert. De opdracht is:    
.\log4j_jndiremoval.ps1 -verify

pic_04.JPG

  1. Wanneer u op Enter klikt, wordt het script uitgevoerd en wordt vervolgens gevraagd om het pad naar de DPA-installatie. Voer het volledige pad naar de DPA-installatie in.

pic_06.JPG

 

  1. Nadat u op Enter hebt geslagen, wordt het script uitgevoerd en worden eventuele kwetsbare bestanden geïdentificeerd.

pic_07.JPG

 

  1. Voer het script opnieuw uit in het PowerShell-venster waarin de optie Verify wordt weggelaten. In deze modus scant en repareert het script een van de betreffende bestanden. De opdracht is:   
.\log4j_jndiremoval.ps1

Opmerking: Het DPA-installatiepad moet opnieuw worden ingevoerd.

pic_09.JPG

 

  1. Nadat u op Enter hebt geslagen, zoekt het script naar alle gevonden kwetsbare bestanden en lost het deze op.

pic_10.JPG

 

  1. Op dit punt is het herstel voltooid.
  2. Als optionele stap controleert u het opnieuw door het script opnieuw uit te voeren. Voer het script uit in het PowerShell-venster met behulp van de optie Verify, die de betreffende bestanden scant en controleert. De opdracht is:
.\log4j_jndiremoval.ps1 -verify

pic_14.JPG

 

  1. Start de DPA Agent-service. Dit kan worden gedaan met behulp van de Windows Services snap-in of vanaf de opdrachtregel met behulp van de Windows PowerShell.

Als dit in het Windows PowerShell-venster een Agent-installatie is op de DPA applicatie of DPA Datastore, is de opdracht:

Starten van dpa-agent

In het Windows PowerShell-venster, als dit een Standalone DPA Agent-installatie is, is de opdracht:

\dpa start

Voorbeeld:   
C:\Program Files\EMC\DPA\agent\etc\dpa start

 

Addendum:
Hieronder vindt u de volledige tekst van het PowerShell-script. Als het bestand dat aan dit KB-artikel is gekoppeld, niet kan worden geopend, kan deze tekst worden gekopieerd en geplakt in een tekstbestand (.txt) voor gebruik in de bovenstaande stappen.

param ( [switch]$verify ) '--------------------------------------------------------------------------' '--------------------------------------------------------------------------' ' Data Protection Advisor CVE-2021-44228, CVE-2021-45046 Patcher 1.1 ' ' Developer : Pankaj Pande(p.pande@dell.com) ' ' Release : 29 Dec 2021 ' '--------------------------------------------------------------------------' 'Welcome to CVE-2021-44228, CVE-2021-45046 Patching Tool.' 'This utility will assist you in patching Data Protection Advisor for CVE-2021-44228 and CVE-2021-45046 on a Windows system.' "Special Note : The tool automates remediation steps for all internal components. Following remediation, validation checks are also run. While this tool remediates these vulnerabilities, all available information from Apache on log4j continues to be monitored. If new CVEs are discovered, Dell Technologies' Engineering teams will clarify impact and new remediation steps where necessary. If needed this tool will be updated to include the new remediation steps." '---------------------------------------------------------------------------' function List-JndiLookup { Param ( [string[]]$JarFiles, [string] $FilenameToRemove ) #initiate the .net namespace add-type -AssemblyName 'System.IO.Compression.filesystem' "The number of files to be processed is : $($JarFiles.Count)" #list the files we are processing # them later foreach ($JarFile in $JarFiles) { "$JarFile" } $processedFiles = 0; $skippedFiles = 0; foreach ($JarFile in $JarFiles) { # Open the jar for updating (.jar files are just .zip files) try { $ProcessJarFile = [io.compression.zipfile]::Open($JarFile,'Update') } catch { # Error Handling } "Checking $JarFile for $FilenameToRemove" $totalFilesInJar = ($ProcessJarFile.Entries | Where FullName -Match $FilenameToRemove).Count if($totalFilesInJar -gt 0){ $processedFiles++ } #close Zip try { $ProcessJarFile.Dispose() } catch { # Error Handling } } if ( $processedFiles -gt 0) { Write-Host "$processedFiles file(s) found vulnerable" -fore red Write-Host "Finished...Please make sure to run the patching on this sytem" -fore red } else { Write-Host "$processedFiles file(s) found vulnerable" -fore green Write-Host "Finished...No Action needed" -fore green } } function Remove-JndiLookup { Param ( [string[]]$JarFiles, [string] $FilenameToRemove ) #initiate the .net namespace add-type -AssemblyName 'System.IO.Compression.filesystem' "The number of files to be processed is : $($JarFiles.Count)" #list the files we are processing # them later foreach ($JarFile in $JarFiles) { "$JarFile" } "Starting patching/Removel Process" $processedFiles = 0; $skippedFiles = 0; foreach ($JarFile in $JarFiles) { # Open the jar for updating (.jar files are just .zip files) try { $ProcessJarFile = [io.compression.zipfile]::Open($JarFile,'Update') } catch { # Error Handling } "Checking $JarFile for $FilenameToRemove" $totalFilesInJar = ($ProcessJarFile.Entries | Where FullName -Match $FilenameToRemove).Count if($totalFilesInJar -gt 0){ "Deleting unwanted file $FilenameToRemove from $JarFile" ($ProcessJarFile.Entries | Where FullName -Match $FilenameToRemove).Delete() $processedFiles++ } else { "File $FilenameToRemove not found inside $JarFile, this may have already been deleted." $skippedFiles++ } # Clean up / close the zip try { $ProcessJarFile.Dispose() } catch { # Error Handling } } "$processedFiles file(s) processed`n$skippedFiles file(s) skipped" Write-Host "Finished..." -fore green } if ( $verify ) { Write-Host "Running in dry-run mode. Will not process any files" -fore green } else { Write-Host "Running in fix mode. Will patch files that are found affected" -fore red } $dpa_path = Read-Host "Enter the DPA location " Write-Host "Running in : '$dpa_path' " -fore green if ($verify) { List-JndiLookup -JarFiles (Get-ChildItem -Exclude 'tmp' -Recurse -Path "$dpa_path" -Filter 'dpa*.jar' | ? { $_.FullName -inotmatch 'tmp' }).FullName -FilenameToRemove 'JndiLookup.class' } else { Remove-JndiLookup -JarFiles (Get-ChildItem -Exclude 'tmp' -Recurse -Path "$dpa_path" -Filter 'dpa*.jar' | ? { $_.FullName -inotmatch 'tmp' }).FullName -FilenameToRemove 'JndiLookup.class' }

 



Neem voor vragen of hulp bij deze instructies contact op met De Technische Support van Dell.

Article Properties
Article Number: 000194869
Article Type: How To
Last Modified: 18 Aug 2022
Version:  4
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.