SlideShare a Scribd company logo
1 of 37
Download to read offline
Check Your Privilege
(Escalation)
KATE BROUSSARD, SENIOR SECURITY ANALYST AT BISHOP FOX
March 1, 2019
BSidesCMH 2019
22
Kate Broussard
Senior Security Analyst
kbroussard@bishopfox.com
@grazhacks on Twitter
ROADMAP FOR THE NEXT HOUR
Introduction
Outline
• Priv esc definition + framing
• Easy mode
• Sneaky mode
• Boss mode
• Summary
• Resources
PRIVILEGE ESCALATION
AND SO WE BEGIN
4
Definition
• Using privileges of various agents to
gain access to resources
When does it come into play?
Framing
• Who’s doing the execution?
• What are their privileges?
Two ways to escalate:
1. You’re the agent – your current user
permissions are sufficient to execute
the command & do the thing
2. Something else is the agent – you get
something else to execute the
command under THEIR permissions,
which are sufficient to do the thing
DEFINITION AND FRAMING
Privilege Escalation
EASY MODE
SO YOU’RE IN THE SERVER – NOW WHAT?
6
• Who are you?
whoami
id
• Where are you?
pwd
• Are you really really lucky?
cat /etc/shadow vs. cat /etc/passwd
cd /root
CHECK YOUR PRIVILEGE
Before anything else
7
• Where do you have read access?
/home/
/usr/share/
ENV
• Where do you have write access?
/home/USER/.ssh
/root/
/etc/crontab
CHECK YOUR PRIVILEGE
Permissions
8
sudo = super user do [something]
sudo –l
• What commands can you execute?
• Do you need a password?
https://xkcd.com/838/ - Incident
MAKE ME A SANDWICH
sudo
9
sudo = super user do [something]
sudo –l
• What commands can you execute?
• Do you need a password?
MAKE ME A SANDWICH
sudo
cat /etc/sudoers
• if readable, tells you which
users/groups to target
cat /etc/group
• lists users, IDs, group affiliations
10
sudo –l
• User has sudo permissions for python
• Without needing the password – excellent!
• Therefore can run python under root
permissions
sudo python –c ‘import
pty;pty.spawn(“/bin/bash”);’
• New shell spawned by python also
runs under root permissions
SUDO MAKE ME A SANDWICH
sudo Exploit - Python
11
Password reuse is RAMPANT
• web application passwords
• common/default passwords
nmap port scan or ps auf to see what’s up
• known compromised passwords for
specific users
https://xkcd.com/792/ - Password Reuse
WE ARE CREATURES OF HABIT
Credential Reuse
12
• Any passwords entered into history?
• Any interesting files or directories?
cat .bash_history vs history
• .bash_history won’t dump current
session data until session ends
• history is a live dump of session
LEAKED INFORMATION
.bash_history
13
• Are any credentials stored in logs?
• Any other useful information?
Log files/dirs that are writeable can be
replaced by symlink.
When owning process tries to write to log,
will write to symlink instead.
Can be a way to output data somewhere
that you can read it.
LEAKED INFORMATION
/var/log
14
1. Who/where are you
2. What can you see/modify with
current permissions?
3. Look for:
1. sudo permissions
2. Credential Reuse
3. Leaked info from:
1. cat .bash_history
2. /var/log files
Two ways to escalate:
1. You’re the agent – your current user
permissions are sufficient to execute
the command & do the thing
2. Something else is the agent – you get
something else to execute the
command under THEIR permissions,
which are sufficient to do the thing
RECAP
Easy Mode
SNEAKY MODE
FIND AND EXPLOIT SOME MISCONFIGURATIONS
16
• What is the SUID/SGID bit?
• How to find a SUID/SGID binary?
• What runs as the root user?
find / -perm -u=s [-type f] 2>/dev/null
find / -perm -4000 [-type f] 2>/dev/null
• What runs in the root group?
find / -perm -g=s [-type f] 2>/dev/null
find / -perm -2000 [-type f] 2>/dev/null
CHECK THEIR PRIVILEGE
SUID/SGID bits
17
• What are “normal” SUID programs vs
ones that are exploitable?
Standard Linux utility?
Try shell escape or
command option argument
Custom script to make an admin’s life easy?
Try PATH = .
especially if the script makes a call to an alias
Also watch for wildcards
CHECK THEIR PRIVILEGE
SUID/SGID bits
18
Binary Shell escape
less !cmd
more !cmd
:!cmd
vi :! cmd
mysql system cmd
! cmd
AND MANY MORE
INTENTIONAL OPTION TO EXECUTE COMMANDS
Shell escapes
https://www.mariowiki.com/File:Koopa_Troopa_Artwork_-
_Super_Mario_3D_World.png
19
Binary Option
find -exec CMD ;
awk ‘{system(“CMD”)}’
AND MANY MORE
INTENTIONAL OPTION TO EXECUTE COMMANDS
Cmd option arguments
20
TRICKING AN EXECUTABLE INTO SPAWNING A SHELL
SUID Exploit
Nano is another common executable
If nano has a SUID bit set to root, can
force an escape to root shell
Exploit:
1. create a temporary
file with shell cmd
2. open nano with temp
file set as spell-check
reference
3. run spell-check to
execute cmd under
root permissions
21
Path is an environment variable telling the
OS where to look for an aliased binary
Instead of typing /bin/ls every time,
you can just type ls
Use case: Prank the Admin
• Bill knows that his supervisor Sue has
her PATH = .
• Writes a script to prank her, names it ls,
sticks it in his /home/BILL/ directory
• Asks Sue why ls isn’t working in his ~
• Sue runs ls in /home/BILL/ and executes
the prank script instead of /bin/ls binary
START LOOKING HERE
Path = .
22
Not easy during assessment to know which
users have PATH = .
HOWEVER!
Custom script on the web server might
execute call to aliased program
calling cat $FILE instead of /bin/cat $FILE
If it runs under root privs, you can exploit it
Use case: helperSH Exploit
• helperSH is a custom script on the web
server that makes life easy for an
admin; SUID as root
• Command within the script executes
something recognizable (like ps)
• In writeable dir, make new file
echo “/bin/sh” > ps
• Set own PATH = .
• Execute script from writeable dir
START LOOKING HERE
Path = .
23
Use case: helperSH Exploit
• helperSH is a custom script on the web
server that makes life easy for an
admin; SUID as root
• Command within the script executes
something recognizable (like ps)
• In writeable dir, make new file
echo “/bin/sh” > ps
• Set own PATH = .
• Execute script from writeable dir
START LOOKING HERE
Path = .
24
When using * wildcard, Unix shell
interprets –FILENAME as command option
argument
Meaning you can
submit command options
through file name
when running a wildcard process
Keep an eye out for wildcards in
custom scripts, cron jobs, executables
chown example
files in a given dir include:
.FileRef.php
--reference=.FileRef.php
when root executes the following:
chown –R nobody:nobody *.php
becomes:
chown –R nobody:nobody --reference=.FileRef.php
User:group permissions of .FileRef.php are
mapped onto every file in the directory
COMMAND OPTION ARGUMENTS AS FILENAMES
Wildcards
25
When using * wildcard, Unix shell
interprets –FILENAME as command option
argument
Meaning you can
submit command options
through file name
when running a wildcard process
Keep an eye out for wildcards in
custom scripts, cron jobs, executables
NOTE –
EXPLOIT BELOW DELETES THE FILESYSTEM
cd /tmp
echo “blah” > “-rf /*”
rm *
When rm * gets to –rf /* file, command
becomes rm –rf /*
Which recursively deletes everything on
the filesystem, starting at /
COMMAND OPTION ARGUMENTS AS FILENAMES
Wildcards
26
SUID/SGID bits
1. Shell escapes
2. Cmd option arguments
3. PATH = .
Wildcards
Two ways to escalate:
1. You’re the agent – your current user
permissions are sufficient to execute
the command & do the thing
2. Something else is the agent – you get
something else to execute the
command under THEIR permissions,
which are sufficient to do the thing
RECAP
Sneaky Mode
BOSS MODE
THESE WILL TAKE SOME TIME TO GET RIGHT
28
Cron jobs are cmds executed on a schedule
Almost always run under root permissions
• /etc/cron.allow & /etc/cron.deny specify user privs
Cron takes a file; file tells it what to execute
and when
• /etc/crontab
Related: at, batch (one-time execution)
PRIVILEGE IS A CRONIC PROBLEM
cron
• How to exploit?
1. Overwrite /etc/crontab
2. Write to a cron dir (priv misconfig)
3. If the what is vulnerable, might be able to
modify or hit something downstream
4. Cron jobs may also have exploitable
wildcards
29
PRIVILEGE IS A CRONIC PROBLEM
cron
• How to exploit?
1. Overwrite /etc/crontab (SUID on nano!)
2. Write to a cron dir (priv misconfig)
3. If the what is vulnerable, might be able to
modify or hit something downstream
4. Cron jobs may also have exploitable
wildcards
30
PRIVILEGE IS A CRONIC PROBLEM
cron
• How to exploit?
1. Overwrite /etc/crontab
2. Write to a cron dir (priv misconfig)
3. If the what is vulnerable, might be able to
modify or hit something downstream
4. Cron jobs may also have exploitable
wildcards
31
PRIVILEGE IS A CRONIC PROBLEM
cron
• How to exploit?
1. Overwrite /etc/crontab
2. Write to a cron dir (priv misconfig)
3. If the what is vulnerable, might be able to
modify or hit something downstream
4. Cron jobs may also have exploitable
wildcards
32
Magic bullet: what if we just compromise
the server OS itself??!
Downside: there might be exploits that you
need to grab & compile & debug
NOTE: not-small risk of bricking the server
HOPE YOU LIKE DEBUGGING IN C
Kernel Exploits
LSB_RELEASE -A
UNAME -A
33
Cron jobs
1. /etc/crontab
2. writeable cron dir
3. affect process downstream
Kernel exploits
Two ways to escalate:
1. You’re the agent – your current user
permissions are sufficient to execute
the command & do the thing
2. Something else is the agent – you get
something else to execute the
command under THEIR permissions,
which are sufficient to do the thing
RECAP
Boss Mode
THAT’S ONE IN THE BANK
LET ME SUM UP
35
Typical goal in server:
persistence + privilege escalation
Linux tends to be consistent in its core utilities;
get familiar with what’s there and where it lives,
and spotting vulnerable paths gets a lot easier
• Are you the agent? Drop into a root shell &
give yourself persistence
• Is something else the agent? Need an
intermediate step – get something to help
you out
ONE HOUR IN ONE SLIDE
Summary
• Easy mode
• Who are you?
• Where are you?
• What can you do?
• Sneaky mode
• SUID/SGID bits:
shell escapes, cmd option args, PATH = .
• Wildcards
• Boss mode
• Cron jobs
• Kernel exploits
36
• https://payatu.com/guide-linux-privilege-escalation/
• http://www.securitysift.com/download/
linuxprivchecker.py
• https://exploit-db.com
• https://www.linode.com/docs/tools-reference/linux-users-
and-groups/
• https://resources.infosecinstitute.com/
privilege-escalation-linux-live-examples/
• https://www.hackingarticles.in/exploiting-wildcard-for-
privilege-escalation/
• https://percussiveelbow.github.io/linux-privesc/
I’M REAL FRIENDLY
Resources & Contact
kbroussard@bishopfox.com
@grazhacks on Twitter
SLIDE DECK
http://github.com/
grazhacks/BSidesCMH2019
PRACTICE VM
http://bit.ly/
BSidesCMH2019
Thank You!
Questions?
kbroussard@bishopfox.com
@grazhacks on Twitter
SLIDE DECK
http://github.com/
grazhacks/BSidesCMH2019
PRACTICE VM
http://bit.ly/
BSidesCMH2019

More Related Content

What's hot

Owning computers without shell access dark
Owning computers without shell access darkOwning computers without shell access dark
Owning computers without shell access darkRoyce Davis
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2Royce Davis
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesPeter Hlavaty
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" Peter Hlavaty
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Hossam .M Hamed
 
Guardians of your CODE
Guardians of your CODEGuardians of your CODE
Guardians of your CODEPeter Hlavaty
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsShakacon
 
Vulnerability desing patterns
Vulnerability desing patternsVulnerability desing patterns
Vulnerability desing patternsPeter Hlavaty
 
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]RootedCON
 
Linux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLinux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLubomir Rintel
 
Modern Evasion Techniques
Modern Evasion TechniquesModern Evasion Techniques
Modern Evasion TechniquesJason Lang
 
Exploiting Llinux Environment
Exploiting Llinux EnvironmentExploiting Llinux Environment
Exploiting Llinux EnvironmentEnrico Scapin
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell   malware is hard.  let's go shopping!!Richard wartell   malware is hard.  let's go shopping!!
Richard wartell malware is hard. let's go shopping!!Shakacon
 
SANS @Night There's Gold in Them Thar Package Management Databases
SANS @Night There's Gold in Them Thar Package Management DatabasesSANS @Night There's Gold in Them Thar Package Management Databases
SANS @Night There's Gold in Them Thar Package Management DatabasesPhil Hagen
 
Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Eviljaredhaight
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon chinaPeter Hlavaty
 
Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.Shahriman .
 

What's hot (20)

Racing with Droids
Racing with DroidsRacing with Droids
Racing with Droids
 
Owning computers without shell access dark
Owning computers without shell access darkOwning computers without shell access dark
Owning computers without shell access dark
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2
 
Back to the CORE
Back to the COREBack to the CORE
Back to the CORE
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop
 
Guardians of your CODE
Guardians of your CODEGuardians of your CODE
Guardians of your CODE
 
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan BalazsHacking Highly Secured Enterprise Environments by Zoltan Balazs
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
 
Vulnerability desing patterns
Vulnerability desing patternsVulnerability desing patterns
Vulnerability desing patterns
 
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
 
Linux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLinux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshop
 
Modern Evasion Techniques
Modern Evasion TechniquesModern Evasion Techniques
Modern Evasion Techniques
 
Exploiting Llinux Environment
Exploiting Llinux EnvironmentExploiting Llinux Environment
Exploiting Llinux Environment
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell   malware is hard.  let's go shopping!!Richard wartell   malware is hard.  let's go shopping!!
Richard wartell malware is hard. let's go shopping!!
 
How fun of privilege escalation Red Pill2017
How fun of privilege escalation  Red Pill2017How fun of privilege escalation  Red Pill2017
How fun of privilege escalation Red Pill2017
 
SANS @Night There's Gold in Them Thar Package Management Databases
SANS @Night There's Gold in Them Thar Package Management DatabasesSANS @Night There's Gold in Them Thar Package Management Databases
SANS @Night There's Gold in Them Thar Package Management Databases
 
Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Evil
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon china
 
Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.
 

Similar to Check Your Privilege (Escalation)

Server quickstart47 linux
Server quickstart47 linuxServer quickstart47 linux
Server quickstart47 linuxkb_exchange_hk
 
Kubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with PodmanKubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with PodmanMihai Criveti
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell ScriptingMustafa Qasim
 
Linux privilege escalation
Linux privilege escalationLinux privilege escalation
Linux privilege escalationSongchaiDuangpan
 
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows AdminsThe Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows AdminsBill Malchisky Jr.
 
Using filesystem capabilities with rsync
Using filesystem capabilities with rsyncUsing filesystem capabilities with rsync
Using filesystem capabilities with rsyncHazel Smith
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction to  Command LineChapter 1: Introduction to  Command Line
Chapter 1: Introduction to Command Lineazzamhadeel89
 
Death matchtournament del2014
Death matchtournament del2014Death matchtournament del2014
Death matchtournament del2014Nabil Munawar
 
Linux week 2
Linux week 2Linux week 2
Linux week 2Vinoth Sn
 
Unraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudUnraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudSalman Baset
 
Tokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityTokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityPhil Estes
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction  to Command LineChapter 1: Introduction  to Command Line
Chapter 1: Introduction to Command Lineazzamhadeel89
 
Shared Coursework in Cyber Security Instructions Manual .docx
Shared Coursework in Cyber Security Instructions Manual .docxShared Coursework in Cyber Security Instructions Manual .docx
Shared Coursework in Cyber Security Instructions Manual .docxedgar6wallace88877
 
Command line for the beginner - Using the command line in developing for the...
Command line for the beginner -  Using the command line in developing for the...Command line for the beginner -  Using the command line in developing for the...
Command line for the beginner - Using the command line in developing for the...Jim Birch
 
Unix Security
Unix SecurityUnix Security
Unix Securityreplay21
 
InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018Mandi Walls
 

Similar to Check Your Privilege (Escalation) (20)

Linux privesc.pptx
Linux privesc.pptxLinux privesc.pptx
Linux privesc.pptx
 
Server quickstart47 linux
Server quickstart47 linuxServer quickstart47 linux
Server quickstart47 linux
 
Kubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with PodmanKubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with Podman
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell Scripting
 
1000 to 0
1000 to 01000 to 0
1000 to 0
 
Linux privilege escalation
Linux privilege escalationLinux privilege escalation
Linux privilege escalation
 
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows AdminsThe Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
 
Using filesystem capabilities with rsync
Using filesystem capabilities with rsyncUsing filesystem capabilities with rsync
Using filesystem capabilities with rsync
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction to  Command LineChapter 1: Introduction to  Command Line
Chapter 1: Introduction to Command Line
 
Us 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimesUs 17-krug-hacking-severless-runtimes
Us 17-krug-hacking-severless-runtimes
 
Death matchtournament del2014
Death matchtournament del2014Death matchtournament del2014
Death matchtournament del2014
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
 
Unraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudUnraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production Cloud
 
Tokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityTokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker Security
 
Chapter 1: Introduction to Command Line
Chapter 1: Introduction  to Command LineChapter 1: Introduction  to Command Line
Chapter 1: Introduction to Command Line
 
Shared Coursework in Cyber Security Instructions Manual .docx
Shared Coursework in Cyber Security Instructions Manual .docxShared Coursework in Cyber Security Instructions Manual .docx
Shared Coursework in Cyber Security Instructions Manual .docx
 
Volatility101
Volatility101Volatility101
Volatility101
 
Command line for the beginner - Using the command line in developing for the...
Command line for the beginner -  Using the command line in developing for the...Command line for the beginner -  Using the command line in developing for the...
Command line for the beginner - Using the command line in developing for the...
 
Unix Security
Unix SecurityUnix Security
Unix Security
 
InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018InSpec Workshop at Velocity London 2018
InSpec Workshop at Velocity London 2018
 

More from Bishop Fox

OWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDF
OWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDFOWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDF
OWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDFBishop Fox
 
InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...
	 InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...	 InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...
InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...Bishop Fox
 
InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...
InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...
InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...Bishop Fox
 
DEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDF
DEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDFDEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDF
DEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDFBishop Fox
 
SpellCheckV2 Rules
SpellCheckV2 RulesSpellCheckV2 Rules
SpellCheckV2 RulesBishop Fox
 
Smarter Home Invasion With ZigDiggity
Smarter Home Invasion With ZigDiggitySmarter Home Invasion With ZigDiggity
Smarter Home Invasion With ZigDiggityBishop Fox
 
Hacking Exposed EBS Volumes
Hacking Exposed EBS Volumes Hacking Exposed EBS Volumes
Hacking Exposed EBS Volumes Bishop Fox
 
Ghost in the Browser: Broad-Scale Espionage with Bitsquatting
 Ghost in the Browser: Broad-Scale Espionage with Bitsquatting Ghost in the Browser: Broad-Scale Espionage with Bitsquatting
Ghost in the Browser: Broad-Scale Espionage with BitsquattingBishop Fox
 
Ferris Bueller’s Guide to Abuse Domain Permutations
Ferris Bueller’s Guide to Abuse Domain PermutationsFerris Bueller’s Guide to Abuse Domain Permutations
Ferris Bueller’s Guide to Abuse Domain PermutationsBishop Fox
 
Penetration Testing Resource Guide
Penetration Testing Resource Guide Penetration Testing Resource Guide
Penetration Testing Resource Guide Bishop Fox
 
How Perceptual Analysis Helps Bug Hunters
How Perceptual Analysis Helps Bug HuntersHow Perceptual Analysis Helps Bug Hunters
How Perceptual Analysis Helps Bug HuntersBishop Fox
 
Getting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at Scale
Getting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at ScaleGetting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at Scale
Getting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at ScaleBishop Fox
 
Evolving Cyber Adversary Simulation: How Red Teaming Benefits Organizations
Evolving Cyber Adversary Simulation: How Red Teaming Benefits OrganizationsEvolving Cyber Adversary Simulation: How Red Teaming Benefits Organizations
Evolving Cyber Adversary Simulation: How Red Teaming Benefits OrganizationsBishop Fox
 
ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In
ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In
ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In Bishop Fox
 
CactusCon 2018 - Anatomy of an AppSec Program
CactusCon 2018 - Anatomy of an AppSec Program CactusCon 2018 - Anatomy of an AppSec Program
CactusCon 2018 - Anatomy of an AppSec Program Bishop Fox
 
Preparing a Next Generation IT Strategy
Preparing a Next Generation IT StrategyPreparing a Next Generation IT Strategy
Preparing a Next Generation IT StrategyBishop Fox
 
Lord of the Bing: Taking Back Search Engine Hacking From Google and Bing
Lord of the Bing: Taking Back Search Engine Hacking From Google and BingLord of the Bing: Taking Back Search Engine Hacking From Google and Bing
Lord of the Bing: Taking Back Search Engine Hacking From Google and BingBishop Fox
 
Pulp Google Hacking
Pulp Google HackingPulp Google Hacking
Pulp Google HackingBishop Fox
 
Black Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet Farmer
Black Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet FarmerBlack Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet Farmer
Black Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet FarmerBishop Fox
 
RFID Hacking: Live Free or RFID Hard
RFID Hacking: Live Free or RFID HardRFID Hacking: Live Free or RFID Hard
RFID Hacking: Live Free or RFID HardBishop Fox
 

More from Bishop Fox (20)

OWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDF
OWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDFOWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDF
OWASP LA – SharePoint Hacking – 22Feb2012 – Slides.PDF
 
InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...
	 InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...	 InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...
InfoSec World 2016 – RFIDiggity – Pentester Guide to Hacking HF/NFC and UHF...
 
InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...
InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...
InfoSec World 2013 – W4 – Using Google to Find Vulnerabilities in Your IT Env...
 
DEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDF
DEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDFDEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDF
DEFCON 20 (2012) – Tenacious Diggity – 29July2012 – Slides.PDF
 
SpellCheckV2 Rules
SpellCheckV2 RulesSpellCheckV2 Rules
SpellCheckV2 Rules
 
Smarter Home Invasion With ZigDiggity
Smarter Home Invasion With ZigDiggitySmarter Home Invasion With ZigDiggity
Smarter Home Invasion With ZigDiggity
 
Hacking Exposed EBS Volumes
Hacking Exposed EBS Volumes Hacking Exposed EBS Volumes
Hacking Exposed EBS Volumes
 
Ghost in the Browser: Broad-Scale Espionage with Bitsquatting
 Ghost in the Browser: Broad-Scale Espionage with Bitsquatting Ghost in the Browser: Broad-Scale Espionage with Bitsquatting
Ghost in the Browser: Broad-Scale Espionage with Bitsquatting
 
Ferris Bueller’s Guide to Abuse Domain Permutations
Ferris Bueller’s Guide to Abuse Domain PermutationsFerris Bueller’s Guide to Abuse Domain Permutations
Ferris Bueller’s Guide to Abuse Domain Permutations
 
Penetration Testing Resource Guide
Penetration Testing Resource Guide Penetration Testing Resource Guide
Penetration Testing Resource Guide
 
How Perceptual Analysis Helps Bug Hunters
How Perceptual Analysis Helps Bug HuntersHow Perceptual Analysis Helps Bug Hunters
How Perceptual Analysis Helps Bug Hunters
 
Getting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at Scale
Getting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at ScaleGetting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at Scale
Getting Buzzed on Buzzwords: Using Cloud & Big Data to Pentest at Scale
 
Evolving Cyber Adversary Simulation: How Red Teaming Benefits Organizations
Evolving Cyber Adversary Simulation: How Red Teaming Benefits OrganizationsEvolving Cyber Adversary Simulation: How Red Teaming Benefits Organizations
Evolving Cyber Adversary Simulation: How Red Teaming Benefits Organizations
 
ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In
ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In
ASU Cybersecurity Symposium - Breaking Into a Career of Breaking In
 
CactusCon 2018 - Anatomy of an AppSec Program
CactusCon 2018 - Anatomy of an AppSec Program CactusCon 2018 - Anatomy of an AppSec Program
CactusCon 2018 - Anatomy of an AppSec Program
 
Preparing a Next Generation IT Strategy
Preparing a Next Generation IT StrategyPreparing a Next Generation IT Strategy
Preparing a Next Generation IT Strategy
 
Lord of the Bing: Taking Back Search Engine Hacking From Google and Bing
Lord of the Bing: Taking Back Search Engine Hacking From Google and BingLord of the Bing: Taking Back Search Engine Hacking From Google and Bing
Lord of the Bing: Taking Back Search Engine Hacking From Google and Bing
 
Pulp Google Hacking
Pulp Google HackingPulp Google Hacking
Pulp Google Hacking
 
Black Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet Farmer
Black Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet FarmerBlack Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet Farmer
Black Hat USA - CloudBots Harvesting Crypto Coins Like a Botnet Farmer
 
RFID Hacking: Live Free or RFID Hard
RFID Hacking: Live Free or RFID HardRFID Hacking: Live Free or RFID Hard
RFID Hacking: Live Free or RFID Hard
 

Recently uploaded

Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 

Recently uploaded (20)

Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 

Check Your Privilege (Escalation)

  • 1. Check Your Privilege (Escalation) KATE BROUSSARD, SENIOR SECURITY ANALYST AT BISHOP FOX March 1, 2019 BSidesCMH 2019
  • 2. 22 Kate Broussard Senior Security Analyst kbroussard@bishopfox.com @grazhacks on Twitter ROADMAP FOR THE NEXT HOUR Introduction Outline • Priv esc definition + framing • Easy mode • Sneaky mode • Boss mode • Summary • Resources
  • 4. 4 Definition • Using privileges of various agents to gain access to resources When does it come into play? Framing • Who’s doing the execution? • What are their privileges? Two ways to escalate: 1. You’re the agent – your current user permissions are sufficient to execute the command & do the thing 2. Something else is the agent – you get something else to execute the command under THEIR permissions, which are sufficient to do the thing DEFINITION AND FRAMING Privilege Escalation
  • 5. EASY MODE SO YOU’RE IN THE SERVER – NOW WHAT?
  • 6. 6 • Who are you? whoami id • Where are you? pwd • Are you really really lucky? cat /etc/shadow vs. cat /etc/passwd cd /root CHECK YOUR PRIVILEGE Before anything else
  • 7. 7 • Where do you have read access? /home/ /usr/share/ ENV • Where do you have write access? /home/USER/.ssh /root/ /etc/crontab CHECK YOUR PRIVILEGE Permissions
  • 8. 8 sudo = super user do [something] sudo –l • What commands can you execute? • Do you need a password? https://xkcd.com/838/ - Incident MAKE ME A SANDWICH sudo
  • 9. 9 sudo = super user do [something] sudo –l • What commands can you execute? • Do you need a password? MAKE ME A SANDWICH sudo cat /etc/sudoers • if readable, tells you which users/groups to target cat /etc/group • lists users, IDs, group affiliations
  • 10. 10 sudo –l • User has sudo permissions for python • Without needing the password – excellent! • Therefore can run python under root permissions sudo python –c ‘import pty;pty.spawn(“/bin/bash”);’ • New shell spawned by python also runs under root permissions SUDO MAKE ME A SANDWICH sudo Exploit - Python
  • 11. 11 Password reuse is RAMPANT • web application passwords • common/default passwords nmap port scan or ps auf to see what’s up • known compromised passwords for specific users https://xkcd.com/792/ - Password Reuse WE ARE CREATURES OF HABIT Credential Reuse
  • 12. 12 • Any passwords entered into history? • Any interesting files or directories? cat .bash_history vs history • .bash_history won’t dump current session data until session ends • history is a live dump of session LEAKED INFORMATION .bash_history
  • 13. 13 • Are any credentials stored in logs? • Any other useful information? Log files/dirs that are writeable can be replaced by symlink. When owning process tries to write to log, will write to symlink instead. Can be a way to output data somewhere that you can read it. LEAKED INFORMATION /var/log
  • 14. 14 1. Who/where are you 2. What can you see/modify with current permissions? 3. Look for: 1. sudo permissions 2. Credential Reuse 3. Leaked info from: 1. cat .bash_history 2. /var/log files Two ways to escalate: 1. You’re the agent – your current user permissions are sufficient to execute the command & do the thing 2. Something else is the agent – you get something else to execute the command under THEIR permissions, which are sufficient to do the thing RECAP Easy Mode
  • 15. SNEAKY MODE FIND AND EXPLOIT SOME MISCONFIGURATIONS
  • 16. 16 • What is the SUID/SGID bit? • How to find a SUID/SGID binary? • What runs as the root user? find / -perm -u=s [-type f] 2>/dev/null find / -perm -4000 [-type f] 2>/dev/null • What runs in the root group? find / -perm -g=s [-type f] 2>/dev/null find / -perm -2000 [-type f] 2>/dev/null CHECK THEIR PRIVILEGE SUID/SGID bits
  • 17. 17 • What are “normal” SUID programs vs ones that are exploitable? Standard Linux utility? Try shell escape or command option argument Custom script to make an admin’s life easy? Try PATH = . especially if the script makes a call to an alias Also watch for wildcards CHECK THEIR PRIVILEGE SUID/SGID bits
  • 18. 18 Binary Shell escape less !cmd more !cmd :!cmd vi :! cmd mysql system cmd ! cmd AND MANY MORE INTENTIONAL OPTION TO EXECUTE COMMANDS Shell escapes https://www.mariowiki.com/File:Koopa_Troopa_Artwork_- _Super_Mario_3D_World.png
  • 19. 19 Binary Option find -exec CMD ; awk ‘{system(“CMD”)}’ AND MANY MORE INTENTIONAL OPTION TO EXECUTE COMMANDS Cmd option arguments
  • 20. 20 TRICKING AN EXECUTABLE INTO SPAWNING A SHELL SUID Exploit Nano is another common executable If nano has a SUID bit set to root, can force an escape to root shell Exploit: 1. create a temporary file with shell cmd 2. open nano with temp file set as spell-check reference 3. run spell-check to execute cmd under root permissions
  • 21. 21 Path is an environment variable telling the OS where to look for an aliased binary Instead of typing /bin/ls every time, you can just type ls Use case: Prank the Admin • Bill knows that his supervisor Sue has her PATH = . • Writes a script to prank her, names it ls, sticks it in his /home/BILL/ directory • Asks Sue why ls isn’t working in his ~ • Sue runs ls in /home/BILL/ and executes the prank script instead of /bin/ls binary START LOOKING HERE Path = .
  • 22. 22 Not easy during assessment to know which users have PATH = . HOWEVER! Custom script on the web server might execute call to aliased program calling cat $FILE instead of /bin/cat $FILE If it runs under root privs, you can exploit it Use case: helperSH Exploit • helperSH is a custom script on the web server that makes life easy for an admin; SUID as root • Command within the script executes something recognizable (like ps) • In writeable dir, make new file echo “/bin/sh” > ps • Set own PATH = . • Execute script from writeable dir START LOOKING HERE Path = .
  • 23. 23 Use case: helperSH Exploit • helperSH is a custom script on the web server that makes life easy for an admin; SUID as root • Command within the script executes something recognizable (like ps) • In writeable dir, make new file echo “/bin/sh” > ps • Set own PATH = . • Execute script from writeable dir START LOOKING HERE Path = .
  • 24. 24 When using * wildcard, Unix shell interprets –FILENAME as command option argument Meaning you can submit command options through file name when running a wildcard process Keep an eye out for wildcards in custom scripts, cron jobs, executables chown example files in a given dir include: .FileRef.php --reference=.FileRef.php when root executes the following: chown –R nobody:nobody *.php becomes: chown –R nobody:nobody --reference=.FileRef.php User:group permissions of .FileRef.php are mapped onto every file in the directory COMMAND OPTION ARGUMENTS AS FILENAMES Wildcards
  • 25. 25 When using * wildcard, Unix shell interprets –FILENAME as command option argument Meaning you can submit command options through file name when running a wildcard process Keep an eye out for wildcards in custom scripts, cron jobs, executables NOTE – EXPLOIT BELOW DELETES THE FILESYSTEM cd /tmp echo “blah” > “-rf /*” rm * When rm * gets to –rf /* file, command becomes rm –rf /* Which recursively deletes everything on the filesystem, starting at / COMMAND OPTION ARGUMENTS AS FILENAMES Wildcards
  • 26. 26 SUID/SGID bits 1. Shell escapes 2. Cmd option arguments 3. PATH = . Wildcards Two ways to escalate: 1. You’re the agent – your current user permissions are sufficient to execute the command & do the thing 2. Something else is the agent – you get something else to execute the command under THEIR permissions, which are sufficient to do the thing RECAP Sneaky Mode
  • 27. BOSS MODE THESE WILL TAKE SOME TIME TO GET RIGHT
  • 28. 28 Cron jobs are cmds executed on a schedule Almost always run under root permissions • /etc/cron.allow & /etc/cron.deny specify user privs Cron takes a file; file tells it what to execute and when • /etc/crontab Related: at, batch (one-time execution) PRIVILEGE IS A CRONIC PROBLEM cron • How to exploit? 1. Overwrite /etc/crontab 2. Write to a cron dir (priv misconfig) 3. If the what is vulnerable, might be able to modify or hit something downstream 4. Cron jobs may also have exploitable wildcards
  • 29. 29 PRIVILEGE IS A CRONIC PROBLEM cron • How to exploit? 1. Overwrite /etc/crontab (SUID on nano!) 2. Write to a cron dir (priv misconfig) 3. If the what is vulnerable, might be able to modify or hit something downstream 4. Cron jobs may also have exploitable wildcards
  • 30. 30 PRIVILEGE IS A CRONIC PROBLEM cron • How to exploit? 1. Overwrite /etc/crontab 2. Write to a cron dir (priv misconfig) 3. If the what is vulnerable, might be able to modify or hit something downstream 4. Cron jobs may also have exploitable wildcards
  • 31. 31 PRIVILEGE IS A CRONIC PROBLEM cron • How to exploit? 1. Overwrite /etc/crontab 2. Write to a cron dir (priv misconfig) 3. If the what is vulnerable, might be able to modify or hit something downstream 4. Cron jobs may also have exploitable wildcards
  • 32. 32 Magic bullet: what if we just compromise the server OS itself??! Downside: there might be exploits that you need to grab & compile & debug NOTE: not-small risk of bricking the server HOPE YOU LIKE DEBUGGING IN C Kernel Exploits LSB_RELEASE -A UNAME -A
  • 33. 33 Cron jobs 1. /etc/crontab 2. writeable cron dir 3. affect process downstream Kernel exploits Two ways to escalate: 1. You’re the agent – your current user permissions are sufficient to execute the command & do the thing 2. Something else is the agent – you get something else to execute the command under THEIR permissions, which are sufficient to do the thing RECAP Boss Mode
  • 34. THAT’S ONE IN THE BANK LET ME SUM UP
  • 35. 35 Typical goal in server: persistence + privilege escalation Linux tends to be consistent in its core utilities; get familiar with what’s there and where it lives, and spotting vulnerable paths gets a lot easier • Are you the agent? Drop into a root shell & give yourself persistence • Is something else the agent? Need an intermediate step – get something to help you out ONE HOUR IN ONE SLIDE Summary • Easy mode • Who are you? • Where are you? • What can you do? • Sneaky mode • SUID/SGID bits: shell escapes, cmd option args, PATH = . • Wildcards • Boss mode • Cron jobs • Kernel exploits
  • 36. 36 • https://payatu.com/guide-linux-privilege-escalation/ • http://www.securitysift.com/download/ linuxprivchecker.py • https://exploit-db.com • https://www.linode.com/docs/tools-reference/linux-users- and-groups/ • https://resources.infosecinstitute.com/ privilege-escalation-linux-live-examples/ • https://www.hackingarticles.in/exploiting-wildcard-for- privilege-escalation/ • https://percussiveelbow.github.io/linux-privesc/ I’M REAL FRIENDLY Resources & Contact kbroussard@bishopfox.com @grazhacks on Twitter SLIDE DECK http://github.com/ grazhacks/BSidesCMH2019 PRACTICE VM http://bit.ly/ BSidesCMH2019
  • 37. Thank You! Questions? kbroussard@bishopfox.com @grazhacks on Twitter SLIDE DECK http://github.com/ grazhacks/BSidesCMH2019 PRACTICE VM http://bit.ly/ BSidesCMH2019