|
<# |
|
.SYNOPSIS |
|
Checks this Windows PC for the "k2f" agent delivered through the NIKKE PC |
|
launcher (November 2026), and - only with your confirmation at each step - |
|
removes the persistence it leaves behind. |
|
|
|
.DESCRIPTION |
|
In late 2026 some of the NIKKE PC launcher's official web files on Level |
|
Infinite's CDN were modified to load a script from insightjs.com. On |
|
affected PCs that script downloaded a remote-access agent ("k2f") into the |
|
launcher and, according to public analysis, could install persistence |
|
inside Chromium browser profiles. |
|
|
|
This script follows the public write-up at: |
|
https://gist.github.com/MotherSphere/d6c049a09ba8ac3085c51ee9df24a4e5 |
|
(instructions as of 2026-11-03 19:51 GMT, "Last updated 19:10 GMT"), plus |
|
the gist's comments and https://github.com/WormW/nikke_malware_analysis. |
|
|
|
What it does, in order. Nothing is changed without a y/n prompt: |
|
|
|
1. Explains itself and asks whether to start. |
|
2. Finds your NIKKE install(s) and asks to close the launcher if it is |
|
running (the agent runs inside the launcher's own processes). |
|
3. DETECTION (read-only): |
|
- Launcher\intl_service\debug.log for "k2f_chan registered", |
|
"agent started as <PC name>", "adopted <id>", "lua downloaded to" |
|
- Launcher\log\tinyget\*.log for downloads from insightjs.com, and |
|
whether the downloaded payload file still exists |
|
- The launcher's browser profiles (%APPDATA%\nikke_launcher, and the |
|
_google / _hmt variants) for the agent's saved state |
|
("k2f.agent.state"), cached attacker scripts (insightjs.com/l.js), |
|
network history and HSTS records of attacker hosts |
|
- %TEMP% for k2f-bcreds-* (credential dumps) and k2f_screen_*.jpg |
|
- Every Chromium-based browser's "User Data\PlatformExperienceHelper" |
|
folder for platform_experience_helper.dll |
|
- HKCU\Software\Classes\CLSID\{E77CC89B-7401-4C04-8CED-149DB35ADD04} |
|
(the COM hijack), plus any other per-user COM entry that points at |
|
that DLL |
|
4. Offers to copy evidence (logs, cache files, registry export) into a |
|
folder on your Desktop before anything is deleted. |
|
5. REMEDIATION. Each item gets its own prompt: |
|
- remove the HKCU COM hijack key (after exporting a backup) |
|
- delete platform_experience_helper.dll from every browser profile |
|
- delete k2f temp files and any leftover payload file |
|
- delete the launcher's web cache (tbs_cache), as the gist advises |
|
- (Administrator only) block the attacker domains in the hosts file |
|
and the attacker IP in Windows Firewall |
|
6. Prints a summary, a verdict and what to do next. |
|
|
|
What it never does: |
|
- It never touches HKLM. The same CLSID exists under HKLM on every |
|
Windows install (Windows Parental Controls, wpc.dll) and is legitimate. |
|
- It never deletes Chrome's own files in PlatformExperienceHelper (for |
|
example "LoadFeatures"). Only DLLs, which do not belong there. |
|
- It never uploads anything or contacts the attacker's servers. |
|
- It does not need Administrator. Steps that do are skipped and explained. |
|
|
|
IMPORTANT LIMITS |
|
- A clean result is not proof the PC was never infected. The launcher |
|
log can be overwritten, and the operator could run any command. If |
|
anything CRITICAL is found, the safest fix is reinstalling Windows. |
|
- Change passwords from a DIFFERENT, clean device. |
|
|
|
.PARAMETER NikkePath |
|
One or more NIKKE install folders (for example D:\Games\NIKKE). Optional: |
|
the script looks in C:\NIKKE, every drive's \NIKKE, Program Files, the |
|
Windows "installed apps" list, the nikkelauncher:// link handler and |
|
Steam libraries. |
|
|
|
.PARAMETER ScanOnly |
|
Detection only. Shows what would be removed but changes nothing. |
|
|
|
.PARAMETER ReportRoot |
|
Where to create the report/evidence folder. Default: your Desktop. |
|
|
|
.EXAMPLE |
|
# Recommended: run from a normal (non-admin) PowerShell window |
|
powershell -NoProfile -ExecutionPolicy Bypass -File .\Check-NikkeK2f.ps1 |
|
|
|
.EXAMPLE |
|
# Look only, change nothing |
|
powershell -NoProfile -ExecutionPolicy Bypass -File .\Check-NikkeK2f.ps1 -ScanOnly |
|
|
|
.EXAMPLE |
|
# NIKKE installed somewhere unusual |
|
powershell -NoProfile -ExecutionPolicy Bypass -File .\Check-NikkeK2f.ps1 -NikkePath 'E:\Games\NIKKE' |
|
|
|
.NOTES |
|
Exit codes: 0 = no indicators found, 1 = indicators found, 2 = script error. |
|
Works on Windows PowerShell 5.1 (built into Windows 10/11) and PowerShell 7. |
|
The file is plain ASCII on purpose, so Windows PowerShell 5.1 reads it |
|
correctly without a byte-order mark. |
|
#> |
|
|
|
[CmdletBinding()] |
|
param( |
|
[string[]]$NikkePath, |
|
[switch]$ScanOnly, |
|
[string]$ReportRoot = [Environment]::GetFolderPath('Desktop') |
|
) |
|
|
|
$ErrorActionPreference = 'Continue' |
|
|
|
# --------------------------------------------------------------------------- |
|
# Indicators of compromise (from the gist and from a confirmed infection) |
|
# --------------------------------------------------------------------------- |
|
# Bump on every change, so a pasted transcript shows which version ran. |
|
$ScriptVersion = '2026-11-04.4' |
|
|
|
$IOC = [ordered]@{ |
|
GistUrl = 'https://gist.github.com/MotherSphere/d6c049a09ba8ac3085c51ee9df24a4e5' |
|
GistCheckedAt = '2026-11-04 05:28 GMT' |
|
# COM class hijacked under HKCU only. The HKLM copy (wpc.dll) is legitimate. |
|
Clsid = '{E77CC89B-7401-4C04-8CED-149DB35ADD04}' |
|
DllName = 'platform_experience_helper.dll' |
|
PersistDirName = 'PlatformExperienceHelper' |
|
Domains = @('insightjs.com', 'www.insightjs.com', 'analytics.insightjs.com', |
|
'portal.insightjs.com', 'docs.insightjs.com', 'insightjs.org', |
|
'analytics.insightjs.org') |
|
# The agent talks to the server through the loader in the launcher's |
|
# browser, so the browser reaching analytics.* means the agent ran. The |
|
# other hosts only serve the loader. |
|
AgentHostRegex = '^analytics\.insightjs\.' |
|
# Launcher profiles under %APPDATA%: the desktop launcher, the Google Play |
|
# Games PC build and the HMT build. |
|
LauncherProfileNames = @('nikke_launcher', 'nikke_launcher_google', 'nikke_launcher_hmt') |
|
# Left in Chrome's program folder by the agent's install/cleanup code. |
|
ProgramLeftovers = @('platform_experience_helper.dll.old', 'old-clsid.txt') |
|
# 89.127.233.127 from Oct 23, 89.126.250.172 from Oct 5 to Oct 21 (gist |
|
# comment by D-Maledicte). Both are in 1984 ehf's network. |
|
Ips = @('89.127.233.127', '89.126.250.172') |
|
# Lines the agent writes into the launcher's Chromium console log. |
|
DebugLogRegex = 'k2f_chan|agent started as |lua downloaded to |"(adopted|resuming) [0-9a-f]{8}-[0-9a-f]{4}-' |
|
# Logged by the injected loader code itself (with an empty source) when |
|
# another loader already started the agent: the loader ran, but this line |
|
# alone does not show that the agent did. |
|
LoaderLogRegex = '"startup already in progress", source: \(' |
|
# One public build of the payload (insight.bundle). Builds change; the |
|
# same size with a different hash is still the payload. |
|
PayloadSha256 = 'CC0AD05BFE85940A6067B3A72C182D3953339129206634141926D5D0B35973EC' |
|
PayloadSize = 205135 |
|
# The published persistence DLL (WormW/nikke_malware_analysis, Sample-A). |
|
# chrome_install accepts any DLL, so other hashes are just as malicious. |
|
DllSha256 = 'F3E93D049851D5C19552C7D9B73C8BE4580DC9D549E8F65F9F0C357C1DF9D252' |
|
# ETags of the modified official CDN files. The launcher's HTTP cache keeps |
|
# response headers uncompressed, so these show that a modified copy was |
|
# cached, and that the launcher would run the loader again from cache. |
|
ModifiedEtags = [ordered]@{ |
|
'50d1861152ea7f6875ffceb7d08445b5' = 'aegis-fix.min.js' |
|
'481e9b5ab8fb93406bf31980b53e0578' = 'images.7fec4c32.js' |
|
'b7d842200372ad0d9a84ef4cc8511311' = 'FeedList.feb647c9.js' |
|
'dd06875637a29cddd3bae2ba84142c78' = 'vue-bucket.min.js' |
|
} |
|
} |
|
|
|
# Chromium-based browsers and where they keep "User Data". The DLL hijack was |
|
# reported in Chrome; the others are checked because the agent steals from all |
|
# of them and the same trick works in any Chromium profile. |
|
$ChromiumProfiles = @( |
|
@{ Name = 'Google Chrome'; Path = '%LOCALAPPDATA%\Google\Chrome\User Data' } |
|
@{ Name = 'Google Chrome Beta'; Path = '%LOCALAPPDATA%\Google\Chrome Beta\User Data' } |
|
@{ Name = 'Google Chrome Dev'; Path = '%LOCALAPPDATA%\Google\Chrome Dev\User Data' } |
|
@{ Name = 'Google Chrome Canary'; Path = '%LOCALAPPDATA%\Google\Chrome SxS\User Data' } |
|
@{ Name = 'Chromium'; Path = '%LOCALAPPDATA%\Chromium\User Data' } |
|
@{ Name = 'Microsoft Edge'; Path = '%LOCALAPPDATA%\Microsoft\Edge\User Data' } |
|
@{ Name = 'Microsoft Edge Beta'; Path = '%LOCALAPPDATA%\Microsoft\Edge Beta\User Data' } |
|
@{ Name = 'Microsoft Edge Dev'; Path = '%LOCALAPPDATA%\Microsoft\Edge Dev\User Data' } |
|
@{ Name = 'Microsoft Edge Canary';Path = '%LOCALAPPDATA%\Microsoft\Edge SxS\User Data' } |
|
@{ Name = 'Brave'; Path = '%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data' } |
|
@{ Name = 'Brave Beta'; Path = '%LOCALAPPDATA%\BraveSoftware\Brave-Browser-Beta\User Data' } |
|
@{ Name = 'Brave Nightly'; Path = '%LOCALAPPDATA%\BraveSoftware\Brave-Browser-Nightly\User Data' } |
|
@{ Name = 'Vivaldi'; Path = '%LOCALAPPDATA%\Vivaldi\User Data' } |
|
@{ Name = 'Yandex Browser'; Path = '%LOCALAPPDATA%\Yandex\YandexBrowser\User Data' } |
|
@{ Name = 'Thorium'; Path = '%LOCALAPPDATA%\Thorium\User Data' } |
|
@{ Name = 'Coc Coc'; Path = '%LOCALAPPDATA%\CocCoc\Browser\User Data' } |
|
@{ Name = 'Opera'; Path = '%APPDATA%\Opera Software\Opera Stable' } |
|
@{ Name = 'Opera GX'; Path = '%APPDATA%\Opera Software\Opera GX Stable' } |
|
) |
|
|
|
# Process names, used to ask you to close programs before files are removed. |
|
$LauncherProcessNames = @('nikke_launcher', 'intl_service', 'tbs_browser', 'nikke') |
|
$BrowserProcessNames = @('chrome', 'msedge', 'brave', 'vivaldi', 'opera', 'browser', 'chromium', 'thorium') |
|
|
|
$Latin1 = [System.Text.Encoding]::GetEncoding(28591) |
|
# Missing when the Microsoft.PowerShell.Security module cannot load. |
|
$HasAuthenticode = [bool](Get-Command Get-AuthenticodeSignature -ErrorAction SilentlyContinue) |
|
$Findings = New-Object System.Collections.Generic.List[object] |
|
$Actions = New-Object System.Collections.Generic.List[string] |
|
|
|
# --------------------------------------------------------------------------- |
|
# Output and prompt helpers |
|
# --------------------------------------------------------------------------- |
|
|
|
function Write-Banner { |
|
param([string]$Text) |
|
Write-Host '' |
|
Write-Host ('=' * 78) -ForegroundColor Cyan |
|
Write-Host " $Text" -ForegroundColor Cyan |
|
Write-Host ('=' * 78) -ForegroundColor Cyan |
|
} |
|
|
|
function Write-Info { |
|
param([string[]]$Lines, [ConsoleColor]$Color = 'Gray') |
|
foreach ($line in $Lines) { Write-Host " $line" -ForegroundColor $Color } |
|
} |
|
|
|
# Asks a yes/no question after printing an explanation. Returns $true/$false. |
|
# Destructive steps default to "No": pressing Enter alone means No. |
|
function Confirm-Step { |
|
param( |
|
[string]$Question, |
|
[string[]]$Explanation, |
|
[switch]$DefaultYes |
|
) |
|
if ($Explanation) { Write-Host ''; Write-Info $Explanation } |
|
if (-not [Environment]::UserInteractive) { |
|
Write-Info 'Non-interactive session: answering No.' -Color Yellow |
|
return $false |
|
} |
|
$hint = if ($DefaultYes) { '[Y/n]' } else { '[y/N]' } |
|
while ($true) { |
|
$answer = Read-Host " $Question $hint" |
|
if ([string]::IsNullOrWhiteSpace($answer)) { return [bool]$DefaultYes } |
|
switch -Regex ($answer.Trim()) { |
|
'^(y|yes)$' { return $true } |
|
'^(n|no)$' { return $false } |
|
default { Write-Info 'Please type y or n.' -Color Yellow } |
|
} |
|
} |
|
} |
|
|
|
# Records a finding and prints it immediately. |
|
# CRITICAL = the agent ran here or left persistence / stolen data behind |
|
# WARNING = the launcher loaded attacker code, or something needs a look |
|
# INFO = context |
|
function Add-Finding { |
|
param( |
|
[ValidateSet('CRITICAL', 'WARNING', 'INFO')][string]$Severity, |
|
[string]$Title, |
|
[string]$Location, |
|
[string]$Detail |
|
) |
|
$Findings.Add([pscustomobject]@{ |
|
Severity = $Severity; Title = $Title; Location = $Location; Detail = $Detail |
|
}) |
|
$color = @{ CRITICAL = 'Red'; WARNING = 'Yellow'; INFO = 'Gray' }[$Severity] |
|
Write-Host " [$Severity] $Title" -ForegroundColor $color |
|
if ($Location) { Write-Host " where: $Location" -ForegroundColor DarkGray } |
|
if ($Detail) { foreach ($l in ($Detail -split "`n")) { Write-Host " $l" -ForegroundColor DarkGray } } |
|
} |
|
|
|
function Add-Action { |
|
param([string]$Text) |
|
$Actions.Add($Text) |
|
Write-Info "-> $Text" -Color Green |
|
} |
|
|
|
# --------------------------------------------------------------------------- |
|
# File helpers. Files are opened with sharing so that logs held open by the |
|
# launcher can still be read, and nothing is ever opened for writing. |
|
# --------------------------------------------------------------------------- |
|
|
|
function Read-SharedBytes { |
|
param([string]$Path, [long]$MaxBytes = 512MB, [long]$HeadBytes = 0) |
|
try { |
|
$share = [System.IO.FileShare]'ReadWrite, Delete' |
|
$fs = [System.IO.File]::Open($Path, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, $share) |
|
} catch { return $null } |
|
try { |
|
$len = $fs.Length |
|
if ($HeadBytes -gt 0 -and $len -gt $HeadBytes) { $len = $HeadBytes } |
|
if ($len -gt $MaxBytes) { return $null } |
|
$buf = New-Object byte[] $len |
|
$read = 0 |
|
while ($read -lt $len) { |
|
$n = $fs.Read($buf, $read, $len - $read) |
|
if ($n -le 0) { break } |
|
$read += $n |
|
} |
|
return ,$buf |
|
} finally { $fs.Dispose() } |
|
} |
|
|
|
# Byte-for-byte text view (Latin-1), so binary cache files can be searched. |
|
function Read-SharedText { |
|
param([string]$Path, [long]$HeadBytes = 0) |
|
$b = Read-SharedBytes -Path $Path -HeadBytes $HeadBytes |
|
if ($null -eq $b) { return $null } |
|
return $Latin1.GetString($b) |
|
} |
|
|
|
# Yields the lines of a text file that match a regex, reading it as a stream |
|
# so that a very large log does not have to fit in memory. |
|
function Select-SharedLines { |
|
param([string]$Path, [string]$Pattern) |
|
$fs = [System.IO.File]::Open($Path, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, |
|
[System.IO.FileShare]'ReadWrite, Delete') |
|
$sr = New-Object System.IO.StreamReader($fs, $Latin1) |
|
try { |
|
$re = New-Object System.Text.RegularExpressions.Regex $Pattern |
|
while ($null -ne ($line = $sr.ReadLine())) { if ($re.IsMatch($line)) { $line } } |
|
} finally { $sr.Dispose() } |
|
} |
|
|
|
function Get-Sha256 { |
|
param([string]$Path) |
|
try { |
|
$fs = [System.IO.File]::Open($Path, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, |
|
[System.IO.FileShare]'ReadWrite, Delete') |
|
} catch { return 'unavailable (file locked or unreadable)' } |
|
$sha = [System.Security.Cryptography.SHA256]::Create() |
|
try { return ([BitConverter]::ToString($sha.ComputeHash($fs))).Replace('-', '') } |
|
catch { return 'unavailable (file locked or unreadable)' } |
|
finally { $sha.Dispose(); $fs.Dispose() } |
|
} |
|
|
|
# Lists the files (or, with -Directories, the folders) under $Root. |
|
# Used instead of Get-ChildItem -Recurse, which in Windows PowerShell 5.1 can |
|
# stop with a terminating error ("The system cannot find the file specified") |
|
# on app aliases in %LOCALAPPDATA%\Microsoft\WindowsApps, on files deleted |
|
# mid-scan in %TEMP%, or on paths that are too long. Here a folder that |
|
# cannot be read is skipped, and junctions and symbolic links are not |
|
# followed. -FileName returns only files with exactly that name. |
|
function Get-ChildItemSafe { |
|
param([string]$Root, [int]$MaxDepth = 32, [string]$FileName, [switch]$Directories) |
|
try { $start = New-Object System.IO.DirectoryInfo $Root } catch { return } |
|
if (-not $start.Exists) { return } |
|
$stack = New-Object System.Collections.Generic.Stack[object] |
|
$stack.Push([pscustomobject]@{ Dir = $start; Depth = 0 }) |
|
while ($stack.Count -gt 0) { |
|
$cur = $stack.Pop() |
|
try { $subdirs = $cur.Dir.GetDirectories() } catch { continue } |
|
foreach ($d in $subdirs) { |
|
if ($Directories) { $d } |
|
$isLink = [bool]($d.Attributes -band [System.IO.FileAttributes]::ReparsePoint) |
|
if (-not $isLink -and $cur.Depth -lt $MaxDepth) { |
|
$stack.Push([pscustomobject]@{ Dir = $d; Depth = $cur.Depth + 1 }) |
|
} |
|
} |
|
if ($Directories) { continue } |
|
try { |
|
$files = if ($FileName) { $cur.Dir.GetFiles($FileName) } else { $cur.Dir.GetFiles() } |
|
} catch { continue } |
|
foreach ($f in $files) { if (-not $FileName -or $f.Name -ieq $FileName) { $f } } |
|
} |
|
} |
|
|
|
# Runs one check. If it fails, the failure is recorded and the script moves |
|
# on to the next check instead of stopping. |
|
function Invoke-Check { |
|
param([string]$Name, [scriptblock]$Check) |
|
try { & $Check } |
|
catch { |
|
$msg = "$($_.Exception.Message) (line $($_.InvocationInfo.ScriptLineNumber))" |
|
$script:FailedChecks += ,"$Name : $msg" |
|
Write-Info "Could not finish the $Name check: $msg" -Color Yellow |
|
Write-Info 'The other checks still run. This one is listed again in the result.' -Color Yellow |
|
} |
|
} |
|
|
|
# Returns $true when a file has a valid Authenticode signature from Google or |
|
# Microsoft, i.e. it is very unlikely to be the attacker DLL. |
|
function Test-TrustedSignature { |
|
param([string]$Path) |
|
if (-not $HasAuthenticode) { return $false } |
|
$sig = Get-AuthenticodeSignature -LiteralPath $Path -ErrorAction SilentlyContinue |
|
if ($null -eq $sig) { return $false } |
|
return ($sig.Status -eq 'Valid' -and "$($sig.SignerCertificate.Subject)" -match 'O=(Google|Microsoft)') |
|
} |
|
|
|
function Get-SignatureText { |
|
param([string]$Path) |
|
if (-not $HasAuthenticode) { return 'could not check signature (Get-AuthenticodeSignature unavailable)' } |
|
$sig = Get-AuthenticodeSignature -LiteralPath $Path -ErrorAction SilentlyContinue |
|
if ($null -eq $sig) { return 'could not check signature' } |
|
if ($sig.SignerCertificate) { return "$($sig.Status), signer: $($sig.SignerCertificate.Subject)" } |
|
return "$($sig.Status) (no signer)" |
|
} |
|
|
|
# Reads a registry key's (Default) value without expanding %VARIABLES%. |
|
# Uses the .NET registry API, so a missing key returns $null without an |
|
# error record (a caught Get-Item error still shows up in the transcript as |
|
# "TerminatingError", which looks like a crash to whoever reads it). |
|
function Get-RegDefault { |
|
param([string]$Path) |
|
$hives = @{ 'HKCU:' = [Microsoft.Win32.Registry]::CurrentUser; 'HKLM:' = [Microsoft.Win32.Registry]::LocalMachine } |
|
$parts = $Path -split '\\', 2 |
|
$hive = $hives[$parts[0].ToUpperInvariant()] |
|
if ($null -eq $hive -or $parts.Count -lt 2) { return $null } |
|
try { |
|
$key = $hive.OpenSubKey($parts[1]) |
|
if ($null -eq $key) { return $null } |
|
try { return $key.GetValue('', $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) } |
|
finally { $key.Close() } |
|
} catch { return $null } |
|
} |
|
|
|
function Test-IsAdmin { |
|
try { |
|
$id = [Security.Principal.WindowsIdentity]::GetCurrent() |
|
return ([Security.Principal.WindowsPrincipal]$id).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) |
|
} catch { return $false } |
|
} |
|
|
|
# Turns microseconds since 1970 (the agent's server timestamps) into UTC text. |
|
function Convert-MicrosToUtc { |
|
param([string]$Micros) |
|
try { |
|
$ms = [int64]([int64]$Micros / 1000) |
|
return [DateTimeOffset]::FromUnixTimeMilliseconds($ms).UtcDateTime.ToString('yyyy-MM-dd HH:mm:ss') + ' UTC' |
|
} catch { return $Micros } |
|
} |
|
|
|
# --------------------------------------------------------------------------- |
|
# Locating NIKKE installs |
|
# --------------------------------------------------------------------------- |
|
|
|
# Accepts a NIKKE root, its Launcher folder, or a launcher .exe path, and |
|
# returns the root folder (the one containing "Launcher"), or $null. |
|
# An uninstall can remove the .exe but leave the log folders behind, so a |
|
# folder with only Launcher\intl_service or Launcher\log still counts. |
|
function Resolve-NikkeRoot { |
|
param([string]$Candidate) |
|
if ([string]::IsNullOrWhiteSpace($Candidate)) { return $null } |
|
$c = [Environment]::ExpandEnvironmentVariables($Candidate.Trim('"', ' ')) |
|
if (Test-Path -LiteralPath $c -PathType Leaf) { $c = [System.IO.Path]::GetDirectoryName($c) } |
|
if (-not (Test-Path -LiteralPath $c -PathType Container)) { return $null } |
|
$c = (Resolve-Path -LiteralPath $c).ProviderPath.TrimEnd('\') |
|
foreach ($marker in @('Launcher\intl_service', 'Launcher\log', 'Launcher\nikke_launcher.exe')) { |
|
if (Test-Path -LiteralPath (Join-Path $c $marker)) { return $c } |
|
} |
|
if ((Test-Path -LiteralPath (Join-Path $c 'intl_service')) -or |
|
(Test-Path -LiteralPath (Join-Path $c 'log\tinyget')) -or |
|
(Test-Path -LiteralPath (Join-Path $c 'nikke_launcher.exe'))) { |
|
return [System.IO.Path]::GetDirectoryName($c) |
|
} |
|
return $null |
|
} |
|
|
|
function Find-NikkeRoots { |
|
$candidates = New-Object System.Collections.Generic.List[string] |
|
if ($NikkePath) { $NikkePath | ForEach-Object { $candidates.Add($_) } } |
|
|
|
# Default install folder, on every local drive. |
|
Get-PSDrive -PSProvider FileSystem -ErrorAction SilentlyContinue | ForEach-Object { |
|
if ($_.Root) { $candidates.Add((Join-Path $_.Root 'NIKKE')) } |
|
} |
|
foreach ($pf in @($env:ProgramFiles, ${env:ProgramFiles(x86)})) { |
|
if ($pf) { $candidates.Add((Join-Path $pf 'NIKKE')) } |
|
} |
|
|
|
# Windows "installed apps" entries. |
|
$uninstallKeys = @( |
|
'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall', |
|
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', |
|
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' |
|
) |
|
foreach ($uk in $uninstallKeys) { |
|
Get-ChildItem -LiteralPath $uk -ErrorAction SilentlyContinue | ForEach-Object { |
|
$p = Get-ItemProperty -LiteralPath $_.PSPath -ErrorAction SilentlyContinue |
|
if ($p -and ("$($p.DisplayName)" -like '*NIKKE*')) { |
|
if ($p.InstallLocation) { $candidates.Add("$($p.InstallLocation)") } |
|
foreach ($v in @($p.UninstallString, $p.DisplayIcon)) { |
|
if ("$v" -match '^\s*"?([^"]+?\.exe)') { $candidates.Add($Matches[1]) } |
|
} |
|
} |
|
} |
|
} |
|
|
|
# The nikkelauncher:// link handler points at the launcher .exe. |
|
$cmd = Get-RegDefault 'HKCU:\Software\Classes\nikkelauncher\Shell\Open\Command' |
|
if ("$cmd" -match '^\s*"?([^"]+?\.exe)') { $candidates.Add($Matches[1]) } |
|
|
|
# Steam libraries (NIKKE is also distributed through Steam). |
|
$steamRoots = @(@(${env:ProgramFiles(x86)}, $env:ProgramFiles) | Where-Object { $_ } | ForEach-Object { Join-Path $_ 'Steam' }) |
|
$sp = (Get-ItemProperty -LiteralPath 'HKCU:\Software\Valve\Steam' -ErrorAction SilentlyContinue).SteamPath |
|
if ($sp) { $steamRoots += ($sp -replace '/', '\') } |
|
foreach ($sr in $steamRoots) { |
|
$vdf = Join-Path $sr 'steamapps\libraryfolders.vdf' |
|
$libs = @($sr) |
|
if (Test-Path -LiteralPath $vdf) { |
|
$text = Get-Content -LiteralPath $vdf -Raw -ErrorAction SilentlyContinue |
|
foreach ($m in [regex]::Matches("$text", '"path"\s+"([^"]+)"')) { |
|
$libs += ($m.Groups[1].Value -replace '\\\\', '\') |
|
} |
|
} |
|
foreach ($lib in $libs) { |
|
Get-ChildItem -LiteralPath (Join-Path $lib 'steamapps\common') -Directory -Filter '*NIKKE*' -ErrorAction SilentlyContinue | |
|
ForEach-Object { $candidates.Add($_.FullName) } |
|
} |
|
} |
|
|
|
$roots = @{} |
|
foreach ($c in $candidates) { |
|
$r = Resolve-NikkeRoot $c |
|
if ($r) { $roots[$r.ToLowerInvariant()] = $r } |
|
} |
|
return @($roots.Values) |
|
} |
|
|
|
# --------------------------------------------------------------------------- |
|
# Detection |
|
# --------------------------------------------------------------------------- |
|
|
|
# 1) The launcher's Chromium console log. The agent prints its status here. |
|
function Test-DebugLog { |
|
param([string]$Root) |
|
$log = Join-Path $Root 'Launcher\intl_service\debug.log' |
|
if (-not (Test-Path -LiteralPath $log)) { |
|
Add-Finding INFO 'Launcher debug.log not found (nothing to check here).' $log |
|
return |
|
} |
|
$item = Get-Item -LiteralPath $log -Force |
|
Write-Info "debug.log: $([math]::Round($item.Length / 1MB, 1)) MB, last written $($item.LastWriteTime)" |
|
try { |
|
$hits = @(Select-SharedLines $log $IOC.DebugLogRegex) |
|
$loaderHits = @(Select-SharedLines $log $IOC.LoaderLogRegex) |
|
} catch { Add-Finding WARNING 'Could not read debug.log.' $log $_.Exception.Message; return } |
|
if ($hits.Count -eq 0) { |
|
if ($loaderHits.Count -gt 0) { |
|
Add-Finding WARNING "The attacker loader code ran in the launcher ($($loaderHits.Count) log lines), but no agent start was logged." $log ` |
|
("Timestamps are [MMDD/HHMMSS] in this PC's local time. On infected PCs this line has been seen just`n" + |
|
"before the payload download, so the payload may have been served even though no agent start was logged.`n" + |
|
(($loaderHits | Select-Object -First 5) -join "`n")) |
|
} |
|
Add-Finding INFO 'No k2f agent lines in debug.log.' $log ` |
|
'The launcher keeps this log across launches, but it is lost if NIKKE was reinstalled or its folder deleted.' |
|
return |
|
} |
|
$shown = ($hits | Select-Object -First 20 | ForEach-Object { |
|
if ($_.Length -gt 200) { $_.Substring(0, 200) + '...' } else { $_ } |
|
}) -join "`n" |
|
Add-Finding CRITICAL "The k2f agent ran inside the NIKKE launcher ($($hits.Count) log lines)." $log ` |
|
("Timestamps are [MMDD/HHMMSS] in this PC's local time.`n" + $shown) |
|
foreach ($h in $hits) { |
|
# "lua downloaded to <path>" names the payload file, relative to |
|
# Launcher: log\tinyget\k2f.lua on early runs, a tinyget.<time>.log later. |
|
if ($h -match 'lua downloaded to ([^"]+)"') { |
|
Test-PayloadFile (Join-Path (Join-Path $Root 'Launcher') $Matches[1].Trim()) |
|
} |
|
if ($h -match 'agent started as ([^"\s]+)') { |
|
$name = $Matches[1] |
|
if ($name -ieq $env:COMPUTERNAME) { |
|
Add-Finding CRITICAL "The agent registered with the attacker as this PC ($name)." $log |
|
} else { |
|
Add-Finding WARNING "The agent registered as '$name' (this PC is '$env:COMPUTERNAME')." $log |
|
} |
|
} |
|
} |
|
} |
|
|
|
# 2) The launcher's download logs. They show the payload download and the |
|
# disguised file name it was saved under. |
|
function Test-TinygetLogs { |
|
param([string]$Root) |
|
$dir = Join-Path $Root 'Launcher\log\tinyget' |
|
$logs = @(Get-ChildItem -LiteralPath $dir -File -Filter '*.log' -ErrorAction SilentlyContinue) |
|
if ($logs.Count -eq 0) { Add-Finding INFO 'No launcher download logs (tinyget) found.' $dir; return } |
|
$any = $false |
|
foreach ($f in $logs) { |
|
$text = Read-SharedText $f.FullName |
|
if ($null -eq $text -or $text.IndexOf('insightjs', [StringComparison]::OrdinalIgnoreCase) -lt 0) { continue } |
|
$any = $true |
|
$drops = @{} |
|
foreach ($m in [regex]::Matches($text, 'url=(https?://[^,\s]*insightjs[^,\s]*),\s*path=([^\r\n,]+)')) { |
|
$drops[$m.Groups[2].Value.Trim()] = $m.Groups[1].Value |
|
} |
|
# A finished download logs "result=0 ... total=<bytes>" (OnDownloadResult) |
|
# or "result=0 ... size=<bytes>" (OnTaskResult). A failed attempt logs a |
|
# non-zero result and total=0, so the URL alone is not a download. |
|
$sizes = @(@(foreach ($line in ($text -split "`n")) { |
|
if ($line.IndexOf('insightjs', [StringComparison]::OrdinalIgnoreCase) -lt 0) { continue } |
|
if ($line -match 'On(Download|Task)Result.*\bresult=0,.*\b(total|size)=([1-9][0-9]*)') { [int64]$Matches[3] } |
|
}) | Select-Object -Unique) |
|
$detail = if ($drops.Count) { |
|
($drops.GetEnumerator() | ForEach-Object { "$($_.Value)`n saved as $($_.Key)" }) -join "`n" |
|
} else { 'mentions insightjs.com' } |
|
if ($sizes.Count -gt 0) { |
|
$detail += "`ncompleted download size(s): $($sizes -join ', ') bytes (the payload is $($IOC.PayloadSize))" |
|
Add-Finding CRITICAL 'The launcher downloaded the attacker payload from insightjs.com.' $f.FullName $detail |
|
} else { |
|
Add-Finding WARNING 'The launcher tried to download the attacker payload, but this log shows no completed download.' $f.FullName ` |
|
($detail + "`nA failed attempt still means the loader ran. Check the other findings for signs the agent started.") |
|
} |
|
foreach ($path in $drops.Keys) { Test-PayloadFile $path } |
|
} |
|
if (-not $any) { Add-Finding INFO 'Launcher download logs show no insightjs.com downloads.' $dir } |
|
|
|
# Whatever the logs say, any file in this folder that starts with the |
|
# LuaJIT bytecode header ("\x1bLJ") is the payload, under any name. |
|
foreach ($f in @(Get-ChildItemSafe $dir -MaxDepth 1)) { |
|
$head = Read-SharedBytes -Path $f.FullName -HeadBytes 4 |
|
if ($head -and $head.Length -ge 3 -and $head[0] -eq 0x1B -and $head[1] -eq 0x4C -and $head[2] -eq 0x4A) { |
|
Test-PayloadFile $f.FullName |
|
} |
|
} |
|
} |
|
|
|
# Reports one payload file path, once, whether it still exists or not. |
|
function Test-PayloadFile { |
|
param([string]$Path) |
|
# The same download is usually logged in more than one place. |
|
$key = $Path.ToLowerInvariant() |
|
if ($script:SeenDrops.ContainsKey($key)) { return } |
|
$script:SeenDrops[$key] = $true |
|
if (Test-Path -LiteralPath $Path) { |
|
$fi = Get-Item -LiteralPath $Path -Force |
|
$hash = Get-Sha256 $Path |
|
$known = if ($hash -eq $IOC.PayloadSha256) { ' (matches the published payload hash)' } |
|
elseif ($fi.Length -eq $IOC.PayloadSize) { ' (same size as the payload, different build)' } |
|
else { '' } |
|
Add-Finding CRITICAL 'The downloaded payload file is still on disk.' $Path ` |
|
"size $($fi.Length) bytes, SHA-256 $hash$known" |
|
$script:PayloadFiles += ,$Path |
|
} else { |
|
Add-Finding INFO 'The payload file itself is no longer on disk.' $Path |
|
} |
|
} |
|
|
|
# 3) The launcher's embedded-browser profile in %APPDATA%\nikke_launcher. |
|
# The agent saves its identity and beacon counters in Local Storage under |
|
# "k2f.agent.state". The attacker loader script leaves Code Cache entries |
|
# keyed "insightjs.com/l.js?f=...". |
|
# The Google Play Games PC build and the HMT build keep the same profile |
|
# under their own folder names. |
|
function Test-LauncherProfile { |
|
foreach ($name in $IOC.LauncherProfileNames) { |
|
$prof = Join-Path $env:APPDATA $name |
|
if (Test-Path -LiteralPath $prof) { |
|
$script:LauncherProfiles += ,$prof |
|
Test-LauncherProfileDir $prof |
|
} |
|
} |
|
if ($script:LauncherProfiles.Count -eq 0) { |
|
Add-Finding INFO "No launcher profile in %APPDATA% ($($IOC.LauncherProfileNames -join ', '))." $env:APPDATA |
|
} |
|
} |
|
|
|
# Base64 SHA-256 of a host name in DNS wire format: how Chromium names hosts |
|
# in its TransportSecurity (HSTS) file. |
|
function Get-HstsHostHash { |
|
param([string]$HostName) |
|
$bytes = New-Object System.Collections.Generic.List[byte] |
|
foreach ($label in $HostName.ToLowerInvariant().Split('.')) { |
|
$bytes.Add([byte]$label.Length) |
|
$bytes.AddRange([System.Text.Encoding]::ASCII.GetBytes($label)) |
|
} |
|
$bytes.Add(0) |
|
$sha = [System.Security.Cryptography.SHA256]::Create() |
|
try { return [Convert]::ToBase64String($sha.ComputeHash($bytes.ToArray())) } finally { $sha.Dispose() } |
|
} |
|
|
|
function Test-LauncherProfileDir { |
|
param([string]$prof) |
|
$profDirs = @(Get-ChildItemSafe $prof -Directories) |
|
$profFiles = @(Get-ChildItemSafe $prof) |
|
|
|
# Local Storage (LevelDB): *.log is plain text, *.ldb may be compressed. |
|
$lsDirs = @($profDirs | Where-Object { $_.Name -eq 'leveldb' -and $_.Parent.Name -eq 'Local Storage' }) |
|
foreach ($d in $lsDirs) { |
|
foreach ($f in @(Get-ChildItemSafe $d.FullName -MaxDepth 0 | |
|
Where-Object { $_.Extension -in '.log', '.ldb' })) { |
|
$text = Read-SharedText $f.FullName |
|
if ($null -eq $text -or $text.IndexOf('k2f.agent', [StringComparison]::Ordinal) -lt 0) { continue } |
|
$ids = @([regex]::Matches($text, '"agent_id":"([0-9a-f-]{36})"') | ForEach-Object { $_.Groups[1].Value } | Select-Object -Unique) |
|
$ts = @([regex]::Matches($text, '"s2c_counter":(\d{13,17})') | ForEach-Object { $_.Groups[1].Value } | Sort-Object { [int64]$_ }) |
|
$detail = "agent id(s): $($ids -join ', ')" |
|
if ($ts.Count) { |
|
$detail += "`n$($ts.Count) saved check-ins with the attacker server, first $(Convert-MicrosToUtc $ts[0]), last $(Convert-MicrosToUtc $ts[-1])" |
|
} |
|
$detail += "`n(The record also holds the agent's secret key. This script does not print it.)" |
|
Add-Finding CRITICAL "The agent's saved state (k2f.agent.state) is in the launcher's storage." $f.FullName $detail |
|
} |
|
} |
|
|
|
# Code Cache: compiled-script cache keys contain the script URL. |
|
$ccDirs = @($profDirs | Where-Object { $_.Name -eq 'js' -and $_.Parent.Name -eq 'Code Cache' }) |
|
foreach ($d in $ccDirs) { |
|
foreach ($f in @(Get-ChildItemSafe $d.FullName -MaxDepth 0)) { |
|
$head = Read-SharedText $f.FullName -HeadBytes 4096 |
|
if ($null -eq $head) { continue } |
|
$m = [regex]::Match($head, 'https?://[a-z0-9.-]*insightjs\.[a-z]+/[\x21-\x7e]{0,60}') |
|
if ($m.Success) { |
|
Add-Finding WARNING 'The launcher ran the attacker loader script.' $f.FullName ` |
|
"$($m.Value) (cache entry last written $($f.LastWriteTime))" |
|
$script:EvidenceFiles += ,$f.FullName |
|
} |
|
} |
|
} |
|
|
|
# Network history: hosts the embedded browser connected to. |
|
foreach ($f in @($profFiles | Where-Object { $_.Name -eq 'Network Persistent State' })) { |
|
$text = Read-SharedText $f.FullName |
|
if ($text -and $text.IndexOf('insightjs', [StringComparison]::OrdinalIgnoreCase) -ge 0) { |
|
$hosts = @([regex]::Matches($text, 'https?://[a-z0-9.-]*insightjs\.[a-z]+') | ForEach-Object { $_.Value } | Select-Object -Unique) |
|
if ($hosts | Where-Object { ($_ -replace '^https?://', '') -match $IOC.AgentHostRegex }) { |
|
Add-Finding CRITICAL "The launcher browser connected to the agent's server." $f.FullName ` |
|
(($hosts -join ', ') + "`nOnly the running agent talks to analytics.insightjs.*.") |
|
} else { |
|
Add-Finding WARNING 'The launcher browser connected to the attacker loader site.' $f.FullName ($hosts -join ', ') |
|
} |
|
} |
|
} |
|
|
|
# HSTS records: written when the browser reaches an attacker host over |
|
# HTTPS. sts_observed is a time when that happened, not necessarily the |
|
# first or last contact. |
|
$hstsHosts = @{} |
|
foreach ($d in $IOC.Domains) { $hstsHosts[(Get-HstsHostHash $d)] = $d } |
|
foreach ($f in @($profFiles | Where-Object { $_.Name -eq 'TransportSecurity' })) { |
|
$text = Read-SharedText $f.FullName |
|
if (-not $text) { continue } |
|
try { $json = $text | ConvertFrom-Json -ErrorAction Stop } catch { continue } |
|
foreach ($e in @($json.sts)) { |
|
if (-not $e -or -not $hstsHosts.ContainsKey("$($e.host)")) { continue } |
|
$h = $hstsHosts["$($e.host)"] |
|
$when = try { [DateTimeOffset]::FromUnixTimeMilliseconds([int64]([double]$e.sts_observed * 1000)).UtcDateTime.ToString('yyyy-MM-dd HH:mm:ss') + ' UTC' } catch { 'unknown' } |
|
$detail = "$h (HSTS entry $($e.host)), contact seen at $when" |
|
if ($h -match $IOC.AgentHostRegex) { |
|
Add-Finding CRITICAL "The launcher browser reached the agent's server ($h)." $f.FullName ` |
|
($detail + "`nOnly the running agent talks to this host.") |
|
} else { |
|
Add-Finding WARNING "The launcher browser reached the attacker loader site ($h)." $f.FullName $detail |
|
} |
|
$script:EvidenceFiles += ,$f.FullName |
|
} |
|
} |
|
|
|
# HTTP cache: copies of the modified official files, found by ETag. A |
|
# cached copy means the loader ran at least once, and it would run again |
|
# from the cache even after Level Infinite fixed the file. |
|
$cacheFiles = @($profFiles | Where-Object { $_.Directory.Name -in 'Cache', 'Cache_Data' }) |
|
$cached = [ordered]@{} |
|
foreach ($f in $cacheFiles) { |
|
$text = Read-SharedText $f.FullName |
|
if ($null -eq $text) { continue } |
|
foreach ($etag in $IOC.ModifiedEtags.Keys) { |
|
if ($text.IndexOf($etag, [StringComparison]::OrdinalIgnoreCase) -ge 0) { |
|
$cached["$($IOC.ModifiedEtags[$etag]) (ETag $etag)"] = $f.FullName |
|
$script:EvidenceFiles += ,$f.FullName |
|
} |
|
} |
|
} |
|
if ($cached.Count -gt 0) { |
|
Add-Finding WARNING "The launcher's web cache holds modified official files that load the attacker script." ` |
|
(Join-Path $prof 'tbs_cache') ` |
|
((($cached.GetEnumerator() | ForEach-Object { "$($_.Key)`n in $($_.Value)" }) -join "`n") + |
|
"`nDelete tbs_cache (offered in Step 5) before opening the launcher again.") |
|
} |
|
} |
|
|
|
# 0) The agent's control channel is a named pipe, k2f_chan. If it exists, |
|
# the agent is running right now (inside the launcher, or loaded by the DLL). |
|
function Test-LiveAgent { |
|
# Directory.GetFiles throws when any pipe name has characters .NET rejects |
|
# in a path; Get-ChildItem copes with those but is slower. |
|
try { $pipes = @([System.IO.Directory]::GetFiles('\\.\pipe\') | ForEach-Object { [System.IO.Path]::GetFileName($_) }) } |
|
catch { $pipes = @(Get-ChildItem -LiteralPath '\\.\pipe\' -ErrorAction Stop | ForEach-Object { $_.Name }) } |
|
$live = @($pipes | Where-Object { $_ -like 'k2f*' }) |
|
if ($live.Count -gt 0) { |
|
Add-Finding CRITICAL 'The k2f agent is running on this PC right now (its named pipe exists).' "\\.\pipe\$($live[0])" ` |
|
'Close the NIKKE launcher and your browsers when asked. If the pipe is still there afterwards, restart Windows and run this script again.' |
|
} else { |
|
Write-Info 'No k2f_chan named pipe: the agent is not running right now (OK)' |
|
} |
|
} |
|
|
|
# 4) Files the agent writes to %TEMP%: credential dumps and screenshots. |
|
function Test-TempArtifacts { |
|
$found = @() |
|
$found += @(Get-ChildItem -LiteralPath $env:TEMP -Force -Filter 'k2f-bcreds-*' -ErrorAction SilentlyContinue) |
|
$found += @(Get-ChildItemSafe $env:TEMP -MaxDepth 2 | Where-Object { $_.Name -like 'k2f_screen_*' }) |
|
if ($found.Count -eq 0) { Add-Finding INFO 'No k2f files in %TEMP%.' $env:TEMP; return } |
|
foreach ($f in $found) { |
|
$kind = if ($f.Name -like 'k2f-bcreds-*') { 'a browser-credential dump' } else { 'a screenshot taken by the agent' } |
|
Add-Finding CRITICAL "Agent leftover: $kind." $f.FullName "created $($f.CreationTime)" |
|
$script:TempArtifacts += ,$f.FullName |
|
} |
|
} |
|
|
|
# 5) Persistence DLL inside Chromium browser profiles. Chrome legitimately |
|
# creates a "PlatformExperienceHelper" folder (for example with a |
|
# "LoadFeatures" file), but never a DLL there. The malicious DLL sits in a |
|
# subfolder named with a 64-character hash. |
|
function Test-BrowserPersistence { |
|
$seen = @{} |
|
foreach ($b in $ChromiumProfiles) { |
|
$ud = [Environment]::ExpandEnvironmentVariables($b.Path) |
|
if (-not (Test-Path -LiteralPath $ud)) { continue } |
|
$peh = Join-Path $ud $IOC.PersistDirName |
|
if (-not (Test-Path -LiteralPath $peh)) { |
|
Write-Info "$($b.Name): no $($IOC.PersistDirName) folder (OK)" |
|
continue |
|
} |
|
# The extension is compared exactly: a '*.dll' wildcard also matches |
|
# '.dllx' and similar on Windows. |
|
$dlls = @(Get-ChildItemSafe $peh | Where-Object { $_.Extension -ieq '.dll' }) |
|
$hashDirs = @(Get-ChildItemSafe $peh -MaxDepth 0 -Directories | |
|
Where-Object { $_.Name -match '^[0-9a-fA-F]{64}$' }) |
|
if ($dlls.Count -eq 0 -and $hashDirs.Count -eq 0) { |
|
Write-Info "$($b.Name): $($IOC.PersistDirName) folder holds only the browser's own files (OK)" |
|
continue |
|
} |
|
foreach ($d in $dlls) { |
|
$seen[$d.FullName.ToLowerInvariant()] = $true |
|
Add-DllFinding $d "Persistence DLL in $($b.Name)." |
|
} |
|
foreach ($h in $hashDirs) { |
|
$prefix = $h.FullName.TrimEnd('\', '/') + [System.IO.Path]::DirectorySeparatorChar |
|
if (-not ($dlls | Where-Object { $_.FullName.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase) })) { |
|
Add-Finding WARNING "Hash-named folder in $($b.Name)'s $($IOC.PersistDirName) (no DLL inside)." $h.FullName |
|
} |
|
$script:PersistDirs += ,$h.FullName |
|
} |
|
} |
|
|
|
# Catch-all: the DLL name anywhere else in your profile (slower). |
|
Write-Info "Searching %LOCALAPPDATA%, %APPDATA% and Chrome's program folder for $($IOC.DllName) (this can take a minute)..." |
|
# The payload also knows Chrome's program folders. Chrome's own |
|
# platform_experience_helper.exe lives there; a .dll of that name never does. |
|
$chromeApps = @($env:ProgramFiles, ${env:ProgramFiles(x86)}, $env:ProgramW6432) | |
|
Where-Object { $_ } | ForEach-Object { Join-Path $_ 'Google\Chrome\Application' } | Select-Object -Unique |
|
foreach ($base in @(@($env:LOCALAPPDATA, $env:APPDATA) + $chromeApps)) { |
|
Get-ChildItemSafe $base -MaxDepth 7 -FileName $IOC.DllName | |
|
Where-Object { -not $seen.ContainsKey($_.FullName.ToLowerInvariant()) } | |
|
ForEach-Object { |
|
$seen[$_.FullName.ToLowerInvariant()] = $true |
|
Add-DllFinding $_ "$($IOC.DllName) found outside a browser's expected folder." |
|
} |
|
} |
|
|
|
# Files the agent's install and cleanup code leaves in Chrome's program |
|
# folder. Reported for a manual look; Program Files needs Administrator. |
|
foreach ($base in $chromeApps) { |
|
foreach ($leftName in $IOC.ProgramLeftovers) { |
|
Get-ChildItemSafe $base -MaxDepth 3 -FileName $leftName | ForEach-Object { |
|
Add-Finding WARNING "Agent leftover in Chrome's program folder ($leftName)." $_.FullName ` |
|
"created $($_.CreationTime). The agent's DLL install writes this file; check it and delete it as administrator." |
|
} |
|
} |
|
} |
|
} |
|
|
|
# Reports one suspicious DLL. A DLL with a valid Google or Microsoft signature |
|
# is reported for a manual look but never offered for deletion. |
|
function Add-DllFinding { |
|
param([System.IO.FileInfo]$File, [string]$Title) |
|
$hash = Get-Sha256 $File.FullName |
|
# The DLL is built per victim (it embeds the agent ID), so the published |
|
# hash rarely matches. Its SHA-256 equalling its folder name is the |
|
# attacker's naming pattern. |
|
$known = '' |
|
if ($hash -eq $IOC.DllSha256) { $known += ' (matches the published attacker DLL)' } |
|
if ($hash -and $hash -eq $File.Directory.Name) { $known += " (its SHA-256 equals its folder name: the attacker's naming pattern)" } |
|
$detail = "SHA-256 $hash$known`nsignature: $(Get-SignatureText $File.FullName)`ncreated $($File.CreationTime)" |
|
if (Test-TrustedSignature $File.FullName) { |
|
Add-Finding WARNING "Signed DLL in an unexpected place, not removed: check it by hand." $File.FullName $detail |
|
return |
|
} |
|
Add-Finding CRITICAL $Title $File.FullName $detail |
|
$script:PersistDlls += ,$File.FullName |
|
} |
|
|
|
# 6) The COM hijack. Windows checks HKCU\Software\Classes before HKLM, so a |
|
# per-user copy of a system CLSID makes any program that loads that class |
|
# load the attacker DLL instead. |
|
function Test-ComHijack { |
|
foreach ($view in @('CLSID', 'Wow6432Node\CLSID')) { |
|
$key = "HKCU:\Software\Classes\$view\$($IOC.Clsid)" |
|
if (Test-Path -LiteralPath $key) { |
|
$srv = Get-RegDefault "$key\InprocServer32" |
|
# The agent's chrome_uninstall deletes the DLL but leaves this key |
|
# with an empty value, so an empty key still means it was installed. |
|
$note = if ($srv) { $srv } else { |
|
"(empty)`nAn empty key is what the agent leaves after removing its own DLL, so the DLL was installed here at some point." |
|
} |
|
Add-Finding CRITICAL 'Attacker COM hijack key present (per-user, HKCU).' $key "InprocServer32 = $note" |
|
$script:ComKeys += ,$key |
|
} |
|
} |
|
if (-not $script:ComKeys) { Add-Finding INFO "No HKCU COM hijack for $($IOC.Clsid)." 'HKCU:\Software\Classes\CLSID' } |
|
|
|
# For reference only: the legitimate HKLM registration. Never modified. |
|
$hklm = Get-RegDefault "HKLM:\SOFTWARE\Classes\CLSID\$($IOC.Clsid)\InprocServer32" |
|
if ($hklm) { |
|
$ok = if ("$hklm" -match 'wpc\.dll') { 'expected Windows entry' } else { 'UNEXPECTED value, check manually' } |
|
Write-Info "HKLM copy of $($IOC.Clsid): $hklm ($ok). This script never changes HKLM." |
|
} |
|
|
|
# Any other per-user COM class pointing at the persistence DLL or folder. |
|
foreach ($view in @('CLSID', 'Wow6432Node\CLSID')) { |
|
$base = "HKCU:\Software\Classes\$view" |
|
Get-ChildItem -LiteralPath $base -ErrorAction SilentlyContinue | ForEach-Object { |
|
if ($_.PSChildName -ieq $IOC.Clsid) { return } |
|
foreach ($sub in @('InprocServer32', 'LocalServer32')) { |
|
# OpenSubKey returns $null when the subkey is absent: much faster |
|
# than going through the provider for thousands of classes. |
|
# A key we may not read is skipped rather than stopping the scan. |
|
try { |
|
$sk = $_.OpenSubKey($sub) |
|
if ($null -eq $sk) { continue } |
|
$v = $sk.GetValue('', $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) |
|
$sk.Close() |
|
} catch { continue } |
|
# Only the DLL, or a file inside a browser's User Data folder. |
|
# Chrome registers its own platform_experience_helper.exe here |
|
# (under Application\<version>), which is legitimate. |
|
if ("$v" -match 'platform_experience_helper\.dll|\\User Data\\PlatformExperienceHelper\\') { |
|
$friendly = "HKCU:\Software\Classes\$view\$($_.PSChildName)" |
|
Add-Finding CRITICAL 'Another per-user COM entry points at the persistence DLL.' $friendly "$sub = $v" |
|
$script:ComKeys += ,$friendly |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
# --------------------------------------------------------------------------- |
|
# Evidence copy and remediation steps |
|
# --------------------------------------------------------------------------- |
|
|
|
function Copy-Evidence { |
|
param([string]$Dest, [string[]]$Roots) |
|
$copy = { |
|
param($src, $sub) |
|
if (-not (Test-Path -LiteralPath $src)) { return } |
|
# Files are copied one by one with sharing, so files the launcher holds |
|
# open (LevelDB's LOCK, the current log) do not stop the whole copy. |
|
$pairs = @(if (Test-Path -LiteralPath $src -PathType Container) { |
|
$base = (Get-Item -LiteralPath $src -Force).FullName.TrimEnd('\') |
|
Get-ChildItemSafe $src | ForEach-Object { |
|
[pscustomobject]@{ From = $_.FullName; To = (Join-Path $sub $_.FullName.Substring($base.Length).TrimStart('\')) } |
|
} |
|
} else { [pscustomobject]@{ From = $src; To = $sub } }) |
|
foreach ($p in $pairs) { |
|
$target = Join-Path $Dest $p.To |
|
try { |
|
New-Item -ItemType Directory -Force -Path ([System.IO.Path]::GetDirectoryName($target)) -ErrorAction Stop | Out-Null |
|
$bytes = Read-SharedBytes -Path $p.From -MaxBytes 1GB |
|
if ($null -eq $bytes) { throw 'locked, unreadable or over 1 GB' } |
|
[System.IO.File]::WriteAllBytes($target, $bytes) |
|
} catch { Write-Info "could not copy $($p.From) : $_" -Color Yellow } |
|
} |
|
} |
|
New-Item -ItemType Directory -Force -Path $Dest | Out-Null |
|
foreach ($r in $Roots) { |
|
$tag = ($r -replace '[:\\]', '_').Trim('_') |
|
& $copy (Join-Path $r 'Launcher\intl_service\debug.log') "$tag\debug.log" |
|
Get-ChildItem -LiteralPath (Join-Path $r 'Launcher\log\tinyget') -File -Filter '*.log' -ErrorAction SilentlyContinue | |
|
ForEach-Object { & $copy $_.FullName "$tag\tinyget\$($_.Name)" } |
|
} |
|
foreach ($lp in $script:LauncherProfiles) { |
|
$lpName = [System.IO.Path]::GetFileName($lp) |
|
Get-ChildItemSafe $lp -Directories | Where-Object { $_.Name -eq 'Local Storage' } | |
|
ForEach-Object { |
|
$rel = $_.FullName.Substring($lp.Length).TrimStart('\') |
|
& $copy $_.FullName "$lpName\$rel" |
|
} |
|
foreach ($name in @('Network Persistent State', 'TransportSecurity')) { |
|
Get-ChildItemSafe $lp -FileName $name | |
|
ForEach-Object { |
|
$rel = $_.FullName.Substring($lp.Length).TrimStart('\') |
|
& $copy $_.FullName "$lpName\$rel" |
|
} |
|
} |
|
foreach ($f in $script:EvidenceFiles) { |
|
if ($f.StartsWith($lp + '\', [StringComparison]::OrdinalIgnoreCase)) { |
|
$rel = $f.Substring($lp.Length).TrimStart('\') |
|
& $copy $f "$lpName\$rel" |
|
} |
|
} |
|
} |
|
foreach ($k in $script:ComKeys) { |
|
$regPath = $k -replace '^HKCU:\\', 'HKCU\' |
|
$file = Join-Path $Dest ("registry-" + ($k -replace '[^A-Za-z0-9{}-]', '_') + '.reg') |
|
& reg.exe export $regPath $file /y | Out-Null |
|
} |
|
$Findings | Format-List | Out-String -Width 200 | Set-Content -LiteralPath (Join-Path $Dest 'findings.txt') -Encoding UTF8 |
|
Add-Action "Evidence copied to $Dest" |
|
} |
|
|
|
function Stop-ProcessesByName { |
|
param([string[]]$Names, [string]$What) |
|
$procs = @(Get-Process -ErrorAction SilentlyContinue | Where-Object { $Names -contains $_.ProcessName.ToLowerInvariant() }) |
|
if ($procs.Count -eq 0) { return $true } |
|
$list = ($procs | ForEach-Object { "$($_.ProcessName) (pid $($_.Id))" } | Select-Object -Unique) -join ', ' |
|
$ok = Confirm-Step "Close $What now?" @( |
|
"These $What processes are running: $list", |
|
'Files that a running program has loaded cannot be deleted, and for the', |
|
'launcher the agent itself lives inside these processes.', |
|
'Save any open work in them first. Answer y to close them, or n to close', |
|
'them yourself and continue.' |
|
) |
|
if ($ok) { |
|
$procs | Stop-Process -Force -ErrorAction SilentlyContinue |
|
Start-Sleep -Seconds 2 |
|
Add-Action "Closed $What processes: $list" |
|
} |
|
return $ok |
|
} |
|
|
|
function Remove-PathSafely { |
|
param([string]$Path, [string]$Label) |
|
try { |
|
Remove-Item -LiteralPath $Path -Recurse -Force -ErrorAction Stop |
|
Add-Action "Deleted $Label : $Path" |
|
return $true |
|
} catch { |
|
Write-Info "Could not delete $Path : $($_.Exception.Message)" -Color Yellow |
|
# Inside the user's own profile "Access is denied" means the file is |
|
# loaded (the COM hijack keeps the DLL locked even with the browser |
|
# closed), not missing rights. The hijack key is removed first, so a |
|
# restart releases it. |
|
$inProfile = $false |
|
foreach ($root in @($env:USERPROFILE, $env:LOCALAPPDATA, $env:APPDATA, $env:TEMP)) { |
|
if (-not $root) { continue } |
|
$prefix = $root.TrimEnd('\', '/') + [System.IO.Path]::DirectorySeparatorChar |
|
if ($Path.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) { $inProfile = $true; break } |
|
} |
|
if ($_.Exception -is [System.UnauthorizedAccessException] -and -not $isAdmin -and -not $inProfile) { |
|
Write-Info 'This location needs Administrator. Run the script again as administrator.' -Color Yellow |
|
} else { |
|
Write-Info 'It is probably in use. Restart Windows, then run this script again.' -Color Yellow |
|
$script:NeedsReboot = $true |
|
} |
|
return $false |
|
} |
|
} |
|
|
|
# --------------------------------------------------------------------------- |
|
# Main |
|
# --------------------------------------------------------------------------- |
|
|
|
$script:PayloadFiles = @(); $script:TempArtifacts = @(); $script:PersistDlls = @() |
|
$script:PersistDirs = @(); $script:ComKeys = @(); $script:EvidenceFiles = @() |
|
$script:LauncherProfiles = @(); $script:NeedsReboot = $false; $script:SeenDrops = @{} |
|
$script:FailedChecks = @() |
|
|
|
# The report can hold session tickets and the agent's key. If the Desktop is |
|
# synced by OneDrive, default to the user folder so it is not uploaded. |
|
$reportMovedFromOneDrive = $false |
|
if (-not $PSBoundParameters.ContainsKey('ReportRoot')) { |
|
foreach ($od in @($env:OneDrive, $env:OneDriveConsumer, $env:OneDriveCommercial)) { |
|
if ($od -and $ReportRoot.StartsWith($od.TrimEnd('\') + '\', [StringComparison]::OrdinalIgnoreCase)) { |
|
$ReportRoot = $env:USERPROFILE |
|
$reportMovedFromOneDrive = $true |
|
break |
|
} |
|
} |
|
} |
|
|
|
try { |
|
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss' |
|
$reportDir = Join-Path $ReportRoot "NIKKE-k2f-check-$stamp" |
|
$isAdmin = Test-IsAdmin |
|
|
|
Write-Banner "NIKKE launcher `"k2f`" agent check (version $ScriptVersion)" |
|
Write-Info @( |
|
'This script checks this PC for the remote-access agent that was delivered', |
|
'through the NIKKE PC launcher in late 2026, following the public analysis at:', |
|
" $($IOC.GistUrl)", |
|
" (instructions as of $($IOC.GistCheckedAt))", |
|
'', |
|
'Detection is read-only. Before anything is changed or deleted you will see', |
|
'what it is and why, and you will be asked y/n. Pressing Enter alone on a', |
|
'removal question means No.', |
|
'', |
|
"A report will be saved to: $reportDir", |
|
$(if ($reportMovedFromOneDrive) { ' (not the Desktop: it is synced by OneDrive, and the report can hold private data)' } else { '' }), |
|
"Running as: $env:USERDOMAIN\$env:USERNAME on $env:COMPUTERNAME$(if ($isAdmin) { ' (Administrator)' } else { ' (normal user)' })", |
|
"Mode: $(if ($ScanOnly) { 'SCAN ONLY - nothing will be changed' } else { 'scan, then optional cleanup' })" |
|
) |
|
if (-not (Confirm-Step 'Start the check?' -DefaultYes)) { Write-Info 'Nothing done.'; exit 0 } |
|
|
|
New-Item -ItemType Directory -Force -Path $reportDir | Out-Null |
|
try { Start-Transcript -LiteralPath (Join-Path $reportDir 'transcript.txt') | Out-Null } catch { } |
|
# The intro above is printed before the transcript starts, so repeat the |
|
# facts that matter when someone reads the transcript later. |
|
Write-Info @( |
|
"Check-NikkeK2f.ps1 version $ScriptVersion, gist instructions as of $($IOC.GistCheckedAt)", |
|
"Mode: $(if ($ScanOnly) { 'scan only' } else { 'scan and optional cleanup' }); Administrator: $isAdmin; PowerShell $($PSVersionTable.PSVersion)" |
|
) |
|
|
|
# --- Step 1: find NIKKE and stop the launcher -------------------------- |
|
Write-Banner 'Step 1 of 6: Finding NIKKE' |
|
$roots = @() |
|
Invoke-Check 'NIKKE install search' { $script:roots = @(Find-NikkeRoots) } |
|
$roots = @($script:roots | Where-Object { $_ }) |
|
if ($roots.Count -eq 0) { |
|
Add-Finding INFO 'No NIKKE install or leftover NIKKE folder found.' '' |
|
Write-Info @( |
|
'If NIKKE was uninstalled, that is fine: the browser, registry, temp-file and', |
|
'launcher-profile (%APPDATA%\nikke_launcher*) checks do not need the game folder', |
|
'and still run. Only the launcher log checks (debug.log, tinyget) are skipped.', |
|
'If a NIKKE folder is left over somewhere unusual, rerun with', |
|
" -NikkePath 'D:\path\to\NIKKE'" |
|
) -Color Yellow |
|
} else { |
|
$roots | ForEach-Object { Write-Info "NIKKE install: $_" } |
|
} |
|
Invoke-Check 'running agent (named pipe)' { Test-LiveAgent } |
|
if (-not $ScanOnly) { [void](Stop-ProcessesByName $LauncherProcessNames 'NIKKE launcher/game') } |
|
|
|
# --- Step 2: launcher logs and profile --------------------------------- |
|
Write-Banner 'Step 2 of 6: Checking the launcher logs and its browser profile' |
|
foreach ($r in $roots) { |
|
Invoke-Check "debug.log ($r)" { Test-DebugLog $r } |
|
Invoke-Check "download log ($r)" { Test-TinygetLogs $r } |
|
} |
|
Invoke-Check 'launcher profile' { Test-LauncherProfile } |
|
|
|
# --- Step 3: persistence and leftovers --------------------------------- |
|
Write-Banner 'Step 3 of 6: Checking browsers, registry and temp files' |
|
Invoke-Check 'browser persistence DLL' { Test-BrowserPersistence } |
|
Invoke-Check 'registry (COM hijack)' { Test-ComHijack } |
|
Invoke-Check 'temp files' { Test-TempArtifacts } |
|
|
|
$critical = @($Findings | Where-Object Severity -eq 'CRITICAL').Count |
|
$warning = @($Findings | Where-Object Severity -eq 'WARNING').Count |
|
|
|
# --- Step 4: evidence --------------------------------------------------- |
|
Write-Banner 'Step 4 of 6: Saving evidence' |
|
if (($critical + $warning) -gt 0) { |
|
$doCopy = Confirm-Step 'Copy evidence into the report folder before cleanup?' @( |
|
'This copies the launcher logs, the launcher browser storage that holds the', |
|
"agent's state, the matching cache entries and a backup of any attacker", |
|
"registry key into: $reportDir", |
|
'This helps if you report the incident or want a second opinion later.', |
|
'WARNING: the launcher logs contain your NIKKE login session tickets, and', |
|
"the copied storage holds the agent's secret key. Keep this folder private,", |
|
'and delete it once you no longer need it. The malicious DLL itself is NOT', |
|
'copied, only its SHA-256 hash.' |
|
) -DefaultYes |
|
if ($doCopy) { Copy-Evidence -Dest (Join-Path $reportDir 'evidence') -Roots $roots } |
|
} else { |
|
Write-Info 'Nothing suspicious found, so there is no evidence to copy.' |
|
} |
|
|
|
# --- Step 5: remediation ----------------------------------------------- |
|
Write-Banner 'Step 5 of 6: Cleanup' |
|
if ($ScanOnly) { |
|
Write-Info 'Scan-only mode: listing what cleanup would offer, without changing anything.' -Color Yellow |
|
$script:ComKeys | ForEach-Object { Write-Info "would remove registry key $_" } |
|
$script:PersistDlls | ForEach-Object { Write-Info "would delete $_" } |
|
$script:TempArtifacts | ForEach-Object { Write-Info "would delete $_" } |
|
$script:PayloadFiles | ForEach-Object { Write-Info "would delete $_" } |
|
$script:LauncherProfiles | ForEach-Object { Write-Info "would offer to delete $(Join-Path $_ 'tbs_cache')" } |
|
} else { |
|
# 5a. Registry first, so nothing can load the DLL again while it is deleted. |
|
foreach ($k in $script:ComKeys) { |
|
$srv = Get-RegDefault "$k\InprocServer32" |
|
if (Confirm-Step "Remove registry key $k ?" @( |
|
'This per-user COM registration makes programs that use this Windows', |
|
'component load the attacker DLL instead of the real one:', |
|
" $k", |
|
" InprocServer32 = $srv", |
|
'Removing it makes Windows use the normal system registration in HKLM', |
|
'again. HKLM is not touched. A .reg backup is exported to the report', |
|
'folder first, so the key could be re-imported if ever needed.' |
|
)) { |
|
$regPath = $k -replace '^HKCU:\\', 'HKCU\' |
|
$backup = Join-Path $reportDir ('backup-' + ($k -replace '[^A-Za-z0-9{}-]', '_') + '.reg') |
|
& reg.exe export $regPath $backup /y | Out-Null |
|
try { |
|
Remove-Item -LiteralPath $k -Recurse -Force -ErrorAction Stop |
|
Add-Action "Removed registry key $k (backup: $backup)" |
|
} catch { Write-Info "Could not remove $k : $($_.Exception.Message)" -Color Yellow } |
|
} |
|
} |
|
|
|
# 5b. Persistence DLLs in browser profiles. |
|
if ($script:PersistDlls.Count -gt 0 -or $script:PersistDirs.Count -gt 0) { |
|
[void](Stop-ProcessesByName $BrowserProcessNames 'web browser') |
|
foreach ($dll in $script:PersistDlls) { |
|
if (Confirm-Step "Delete $dll ?" @( |
|
'This DLL is the persistence part of the agent. It lets the attacker', |
|
'regain control when your browser or Windows loads it. No real browser', |
|
'puts a DLL in this folder, so deleting it does not break the browser.', |
|
"SHA-256 (already recorded in the report): $(Get-Sha256 $dll)" |
|
)) { |
|
if (Remove-PathSafely $dll 'persistence DLL') { |
|
$parent = [System.IO.Path]::GetDirectoryName($dll) |
|
if ([System.IO.Path]::GetFileName($parent) -match '^[0-9a-fA-F]{64}$' -and |
|
-not (Get-ChildItem -LiteralPath $parent -Force -ErrorAction SilentlyContinue)) { |
|
[void](Remove-PathSafely $parent 'empty hash-named folder') |
|
} |
|
} |
|
} |
|
} |
|
foreach ($d in $script:PersistDirs) { |
|
if ((Test-Path -LiteralPath $d) -and (Confirm-Step "Delete leftover folder $d ?" @( |
|
'This hash-named folder was created by the agent alongside its DLL.', |
|
'Browsers do not create folders with names like this here.' |
|
))) { [void](Remove-PathSafely $d 'hash-named persistence folder') } |
|
} |
|
} else { |
|
Write-Info 'No persistence DLL found in any browser profile. Nothing to remove.' |
|
} |
|
|
|
# 5c. Temp leftovers and payload files. |
|
foreach ($t in @($script:TempArtifacts + $script:PayloadFiles)) { |
|
if ((Test-Path -LiteralPath $t) -and (Confirm-Step "Delete $t ?" @( |
|
'This file was created by the agent (a credential dump, a screenshot or', |
|
'the downloaded payload). Credential dumps can hold your passwords in', |
|
'readable form, so deleting them is strongly recommended. Its name and', |
|
'time are already in the report.' |
|
))) { [void](Remove-PathSafely $t 'agent file') } |
|
} |
|
|
|
# 5d. Launcher web cache, as the gist advises before reopening the launcher. |
|
foreach ($lp in $script:LauncherProfiles) { |
|
$tbs = Join-Path $lp 'tbs_cache' |
|
if (Test-Path -LiteralPath $tbs) { |
|
if (Confirm-Step "Delete the launcher's web cache ($tbs)?" @( |
|
"The gist advises deleting this folder before opening the launcher again.", |
|
"It holds the launcher's cached web pages and scripts, including any cached", |
|
"attacker loader, plus the agent's saved state, so a reopened launcher", |
|
'starts clean. The launcher rebuilds it. You may have to log in again.', |
|
'If you want evidence, make sure you said yes in Step 4 first.', |
|
'Level Infinite says it deployed a fix on Nov 3 (about 17:30 GMT), and the', |
|
'CDN files were clean on all checked servers by Nov 4. Still keep the', |
|
'launcher closed until Level Infinite confirms it is safe to use.' |
|
)) { [void](Remove-PathSafely $tbs 'launcher web cache') } |
|
} |
|
} |
|
|
|
# 5e. Network blocks. These need Administrator. |
|
$hostsLines = $IOC.Domains | ForEach-Object { "0.0.0.0 $_" } |
|
if ($isAdmin) { |
|
$hostsFile = Join-Path $env:SystemRoot 'System32\drivers\etc\hosts' |
|
$current = Get-Content -LiteralPath $hostsFile -ErrorAction SilentlyContinue |
|
$missing = @($hostsLines | Where-Object { $current -notcontains $_ }) |
|
$hostsExplain = @('This adds these lines to the Windows hosts file so this PC cannot reach', |
|
'the attacker domains:') + |
|
@($missing | ForEach-Object { " $_" }) + |
|
@('A backup copy of the hosts file is saved in the report folder first.', |
|
'Some antivirus tools warn about hosts file changes. That is expected here.') |
|
if ($missing.Count -and (Confirm-Step 'Block the attacker domains in the hosts file?' $hostsExplain)) { |
|
try { |
|
Copy-Item -LiteralPath $hostsFile -Destination (Join-Path $reportDir 'hosts.backup') -Force -ErrorAction Stop |
|
Add-Content -LiteralPath $hostsFile -Value (@('', "# NIKKE k2f attacker domains, added $stamp") + $missing) -Encoding ASCII -ErrorAction Stop |
|
Add-Action 'Added attacker domains to the hosts file' |
|
} catch { |
|
Write-Info "Could not change the hosts file: $($_.Exception.Message)" -Color Yellow |
|
Write-Info 'Antivirus software often protects it. This step is optional.' -Color Yellow |
|
} |
|
} |
|
# A new name: a rule from an earlier version of this script blocked |
|
# only the first IP, and must not make this step look done. |
|
$ruleName = 'Block NIKKE k2f attacker IPs' |
|
$ipList = $IOC.Ips -join ', ' |
|
if (-not (Get-NetFirewallRule -DisplayName $ruleName -ErrorAction SilentlyContinue) -and |
|
(Confirm-Step "Block outbound traffic to $ipList in Windows Firewall?" @( |
|
"This adds one outbound firewall rule named '$ruleName' that stops this", |
|
"PC from connecting to the attacker servers $ipList, even by IP.", |
|
'You can remove it later in Windows Defender Firewall > Outbound Rules.' |
|
))) { |
|
try { |
|
New-NetFirewallRule -DisplayName $ruleName -Direction Outbound -RemoteAddress $IOC.Ips -Action Block -ErrorAction Stop | Out-Null |
|
Add-Action "Added firewall rule blocking $ipList" |
|
} catch { Write-Info "Could not add the firewall rule: $($_.Exception.Message)" -Color Yellow } |
|
} |
|
} else { |
|
Write-Info @( |
|
'Optional, needs Administrator: block the attacker in the hosts file and the firewall.', |
|
'Open PowerShell with "Run as administrator" and paste:', |
|
" Add-Content `"`$env:SystemRoot\System32\drivers\etc\hosts`" '','$($hostsLines -join "','")'", |
|
" New-NetFirewallRule -DisplayName 'Block NIKKE k2f attacker IPs' -Direction Outbound -RemoteAddress $($IOC.Ips -join ',') -Action Block", |
|
'Blocking only stops the current servers. The attacker can switch domains.' |
|
) -Color Yellow |
|
} |
|
} |
|
|
|
# --- Step 6: summary ------------------------------------------------------ |
|
Write-Banner 'Step 6 of 6: Result' |
|
$critical = @($Findings | Where-Object Severity -eq 'CRITICAL').Count |
|
$warning = @($Findings | Where-Object Severity -eq 'WARNING').Count |
|
if ($critical -gt 0) { |
|
Write-Host ' VERDICT: COMPROMISED. The agent ran on this PC or left files behind.' -ForegroundColor Red |
|
} elseif ($warning -gt 0) { |
|
Write-Host ' VERDICT: EXPOSED. The launcher loaded attacker code; no agent was confirmed.' -ForegroundColor Yellow |
|
} else { |
|
Write-Host ' VERDICT: NO INDICATORS FOUND.' -ForegroundColor Green |
|
Write-Info 'This is not proof of safety: logs can be overwritten. If you opened the NIKKE' |
|
Write-Info 'launcher between late September and early November 2026, still follow the advice below.' |
|
if ($roots.Count -eq 0) { |
|
Write-Info @( |
|
'No NIKKE folder was found, so the launcher logs (the clearest sign of the', |
|
'agent) could not be checked. Uninstalling NIKKE deletes that evidence but', |
|
'does NOT remove the browser DLL or the registry key, which were checked above.' |
|
) -Color Yellow |
|
} |
|
if ($script:LauncherProfiles.Count -eq 0) { |
|
Write-Info 'No launcher profile (%APPDATA%\nikke_launcher*) was found either.' -Color Yellow |
|
} |
|
} |
|
Write-Info '' |
|
Write-Info "Findings: $critical critical, $warning warning. Actions taken: $($Actions.Count)." |
|
$Actions | ForEach-Object { Write-Info " - $_" -Color Green } |
|
if ($script:NeedsReboot) { |
|
Write-Info @( |
|
'Some files were in use. Restart Windows and run this script again to finish.', |
|
'A locked persistence DLL is expected. Once the HKCU registry key that loads it', |
|
'is removed, nothing loads it after the restart and it can be deleted.' |
|
) -Color Yellow |
|
} |
|
if ($script:FailedChecks.Count -gt 0) { |
|
Write-Info '' |
|
Write-Info 'These checks could not finish, so the result above is incomplete:' -Color Yellow |
|
$script:FailedChecks | ForEach-Object { Write-Info " - $_" -Color Yellow } |
|
Write-Info 'Please report this together with transcript.txt from the report folder.' -Color Yellow |
|
} |
|
if (($critical + $warning) -gt 0) { |
|
Write-Info @( |
|
'', |
|
'WHAT TO DO NEXT (use a DIFFERENT, clean device for passwords):', |
|
' 1. Do not open the NIKKE launcher until Level Infinite confirms the fix.', |
|
' 2. Change passwords: NIKKE / Level Infinite first (the agent decrypts the', |
|
' launcher''s saved login), then email, Discord, banking, and every password', |
|
' saved in your browsers. Turn on two-factor authentication.', |
|
' 3. Sign out of all sessions everywhere (Google, Discord, Steam, ...). Stolen', |
|
' cookies work without your password.', |
|
' 4. Revoke and recreate API tokens, SSH keys and other developer credentials', |
|
' that were on this PC (or in WSL on this PC), including AI tool keys (Claude,', |
|
' OpenAI, Gemini), cloud CLIs, npm/PyPI tokens and VS Code / Cursor sign-ins.', |
|
' It also reads developer entries in Windows Credential Manager (git:, gh:,', |
|
' npm:, docker:, aws:, azure:, vscode: ...): run cmdkey /list to see them.', |
|
' 5. Crypto wallets: move funds to a NEW wallet with a NEW seed phrase.', |
|
' 6. Safest option: back up your files and reinstall Windows. The attacker could', |
|
' run any command, so cleanup alone cannot guarantee nothing else was left.', |
|
' System Restore does not remove it. Do not restore a full backup made after', |
|
' Sep 27 2026; copy back your documents instead.', |
|
' To estimate how much data left this PC, look up tbs_browser.exe "bytes sent"', |
|
' in the Windows network usage history (SRUM), for example with NirSoft', |
|
' NetworkUsageView.', |
|
' A clean antivirus result does not clear this infection: Microsoft Defender', |
|
' Offline has missed the persistence DLL on at least one infected PC.' |
|
) -Color White |
|
if ($script:PersistDlls.Count -gt 0 -or $script:PersistDirs.Count -gt 0 -or $script:ComKeys.Count -gt 0) { |
|
Write-Info @( |
|
'', |
|
'THE BROWSER PERSISTENCE DLL WAS FOUND. While it was installed it read:', |
|
' - every password typed into a password field in the browser, and', |
|
' - crypto wallet seed phrases (MetaMask, Phantom, Binance, SubWallet and other', |
|
' browser wallets). Treat every seed phrase used in this browser as stolen:', |
|
' create a new wallet on a clean device and move the funds there.' |
|
) -Color Yellow |
|
} |
|
} |
|
$Findings | Format-List | Out-String -Width 200 | Set-Content -LiteralPath (Join-Path $reportDir 'findings.txt') -Encoding UTF8 |
|
Write-Info '' |
|
Write-Info "Report folder: $reportDir" |
|
try { Stop-Transcript | Out-Null } catch { } |
|
if ($critical -gt 0 -or $warning -gt 0) { exit 1 } |
|
elseif ($script:FailedChecks.Count -gt 0) { exit 2 } |
|
else { exit 0 } |
|
} |
|
catch { |
|
Write-Host " Script error: $($_.Exception.Message)" -ForegroundColor Red |
|
Write-Host " at line $($_.InvocationInfo.ScriptLineNumber): $($_.InvocationInfo.Line.Trim())" -ForegroundColor Red |
|
try { Stop-Transcript | Out-Null } catch { } |
|
exit 2 |
|
} |
I've made some fixes to the script. The script is now version 2026-11-04.3, and the README is updated to match.
Credits to cheejordan and SoloAnnonAnnon for the new information behind these changes.
Testing: I ran the two changed functions under pwsh on Linux with a fake DLL. The folder-name label appears when the hash matches the folder and not when it doesn't. A delete that fails inside the user's folders gives the restart message; one outside them gives the administrator message.
The first test run failed because my folder check only understood Windows \ paths, so the Linux test paths never matched. I fixed that and also guarded against an unset folder variable. Two things weren't tested: a full run of the script (it needs Windows), and the new end-of-run advice text, which I only checked for parse errors.