Post

aa-exec: pwn.college

aa-exec: pwn.college

Check the sudo rule

The sudo -l output allows /usr/bin/aa-exec to run as root without a password. Screenshot

Locate the flag

The search output shows the protected file at /flag: Screenshot

Open a shell

I found a way to start a shell with aa-exec on GTFOBins. I ran it through the sudo rule, checked my user ID, then read the flag:

1
2
3
sudo -u root aa-exec /bin/sh
id
cat /flag

Screenshot Screenshot

The shell is subject to the host’s active AppArmor profile.

Findings

I checked sudo -l and found I could run aa-exec as root. I used it to open a shell, checked my user ID, and read /flag. AppArmor can still limit what the shell can do.

What I Learned

I had to check both the sudo permission and the AppArmor rules. Running aa-exec as root can open a shell, but the rules may still limit it. I checked the command in the aa-exec manual. The pwn.college challenge provides this sudo rule.

This post is licensed under CC BY 4.0 by the author.