1
mirror of https://github.com/carlospolop/PEASS-ng synced 2024-11-27 14:13:38 +01:00

Added well-known SIDs

This commit is contained in:
carlospolop 2020-01-29 13:30:58 -05:00
parent 4cc980ee58
commit 64b41fb552
25 changed files with 2142 additions and 11 deletions

21
winPEAS/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Carlos Polop
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,14 +1,16 @@
# Windows Privilege Escalation Awesome Scripts # PEASS - Privilege Escalation Awesome Scripts SUITE
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/winpeas.png) ![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/linPEAS/images/peass.png)
Check the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)** Here you will find **privilege escalation tools for Windows and Linux/Unix\*** (in some near future also for Mac).
Check more **information about how to exploit** found misconfigurations in **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/windows-local-privilege-escalation)** These tools search for possible **local privilege escalation paths** that you could exploit and print them to you **with nice colors** so you can recognize the misconfigurations easily.
## WinPEAS .exe and .bat - Check the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)**
- [Link to WinPEAS C# project (.exe)](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASexe) - **[WinPEAS](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) - Windows local Privilege Escalation Awesome Script (C#.exe and .bat)**
- [Link to WinPEAS .bat project](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASbat) Notice that WinPEAS.bat is a batch script made for Windows systems which don't support WinPEAS.exe (Net.4 required)
- Check the **Local Linux Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/linux-unix/linux-privilege-escalation-checklist)**
- **[LinPEAS](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) - Linux local Privilege Escalation Awesome Script (.sh)**
## Let's improve PEASS together ## Let's improve PEASS together
@ -24,7 +26,8 @@ Contact me and ask about the **Privilege Escalation Course** I am preparing for
## Advisory ## Advisory
All the scripts/binaries of the PEAS Suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own networks and/or with the network owner's permission. All the scripts/binaries of the PEAS suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own networks and/or with the network owner's permission.
## License ## License

277
winPEAS/linPEAS/README.md Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

1679
winPEAS/linPEAS/linpeas.sh Normal file

File diff suppressed because one or more lines are too long

View File

@ -92,7 +92,10 @@ namespace winPEAS
{ {
gName = UserInfo.SID2GroupName(group.ToString()); gName = UserInfo.SID2GroupName(group.ToString());
} }
catch { } catch (Exception ex)
{
Beaprint.GrayPrint("Error obtaining current SIDs: " + ex);
}
currentUserSIDs[group.ToString()] = gName; currentUserSIDs[group.ToString()] = gName;
} }

View File

@ -5,6 +5,7 @@ using System.DirectoryServices.AccountManagement;
using System.Security.Principal; using System.Security.Principal;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using System.Text.RegularExpressions;
//Configuring Fody: https://tech.trailmax.info/2014/01/bundling-all-your-assemblies-into-one-or-alternative-to-ilmerge/ //Configuring Fody: https://tech.trailmax.info/2014/01/bundling-all-your-assemblies-into-one-or-alternative-to-ilmerge/
//I have also created the folder Costura32 and Costura64 with the respective Dlls of Colorful.Console //I have also created the folder Costura32 and Costura64 with the respective Dlls of Colorful.Console
@ -349,10 +350,139 @@ namespace winPEAS
return myItems; return myItems;
} }
public static string staticSID2GroupName(string SID)
{
Dictionary<string, string> known_SID_dic = new Dictionary<string, string>()
{
//From https://support.microsoft.com/en-us/help/243330/well-known-security-identifiers-in-windows-operating-systems
{ "S-1-0", "Null Authority" }, //An identifier authority.
{ "S-1-0-0", "Nobody" }, //No security principal.
{ "S-1-1", "World Authority" }, //An identifier authority.
{ "S-1-1-0", "Everyone" }, //A group that includes all users, even anonymous users and guests. Membership is controlled by the operating system.
{ "S-1-2", "Local Authority" }, //An identifier authority.
{ "S-1-2-0", "Local" }, //A group that includes all users who have logged on locally.
{ "S-1-3", "Creator Authority" }, //An identifier authority.
{ "S-1-3-0", "Creator Owner" }, //A placeholder in an inheritable access control entry (ACE). When the ACE is inherited, the system replaces this SID with the SID for the object's creator.
{ "S-1-3-1", "Creator Group" }, //A placeholder in an inheritable ACE. When the ACE is inherited, the system replaces this SID with the SID for the primary group of the object's creator. The primary group is used only by the POSIX subsystem.
{ "S-1-3-4", "Owner Rights" }, //A group that represents the current owner of the object. When an ACE that carries this SID is applied to an object, the system ignores the implicit READ_CONTROL and WRITE_DAC permissions for the object owner.
{ "S-1-4", "Non-unique Authority" }, //An identifier authority.
{ "S-1-5", "NT Authority" }, //An identifier authority.
{ "S-1-5-1", "Dialup" }, //A group that includes all users who have logged on through a dial-up connection. Membership is controlled by the operating system.
{ "S-1-5-2", "Network" }, //A group that includes all users that have logged on through a network connection. Membership is controlled by the operating system.
{ "S-1-5-3", "Batch" }, //A group that includes all users that have logged on through a batch queue facility. Membership is controlled by the operating system.
{ "S-1-5-4", "Interactive" }, //A group that includes all users that have logged on interactively. Membership is controlled by the operating system.
{ "S-1-5-5-.+-.+", "Logon Session" }, //A logon session. The X and Y values for these SIDs are different for each session.
{ "S-1-5-6", "Service" }, //A group that includes all security principals that have logged on as a service. Membership is controlled by the operating system.
{ "S-1-5-7", "Anonymous" }, //A group that includes all users that have logged on anonymously. Membership is controlled by the operating system.
{ "S-1-5-9", "Enterprise Domain Controllers" }, //A group that includes all domain controllers in a forest that uses an Active Directory directory service. Membership is controlled by the operating system.
{ "S-1-5-10", "Principal Self" }, //A placeholder in an inheritable ACE on an account object or group object in Active Directory. When the ACE is inherited, the system replaces this SID with the SID for the security principal who holds the account.
{ "S-1-5-11", "Authenticated Users" }, //A group that includes all users whose identities were authenticated when they logged on. Membership is controlled by the operating system.
{ "S-1-5-12", "Restricted Code" }, //This SID is reserved for future use.
{ "S-1-5-13", "Terminal Server Users" }, //Terminal Server Users
{ "S-1-5-14", "Remote Interactive Logon" }, //Remote Interactive Logon
{ "S-1-5-17", "This Organization" }, //An account that is used by the default Internet Information Services (IIS) user.
{ "S-1-5-18", "Local System" }, //A service account that is used by the operating system.
{ "S-1-5-19", "NT Authority\\Local Service" },
{ "S-1-5-20", "NT Authority\\Network Service" },
{ "S-1-5-21.+-500", "Administrator" }, //A user account for the system administrator. By default, it is the only user account that is given full control over the system.
{ "S-1-5-21.+-501", "Guest" }, //A user account for people who do not have individual accounts. This user account does not require a password. By default, the Guest account is disabled.
{ "S-1-5-21.+-502", "KRBTGT" }, //A service account that is used by the Key Distribution Center (KDC) service.
{ "S-1-5-21.+-512", "Domain Admins" }, //A global group whose members are authorized to administer the domain. By default, the Domain Admins group is a member of the Administrators group on all computers that have joined a domain, including the domain controllers. Domain Admins is the default owner of any object that is created by any member of the group.
{ "S-1-5-21.+-513", "Domain Users" }, //A global group that, by default, includes all user accounts in a domain. When you create a user account in a domain, it is added to this group by default.
{ "S-1-5-21.+-514", "Domain Guests" }, //A global group that, by default, has only one member, the domain's built-in Guest account.
{ "S-1-5-21.+-515", "Domain Computers" }, //A global group that includes all clients and servers that have joined the domain.
{ "S-1-5-21.+-516", "Domain Controllers" }, //A global group that includes all domain controllers in the domain. New domain controllers are added to this group by default.
{ "S-1-5-21.+-517", "Cert Publishers" }, //A global group that includes all computers that are running an enterprise certification authority. Cert Publishers are authorized to publish certificates for User objects in Active Directory.
{ "S-1-5-21.+-518", "Schema Admins" }, //A universal group in a native-mode domain; a global group in a mixed-mode domain. The group is authorized to make schema changes in Active Directory. By default, the only member of the group is the Administrator account for the forest root domain.
{ "S-1-5-21.+-519", "Enterprise Admins" }, //A universal group in a native-mode domain; a global group in a mixed-mode domain. The group is authorized to make forest-wide changes in Active Directory, such as adding child domains. By default, the only member of the group is the Administrator account for the forest root domain.
{ "S-1-5-21.+-520", "Group Policy Creator Owners" }, //A global group that is authorized to create new Group Policy objects in Active Directory. By default, the only member of the group is Administrator.
{ "S-1-5-21.+-526", "Key Admins" }, //A security group. The intention for this group is to have delegated write access on the msdsKeyCredentialLink attribute only. The group is intended for use in scenarios where trusted external authorities (for example, Active Directory Federated Services) are responsible for modifying this attribute. Only trusted administrators should be made a member of this group.
{ "S-1-5-21.+-527", "Enterprise Key Admins" }, //A security group. The intention for this group is to have delegated write access on the msdsKeyCredentialLink attribute only. The group is intended for use in scenarios where trusted external authorities (for example, Active Directory Federated Services) are responsible for modifying this attribute. Only trusted administrators should be made a member of this group.
{ "S-1-5-21.+-553", "RAS and IAS Servers" }, //A domain local group. By default, this group has no members. Servers in this group have Read Account Restrictions and Read Logon Information access to User objects in the Active Directory domain local group.
{ "S-1-5-32-544", "Administrators" }, //A built-in group. After the initial installation of the operating system, the only member of the group is the Administrator account. When a computer joins a domain, the Domain Admins group is added to the Administrators group. When a server becomes a domain controller, the Enterprise Admins group also is added to the Administrators group.
{ "S-1-5-32-545", "Users" }, //A built-in group. After the initial installation of the operating system, the only member is the Authenticated Users group. When a computer joins a domain, the Domain Users group is added to the Users group on the computer.
{ "S-1-5-32-546", "Guests" }, //A built-in group. By default, the only member is the Guest account. The Guests group allows occasional or one-time users to log on with limited privileges to a computer's built-in Guest account.
{ "S-1-5-32-547", "Power Users" }, //A built-in group. By default, the group has no members. Power users can create local users and groups; modify and delete accounts that they have created; and remove users from the Power Users, Users, and Guests groups. Power users also can install programs; create, manage, and delete local printers; and create and delete file shares.
{ "S-1-5-32-548", "Account Operators" }, //A built-in group that exists only on domain controllers. By default, the group has no members. By default, Account Operators have permission to create, modify, and delete accounts for users, groups, and computers in all containers and organizational units of Active Directory except the Builtin container and the Domain Controllers OU. Account Operators do not have permission to modify the Administrators and Domain Admins groups, nor do they have permission to modify the accounts for members of those groups.
{ "S-1-5-32-549", "Server Operators" }, //A built-in group that exists only on domain controllers. By default, the group has no members. Server Operators can log on to a server interactively; create and delete network shares; start and stop services; back up and restore files; format the hard disk of the computer; and shut down the computer.
{ "S-1-5-32-550", "Print Operators" }, //A built-in group that exists only on domain controllers. By default, the only member is the Domain Users group. Print Operators can manage printers and document queues.
{ "S-1-5-32-551", "Backup Operators" }, //A built-in group. By default, the group has no members. Backup Operators can back up and restore all files on a computer, regardless of the permissions that protect those files. Backup Operators also can log on to the computer and shut it down.
{ "S-1-5-32-552", "Replicators" }, //A built-in group that is used by the File Replication service on domain controllers. By default, the group has no members. Do not add users to this group.
{ "S-1-5-32-582", "Storage Replica Administrators" }, //A built-in group that grants complete and unrestricted access to all features of Storage Replica.
{ "S-1-5-64-10", "NTLM Authentication" }, //An SID that is used when the NTLM authentication package authenticated the client.
{ "S-1-5-64-14", "SChannel Authentication" }, //An SID that is used when the SChannel authentication package authenticated the client.
{ "S-1-5-64-21", "Digest Authentication" }, //An SID that is used when the Digest authentication package authenticated the client.
{ "S-1-5-80", "NT Service" }, //An NT Service account prefix.
{ "S-1-3-2", "Creator Owner Server" }, //This SID is not used in Windows 2000.
{ "S-1-3-3", "Creator Group Server" }, //This SID is not used in Windows 2000.
{ "S-1-5-8", "Proxy" }, //This SID is not used in Windows 2000.
{ "S-1-5-15", "This Organization" }, //A group that includes all users from the same organization. Only included with AD accounts and only added by a Windows Server 2003 or later domain controller.
{ "S-1-5-32-554", "Builtin\\Pre-Windows 2000 Compatible Access" }, //An alias added by Windows 2000. A backward compatibility group which allows read access on all users and groups in the domain.
{ "S-1-5-32-555", "Builtin\\Remote Desktop Users" }, //An alias. Members in this group are granted the right to log on remotely.
{ "S-1-5-32-556", "Builtin\\Network Configuration Operators" }, //An alias. Members in this group can have some administrative privileges to manage configuration of networking features.
{ "S-1-5-32-557", "Builtin\\Incoming Forest Trust Builders" }, //An alias. Members of this group can create incoming, one-way trusts to this forest.
{ "S-1-5-32-558", "Builtin\\Performance Monitor Users" }, //An alias. Members of this group have remote access to monitor this computer.
{ "S-1-5-32-559", "Builtin\\Performance Log Users" }, //An alias. Members of this group have remote access to schedule logging of performance counters on this computer.
{ "S-1-5-32-560", "Builtin\\Windows Authorization Access Group" }, //An alias. Members of this group have access to the computed tokenGroupsGlobalAndUniversal attribute on User objects.
{ "S-1-5-32-561", "Builtin\\Terminal Server License Servers" }, //An alias. A group for Terminal Server License Servers. When Windows Server 2003 Service Pack 1 is installed, a new local group is created.
{ "S-1-5-32-562", "Builtin\\Distributed COM Users" }, //An alias. A group for COM to provide computerwide access controls that govern access to all call, activation, or launch requests on the computer.
{ "S-1-2-1", "Console Logon" }, //A group that includes users who are logged on to the physical console.
{ "S-1-5-21.+-498", "Enterprise Read-only Domain Controllers" }, //A universal group. Members of this group are read-only domain controllers in the enterprise.
{ "S-1-5-21.+-521", "Read-only Domain Controllers" }, //A global group. Members of this group are read-only domain controllers in the domain.
{ "S-1-5-21.+-571", "Allowed RODC Password Replication Group" }, //A domain local group. Members in this group can have their passwords replicated to all read-only domain controllers in the domain.
{ "S-1-5-21.+-572", "Denied RODC Password Replication Group" }, //A domain local group. Members in this group cannot have their passwords replicated to any read-only domain controllers in the domain.
{ "S-1-5-32-569", " Builtin\\Cryptographic Operators" }, //A built-in local group. Members are authorized to perform cryptographic operations.
{ "S-1-5-32-573", "Builtin\\Event Log Readers" }, //A built-in local group. Members of this group can read event logs from local computer.
{ "S-1-5-32-574", "Builtin\\Certificate Service DCOM Access" }, //A built-in local group. Members of this group are allowed to connect to Certification Authorities in the enterprise.
{ "S-1-5-80-0", "NT Services\\All Services" }, //A group that includes all service processes that are configured on the system. Membership is controlled by the operating system.
{ "S-1-5-83-0", "NT Virtual Machine\\Virtual Machines" }, //A built-in group. The group is created when the Hyper-V role is installed. Membership in the group is maintained by the Hyper-V Management Service (VMMS). This group requires the Create Symbolic Links right (SeCreateSymbolicLinkPrivilege), and also the Log on as a Service right (SeServiceLogonRight).
{ "S-1-5-90-0", "Windows Manager\\Windows Manager Group" }, //A built-in group that is used by the Desktop Window Manager (DWM). DWM is a Windows service that manages information display for Windows applications.
{ "S-1-16-0", "Untrusted Mandatory Level" }, //An untrusted integrity level.
{ "S-1-16-4096", "Low Mandatory Level" }, //A low integrity level.
{ "S-1-16-8192", "Medium Mandatory Level" }, //A medium integrity level.
{ "S-1-16-8448", "Medium Plus Mandatory Level" }, //A medium plus integrity level.
{ "S-1-16-12288", "High Mandatory Level" }, //A high integrity level.
{ "S-1-16-16384", "System Mandatory Level" }, //A system integrity level.
{ "S-1-16-20480", "Protected Process Mandatory Level" }, //A protected-process integrity level.
{ "S-1-16-28672", "Secure Process Mandatory Level" }, //A secure process integrity level.
{ "S-1-5-21-.+-522", "Cloneable Domain Controllers" }, //A global group. Members of this group that are domain controllers may be cloned.
{ "S-1-5-32-575", "Builtin\\RDS Remote Access Servers" }, //A built-in local group. Servers in this group enable users of RemoteApp programs and personal virtual desktops access to these resources. In Internet-facing deployments, these servers are typically deployed in an edge network. This group needs to be populated on servers running RD Connection Broker. RD Gateway servers and RD Web Access servers used in the deployment need to be in this group.
{ "S-1-5-32-576", "Builtin\\RDS Endpoint Servers" }, //A built-in local group. Servers in this group run virtual machines and host sessions where users RemoteApp programs and personal virtual desktops run. This group needs to be populated on servers running RD Connection Broker. RD Session Host servers and RD Virtualization Host servers used in the deployment need to be in this group.
{ "S-1-5-32-577", "Builtin\\RDS Management Servers" }, //A builtin local group. Servers in this group can perform routine administrative actions on servers running Remote Desktop Services. This group needs to be populated on all servers in a Remote Desktop Services deployment. The servers running the RDS Central Management service must be included in this group.
{ "S-1-5-32-578", "Builtin\\Hyper-V Administrators" }, //A built-in local group. Members of this group have complete and unrestricted access to all features of Hyper-V.
{ "S-1-5-32-579", "Builtin\\Access Control Assistance Operators" }, //A built-in local group. Members of this group can remotely query authorization attributes and permissions for resources on this computer.
{ "S-1-5-32-580", "Builtin\\Remote Management Users" }, //A built-in local group. Members of this group can access WMI resources over management protocols (such as WS-Management via the Windows Remote Management service). This applies only to WMI namespaces that grant access to the user.
{ "S-1-5-113" , "Local account" },
{ "S-1-5-114" , "Local account and member of Administrators group" },
{ "S-1-5-64-36" , "Cloud Account Authentication" },
};
try
{
foreach (KeyValuePair<string, string> kSID_entry in known_SID_dic)
{
Match mtch = Regex.Match(SID, "^"+kSID_entry.Key+"$", RegexOptions.IgnoreCase);
if (!String.IsNullOrEmpty(mtch.Value))
return known_SID_dic[kSID_entry.Key];
}
return "";
}
catch (Exception ex)
{
Beaprint.GrayPrint("Error in PermInt2Str: " + ex);
}
return "";
}
public static string SID2GroupName(string SID) public static string SID2GroupName(string SID)
{ {
string groupName = ""; //Frist, look in well-known SIDs
string groupName = staticSID2GroupName(SID);
if (!String.IsNullOrEmpty(groupName))
return groupName;
//If not well known, search in local or domain (depending on the nature of the user)
ContextType ct = ContextType.Domain; ContextType ct = ContextType.Domain;
if (Program.currentUserIsLocal) if (Program.currentUserIsLocal)
ct = ContextType.Machine; ct = ContextType.Machine;
@ -363,6 +493,7 @@ namespace winPEAS
} }
catch (Exception ex) catch (Exception ex)
{ {
//If error, check inside the other one
Beaprint.GrayPrint(String.Format(" [X] Exception: {0}\n Checking using the other Principal Context", ex.Message)); Beaprint.GrayPrint(String.Format(" [X] Exception: {0}\n Checking using the other Principal Context", ex.Message));
try try
{ {
@ -370,10 +501,27 @@ namespace winPEAS
groupName = GetSIDGroupName(SID, ContextType.Domain); groupName = GetSIDGroupName(SID, ContextType.Domain);
else else
groupName = GetSIDGroupName(SID, ContextType.Machine); groupName = GetSIDGroupName(SID, ContextType.Machine);
return groupName;
} }
catch catch
{ {
Beaprint.GrayPrint(String.Format(" [X] Exception: {0}\n Checking using the other Principal Context")); Beaprint.GrayPrint(String.Format(" [X] Exception: {0}", ex.Message));
}
}
//If nothing, check inside the other one
if (String.IsNullOrEmpty(groupName))
{
try
{
if (ct == ContextType.Machine)
groupName = GetSIDGroupName(SID, ContextType.Domain);
else
groupName = GetSIDGroupName(SID, ContextType.Machine);
}
catch (Exception ex)
{
Beaprint.GrayPrint(String.Format(" [X] Exception: {0}", ex.Message));
} }
} }
return groupName; return groupName;