LibraryScheduled Tasks and DLL Hijacking

Scheduled Tasks and DLL Hijacking

Learn about Scheduled Tasks and DLL Hijacking as part of OSCP Certification - Offensive Security Certified Professional

Privilege Escalation: Scheduled Tasks & DLL Hijacking

In the pursuit of privilege escalation, understanding how attackers exploit system functionalities is crucial. This module delves into two common techniques: leveraging Scheduled Tasks and exploiting DLL Hijacking vulnerabilities.

Scheduled Tasks for Privilege Escalation

Scheduled Tasks are a powerful Windows feature that allows administrators to automate the execution of programs or scripts at specific times or in response to certain events. Attackers can exploit misconfigured scheduled tasks to gain higher privileges.

What are the two key characteristics of a scheduled task that make it exploitable for privilege escalation?
  1. Runs with high privileges (e.g., SYSTEM). 2. Executes a program/script in a location writable by a low-privileged user.

DLL Hijacking

DLL Hijacking is a vulnerability that occurs when an application loads a Dynamic Link Library (DLL) from an untrusted location before it searches in its legitimate, trusted location. This allows an attacker to place a malicious DLL with the same name in a location that the application will find first.

The DLL search order is a critical concept. Imagine an application needing a specific tool (DLL). It first checks its immediate workspace (current directory), then the general toolbox (System32), and finally the main storage (Windows directory). If the workspace is compromised, the wrong tool is picked up first. This visual represents the prioritized search path.

📚

Text-based content

Library pages focus on text content

FeatureScheduled TasksDLL Hijacking
Primary MechanismExploiting automated execution of programs.Exploiting application's DLL loading order.
TargetSystem-level scheduled tasks.Applications that load DLLs insecurely.
Privilege GainElevated privileges of the scheduled task (e.g., SYSTEM).Privileges of the compromised application.
Exploitation VectorModifying executables run by tasks in writable locations.Placing malicious DLLs in early-searched directories.

Practical Application and Tools

For OSCP preparation, understanding how to identify and exploit these vulnerabilities is key. This involves enumeration, analysis, and payload creation.

Loading diagram...

Similarly, for DLL hijacking, enumeration tools can help identify applications that load DLLs from potentially insecure locations. Crafting a malicious DLL and placing it correctly is the next step.

Remember, successful privilege escalation often relies on thorough enumeration and understanding the target system's configuration and behavior.

Learning Resources

Windows Task Scheduler - Microsoft Docs(documentation)

Official Microsoft documentation explaining the Windows Task Scheduler, its components, and how it functions. Essential for understanding the target system.

DLL Hijacking - OWASP(documentation)

An overview of DLL hijacking vulnerabilities from the Open Web Application Security Project, detailing the attack vector and its implications.

Privilege Escalation: Scheduled Tasks - HackTricks(blog)

A comprehensive guide on exploiting scheduled tasks for privilege escalation on Windows systems, including practical examples and commands.

DLL Hijacking Vulnerabilities - SANS Institute(paper)

A white paper from SANS Institute detailing DLL hijacking, its causes, and methods for detection and prevention.

Windows Privilege Escalation Methods - Offensive Security(paper)

A foundational PDF from Offensive Security covering various Windows privilege escalation techniques, including scheduled tasks and DLLs.

Exploiting DLL Search Order Hijacking - Medium Article(blog)

A detailed blog post explaining the DLL search order and how to exploit it for privilege escalation on various Windows versions.

PowerShell for Windows Privilege Escalation - YouTube(video)

A video tutorial demonstrating how PowerShell can be used to identify and exploit privilege escalation vectors, including scheduled tasks.

Sysinternals Suite - Microsoft Learn(documentation)

The Sysinternals Suite contains powerful tools like Process Explorer and Autoruns, invaluable for enumerating processes, scheduled tasks, and loaded DLLs.

Windows DLL Hijacking - Practical Exploitation(video)

A practical demonstration of how to perform DLL hijacking attacks on Windows systems, showing the steps involved in exploitation.

Scheduled Task Exploitation - Pentest+ Study Guide(paper)

While a study guide for Pentest+, this PDF often contains relevant sections on privilege escalation techniques like scheduled tasks, offering a structured learning approach.