Dumping revelant information on compromised targets without AV detection

Overview

DonPAPI

Dumping revelant information on compromised targets without AV detection

DPAPI dumping

Lots of credentials are protected by DPAPI (link ) We aim at locating those "secured" credentials, and retreive them using :

  • user password
  • domaine DPAPI BackupKey
  • Local machine DPAPI Key (that protect TaskScheduled Blob)

Curently gathered info:

  • Windows credentials (Taskscheduled credentials & a lot more)
  • Windows Vaults
  • Windows RDP credentials
  • AdConnect (still require a manual operation)
  • Wifi key
  • Intenet explorer Creentials
  • Chrome cookies & credentials
  • Firefox cookies & credentials
  • VNC passwords
  • mRemoteNG password (with default config)

Check for a bit of compliance

  • smb signing enabled
  • OS/Domain/Hostname/Ip of the audited scope

Operational use

with local admin account on a machine, we can :

  • gather Machine protected DPAPI secrets, like ScheduledTask, that will contains cleartext login/password of the account that should run the task (Also Wifi passwords)
  • extract Masterkey's hash value for every users profiles (masterkeys beeing protected by the user's password, let's try to crack them with Hashcat)
  • Identify who is connected from where, in order to identify Admin's personal machines.
  • extract other non-dpapi protected secrets (VNC/Firefox/mRemoteNG)

With a user password, or the domain PVK we can unprotect it's DPAPI Secrets. you can pass a full list of credentials that will be tested on the machine.

  • gather protected secrets from IE, Chrome, Firefox and start reaching the Azure tenant.

Exemples

dump all secrets of our target machine with an admin account :

python DonPAPI.py Domain/user:[email protected]

connect with PTH

python DonPAPI.py -Hashes XXXXXXXXXX Domain/[email protected]

can do kerberos (-k), and local auth (-local_auth)

connect with an account that have LAPS rights:

python DonPAPI.py -laps Domain/user:[email protected]

you have a few users passwords ? just give them to DonPAPI and it will try to use them to decipher masterkeys of these users. (the file have to contain user:pass, one per line)

python DonPAPI.py -credz credz_file Domain/user:[email protected]

you got domain admin access and dumped the domain backup key ? (impacket dpapi.py backupkey --export). them dump all secrets of all users of the domain !

python DonPAPI.py -pvk domain_backupkey.pvk -credz file_with_Login:pass Domain/user:[email protected]_network_list

target can be an IP, IP range, CIDR, file containing list of the above targets (one per line)

Opsec consideration

The RemoteOps part can be spoted by some EDR. has it's only real use is to get DPAPI Machine key, it could be deactivated (--no_remoteops). but no more taskscheduled credentials in that case.

INSTALL

git clone https://github.com/login-securite/DonPAPI.git
pip install -r requirements.txt
python3 DonPAPI.py

Credits

All the credits goes to these great guys for doing the hard research & coding :

  • Benjamin Delpy (@gentilkiwi) for most of the DPAPI research (always greatly commented - <3 your code)
  • Alberto Solino (@agsolino) for the tremendous work of Impacket (https://github.com/SecureAuthCorp/impacket). Almost everything we do here comes from impacket.
  • Alesandro Z (@) & everyone who worked on Lazagne (https://github.com/AlessandroZ/LaZagne/wiki) for the VNC & Firefox modules, and most likely for a lots of other ones in the futur.
  • dirkjanm @dirkjanm for the base code of adconnect dump (https://github.com/fox-it/adconnectdump) & every research he ever did. i learned so much on so many subjects thanks to you. <3
  • @Byt3bl3d33r for CME (lots of inspiration and code comes from CME : https://github.com/byt3bl33d3r/CrackMapExec )
  • All the Team of @LoginSecurite for their help in debugging my shity code (special thanks to @layno & @HackAndDo for that)

TODO

  • finish ADSync/ADConnect password extraction
  • CREDHISTORY full extraction
  • extract windows Certificates
  • further analyse ADAL/msteams
  • implement Chrome
  • find a way to implement Lazagne's great modules
Comments
  • Cookie filtering

    Cookie filtering

    At the moment, depending on the network a lot of expired cookies can be returned. It would be nice if the tool could filter out those (at least by default). In the same idea, a lot of cookies can be empty so 99.9% of the time useless, this could also be filtered out.

    opened by tigre-bleu 3
  • Python SyntaxError

    Python SyntaxError

    Hi, When running the DonPAPI.py script I get the following python error:

    File "./DonPAPI.py", line 157
        logging.info(f"Loaded {len(credz)} user credentials")
                                                           ^
    SyntaxError: invalid syntax
    

    Steps to reproduce:

    git clone https://github.com/login-securite/DonPAPI.git
    pip3 install -r requirements.txt
    ./DonPAPI.py
    

    This looks like a great tool, looking forward to using it!

    opened by israsec 2
  • VNC plugin error on reading and parsing registry key

    VNC plugin error on reading and parsing registry key

    The VNC plugin in software/sysadmin/vnc.py does not handle properly the read of a registry key.

    There is two issues:

    • After getting the key from registry, the variable is bytes, but on line 107, you triy to rstrip() some string, causing an error.
    • On the reverse_vncpassword method, you try to unhex/hex the same variable, but as it's bytes and not a string hex representation, it fails.
    opened by Th3l5D 2
  • Short question: cme module

    Short question: cme module

    On the bottom of the readme you write that a lot of code comes from cme. I would love to see the project as a cme module. Is that currently on focus? Maybe you can write your thoughts about this and maybe some hints how to start with this project on my own.

    Cheers.

    opened by blacklist-arcc 2
  • ModuleNotFoundError

    ModuleNotFoundError

    Bonjour à tous, ça fait un p'tit moment que j'utilise DonPAPI et depuis une fresh install de Kali j'ai une erreur que je n'arrive pas debbugger si quelqu'un a une idée je suis preneur:

    python3 DonPAPI.py

    Traceback (most recent call last): File "DonPAPI.py", line 27, in from myseatbelt import MySeatBelt File "myseatbelt.py", line 12, in from lib.secretsdump import LSASecrets as MyLSASecrets ModuleNotFoundError: No module named 'lib.secretsdump'

    Alors que la lib est bien dispo dasn e dossier d'installation dans lib/secretsdump Pour être sûr de moi j'avais ajouté le chemin d'exécution dans la variable $PATH, mais rien n'y fait.

    Je n'ai aucune idée de comment debbugger ceci.

    D'avance merci de l'attention porté à mon problème !

    opened by no0neismrji 1
  • Allow working in local mode

    Allow working in local mode

    Currently this tool allows reading files via SMB only.

    I would like to run it locally, using Kali Live, with Windows drive(s) mounted in eg. /mnt/c, /mnt/d etc.

    opened by tomaszklim 1
  • Add option to retrieve cookies as well as saved logins

    Add option to retrieve cookies as well as saved logins

    DonPAPI does a fantastic job of retrieving saved login credentials, however the option to retrieve cookies would be beneficial to be able to steal existing sessions and bypass 2FA protection. Currently it seems an attempt was made at adding this feature but it may have been abandoned (https://github.com/login-securite/DonPAPI/blob/main/myseatbelt.py#L460). I might try and have a go at this in a few weeks but not sure if I'll be able to pull it off.

    opened by br-sn 1
  • Error when using --GetHashes

    Error when using --GetHashes

    When running DonPAPI with "--GetHashes" I get the following error.

    Traceback (most recent call last):
      File "/<mytoolspath>/DonPAPI/DonPAPI.py", line 273, in <module>
        main()
      File "/<mytoolspath>/DonPAPI/DonPAPI.py", line 185, in main
        my_report.export_hashes()
    AttributeError: 'reporting' object has no attribute 'export_hashes'
    

    DonPAPI is running on KALI 2021.4 with Impacket v0.9.24.dev1+20210720.100427.cd4fe47c. The target is Windows 10 1803

    opened by corsch 1
  • Wrong description for --no_recent and --no_sysadmins

    Wrong description for --no_recent and --no_sysadmins

    The "--no_recent" and "--no_sysamins" options have the wrong description:

    attacks:
      --no_browser          do not hunt for browser passwords
      --no_dpapi            do not hunt for DPAPI secrets
      --no_vnc              do not hunt for VNC passwords
      --no_remoteops        do not hunt for SAM and LSA with remoteops
      --GetHashes           Get all users Masterkey's hash & DCC2 hash
      --no_recent           Get recent files
      --no_sysadmins        Get sysadmins stuff (mRemoteNG, vnc, keepass, lastpass ...)
    

    The Word "Get" should be replaced by "do not hunt for" for --no_recent and --no_sysamins

    opened by corsch 1
  • Poetry build fix + better readme

    Poetry build fix + better readme

    • [x] pyproject.toml: proper pyproject.toml
    • [x] readme: markdown compliant with https://commonmark.org/
    • [x] readme: add alternative poetry install steps

    Before pyproject.toml update

    $ poetry build
    Creating virtualenv donpapi-dfVQVXBX-py3.10 in /home/noraj/.cache/pypoetry/virtualenvs
    Building donpapi (1.0.0)
    
    $ python -m build --wheel
    * Creating virtualenv isolated environment...
    * Installing packages in isolated environment... (poetry-core>=1.0.0)
    * Getting dependencies for wheel...
    * Building wheel...
    Traceback (most recent call last):
      File "/usr/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 351, in <module>
        main()
      File "/usr/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 333, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/usr/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 249, in build_wheel
        return _build_backend().build_wheel(wheel_directory, config_settings,
      File "/tmp/build-env-lekq9y_k/lib/python3.10/site-packages/poetry/core/masonry/api.py", line 67, in build_wheel
        return WheelBuilder.make_in(poetry, Path(wheel_directory))
      File "/tmp/build-env-lekq9y_k/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 74, in make_in
        wb = WheelBuilder(
      File "/tmp/build-env-lekq9y_k/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 57, in __init__
        super().__init__(poetry, executable=executable)
      File "/tmp/build-env-lekq9y_k/lib/python3.10/site-packages/poetry/core/masonry/builders/builder.py", line 83, in __init__
        self._module = Module(
      File "/tmp/build-env-lekq9y_k/lib/python3.10/site-packages/poetry/core/masonry/utils/module.py", line 69, in __init__
        raise ModuleOrPackageNotFound(
    poetry.core.masonry.utils.module.ModuleOrPackageNotFound: No file/folder found for package donpapi
    
    ERROR Backend subprocess exited when trying to invoke build_wheel
    

    cf. https://github.com/python-poetry/poetry/issues/1110

    After pyproject.toml update

    $ poetry build           
    Building donpapi (1.0.0)
      - Building sdist
      - Built donpapi-1.0.0.tar.gz
      - Building wheel
      - Built donpapi-1.0.0-py3-none-any.whl
    
    $  python -m build --wheel
    * Creating virtualenv isolated environment...
    * Installing packages in isolated environment... (poetry-core>=1.0.0)
    * Getting dependencies for wheel...
    * Building wheel...
    Successfully built donpapi-1.0.0-py3-none-any.whl
    
    opened by noraj 0
  • cookies in report and some improvment on the UI

    cookies in report and some improvment on the UI

    adding a section for cookies in the report cookies expire date are printed in readable format section are toggled by default show number of credz in each sections top bar

    opened by login-securite 0
  • Lazagne with DonPAPI

    Lazagne with DonPAPI

    Hello,

    Nice project !

    I wanted to give you some idea to deal with Lazagne modules. I think you could not managed with the lazagne project but you should use lazagne forensic which has been designed to have a similar idea. The project is not up to date but could be done easily copying the code from lazagne modules and modifying from where the data are retrieved.

    What I would suggest you is to integrate lazagneforensic as an external project (like we do in pupy: https://github.com/n1nj4sec/pupy/tree/unstable/pupy/external), and you load the project as module into the code. We update all lazagneForensic modules and fix some compatible issue with your project (if there are).

    Like that if a fix is done on your project or mine, it could be easily fixed.

    If you don't want and want to do your own things, I have no problems with it.

    Have a nice day.

    opened by AlessandroZ 0
  • Missing license file

    Missing license file

    Hi,

    This project looks amazing and solves a large amount of possible problems, However looking at the codebase I wasn't able to find a LICENSE file, The only thing I could find is a message in the master file indicating the license is a modified version of Apache license with more details in the LICENSE file that I wasn't able to find.

    This software is provided under under a slightly modified version

    of the Apache Software License. See the accompanying LICENSE file

    for more information.

    If a license file could be added it will be great help !

    opened by idanlivni 1
Releases(v1.0.0)
Owner
Login Securite
Login Securite
Proof of concept to check if hosts are vulnerable to CVE-2021-41773

CVE-2021-41773 PoC Proof of concept to check if hosts are vulnerable to CVE-2021-41773. Description (https://cve.mitre.org/cgi-bin/cvename.cgi?name=CV

Jordan Jay 43 Nov 09, 2022
Looks at Python code to search for things which look "dodgy" such as passwords or diffs

dodgy Dodgy is a very basic tool to run against your codebase to search for "dodgy" looking values. It is a series of simple regular expressions desig

Landscape 112 Nov 25, 2022
⛤Keylogger Generator for Windows written in Python⛤

⛤Keylogger Generator for Windows written in Python⛤

FZGbzuw412 33 Nov 24, 2022
md5 hash cracking with python.

Python-Md5-Cracker- md5 hash cracking with python. Original files added First create a file called word.txt then run the wordCreate.py script The task

Nebil Sharifi 0 Aug 31, 2022
Apache Flink 目录遍历漏洞批量检测 (CVE-2020-17519)

使用方法&免责声明 该脚本为Apache Flink 目录遍历漏洞批量检测 (CVE-2020-17519)。 使用方法:Python CVE-2020-17519.py urls.txt urls.txt 中每个url为一行,漏洞地址输出在vul.txt中 影响版本: Apache Flink 1

45 Sep 21, 2022
Profil3r is an OSINT tool that allows you to find potential profiles of a person on social networks, as well as their email addresses 🕵️

Profil3r is an OSINT tool that allows you to find potential profiles of a person on social networks, as well as their email addresses. This program also alerts you to the presence of a data leak for

1.1k Aug 24, 2021
A tool that detects the expensive Carbon Black watchlists.

A tool that detects the "expensive" Carbon Black watchlists.

Oğuzcan Pamuk 8 Aug 04, 2022
AMC- Automatic Media Access Control [MAC] Address Spoofing Tool

AMC (Automatic Media Access Control [MAC] Address Spoofing tool), helps you to protect your real network hardware identity. Each entered time interval your hardware address was changed automatically.

Dipen Chavan 14 Dec 23, 2022
TLaunch: Launch Programs on Multiple Hosts

TLaunch: Launch Programs on Multiple Hosts Introduction Deepmind launchpad is a library that helps writing distributed program in a simple way. But cu

Tsinghua AI Research Team for Reinforcement Learning 11 Nov 11, 2022
Tool to check if your DNS comply to Polish Ministry of Finance gambling domains restrictions

dns-mf-hazard Tool to check if your DNS comply to Polish Ministry of Finance gambling domains restrictions How to use it? Installation You need python

Marek Wajdzik 2 Jan 01, 2022
AnonStress-Stored-XSS-Exploit - An exploit and demonstration on how to exploit a Stored XSS vulnerability in anonstress

AnonStress Stored XSS Exploit An exploit and demonstration on how to exploit a S

صلى الله على محمد وآله 3 Jun 22, 2022
I hacked my own webcam from a Kali Linux VM in my local network, using Ettercap to do the MiTM ARP poisoning attack, sniffing with Wireshark, and using metasploit

plan I - Linux Fundamentals Les utilisateurs et les droits Installer des programmes avec apt-get Surveiller l'activité du système Exécuter des program

148 Dec 22, 2022
Multi-Process Vulnerability Tool

Multi-Process Vulnerability Tool

Baris Dincer 1 Dec 22, 2021
Password List Maker

Red-Key Red-Key Password List Maker Version 1.1.2 Created By FireKing255 -=Features=- Create Random Password List Create Password List Create Password

FireKing255 7 Dec 26, 2021
NEW FACEBOOK CLONER WITH NEW PASSWORD, TERMUX FB CLONE, FB CLONING COMMAND. M

NEW FACEBOOK CLONER WITH NEW PASSWORD, TERMUX FB CLONE, FB CLONING COMMAND. M

Mr. Error 81 Jan 08, 2023
Sudo Baron Samedit Exploit

CVE-2021-3156 (Sudo Baron Samedit) This repository is CVE-2021-3156 exploit targeting Linux x64. For writeup, please visit https://datafarm-cybersecur

Worawit Wang 559 Jan 03, 2023
A simple Log4Shell Scan with python

🐞 Log4Scan 🔧 Log4Shell 简单的主动和被动扫描脚本 Log4scan 针对header头和fuzz参数的主动批量扫描,用于大批量黑盒检测

nul1 6 Aug 04, 2022
GitGuardian Shield: protect your secrets with GitGuardian

Detect secret in source code, scan your repo for leaks. Find secrets with GitGuardian and prevent leaked credentials. GitGuardian is an automated secrets detection & remediation service.

GitGuardian 1.2k Dec 27, 2022
PortSwigger Burp Plugin for the Log4j (CVE-2021-44228)

yLog4j This is Y-Sec's @PortSwigger Burp Plugin for the Log4j CVE-2021-44228 vulnerability. The focus of yLog4j is to support mass-scanning of the Log

Y-Security 1 Jan 31, 2022
Open Source Tool - Cybersecurity Graph Database in Neo4j

GraphKer Open Source Tool - Cybersecurity Graph Database in Neo4j |G|r|a|p|h|K|e|r| { open source tool for a cybersecurity graph database in neo4j } W

Adamantios - Marios Berzovitis 27 Dec 06, 2022