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
A semi-automatic osint/recon framework.

Smog Framework A semi-automatic osint/recon framework. Requirements git Python = 3.8 How to use it

toast 22 Oct 17, 2022
A simple python-function, to gain all wlan passwords from stored wlan-profiles on a computer.

Wlan Fetcher Windows10 Description A simple python-function, to gain all wlan passwords from stored wlan-profiles on a computer. Usage This Script onl

2 Nov 20, 2021
带回显版本的漏洞利用脚本

CVE-2021-21978 带回显版本的漏洞利用脚本,更简单的方式 0. 漏洞信息 VMware View Planner Web管理界面存在一个上传日志功能文件的入口,没有进行认证且写入的日志文件路径用户可控,通过覆盖上传日志功能文件log_upload_wsgi.py,即可实现RCE 漏洞代码

3ky7in4 24 Nov 09, 2022
Web Headers Security Scanner

Web Headers Security Scanner

Emre Koybasi 3 Dec 16, 2022
Time Discretization-Invariant Safe Action Repetition for Policy Gradient Methods

Time Discretization-Invariant Safe Action Repetition for Policy Gradient Methods This repository is the official implementation of Seohong Park, Jaeky

Seohong Park 6 Aug 02, 2022
Privilege escalation with polkit - CVE-2021-3560

Polkit-exploit - CVE-2021-3560 Privilege escalation with polkit - CVE-2021-3560 Summary CVE-2021-3560 is an authentication bypass on polkit, which all

Ahmad Almorabea 95 Dec 27, 2022
Local server for IDA Lumina feature

About POC of an offline server for IDA Lumina feature.

Synacktiv 166 Dec 30, 2022
Open-source jailbreaking tool for many iOS devices

Open-source jailbreaking tool for many iOS devices *Read disclaimer before using this software. checkm8 permanent unpatchable bootrom exploit for hund

6.7k Jan 05, 2023
Security-TXT is a python package for retrieving, parsing and manipulating security.txt files.

Security-TXT is a python package for retrieving, parsing and manipulating security.txt files.

Frank 3 Feb 07, 2022
SCodeScanner stands for Source Code scanner where the user can scans the source code for finding the Critical Vulnerabilities.

The SCodeScanner stands for Source Code Scanner, where you can scan your source code files like PHP and get identify the vulnerabilities inside it. The tool can use by Pentester, Developer to quickly

136 Dec 13, 2022
The probability of having the password you want in the PassMaker is +90%!!

PasswordMaker Strong listing password Introduction The probability of having the password you want in the tool is +90%!! How to Install Open the termi

MasterBurnt 4 Sep 05, 2021
the swiss army knife in the hash field. fast, reliable and easy to use

hexxus Hexxus is a fast hash cracking tool which checks more than 30 thousand passwords in under 4 seconds and can crack the following types bcrypt sh

enigma146 17 Apr 05, 2022
Uses Sharphound, Bloodhound and Neo4j to produce an actionable list of attack paths for targeted remediation.

GoodHound ______ ____ __ __ / ____/___ ____ ____/ / / / /___ __ ______ ____/ / / / __/ __ \/ __ \/ __

idna 352 Jan 02, 2023
阿里云accesskey利用工具

aliyun-accesskey-Tools 此工具用于查询ALIYUN_ACCESSKEY的主机,并且远程执行命令。 对于ALIYUN_ACCESSKEY利用方式可参考文章:记一次阿里云主机泄露Access Key到Getshell 工具截图 安装模块 pip install -r require

一灯老和尚 826 Jan 01, 2023
Detection And Breaking With Python

Detection And Breaking IIIIIIIIIIIIIIIIIIII PPPPPPPPPPPPPPPPP VVVVVVVV VVVVVVVV I::::::::II::::::::I P:::::::

Baris Dincer 1 Dec 26, 2021
xray多线程批量扫描工具

Auto_xray xray多线程批量扫描工具 简介 xray社区版貌似没有批量扫描,这就让安服仔使用起来很不方便,扫站得一个个手动添加,非常难受 Auto_xray目录下记得放xray,就跟平时一样的。 选项1:oneforall+xray 输入一个主域名,自动采集子域名然后添加到xray任务列表

1frame 13 Nov 09, 2022
RapiDAST provides a framework for continuous, proactive and fully automated dynamic scanning against web apps/API.

RapiDAST RapiDAST provides a framework for continuous, proactive and fully automated dynamic scanning against web apps/API. Its core engine is OWASP Z

Red Hat Product Security 17 Nov 11, 2022
The best Python Backdoor👌

Backdoor The best Python Backdoor Files Server file is used in all of cases If client is Windows, the client need execute EXE file If client is Linux,

13 Oct 28, 2022
Grafana-POC(CVE-2021-43798)

Grafana-Poc 此工具请勿用于违法用途。 一、使用方法:python3 grafana_hole.py 在domain.txt中填入ip:port 二、漏洞影响范围 影响版本: Grafana 8.0.0 - 8.3.0 安全版本: Grafana 8.3.1, 8.2.7, 8.1.8,

8 Jan 03, 2023
DCSync - DCSync Attack from Outside using Impacket

Adding DCSync Permissions Mostly copypasta from https://github.com/tothi/rbcd-at

n00py 77 Dec 16, 2022