HackTricks Wiki

repository·master·Indexed 11 days ago

https://github.com/hacktricks-wiki/hacktricks

A comprehensive guide to cybersecurity and penetration testing, covering firmware analysis, binary exploitation, and AI security. Includes detailed methodologies for ROP chains, buffer overflows, and the use of tools like GDB, GEF, Ghidra, Metasploit, and pwntools, as well as frameworks for assessing AI system risks such as OWASP ML Top 10 and Google's SAIF.

Tokens
275.9K
Snippets
838
Records
1.3K
Agent score
94%

What's inside HackTricks

  1. Overview of AI in Cybersecurity

    master
    This section provides a roadmap for understanding the intersection of Artificial Intelligence and Cybersecurity. It covers the fundamental machine learning algorithms required for a baseline understanding, the architecture of Large Language Models (LLMs), and various security domains including risk frameworks, prompt security, Remote Code Execution (RCE) via models, and AI-assisted offensive techniques like KYC bypass and automated fuzzing.
  2. Overview of macOS Security and Privilege Escalation

    master

    This guide provides a roadmap for analyzing macOS security, focusing on attack surfaces, privilege escalation, and system protections. Key areas of study include:

    • Basic macOS Fundamentals: Understanding files, permissions, users, AppleFS, kernel architecture, and network protocols.
    • MDM (Mobile Device Management): Understanding how corporate environments manage macOS devices.
    • Security Protections: Analyzing macOS security mechanisms, including TCC (Transparency, Consent, and Control) and SIP (System Integrity Protection).
    • Attack Surfaces: Identifying vulnerabilities in file permissions, .pkg installers, file extension handlers, and URL scheme app handlers.
    • Privilege Escalation: Techniques for escalating to root or bypassing TCC/SIP protections.
  3. Overview of macOS MDM and DEP

    master

    Mobile Device Management (MDM)

    MDM is used to oversee Apple devices (iOS, macOS, tvOS) via a compatible MDM server that adheres to the MDM Protocol. It allows for centralized control, such as remote data erasure or configuration installation.

    Device Enrollment Program (DEP)

    DEP is an Apple service that enables zero-touch configuration. It allows brand-new devices (or those being reconfigured) to automatically register with a pre-defined MDM server upon initial activation.

    Security Warning: If DEP enrollment is not properly secured, attackers may attempt to register unauthorized devices to an organization's MDM server by masquerading as corporate assets.

  4. Common DLL Hijacking techniques

    master

    DLL Hijacking involves manipulating a trusted application into loading a malicious DLL. This can be used for code execution, persistence, and privilege escalation. Common methods include:

    • DLL Replacement: Swapping a genuine DLL with a malicious one (often using DLL Proxying to maintain original functionality).
    • DLL Search Order Hijacking: Placing a malicious DLL in a search path that the application checks before the legitimate path.
    • Phantom DLL Hijacking: Creating a malicious DLL for a non-existent required DLL that the application attempts to load.
    • DLL Redirection: Using %PATH%, .exe.manifest, or .exe.local files to redirect the application to a malicious DLL.
    • WinSxS DLL Replacement: Substituting a DLL within the WinSxS directory.
    • Relative Path DLL Hijacking: Placing a malicious DLL in a user-controlled directory alongside a copied application.
  5. Understand SMTP ports and basic information

    master

    The Simple Mail Transfer Protocol (SMTP) is used to transport email between mail systems. Common mail transfer agents include Postfix, Exim, Sendmail, and Microsoft Exchange.

    Standard Ports:

    • TCP/25: Server-to-server SMTP (often uses STARTTLS).
    • TCP/465: Message submission over implicit TLS.
    • TCP/587: Message submission (normally uses STARTTLS).
    PORT   STATE SERVICE REASON  VERSION
    25/tcp open  smtp    syn-ack Microsoft ESMTP 6.0.3790.3959
  6. Use MARA Framework for Mobile Reverse Engineering

    master

    MARA (Mobile Application Reverse engineering and Analysis Framework) aggregates multiple tools to assist in testing against OWASP mobile security threats.

    Capabilities:

    • Code Extraction: Extracts Java and Smali code.
    • Multi-tool Analysis: Uses smalisca, ClassyShark, androbugs, androwarn, and APKiD.
    • Information Extraction: Uses regex to find private information in the APK.
    • Manifest Analysis
    • Domain Analysis: Uses pyssltest, testssl.sh, and whatweb to analyze found domains.
    • Deobfuscation: Integrates with apk-deguard.com.
  7. Understand macOS Security Protections Overview

    master

    macOS employs several layers of security to protect the system and user privacy. Key components include:

    • Gatekeeper: A combination of Quarantine, Gatekeeper, and XProtect designed to prevent the execution of potentially malicious downloaded software.
    • Process Limitants: Includes MACF (Mandatory Access Control Framework), SIP (System Integrity Protection), and Sandbox (which restricts applications to actions specified in their profile).
    • TCC (Transparency, Consent, and Control): A framework managing application permissions for sensitive features like location, contacts, microphone, camera, and Full Disk Access.
    • Launch/Environment Constraints: Regulates process initiation by defining who can launch a process and from where (introduced in macOS Ventura/Sonoma).
    • MRT (Malware Removal Tool): A reactive tool that removes known malware from infected systems. Unlike the preventative XProtect, MRT runs in the background to clean up detected threats.
    • Background Tasks Management (BTM): Alerts users when software attempts to use persistence techniques (e.g., Login Items, Daemons).
  8. Understand macOS XPC (Inter-Process Communication)

    master

    XPC is a macOS and iOS framework designed for safe, asynchronous communication between processes. It is primarily used to implement privilege separation, where an application is split into multiple components, each running with the minimum necessary permissions. This isolation improves security (limiting damage from a compromised process), stability (isolating crashes), and performance (enabling concurrency).

    Key components include:

    • XPC Services: Bundles with a .xpc extension that contain a binary and an Info.plist.
    • launchd: The system daemon responsible for starting XPC services when they are requested.
    • xpcproxy: A utility used by launchd to enforce restrictions and spawn services with specific Mach ports and file descriptors.
  9. Understand the macOS File Hierarchy

    master

    macOS organizes its filesystem into system, local, network, and user domains. Key directories include:

    • /Applications: User-accessible installed applications.
    • /bin: Command line binaries.
    • /dev: Hardware device files.
    • /etc: Configuration files.
    • /Library: System-wide preferences, caches, and logs.
    • /private: Many system directories are symbolic links to this directory.
    • /sbin: Essential system administration binaries.
    • /System: Core macOS components and Apple-provided files.
    • /tmp: Temporary files (symlink to /private/tmp).
    • /Users: User home directories.
    • /usr: Configuration and system binaries.
    • /var: Log files.
    • /Volumes: Mount points for external or mounted volumes.

    Accessing files via Volume ID and Inode: If you run stat <filename>, the output provides a volume ID and an inode number (e.g., 16777223 7545753). You can access the file directly via the /.vol/ path using these numbers: cat /.vol/<volume_id>/<inode>

  10. Abusing Active Directory ACLs/ACEs

    master

    This guide covers methodologies for abusing Access Control Lists (ACLs) and Access Control Entries (ACEs) within Active Directory to achieve persistence or privilege escalation. Key attack vectors include exploiting specific rights such as GenericAll, GenericWrite, WriteProperty, and ForceChangePassword on users, groups, or computer objects.

    Common exploitation scenarios include:

    • GenericAll on User: Allows full control over the user, including password resets.
    • GenericAll on Group: Allows adding oneself to the group or modifying its members.
    • WriteProperty: Can be used to modify specific attributes (e.g., member on a group or servicePrincipalName on a computer) to escalate privileges.
    • Self-Membership: Exploiting rights that allow an object to modify its own membership or properties.
    • ForceChangePassword: Directly allows changing the password of a target object.
  11. What is Return-Oriented Programming (ROP)?

    master

    Return-Oriented Programming (ROP) is an exploitation technique used to bypass security protections like No-Execute (NX) or Data Execution Prevention (DEP). Instead of injecting new code, an attacker chains together existing code snippets called "gadgets" already present in the binary or loaded libraries.

    Each gadget typically performs a small operation (like pop eax; ret) and ends with a ret instruction, allowing the attacker to control the execution flow by carefully crafting the stack.