SlideShare a Scribd company logo
1 of 11
1
Linux Automated Tasks
Privilege
Escalation
Automated tasks
Linux systems pack a useful and familiar
task scheduler named crontab. The
reason crontab has become popular
with privilege escalation is due to the
fact it may be scheduled to run an
automated process as root.
Having an automated process running as
root makes the whole exploitation much
easier. One need only to tamper with
the task and then wait until the task is
re-initiated.
2
Listing Tab Jobs
Crontab jobs can be found with crontab -
l for scheduled tasks for the current user,
or crontab -l -u [username] for other
users.
Since using crontab -u requires privileges
by itself, a more efficient searching can
be done by exploring ‘/etc/cron.[period]’
directories.
ls -la /etc/cron* will do the job, but
usually an enumeration script will yield
better results.
3
Reading Crontab Jobs
Reading crontab jobs is divided into two
parts; the first part involves the tasks
themselves. Some system wide jobs can
be found with more /etc/crontab. Others
will only be visible to the user they
belong to.
The second part of reading crontab
involves the files executed. These files
reside in the mentioned directories
‘/etc/cron.[period]’.
4
5
Crontab Schedule Format
01,31 04,05 1-15 1,6 * /etc/cron.daily/script
Creating Crontab Jobs
Crontab jobs are created by putting a bash script into one of crontab’s directories. Later on, the job becomes an automatic
process initialized by crontab -e. All crontab jobs will have the same format, as well as the details of the timing, followed by
the bash script location to be executed.
Below is slightly more graphical explanation:
Bash script locationDays of
week
Days of
month
minutes
months
hours
The above example will run ‘/etc/cron.daily/script’ at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through
the 15th of every January and June.
Crontab Escalation Types
Crontab jobs can also be executed frequently.
For example, a task may be run once an hour.
Due to the fact that crontab jobs themselves
won’t be visible to the attacker, the time of
execution can only be speculated.
Write Permissions
Having “write” permissions over a
scheduled script, we can simply alter the
script to perform a different task to fit our
needs. Since most jobs run a root, simply
executing a shell will do.
Wildcards
Wildcards are signs used to select
multiple or arbitrary files. The most
common wildcard used is “*” which
means “select” all files and is usually
passed to a command.
Bad PATH Configuration
When running a program or a command
in Linux, and the program is not in the
current working directory, Linux will
address the PATH variable and search
within the directories listed there.
6
Write Permissions
Write permissions on a crontab job
script is, for the most part, self-
explanatory. An important thing to
remember is that the crontab job cannot
be used to actively open a root shell.
However, we can simply add our user to
the sudo group by inserting sudo
adduser [username] sudo into the script.
7
Bad PATH Configuration
As seen in the example, the user has a
crontab job which runs ‘backupTool’.
Since the directory for ‘backupTool’ is
not in a ‘/bin/’ subfolder, we can assume
it is being searched for in the PATH.
When looking at the PATH variable, we
see that we can write to ‘/usr/local/bin/’
and that there is a directory called
‘/root/scripts/’ in which it is most likely
present.
With a fake ‘backupTool’ in
‘/usr/local/bin/’ , we can assume our
fake tool will be used instead of the real
one.
8
9
The Trick
Searching for Files
When encountering an executable, a Linux system has a specific procedure for searching for the executable in the filesystem.
Failing to specify the full path when using an executable may result in the system becoming vulnerable to bad PATH
configuration attacks.
Below is the order in which directories are searched for executables:
PRRIORITY LOCATION DESCRIPTION
1 Aliases Checks if the executable is a ‘nickname’ given to another command
2 Exported functions Checks if the executable is an exported command of a shared Linux library
3 Built-in shell command Checks if the executable is a built-in shell command
4 PATH Searches for the executable in the directories written in the PATH variable
The Path is searched from start to end and will use the first occurrence of the executable.
Wildcard Injection
As seen in the example, the user has a
crontab job which runs desktopBackup.
This script backs up all the users
documents using tar with ‘*’.
Knowing this, we can create two files
named ‘--checkpoint=1’ and ‘--
checkpoint-action=“sudo adduser vitaly
sudo” ‘
Because tar is being used with ‘*’, both
files will be interpreted as commands
rather than actual files allowing code
execution.
10
Protection
The best way to prevent PE over automated
tasks all together is to follow the principle of
least privileges, having a dedicated user
running crontab jobs instead of root.
Write Permissions
If the command is simple, it can be written in
the crontab job itself and not in separate
script. Monitor write permissions on
scheduled scripts.
Wildcards
when actually crafting crontab jobs, we
should refrain from using wild cards, and
instead be explicit within the declarations.
Bad PATH Configuration
Always specify the full directories for
executable binaries. Avoid having ‘.’ in the
PATH.
11

More Related Content

What's hot

C++ decision making
C++ decision makingC++ decision making
C++ decision makingZohaib Ahmed
 
The CPU and Memory and Major Components
The CPU and Memory and  Major ComponentsThe CPU and Memory and  Major Components
The CPU and Memory and Major Componentsimtiazalijoono
 
PC Hardware Overview
PC Hardware OverviewPC Hardware Overview
PC Hardware OverviewPrabu U
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchysritolia
 
Disk storage - SlideShare by jayed hossain jibon
Disk storage - SlideShare by jayed hossain jibonDisk storage - SlideShare by jayed hossain jibon
Disk storage - SlideShare by jayed hossain jibonJayed Hossain Jibon
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionJuan A. Suárez Romero
 
What is a Rainbow Table?
What is a Rainbow Table?What is a Rainbow Table?
What is a Rainbow Table?Vahid Saffarian
 
Basics of Batch Scripting
Basics of Batch ScriptingBasics of Batch Scripting
Basics of Batch ScriptingArik Fletcher
 
15 Tips For Home Fire Safety
15 Tips For Home  Fire Safety15 Tips For Home  Fire Safety
15 Tips For Home Fire SafetyAbdullah Sachwani
 
Windows 8.x Forensics 1.0
Windows 8.x Forensics 1.0Windows 8.x Forensics 1.0
Windows 8.x Forensics 1.0Brent Muir
 
Basic computer hardware and software
Basic computer hardware and softwareBasic computer hardware and software
Basic computer hardware and softwareCamille Hazellie
 
ICT Laptop and Desktop Policy Final
ICT  Laptop and Desktop Policy FinalICT  Laptop and Desktop Policy Final
ICT Laptop and Desktop Policy FinalKel' Laquian
 

What's hot (20)

File management
File managementFile management
File management
 
C++ decision making
C++ decision makingC++ decision making
C++ decision making
 
The CPU and Memory and Major Components
The CPU and Memory and  Major ComponentsThe CPU and Memory and  Major Components
The CPU and Memory and Major Components
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Linux basics
Linux basicsLinux basics
Linux basics
 
PC Hardware Overview
PC Hardware OverviewPC Hardware Overview
PC Hardware Overview
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchy
 
Disk storage - SlideShare by jayed hossain jibon
Disk storage - SlideShare by jayed hossain jibonDisk storage - SlideShare by jayed hossain jibon
Disk storage - SlideShare by jayed hossain jibon
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An Introduction
 
Operating system
Operating systemOperating system
Operating system
 
What is a Rainbow Table?
What is a Rainbow Table?What is a Rainbow Table?
What is a Rainbow Table?
 
Computer Memory
Computer MemoryComputer Memory
Computer Memory
 
Basics of Batch Scripting
Basics of Batch ScriptingBasics of Batch Scripting
Basics of Batch Scripting
 
Pointers
PointersPointers
Pointers
 
terminal-check-list.pdf
terminal-check-list.pdfterminal-check-list.pdf
terminal-check-list.pdf
 
15 Tips For Home Fire Safety
15 Tips For Home  Fire Safety15 Tips For Home  Fire Safety
15 Tips For Home Fire Safety
 
Disk Management (DM)
Disk Management (DM)Disk Management (DM)
Disk Management (DM)
 
Windows 8.x Forensics 1.0
Windows 8.x Forensics 1.0Windows 8.x Forensics 1.0
Windows 8.x Forensics 1.0
 
Basic computer hardware and software
Basic computer hardware and softwareBasic computer hardware and software
Basic computer hardware and software
 
ICT Laptop and Desktop Policy Final
ICT  Laptop and Desktop Policy FinalICT  Laptop and Desktop Policy Final
ICT Laptop and Desktop Policy Final
 

Similar to Linux automated tasks

Linux week 2
Linux week 2Linux week 2
Linux week 2Vinoth Sn
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.pptKalkey
 
Linux advanced privilege escalation
Linux advanced privilege escalationLinux advanced privilege escalation
Linux advanced privilege escalationJameel Nabbo
 
Linux privilege escalation
Linux privilege escalationLinux privilege escalation
Linux privilege escalationSongchaiDuangpan
 
101 apend. scripting, crond, atd
101 apend. scripting, crond, atd101 apend. scripting, crond, atd
101 apend. scripting, crond, atdAcácio Oliveira
 
Securing docker containers
Securing docker containersSecuring docker containers
Securing docker containersMihir Shah
 
3.1.c apend scripting, crond, atd
3.1.c apend   scripting, crond, atd3.1.c apend   scripting, crond, atd
3.1.c apend scripting, crond, atdAcácio Oliveira
 
OS Lab Manual.pdf
OS Lab Manual.pdfOS Lab Manual.pdf
OS Lab Manual.pdfQucHunh15
 
2023comp90024_linux.pdf
2023comp90024_linux.pdf2023comp90024_linux.pdf
2023comp90024_linux.pdfLevLafayette1
 
Check Your Privilege (Escalation)
Check Your Privilege (Escalation) Check Your Privilege (Escalation)
Check Your Privilege (Escalation) Bishop Fox
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdfroschahacker
 
Lamp technology
Lamp technologyLamp technology
Lamp technology2tharan21
 
SECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profilingSECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profilingOSLL
 

Similar to Linux automated tasks (20)

Linux remote
Linux remoteLinux remote
Linux remote
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.ppt
 
Linux advanced privilege escalation
Linux advanced privilege escalationLinux advanced privilege escalation
Linux advanced privilege escalation
 
Linux privilege escalation
Linux privilege escalationLinux privilege escalation
Linux privilege escalation
 
101 apend. scripting, crond, atd
101 apend. scripting, crond, atd101 apend. scripting, crond, atd
101 apend. scripting, crond, atd
 
Linux privesc.pptx
Linux privesc.pptxLinux privesc.pptx
Linux privesc.pptx
 
Securing docker containers
Securing docker containersSecuring docker containers
Securing docker containers
 
Operating system lab manual
Operating system lab manualOperating system lab manual
Operating system lab manual
 
3.1.c apend scripting, crond, atd
3.1.c apend   scripting, crond, atd3.1.c apend   scripting, crond, atd
3.1.c apend scripting, crond, atd
 
OS Lab Manual.pdf
OS Lab Manual.pdfOS Lab Manual.pdf
OS Lab Manual.pdf
 
2023comp90024_linux.pdf
2023comp90024_linux.pdf2023comp90024_linux.pdf
2023comp90024_linux.pdf
 
Linux
LinuxLinux
Linux
 
Daemons
DaemonsDaemons
Daemons
 
Check Your Privilege (Escalation)
Check Your Privilege (Escalation) Check Your Privilege (Escalation)
Check Your Privilege (Escalation)
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdf
 
Lamp technology
Lamp technologyLamp technology
Lamp technology
 
Slides 29-07-2017
Slides 29-07-2017Slides 29-07-2017
Slides 29-07-2017
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
SECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profilingSECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profiling
 

More from yarden hanan

Introduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineeringIntroduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineeringyarden hanan
 
Android Package tool
Android Package toolAndroid Package tool
Android Package toolyarden hanan
 
Introduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineeringIntroduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineeringyarden hanan
 
Introduction To Malware Analysis & Reverse Engineering
Introduction To Malware Analysis & Reverse EngineeringIntroduction To Malware Analysis & Reverse Engineering
Introduction To Malware Analysis & Reverse Engineeringyarden hanan
 
File windows local
File windows localFile windows local
File windows localyarden hanan
 
Windows post exploitation
Windows post exploitationWindows post exploitation
Windows post exploitationyarden hanan
 
File windows local
File windows localFile windows local
File windows localyarden hanan
 

More from yarden hanan (15)

Introduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineeringIntroduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineering
 
SSL Pinning
SSL PinningSSL Pinning
SSL Pinning
 
Mobile SF
Mobile SFMobile SF
Mobile SF
 
iOS Jail break
iOS Jail breakiOS Jail break
iOS Jail break
 
Ios vs android
Ios vs androidIos vs android
Ios vs android
 
Android Package tool
Android Package toolAndroid Package tool
Android Package tool
 
Android package
Android packageAndroid package
Android package
 
Adb
AdbAdb
Adb
 
Introduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineeringIntroduction to malware analysis & reverse engineering
Introduction to malware analysis & reverse engineering
 
Introduction To Malware Analysis & Reverse Engineering
Introduction To Malware Analysis & Reverse EngineeringIntroduction To Malware Analysis & Reverse Engineering
Introduction To Malware Analysis & Reverse Engineering
 
File windows local
File windows localFile windows local
File windows local
 
Windows advanced
Windows advancedWindows advanced
Windows advanced
 
Linux local
Linux localLinux local
Linux local
 
Windows post exploitation
Windows post exploitationWindows post exploitation
Windows post exploitation
 
File windows local
File windows localFile windows local
File windows local
 

Recently uploaded

VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...Suhani Kapoor
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Datingkojalkojal131
 
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士obuhobo
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...Suhani Kapoor
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceSanjay Bokadia
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girlsshivangimorya083
 
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...Suhani Kapoor
 
Employee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchEmployee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchSoham Mondal
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxGry Tina Tinde
 
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...Call Girls in Nagpur High Profile
 
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiVIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipSoham Mondal
 
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...shivangimorya083
 
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With RoomVIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Roomdivyansh0kumar0
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjLewisJB
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boodykojalkojal131
 
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service CuttackVIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service CuttackSuhani Kapoor
 
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...gurkirankumar98700
 

Recently uploaded (20)

VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
 
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector Experience
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
 
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
VIP Call Girls Firozabad Aaradhya 8250192130 Independent Escort Service Firoz...
 
Employee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchEmployee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India Research
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptx
 
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
 
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiVIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management Internship
 
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
 
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With RoomVIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Room
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbj
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
 
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service CuttackVIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
VIP Call Girls in Cuttack Aarohi 8250192130 Independent Escort Service Cuttack
 
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
 

Linux automated tasks

  • 2. Automated tasks Linux systems pack a useful and familiar task scheduler named crontab. The reason crontab has become popular with privilege escalation is due to the fact it may be scheduled to run an automated process as root. Having an automated process running as root makes the whole exploitation much easier. One need only to tamper with the task and then wait until the task is re-initiated. 2
  • 3. Listing Tab Jobs Crontab jobs can be found with crontab - l for scheduled tasks for the current user, or crontab -l -u [username] for other users. Since using crontab -u requires privileges by itself, a more efficient searching can be done by exploring ‘/etc/cron.[period]’ directories. ls -la /etc/cron* will do the job, but usually an enumeration script will yield better results. 3
  • 4. Reading Crontab Jobs Reading crontab jobs is divided into two parts; the first part involves the tasks themselves. Some system wide jobs can be found with more /etc/crontab. Others will only be visible to the user they belong to. The second part of reading crontab involves the files executed. These files reside in the mentioned directories ‘/etc/cron.[period]’. 4
  • 5. 5 Crontab Schedule Format 01,31 04,05 1-15 1,6 * /etc/cron.daily/script Creating Crontab Jobs Crontab jobs are created by putting a bash script into one of crontab’s directories. Later on, the job becomes an automatic process initialized by crontab -e. All crontab jobs will have the same format, as well as the details of the timing, followed by the bash script location to be executed. Below is slightly more graphical explanation: Bash script locationDays of week Days of month minutes months hours The above example will run ‘/etc/cron.daily/script’ at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.
  • 6. Crontab Escalation Types Crontab jobs can also be executed frequently. For example, a task may be run once an hour. Due to the fact that crontab jobs themselves won’t be visible to the attacker, the time of execution can only be speculated. Write Permissions Having “write” permissions over a scheduled script, we can simply alter the script to perform a different task to fit our needs. Since most jobs run a root, simply executing a shell will do. Wildcards Wildcards are signs used to select multiple or arbitrary files. The most common wildcard used is “*” which means “select” all files and is usually passed to a command. Bad PATH Configuration When running a program or a command in Linux, and the program is not in the current working directory, Linux will address the PATH variable and search within the directories listed there. 6
  • 7. Write Permissions Write permissions on a crontab job script is, for the most part, self- explanatory. An important thing to remember is that the crontab job cannot be used to actively open a root shell. However, we can simply add our user to the sudo group by inserting sudo adduser [username] sudo into the script. 7
  • 8. Bad PATH Configuration As seen in the example, the user has a crontab job which runs ‘backupTool’. Since the directory for ‘backupTool’ is not in a ‘/bin/’ subfolder, we can assume it is being searched for in the PATH. When looking at the PATH variable, we see that we can write to ‘/usr/local/bin/’ and that there is a directory called ‘/root/scripts/’ in which it is most likely present. With a fake ‘backupTool’ in ‘/usr/local/bin/’ , we can assume our fake tool will be used instead of the real one. 8
  • 9. 9 The Trick Searching for Files When encountering an executable, a Linux system has a specific procedure for searching for the executable in the filesystem. Failing to specify the full path when using an executable may result in the system becoming vulnerable to bad PATH configuration attacks. Below is the order in which directories are searched for executables: PRRIORITY LOCATION DESCRIPTION 1 Aliases Checks if the executable is a ‘nickname’ given to another command 2 Exported functions Checks if the executable is an exported command of a shared Linux library 3 Built-in shell command Checks if the executable is a built-in shell command 4 PATH Searches for the executable in the directories written in the PATH variable The Path is searched from start to end and will use the first occurrence of the executable.
  • 10. Wildcard Injection As seen in the example, the user has a crontab job which runs desktopBackup. This script backs up all the users documents using tar with ‘*’. Knowing this, we can create two files named ‘--checkpoint=1’ and ‘-- checkpoint-action=“sudo adduser vitaly sudo” ‘ Because tar is being used with ‘*’, both files will be interpreted as commands rather than actual files allowing code execution. 10
  • 11. Protection The best way to prevent PE over automated tasks all together is to follow the principle of least privileges, having a dedicated user running crontab jobs instead of root. Write Permissions If the command is simple, it can be written in the crontab job itself and not in separate script. Monitor write permissions on scheduled scripts. Wildcards when actually crafting crontab jobs, we should refrain from using wild cards, and instead be explicit within the declarations. Bad PATH Configuration Always specify the full directories for executable binaries. Avoid having ‘.’ in the PATH. 11