# Windows Subsystem for Linux

## Overview

**WSL** allows a user to run Linux on top on the Windows system making it a... subsystem. However, with this comes vulnerabilities like the ability to create a elevated bind shell, with root privileges, to the **Windows** machine on any port.

{% embed url="<https://swisskyrepo.github.io/InternalAllTheThings/redteam/escalation/windows-privilege-escalation/#eop---windows-subsystem-for-linux-wsl>" %}

## Escalation via WSL

```powerquery
where /R C:\Windows bash.exe
where /R C:\Windows wsl.exe
```

```
bash.exe
python -c 'import pty;pty.spawn("/bin/bash")';
```

{% hint style="info" %}
Check the history for easy wins
{% endhint %}


---

# Agent Instructions: 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://pnpt.adot8.com/windows-privilege-escalation/windows-subsystem-for-linux.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.
