Manual Exploitaion
Windows Structure
Named drives i.e. A, B, C, D
\Program Files and \Program Files (x86)
all programs are in these two directories
x86 is for 32-bit and 16-bit programs
\Users
User profile folders which contain files for that specific user
Desktop, Downloads, Documents, Picture, Music
\Windows
Have both \system and \system32 folders
Contain exe and dll files
\Inetpub Default directory for IIS (web server)
Operating System
What is the OS and architecture? Is it missing any patches? (!)
Users
Who are you? (!)
All users
What users are on the system? Any old user profiles that weren’t cleaned up? We list the other user accounts on the box and view our own user's information in a bit more detail.
Add User
Adding user that is part of the Administrator group
Groups
What groups are on the system?
Autologon
Anything in the Registry for User Autologon?
if we got any auto log on enabled , we can use the winexe command to spawn a shell using these credentials:
Programs, Processes, and Services
Softwares
What software is installed?
Services
What are the running processes/services on the system? Is there an inside service not exposed? If so, can we open it?
This one liner returns the process owner without admin rights, if something is blank under owner it’s probably running as SYSTEM, NETWORK SERVICE, or LOCAL SERVICE.
scheduled tasks
What scheduled tasks are there? Anything custom implemented?
Networking
NICs
What NICs are connected? Are there multiple networks?
Routes
What routes do we have?
ARP
Anything in the ARP cache?
Connections
Are there connections to other hosts?
Host File
Firewall
Is the firewall turned on? If so what’s configured?
Enable RDP
SNMP configurations
Weak Files and Folder permissions
Listing files
Icacls
Are there any weak folder or file permissions? Full Permissions for Everyone or Users on Program Folders?
Modify Permissions for Everyone or Users on Program Folders?
Sensitive Information
Yes, passwords.
Even administrators re-use their passwords, or leave their passwords on systems in readable locations.
Windows can be especially vulnerable to this, as several features of Windows store passwords insecurely.
Registry
Searching registry for password
If we got any credentials we can use winexe
to login into box
Autologon
Anything in the Registry for User Autologon?
if we got any auto log on enabled , we can use the winexe command to spawn a shell using these credentials:
Saved Creds
Windows has a runas
command which allows users to run commands with the privileges of other users.
This usually requires the knowledge of the other user’s password.
However, Windows also allows users to save their credentials to the system, and these saved credentials can be used to bypass this requirement.
We can use the saved credential to run any command as the admin user. Start a listener on Kali and run the reverse shell executable:
Configuration Files
Some administrators will leave configurations files on the system with passwords in them.
The Unattend.xml file is an example of this.
It allows for the largely automated setup of Windows systems.
Is XAMPP, Apache, or PHP installed? Any there any XAMPP, Apache, or PHP configuration files?
Once again we can simply use winexe to spawn a shell as the admin user.
Unattend and sysprep
IIS
If the server is an IIS webserver, what’s in inetpub? Any hidden directories? web.config files?
What’s in the IIS Logs?
Unquoted Service Path
The Unquoted Service Paths vulnerability is a vulnerability that arises out of the way Windows interprets a file path for a service binary (executable). File paths that contain spaces, should be enclosed in double-quotes. If not, there’s a potential Unquoted Service Path vulnerability.
For example, the following path would be vulnerable:
Not vulnerable
We could place our payload with any of the following paths:
Required Things -
A service with an "unquoted" binary path containing one or more spaces in the path.
Write permission for any of the folder containing spaces.
A way to reboot the service or system in order to execute a payload.
Finding unquoted services
Checking writable permission
Creating malicious program
Managing Services
once we transferred our payload to particular directory , we can restart the service to execute it
AlwaysInstallElevated
AlwaysInstallElevated is a Windows setting that allows non-privileged users to install Microsoft Windows Installer Package Files (MSI) with elevated system permissions. This means that we can use this feature to execute a malicious MSI installer package with administrator permissions. To achieve this, two registry entries have to be set to the value 1 to be enabled.
Check the value of these registry keys
Generating Payload
Executing msi file
Unattended Installs
Unattended Installs allow Windows to be deployed with little or no active involvement from an administrator. If administrators fail to clean up after such a process, an EXtensible Markup Language (XML) file called Unattend is left on the local system. This file contains all the configuration settings that were set during the installation process, some of which can involve the configuration of local accounts including Administrator accounts!
Unattend credentials are stored in base64 and can be decoded manually with base64.
$PATH Interception
Requirements:
PATH contains a writeable folder with low privileges.
The writeable folder is before the folder that contains the legitimate binary.
List contents of the PATH environment variables
Checking writable permission
Placing malicious binary
Kernel Exploitation
Finding kernel exploit
Finding and using kernel exploits is usually a simple process:
Enumerate Windows version / patch level (systeminfo).
Find matching exploits (Google, ExploitDB, GitHub).
Compile and run.
Known Exploits
List of exploits kernel : https://github.com/SecWiki/windows-kernel-exploits
#Security Bulletin #KB #Description #Operating System
MS17-017 [KB4013081] [GDI Palette Objects Local Privilege Escalation] (windows 7/8)
CVE-2017-8464 [LNK Remote Code Execution Vulnerability] (windows 10/8.1/7/2016/2010/2008)
CVE-2017-0213 [Windows COM Elevation of Privilege Vulnerability] (windows 10/8.1/7/2016/2010/2008)
CVE-2018-0833 [SMBv3 Null Pointer Dereference Denial of Service] (Windows 8.1/Server 2012 R2)
CVE-2018-8120 [Win32k Elevation of Privilege Vulnerability] (Windows 7 SP1/2008 SP2,2008 R2 SP1)
MS17-010 [KB4013389] [Windows Kernel Mode Drivers] (windows 7/2008/2003/XP)
MS16-135 [KB3199135] [Windows Kernel Mode Drivers] (2016)
MS16-111 [KB3186973] [kernel api] (Windows 10 10586 (32/64)/8.1)
MS16-098 [KB3178466] [Kernel Driver] (Win 8.1)
MS16-075 [KB3164038] [Hot Potato] (2003/2008/7/8/2012)
MS16-034 [KB3143145] [Kernel Driver] (2008/7/8/10/2012)
MS16-032 [KB3143141] [Secondary Logon Handle] (2008/7/8/10/2012)
MS16-016 [KB3136041] [WebDAV] (2008/Vista/7)
MS16-014 [K3134228] [remote code execution] (2008/Vista/7) ...
MS03-026 [KB823980] [Buffer Overrun In RPC Interface] (/NT/2000/XP/2003)
Important Tools
Windows Exploit Suggester: https://github.com/bitsadmin/wesng
Precompiled Kernel Exploits: https://github.com/SecWiki/windows-kernel-exploits
Watson: https://github.com/rasta-mouse/Watson
Hot Potatoes
Service Accounts -
Service accounts can be given special privileges in order for them to run their services, and cannot be logged into directly.
Unfortunately, multiple problems have been found with service accounts, making them easier to escalate privileges with.
"SeImpersonatePrivilege" is enabled so we can impersonate other users
If the machine is >= Windows 10 1809 & Windows Server 2019 - Try Rogue Potato If the machine is < Windows 10 1809 < Windows Server 2019 - Try Juicy Potato
Juicy Potato
Vulnerable Win versions
1. Create paylaod
2. Transfer shell.bat and jp.exe to target box
3. Run JuicyPotato
Along with community string if default is failed
CLSID List -
Rogue Potato
Binary available at https://github.com/antonioCoco/RoguePotato
Insecure Service PermissionsEach service has an ACL which defines certain service-specific permissions.
Some permissions are innocuous (e.g. SERVICE_QUERY_CONFIG, SERVICE_QUERY_STATUS).
Some may be useful (e.g. SERVICE_STOP, SERVICE_START).
Some are dangerous (e.g. SERVICE_CHANGE_CONFIG, SERVICE_ALL_ACCESS)
If our user has permission to change the configuration of a service which runs with SYSTEM privileges, we can change the executable the service uses to one of our own.
Potential Rabit Hole: If you can change a service configuration but cannot stop/start the service, you may not be able to escalate privileges!
Identifying Service
The following commands will print the affected services:
Check the current configuration and status of the service
Putting our malicious payload
Starting service
start listener on your kali and start the service on target box
Weak Registry Permissions
The Windows registry stores entries for each service. Since registry entries can have ACLs, if the ACL is misconfigured, it may be possible to modify a service’s configuration even if we cannot modify the service directly.
Identifying weak registry
Overwriting registry key to add reverse shell
Starting service
start listener on your kali and start the service on target box
Last updated