Convert Figma logo to code with AI

GhostPack logoSharpUp

SharpUp is a C# port of various PowerUp functionality.

1,220
236
1,220
7

Top Related Projects

PowerSploit - A PowerShell Post-Exploitation Framework

Six Degrees of Domain Admin

19,244

A little tool to play with Windows security

9,431

Credentials recovery project

15,708

PEASS - Privilege Escalation Awesome Scripts SUITE (with colors)

13,264

Impacket is a collection of Python classes for working with network protocols.

Quick Overview

SharpUp is a C# port of the PowerUp privilege escalation tool, designed for Windows systems. It helps security professionals and penetration testers identify potential privilege escalation vectors on Windows machines by checking for common misconfigurations and vulnerabilities.

Pros

  • Written in C#, allowing for easy integration with other .NET-based tools
  • Provides a comprehensive set of checks for Windows privilege escalation
  • Can be run without dropping files to disk, making it stealthier than some alternatives
  • Regularly updated to include new privilege escalation techniques

Cons

  • Requires .NET Framework, which may not be available on all target systems
  • May trigger antivirus alerts due to its nature as a security testing tool
  • Limited to Windows systems, not applicable for other operating systems
  • Some checks may require elevated privileges to run effectively

Code Examples

// Check for unquoted service paths
public static List<string> GetUnquotedServicePaths()
{
    List<string> results = new List<string>();
    string[] services = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services").GetSubKeyNames();
    foreach (string service in services)
    {
        string imagePath = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + service).GetValue("ImagePath", "").ToString();
        if (imagePath != "" && !imagePath.Contains("\"") && imagePath.Contains(" "))
        {
            results.Add(service + "," + imagePath);
        }
    }
    return results;
}
// Check for modifiable service binaries
public static List<string> GetModifiableServiceBinaries()
{
    List<string> results = new List<string>();
    string[] services = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services").GetSubKeyNames();
    foreach (string service in services)
    {
        string imagePath = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + service).GetValue("ImagePath", "").ToString();
        if (imagePath != "" && FileUtil.CanWrite(imagePath))
        {
            results.Add(service + "," + imagePath);
        }
    }
    return results;
}

Getting Started

To use SharpUp, follow these steps:

  1. Clone the repository: git clone https://github.com/GhostPack/SharpUp.git
  2. Open the solution in Visual Studio
  3. Build the project
  4. Run the compiled executable on the target Windows system

Example usage:

SharpUp.exe audit

This will run all available checks and display the results.

Competitor Comparisons

PowerSploit - A PowerShell Post-Exploitation Framework

Pros of PowerSploit

  • Extensive collection of PowerShell modules for various post-exploitation tasks
  • Well-documented and actively maintained by the community
  • Includes tools for privilege escalation, persistence, and lateral movement

Cons of PowerSploit

  • Primarily written in PowerShell, which may be more easily detected by security solutions
  • Requires PowerShell execution, which might be restricted in some environments
  • Larger footprint compared to SharpUp's focused approach

Code Comparison

PowerSploit (PowerUp.ps1):

function Get-ServiceUnquoted {
    [CmdletBinding()] Param()
    Get-WmiObject -Class win32_service | Where-Object {
        $_.PathName -inotmatch '^"' -and
        $_.PathName -inotmatch '^\\\\' -and
        $_.PathName -inotmatch '^[A-Z]:\\Windows\\' -and
        $_.StartMode -eq 'Auto' -and
        $_.State -eq 'Running' -and
        $_.PathName -imatch '.* .*'
    }
}

SharpUp (Program.cs):

public static void UnquotedServicePath()
{
    Console.WriteLine("\r\n=== Unquoted Service Paths ===");
    var services = ServiceHelper.GetServices();
    foreach (var service in services)
    {
        if (service.PathName.Contains(" ") && !service.PathName.Contains("\""))
        {
            Console.WriteLine($"  {service.Name} : {service.PathName}");
        }
    }
}

Six Degrees of Domain Admin

Pros of BloodHound

  • Provides comprehensive Active Directory attack path visualization
  • Offers a graphical user interface for easier analysis
  • Supports complex queries and custom Cypher queries for advanced users

Cons of BloodHound

  • Requires more setup and infrastructure (Neo4j database)
  • Can be resource-intensive for large environments
  • May trigger security alerts due to its scanning activities

Code Comparison

While a direct code comparison is not particularly relevant due to the different nature of these tools, here's a brief example of how they might be used:

BloodHound (PowerShell data collection):

. .\SharpHound.ps1
Invoke-BloodHound -CollectionMethod All -Domain TESTLAB.LOCAL

SharpUp (C# privilege escalation checks):

SharpUp.Program.Main(new string[] { "audit" });

BloodHound is more focused on mapping AD relationships, while SharpUp is designed for local privilege escalation checks. BloodHound offers a more comprehensive view of the AD environment, but SharpUp is lighter and more focused on individual system vulnerabilities.

19,244

A little tool to play with Windows security

Pros of Mimikatz

  • More comprehensive functionality for Windows credential extraction and manipulation
  • Widely recognized and extensively documented in the security community
  • Supports a broader range of Windows versions and authentication mechanisms

Cons of Mimikatz

  • Written in C, which may be less accessible for some users compared to C#
  • More likely to be flagged by antivirus software due to its popularity
  • Requires administrative privileges for most operations

Code Comparison

Mimikatz (C):

BOOL kuhl_m_sekurlsa_utils_search_generic(PKIWI_BASIC_SECURITY_LOGON_SESSION_DATA pData, LPCWSTR littlePattern, SIZE_T littlePatternSize, PVOID * genericPtr, SIZE_T * genericSize)
{
    BOOL status = FALSE;
    PVOID ptr = NULL;
    SIZE_T sz = 0;

    if(kuhl_m_sekurlsa_utils_search(pData->pList, littlePattern, littlePatternSize, &ptr, &sz))
        status = kuhl_m_sekurlsa_utils_search(ptr, PTRN_WIN5_CREDENTIALKEYS, sizeof(PTRN_WIN5_CREDENTIALKEYS), genericPtr, genericSize);

    return status;
}

SharpUp (C#):

public static List<WindowsPrivilege> GetPrivs()
{
    List<WindowsPrivilege> privileges = new List<WindowsPrivilege>();
    IntPtr hToken = IntPtr.Zero;

    if (!OpenProcessToken(Process.GetCurrentProcess().Handle, TOKEN_QUERY, out hToken))
    {
        return privileges;
    }
}
9,431

Credentials recovery project

Pros of LaZagne

  • Multi-platform support (Windows, Linux, macOS)
  • Retrieves passwords from a wide range of applications and services
  • Actively maintained with regular updates

Cons of LaZagne

  • Written in Python, which may require additional setup on target systems
  • Can be detected by some antivirus software due to its popularity

Code Comparison

LaZagne (Python):

def run_lazagne(category_selected="all", subcategories={}, password=None):
    for category in category_selected:
        for module in get_categories()[category]:
            try:
                mod = import_module(module)
                pwd_found = mod.run(subcategories[category], password)
                # Process and store results
            except Exception:
                pass

SharpUp (C#):

public static void CheckAll()
{
    AlwaysInstallElevated();
    CachedGPPPassword();
    UnattendedInstallFiles();
    // Additional checks...
}

LaZagne offers a more comprehensive password retrieval approach across multiple platforms, while SharpUp focuses on Windows privilege escalation checks. LaZagne's modular structure allows for easy expansion, but its Python base may be less stealthy. SharpUp, being a .NET assembly, integrates more seamlessly with Windows environments and may be less likely to trigger antivirus alerts.

15,708

PEASS - Privilege Escalation Awesome Scripts SUITE (with colors)

Pros of PEASS-ng

  • Multi-platform support (Windows, Linux, macOS)
  • Comprehensive privilege escalation checks
  • Regular updates and active community

Cons of PEASS-ng

  • Larger codebase, potentially slower execution
  • May generate more noise in output

Code Comparison

PEASS-ng (LinPEAS):

if [ "$MACPEAS" ]; then
    print_2title "System Info"
    print_2title "Analyze MacOS"
    system_info
    check_macos_sd
elif [ "$LINPEAS" ]; then
    print_2title "System Info"

SharpUp:

public static void SystemInfo()
{
    Console.WriteLine("\r\n=== System Info ===");
    Console.WriteLine("  Hostname: {0}", Environment.MachineName);
    Console.WriteLine("  OS: {0}", Environment.OSVersion.ToString());
}

PEASS-ng offers a more comprehensive approach with platform-specific checks, while SharpUp focuses on Windows-specific privilege escalation techniques. PEASS-ng's modular structure allows for easier expansion and maintenance, but may result in a larger overall codebase. SharpUp's C# implementation provides native Windows integration and potentially faster execution on Windows systems. Both tools aim to assist in privilege escalation assessments, with PEASS-ng offering broader platform coverage and SharpUp specializing in Windows environments.

13,264

Impacket is a collection of Python classes for working with network protocols.

Pros of Impacket

  • Written in Python, offering cross-platform compatibility and easier integration with other Python tools
  • Provides a comprehensive suite of network protocols and utilities for penetration testing
  • Actively maintained with frequent updates and a large community of contributors

Cons of Impacket

  • Requires Python installation and dependencies, which may not be available on all target systems
  • Can be slower in execution compared to compiled C# tools like SharpUp
  • May be more easily detected by antivirus software due to its interpreted nature

Code Comparison

SharpUp (C#):

public static void GetModifiableServices()
{
    Console.WriteLine("\r\n[*] Checking for modifiable services...");
    // ... (implementation details)
}

Impacket (Python):

def get_modifiable_services():
    print("\n[*] Checking for modifiable services...")
    # ... (implementation details)

While both tools serve different purposes, this comparison highlights the language differences and potential syntax variations between the two projects.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

SharpUp


SharpUp is a C# port of various PowerUp functionality. Currently, only the most common checks have been ported; no weaponization functions have yet been implemented.

@harmj0y is the primary author.

SharpUp is licensed under the BSD 3-Clause license.

Usage

SharpUp.exe [audit] [check1] [check2]...

    audit   - Specifies whether or not to enable audit mode. If enabled, SharpUp will run vulenrability checks
              regardless if the process is in high integrity or the user is in the local administrator's group.
              If no checks are specified, audit will run all checks. Otherwise, each check following audit will
              be ran.

    check*  - The individual vulnerability check to be ran. Must be one of the following:

              - AlwaysInstallElevated
              - CachedGPPPassword
              - DomainGPPPassword
              - HijackablePaths
              - McAfeeSitelistFiles
              - ModifiableScheduledTask
              - ModifiableServiceBinaries
              - ModifiableServiceRegistryKeys
              - ModifiableServices
              - ProcessDLLHijack
              - RegistryAutoLogons
              - RegistryAutoruns
              - TokenPrivileges
              - UnattendedInstallFiles
              - UnquotedServicePath
            

    Examples:
        SharpUp.exe audit
            -> Runs all vulnerability checks regardless of integrity level or group membership.
        
        SharpUp.exe HijackablePaths
            -> Check only if there are modifiable paths in the user's %PATH% variable.

        SharpUp.exe audit HijackablePaths
            -> Check only for modifiable paths in the user's %PATH% regardless of integrity level or group membership. 

Compile Instructions

We are not planning on releasing binaries for SharpUp, so you will have to compile yourself :)

SharpUp has been built against .NET 3.5 and is compatible with Visual Studio 2015 Community Edition. Simply open up the project .sln, choose "release", and build.

Acknowledgments

SharpUp incorporates various code C# snippets and bits of PoCs found throughout research for its capabilities. These snippets and authors are highlighted in the appropriate locations in the source code, and include: