{"id":25398,"date":"2020-01-28T22:12:58","date_gmt":"2020-01-28T16:42:58","guid":{"rendered":"https:\/\/www.armourinfosec.com\/?p=25398"},"modified":"2020-02-07T14:36:23","modified_gmt":"2020-02-07T09:06:23","slug":"linux-privilege-escalation-by-exploiting-cronjobs","status":"publish","type":"post","link":"https:\/\/www.armourinfosec.com\/linux-privilege-escalation-by-exploiting-cronjobs\/","title":{"rendered":"Linux Privilege Escalation by Exploiting Cronjobs"},"content":{"rendered":"
In this blog I will share procedure to enumerate and exploit Cronjob<\/strong>. Before going for exploitation of cronjob we are going to find the answer for the question<\/p>\n Cron<\/strong> is a utility that allows Linux users to do specific task on the server at a given time and date.Consider system admin is required to take the backup of server at regular interval. It means system admin has to do repeated task at certain interval.This repeated task at certain interval can be automated in Linux using cron utility. This automated repeated task is known as cronjob and a table or file that maintain this cronjob is known as crontab. Linux maintains separate crontab for each and every user.Given below is the syntax to define a cronjob in crontab<\/strong>.<\/p>\n <\/p>\n A single line in the crontab represent a cronjob. Cronjob is divided into three parts. All three parts are described below.<\/p>\n First five numeric value represents the time of execution of the cronjob. Now let’s understand the five numeric value.<\/p>\n The value Just after the numeric value represents the user whose privileges will be used to accomplish the task.<\/p>\n After defining the user we need to provide the command to be executed at that time. Lets start with the enumeration of the cronjob. The cronjob enumeration includes, finding and understanding the task that cronjob was assinged.There are following types of cronjob that we have to find.<\/p>\n In Linux each and every user can perform cronjobs. Each and every user maintains a crontab for their cronjobs. The location of the crontab of each user is in the following directory.<\/p>\n The above directory is only accessible through root user. Normal user can check their cronjobs using command.<\/p>\n Certain application in Linux uses cronjob to perform their task. All the cronjobs that are created by any application is placed in the following directory.<\/p>\n Anacron is defined as the cron with ability to performed the task that are skipped due to some reasons.This type of cronjob are placed in the following directory.<\/p>\n Above three are the possible ways to find the cronjobs. Now for understanding them only thing you have to do is read them.<\/p>\n\u201cWhat is Cronjob ?\u201d<\/strong><\/h5>\n
When to perform cronjob ?<\/h5>\n
\n
By whom privileges does the task perform ?<\/h5>\n
Which command to be execute ?<\/h5>\n
\nI hope we found our answer and now we will learn to escalate privileges through cronjob. For better understanding i am dividing further blog into two parts Enumeration and Exploitation.<\/p>\nCronjob Enumeration<\/h4>\n
User based Cronjob<\/h5>\n
\/var\/spool\/cron\/crontabs\/'crontab_of_the_each_user_named_as_their_username'<\/pre>\n
crontab -l<\/pre>\n
Application based Cronjob<\/h5>\n
\/etc\/cron.d<\/pre>\n
Anacron<\/h5>\n
\/etc\/anacrontab<\/pre>\n