Hackfast Offensive Security Documentation

repository·main·Indexed 41 days ago

https://github.com/hack-fast/hackfast

A documentation-driven project focused on offensive security, providing guides, checklists, and tool references for red teaming and attack techniques. It includes detailed technical documentation on Active Directory attacks such as ASREPRoasting, DCSync, Kerberoasting, and LLMNR/NBT-NS poisoning, as well as initial scanning and enumeration techniques for SMB, LDAP, Kerberos, DNS, and RPC.

Tokens
145.8K
Snippets
542
Records
673
Agent score
99%

What's inside Hackfast

  1. Understanding Kernel Exploits for Windows Privilege Escalation

    main

    The kernel is the core intermediary between application software and physical hardware. In Windows, exploiting a kernel vulnerability can allow an attacker to escalate privileges to SYSTEM, which is the highest level of access available on the operating system.

    Warning: Kernel exploits are considered a last resort. They are inherently unstable and can frequently cause system crashes (BSOD) or only succeed once before the system becomes unusable.

  2. CrackMapExec (CME) Overview

    main

    CrackMapExec (CME) is an open-source post-exploitation tool designed for penetration testers to perform network-level attacks and enumeration, specifically within large Active Directory (AD) environments.

    Key Functionalities:

    • Enumerating Users and Groups: Lists AD objects like users and groups.
    • Password Spraying: Tests a single password against multiple accounts.
    • Command Execution: Executes commands remotely on target systems.
    • Dumping Hashes: Extracts password hashes from remote systems.
    • Accessing Shares: Lists and accesses SMB shares.
  3. What is SeTakeOwnershipPrivilege?

    main

    SeTakeOwnershipPrivilege is a Windows privilege that grants a user the ability to take ownership of any securable object. This includes Active Directory objects, NTFS files/folders, printers, registry keys, services, and processes.

    Assigning this privilege provides WRITE_OWNER rights, which allows the user to modify the owner within the object's security descriptor. While typically held by administrators, it may be assigned to specific service accounts.

  4. Determine Command Injection context

    main

    Before attempting injection, determine the execution context to know how to break out of the existing command string:

    • Quoted Context: If the input is wrapped in quotes (e.g., " or '), you must first break out of the quotes before appending your command.
    • Unquoted Context: If the input is not quoted, commands can be directly appended to the existing command string.
  5. Magic Byte Forgery for Bypassing Content-Type Validation

    main

    If an application validates file types using magic bytes (e.g., via PHP's mime_content_type), you can bypass these checks by prepending the magic bytes of a permitted file type to your malicious file.

    File TypeMagic Bytes
    GIFGIF89a;\x0a
    PDF%PDF-
    JPG / JPEG\xFF\xD8\xFF\xDB
    PNG\x89\x50\x4E\x47\x0D\x0A\x1A\x0A
    TAR\x75\x73\x74\x61\x72\x00\x30\x30
    XML<?xml
  6. RCE via File Name Parameter Injection

    main

    Applications that perform custom image processing or file manipulation on uploaded filenames may be vulnerable to command injection. Injecting shell metacharacters into the filename can trigger Remote Code Execution (RCE).

    Example Payloads:

    • a$(whoami)z.jpg -> Executes whoami
    • a;sleep 30;z.jpg -> Causes a 30-second delay (tests for injection)
    • a$(id)z.jpg -> Executes id
    • a$(cat /etc/passwd)z.jpg -> Executes cat /etc/passwd
  7. How DLL hijacking works in Windows services

    main

    DLL hijacking occurs when an attacker manipulates the resolution of Dynamic Link Libraries (DLLs). In the context of Windows services, this works through several mechanisms:

    • Privilege Inheritance: Services load DLLs with the same privileges as the service itself. Controlling the DLL allows code execution at that privilege level.
    • Absolute Path Vulnerability: If a service is configured to load a DLL from a directory that is writable by a lower-privileged user, the user can replace the legitimate DLL with a malicious one.
    • Search Order Exploitation: If an application fails to find a required DLL, Windows searches through a specific order of directories. An attacker can place a malicious DLL in a directory that appears earlier in the search order than the legitimate one.
  8. Privilege Escalation via LD_LIBRARY_PATH exploitation

    main
    The LD_LIBRARY_PATH environment variable specifies additional directories to search for shared libraries. An attacker can manipulate this variable by adding a directory containing malicious libraries to the search path. This allows the attacker to control which libraries are loaded by an application, potentially leading to unauthorized code execution, especially in applications running with elevated privileges.
  9. Understanding SUID and SGID permissions

    main

    SUID (Set Owner User ID) and SGID (Set Group ID) are special executable permissions that change the privilege context of a process during execution:

    • SUID (Set User ID): When executed, the file runs with the privileges of the file owner instead of the user who launched it. This is commonly used for tasks requiring elevated privileges.
    • SGID (Set Group ID): When executed, the file runs with the privileges of the file group.

    Security Note: Environment variables like LD_PRELOAD and LD_LIBRARY_PATH are ignored by the system when executing SUID binaries to prevent library hijacking and security breaches.

  10. Understand Sudoers Configuration Patterns

    main

    The /etc/sudoers file defines how sudo privileges are granted. Common patterns include:

    • (ALL : ALL) ALL: Allows running any command as any user or group.
    • (ALL : ALL) /some/program: Restricts sudo usage to a specific program.
    • (root) NOPASSWD: ALL: Allows running any command as root without a password.
    • (user) /some/program: Allows a specific user to run a specific program.
  11. Understanding Insecure Service Permissions in Windows

    main

    In Windows environments, service security is governed by Access Control Lists (ACLs). These ACLs define the specific actions (such as starting, stopping, or modifying configuration) that a user can perform on a service. If these permissions are misconfigured, they can be leveraged for privilege escalation.

    Critical Pre-exploitation Check: Before attempting to exploit a service, verify that you have sufficient permissions to not only modify the service configuration but also to stop and start the service. If you can modify the configuration but lack the permission to control the service state, the privilege escalation attempt will likely fail.

  12. Identify the two types of Crontabs

    main

    Cron jobs are managed via two primary types of crontabs:

    1. System Crontab: Used for system-wide jobs. The default configuration file is located at /etc/crontab.
    2. User Crontab: Used for user-level jobs. These are created and edited using the crontab -e command and are stored in /var/spool/cron/crontabs.

    Note on Visibility: User crontabs created via crontab -e are considered "hidden cron jobs" because they are only visible to the user who created them. Standard users cannot access the /var/spool/cron/crontabs directory or enumerate these jobs through standard means; they must use the crontab command to view their own.

    crontab -e