r/Hacking_Tutorials • u/duskyWinks • 1h ago
Question Low-privilege shell on Ubuntu. Sudo lets you run one custom script. Can you reach root?
You're on a lab Ubuntu server as user
dev@lab:~$ whoami dev dev@lab:~$ id uid=1001(dev) gid=1001(dev) groups=1001(dev),1002(web) dev@lab:~$ sudo -l User dev may run the following commands: (root) NOPASSWD: /usr/local/bin/backup.sh
The script looks like this:
#!/bin/bash echo "Creating backup..." tar -czf /tmp/backup_$(date +%F).tar.gz /var/www/html echo "Backup finished."
Task:
- Identify the exact issue that allows escalation.
- Show the commands to reach root.
- Explain how you would fix the script properly.
No Metasploit. No automated tools. Just standard Linux commands and shell knowledge.
This is a controlled lab scenario. Share your approach in the comments.
1
Upvotes