From aba74fc4c23113326d55e5a23cd613eb4c8bccf0 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Wed, 4 Nov 2026 09:22:44 +0100 Subject: [PATCH] fix(Uninstall): require confirmation; fix swapped menu numbers in docs README.md documented Lithnet as menu option 5 and Uninstall as option 4, the reverse of the actual menu (and of Elysium.ps1's own help block). Uninstall.ps1 recursively force-deletes the install directory - reports, KHDB and settings included - with no prompt, so an operator following the README to update the Lithnet store wiped the tool instead. Fixed the numbering in both docs, and Uninstall.ps1 now requires typing YES (case-sensitive) before deleting anything. -Force skips the prompt for unattended removal; Restart-WithPwshIfAvailable already forwards bound switches to the relaunched process. Verified on scratch copies: answering "yes" cancels and leaves the directory intact, "YES" deletes it. --- Elysium.ps1 | 4 ++-- README.md | 6 +++--- Uninstall.ps1 | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Elysium.ps1 b/Elysium.ps1 index 82fac20..a29828e 100644 --- a/Elysium.ps1 +++ b/Elysium.ps1 @@ -20,8 +20,8 @@ Elysium.ps1 offers a menu to perform various actions: 1. Download/Update Known-Hashes Database (KHDB) 2. Test Weak AD Passwords 3. Extract and Send Current Hashes for KHDB Update -4. Uninstall the tool -5. Update Lithnet Password Protection store +4. Update Lithnet Password Protection store +5. Uninstall the tool 6. Exit #> diff --git a/README.md b/README.md index 298907f..282f472 100644 --- a/README.md +++ b/README.md @@ -111,15 +111,15 @@ Domains are listed in configuration order, after which the script prompts for th **Encrypted export format (v2.4.5+, magic `ELY2`):** `4-byte magic 'ELY2' | 16-byte PBKDF2 salt | 16-byte AES IV | AES-256-CBC ciphertext | 32-byte HMAC-SHA256`. Both keys are derived from the configured passphrase via one PBKDF2-SHA256 (100,000 iterations) byte stream: the first 32 bytes are the AES key, the next 32 are the HMAC key. The HMAC covers `magic | salt | iv | ciphertext` (encrypt-then-MAC) so a decrypt tool must verify it *before* decrypting - CBC alone doesn't detect a wrong passphrase or corrupted/tampered ciphertext, it just produces garbage or an unhelpful padding exception. This is a breaking change from the older `ELY1` format (no HMAC trailer) produced before v2.4.5; any external decryption tooling on the air-gapped cracking machine needs updating to match. ### Update Lithnet Password Protection store -Run script Elysium.ps1 as an administrator and choose option 5 (Update Lithnet Password Protection Store). +Run script Elysium.ps1 as an administrator and choose option 4 (Update Lithnet Password Protection Store). Configure the target folder via `LithnetStorePath` in `ElysiumSettings.txt` (the location created with `Open-Store`). The script automatically imports the `khdb.txt` file unless you override/add additional NTLM hash lists in `LithnetHashSources` (comma or semicolon separated). You can also populate plaintext password lists (`LithnetPlaintextSources`) and banned-word files (`LithnetBannedWordSources`), or enable `LithnetSyncHibp=true` to seed the store directly from the Have I Been Pwned API (using `Sync-HashesFromHibp`). Behind the scenes the helper loads the `LithnetPasswordProtection` module, opens the store, runs [`Import-CompromisedPasswordHashes`](https://docs.lithnet.io/password-protection/advanced-help/powershell-reference/import-compromisedpasswordhashes)/`Import-CompromisedPasswords`/`Import-BannedWords` for each configured file, and then closes the store. S3-compatible usage notes: - No AWS Tools required. The scripts sign requests using native SigV4 via .NET and HttpClient, including non-default endpoint ports. - To force using AWS Tools instead, set `s3UseAwsTools = true` in `ElysiumSettings.txt` and install `AWS.Tools.S3`. ### Uninstallation -Run script Elysium.ps1 as an administrator and choose option 4 (Uninstall). -The script will then delete everything and remove the passphrase variable. +Run script Elysium.ps1 as an administrator and choose option 5 (Uninstall). +After you type `YES` to confirm, the script deletes everything (including reports, the KHDB, and settings) and removes the passphrase variable. Run `.\Uninstall.ps1 -Force` to skip the confirmation. --- ## FAQ diff --git a/Uninstall.ps1 b/Uninstall.ps1 index 6738073..908e94b 100644 --- a/Uninstall.ps1 +++ b/Uninstall.ps1 @@ -17,8 +17,13 @@ Uninstall script for the Elysium AD password testing tool. .DESCRIPTION This script will remove the Elysium tool and its components (scripts, configurations, and any generated data) from the system, and then delete itself. + +.PARAMETER Force +Skip the confirmation prompt (for unattended removal). #> +param([switch]$Force) + $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest [string]$commonHelper = Join-Path -Path $PSScriptRoot -ChildPath 'Elysium.Common.ps1' @@ -59,6 +64,16 @@ function Uninstall-Elysium { Start-UninstallTranscript try { + # The delete is recursive and irreversible (reports, KHDB, settings included), so a mistyped + # menu choice or a stale doc reference must not be enough to trigger it. + if (-not $Force) { + $answer = Read-Host "This permanently deletes '$PSScriptRoot' including all reports, the KHDB and settings. Type YES to continue" + if ($answer -cne 'YES') { + Write-Host 'Uninstall cancelled.' + return + } + } + # Execute the uninstall function Uninstall-Elysium