Code - S7
Code - S7
Results:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.12 (Ubuntu Linux; protocol 2.0)
5000/tcp open http Gunicorn 20.0.4
|_http-title: Python Code Editor
From the results, we can see that port 5000 is running a Python Code Editor.
This is interesting because it might allow us to run commands on the system.
If we can execute arbitrary Python code, we might be able to extract sensitive
information or even take control of the system.
1
Escalating Privileges to Gain More Access
Examining the backy.sh Script
Once logged in as martin, we begin exploring files that might help us gain
higher privileges. We find a script located at /usr/bin/backy.sh and inspect
its contents:
cat /usr/bin/backy.sh
Key Observations:
• The script takes a JSON file (task.json) as input to decide what files
should be backed up.
• It runs with administrator (sudo) permissions, meaning it has the
ability to access restricted files.
• It only allows backing up files from specific folders (/var/ and /home/),
but we might be able to trick it.
2
5c89db216f724a2a9a3a329ecc0f3d21
Security Takeaways:
1. Avoid exposing unnecessary services like an open Python Code Edi-
tor.
2. Properly secure sensitive scripts that run with sudo privileges.
3. Use strong password hashing and implement multi-factor authen-
tication (MFA).
3
4. Restrict file permissions to prevent unauthorized users from modifying
important files.
By following proper security measures, such vulnerabilities can be mitigated,
preventing unauthorized access in real-world systems.
Pwned! �