Home/Sector 04

Source Code

C#, PHP, VB6, PowerShell and script library.

‹ Back to library
POWERSHELL

Tracer.Fody.NLog Vulnerability Scanner & Remover

A security utility designed to identify and remove the malicious typosquatted NuGet package 'Tracer.Fody.NLog'. It recursively scans .csproj and packages.config files in the current directory, flags matches, and provides an interactive prompt to safely excise the malicious references.

Uploaded 2026.02.0636 lines1,614 bytesID CVE-2025-TYPOSQUAT-01
CVE-2025-TYPOSQUAT-01Powershell
# Utility: NuGet Typosquatting Scanner - Tracer.Fody.NLog
# Purpose: Identifies and removes cryptocurrency wallet-stealing malware references

$maliciousPackage = "Tracer.Fody.NLog"
$searchPath = Get-Location
Write-Host "--- Initiating Scan for: $maliciousPackage ---" -ForegroundColor Cyan

# Locate project configuration files
$files = Get-ChildItem -Path $searchPath -Recurse -Include "*.csproj", "packages.config"
$foundCount = 0

foreach ($file in $files) {
    $content = Get-Content $file.FullName
    
    if ($content -match $maliciousPackage) {
        $foundCount++
        Write-Host "[!] ALERT: Malicious entry found in: $($file.FullName)" -ForegroundColor Red
        
        # Interactive Choice Prompt
        $title = "Remediation Required"
        $message = "Remove '$maliciousPackage' from project file?"
        $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Deletes the malicious line."
        $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Skips removal."
        $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
        
        $result = $host.ui.PromptForChoice($title, $message, $options, 1) 
        
        if ($result -eq 0) {
            $newContent = $content | Where-Object { $_ -notmatch $maliciousPackage }
            $newContent | Set-Content $file.FullName
            Write-Host "[+] Reference purged successfully." -ForegroundColor Green
        }
    }
}

Write-Host "`nScan Finished. Total instances flagged: $foundCount" -ForegroundColor Cyan
Next sector · 05 Research Papers, write-ups and exploit notes.