Home Cron Jobs - File Permissions
Post
Cancel

Cron Jobs - File Permissions

Cron Jobs - File Permissions

Enumeration

We are going to exploit a misconfigured script to escalate our privileges to root. Let’s check the content of a crontab /etc/crontab

linpriv

We will locate the full path of overwrite.sh script and examine it permissions.

linpriv

Well…we have write permission on it, which means we can be able to write our own payload in it so that to be executed automatically by a cronjob. This will allow us to obtain root shell because the script is set to run with root privilege.

Exploitation

Let’s open the script overwrite.sh and add our own reverse shell payload.

linpriv

Now we will save it and setup our reverse shell listener.

linpriv

Well…As you can see, we have obtained a shell with root privilege.

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