ENCRYPTION KEY LOG FILE

this is a text file that contains unique key pairs to decrypt the encrypted traffic session. These key pairs are automatically created (per session) when a connection is established with an SSL/TLS-enabled webpage.

BENEFITS

  • Centrally enables TLS decryption for security monitoring

  • Detects malware C2 traffic using HTTPS

  • Assists in forensic investigations

METHOD 1: PER HOST METHOD

#DEPLOY LOGGING
# Define log file location
$LogPath = "C:\TLSLogs"
$LogFile = "$LogPath\$(whoami).log"

# Create the TLS log directory if it doesn't exist
if (!(Test-Path -Path $LogPath)) {
    New-Item -Path $LogPath -ItemType Directory -Force
    Write-Host "Created TLS log directory at $LogPath"
}

# Set SSLKEYLOGFILE environment variable for all users
[System.Environment]::SetEnvironmentVariable("SSLKEYLOGFILE", $LogFile, [System.EnvironmentVariableTarget]::Machine)

# Apply changes immediately
$env:SSLKEYLOGFILE = $LogFile
Write-Host "SSLKEYLOGFILE set to $LogFile"

# Verify the change
$SetValue = [System.Environment]::GetEnvironmentVariable("SSLKEYLOGFILE", "Machine")
Write-Host "Verification: SSLKEYLOGFILE is set to $SetValue"

# Restart browser processes to apply changes (Optional)
Get-Process chrome, firefox -ErrorAction SilentlyContinue | Stop-Process -Force
Write-Host "Restarted browsers to apply SSL key logging."

# Confirm completion
Write-Host "SSL key logging is now enabled. Check logs at: $LogFile"

METHOD 2: GPO METHOD

METHOD 3: DOMAIN JOINED DEPLOYMENT

CENTRALIZED COLLECTION

DECRYPTING HTTPS TRAFFIC W/ KEYLOG FILE

Last updated