Rednote
GuidebooksTerminalCode
  • Welcome!
  • Utility
    • General
    • Server
    • Transferring File
      • Main
      • Code
      • Miscellaneous
    • Reverse & Bind Shells
      • Havoc
    • Metasploit
    • Service
      • FTP (21)
      • SSH (22)
      • DNS (53)
      • HTTP/HTTPS (80-443)
      • SMTP (25-465-587)
      • POP3 (110-995)
      • IMAP (143-993)
      • MySQL (3306)
      • MSSQL (1433-2433)
      • SMB (139-445)
      • RDP (3389)
      • WinRM (5985-5986)
      • WMI (135)
      • LLMNR & NBT-NS (5355-137)
      • NFS (111-2049)
      • SNMP (161-162)
      • VNC (5900)
      • Rsync (873)
      • R-Service (512-513-514)
      • IPMI (623)
      • Oracle TNS (1521)
  • Pentesting Process
    • Information Gathering
      • Passive
      • Active
      • OSINT
    • Vulnerability
    • Web Attacks
      • GENERAL
      • Crawling/Spidering & Fuzzing
      • Information Disclosure
      • Command Injection
      • Unrestricted File Upload
      • File Inclusion/Path Traversal
      • Request Smuggling
      • Clickjacking
      • Web Cache Poisoning
      • Web Cache Deception
      • Insecure Deserialization
      • Prototype Pollution
      • OAuth 2.0
      • JWT
      • SQLi
        • sqlmap
      • NoSQLi
      • GraphQL
      • XSS
      • SSRF
      • XXE
      • IDOR
      • API
      • SSTI
      • CSRF
      • CORS
      • AJP
      • SSI
      • ESI
      • XSLT
      • Cloud
      • LLM Prompt Security
    • Software Attacks
      • Binary
      • Shellcode
      • AV Evasion & Obfuscation
    • Network Attacks
      • ARP Poisoning
      • Local DNS Cache Poisoning
      • Baby Local DoS
    • Crypto Attacks
      • Utility
      • RSA
      • DSA/DSS
      • PRNG
        • LGC
        • MT
        • LFSR
    • Misc Attacks
    • Social Engineering
    • Password Cracking
      • Wordlist
      • Offline
      • Online
    • Pivoting & Tunneling
    • Local Enumeration
      • Linux
      • Windows
    • Privilege Escalation
      • Linux
        • Linux Privilege Escalation with Groups
        • Linux Privilege Escalation with Library
      • Windows
        • Windows Privilege Escalation with Groups and Privileges
        • Windows Privilege Escalation with DLL Hijacking
    • Active Directory
      • Enumeration
      • Abuse ACL
      • Extract Hash & Password
      • Pass The Hash
      • Pass The Ticket
      • Overpass the Hash
      • Relay Attack
      • Password Spraying Attack
      • AS-REP Roasting
      • Kerberoasting
      • Silver Ticket
      • Golden Ticket
      • DC Synchronization
      • AD Certificates
      • Attacking Domain Trusts
    • Reports
      • Bug Bounty Report
    • CVE
      • Linux
      • Windows
    • OTHER
      • CMS
        • WordPress
        • Joomla
        • Drupal
      • Tomcat
      • Jenkins
      • Splunk
      • Web Service
      • Navigating Python Objects
      • JavaScript Deobfuscation
  • Extra
    • My Books
    • My Exploits
    • Compiled Binaries
Powered by GitBook
On this page
  • Enumeration
  • Functionality
  • SUDO
  • SUID Program
  • SGID Program
  • Capabilities
  • Groups
  • Programms
  • Process
  • Cron Jobs
  • pspy
  • File
  • Documents
  • SSH keys
  • Config
  • Backup
  • Script
  • Writable Files and Directories
  • Hidden Files and Directories
  • Password
  • Browser
  • Various
  • History
  • Variables
  • Library
  • Passive Traffic
  • Restricted Shells
  • Kernel

Was this helpful?

  1. Pentesting Process
  2. Privilege Escalation

Linux

Last updated 1 month ago

Was this helpful?

Enumeration

Tool
Details

./LinEnum.sh -e <OUTPUT_FILE>

Security auditing tool for Linux, macOS and UNIX-based systems. Test security defenses. ./lynis audit system

Functionality

shows how to exploit SUID, Capabilities, and SUDO vulnerabilities on known programs.

SUDO

The sudo utility (Superuser-Do) can be used to run a command with elevated privileges. Must be a member of the sudo group.

sudo -V   # if vulnerable version
sudo -l

See NOPASSWD entries. Also remember abuse of relative paths and Wildcard.

SUID Program

Programs with the SUID flag will run with owner privileges. Analyze these programs.

find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} \; 2>/dev/null

SGID Program

Programs with the SGID flag run binaries as if we were part of the group that created them. Analyze these programs.

find / -perm -g=s -type f 2>/dev/null
find / -user root -perm -6000 -exec ls -ldb {} \; 2>/dev/null

Capabilities

Capabilities are additional attributes that can be applied to processes, binaries, and services to assign specific privileges (ex., administrative). Analyze the presence of misconfigurations.

/usr/sbin/getcap -r / 2>/dev/null
find /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin -type f -exec getcap {} \;

Groups

If the user is part of some privileged groups then he can perform privileged and particularly harmful actions.

id # see groups

Programms

Process

Cron Jobs

Look through the Cron Jobs if they are called editable files to be exploited.

ls -lah /etc/cron* 
crontab -l

Also remember abuse via Wildcard.

Command-line tool designed to snoop around linux processes without needing root permissions. It allows you to see commands executed by other users, cron jobs, etc. while they are running.

./pspy32  
./pspy32s # short version
./pspy64  
./pspy64s # short version

File

Documents

Search for sensitive information in different files, such as system password files, files in the home profile, text files saved on Desktop/Documents, temporary files, etc.

# See if readable and writable
cat /etc/passwd
cat /etc/shadow
cat /etc/security/opasswd

Note: In /etc/passwd and /etc/shadow you can remove the x or insert instead the output of: openssl passwd <PASS>. Or you can add <USER> ALL=(ALL:ALL) ALL | <USER> ALL=(ALL) NOPASSWD: ALL in /etc/sudoers.

cat ~/.bashrc
cat ~/.bash_profile
ls /tmp
ls /var/tmp
ls /dev/shm

SSH keys

Look for ssh keys which may also be located elsewhere in the file system.

ls ~/.ssh
# check known_hosts to find out key targets
grep -rnw "PRIVATE KEY" /* 2>/dev/null | grep ":1"
grep -rnw "ssh-rsa" /* 2>/dev/null | grep ":1"

Config

Search for sensitive information in configuration files.

for l in $(echo ".conf .config .cnf");do echo -e "\n-->" $l; find / -name *$l 2>/dev/null | grep -v "lib\|fonts\|share\|core" ; done
find / ! -path "*/proc/*" -iname "*config*" -type f 2>/dev/null | grep -v "lib\|fonts\|share\|core

Backup

Check if there are any backup files that may contain sensitive information.

find / -name ‘*.bak’ 2>/dev/null

Script

Also check the bash scripts.

find / -name *.sh 2>/dev/null | grep -v "doc\|lib\|headers\|share\|src\|snap";

Writable Files and Directories

Check if there are any interesting writable files and folders.

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

Hidden Files and Directories

Check if there are any interesting hidden files and folders with sensitive information.

find / -type f -name ".*" -exec ls -l {} \; 2>/dev/null | grep <USER>
find / -type d -name ".*" -ls 2>/dev/null

Password

Tool
Details

It searches for passwords. laZagne.py all

A tool to download the current Linux user's login password.

Browser

Tool
Details

Extract sensitive data, including passwords, from browsers. ./hack-browser-data[.exe] (check the results directory)

Various

History

Search the command history.

cat ~/.*history
history
find / -type f \( -name *_hist -o -name *_history \) -exec ls -l {} \; 2>/dev/null

Variables

Check environment variables for sensitive information such as passwords or misconfiguration.

env
echo $PATH

Library

For ELFs see if you can manipulate the LD_PRELOAD variable or the RUNPATH setting of the binaries. In Python see if you can manipulate the PYTHONPATH variable or if there are writable directories in the module import.

Passive Traffic

Tool
Details

Capture sensitive information from live network traffic, with tcpdump

Restricted Shells

Certain users may be assigned shells with limited functionality, such as rbash, rksh, rzsh

compgen -c

Also try

  • Command injection with `

  • Command Chaining with ; & |

  • Variable changes (export -p)

  • Shell functions

Kernel

Exploit Kernel Level. Depends on Kernel Version and Operating System. Better to compile the exploit on the target if it has gcc. May cause crashes!

Tool
Details

It allows you to detect kernel-level security weaknesses.

. In .

See versions of various executable programs to check for Privilege Escalation exploits. See section.

Check executable commands and look for them in

See section.

Docker
LXD / LXC
disk
adm
CVE
pspy
LD_PRELOAD
RUNPATH
PYTHONPATH
GTFOBins
Linux-CVE
LinPEAS
DOWNLOAD
Metasploit
LinEnum
Lynis
LaZagne
mimipenguin
HackBrowserData
PCredz
Linux-Exploit-Suggester
GTFOBins
GTFOBins
Logo