mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
114 lines
4.8 KiB
Markdown
114 lines
4.8 KiB
Markdown
# Jira & Confluence
|
||
|
||
{{#include ../../banners/hacktricks-training.md}}
|
||
|
||
## 检查权限
|
||
|
||
在 Jira 中,**任何用户都可以检查权限**,无论是否经过身份验证,通过端点 `/rest/api/2/mypermissions` 或 `/rest/api/3/mypermissions`。这些端点揭示了用户当前的权限。当 **未认证用户拥有权限** 时,出现了一个显著的担忧,这表明存在 **安全漏洞**,可能有资格获得 **赏金**。同样,**认证用户的意外权限** 也突显了一个 **漏洞**。
|
||
|
||
在 **2019年2月1日** 进行了重要的 **更新**,要求 'mypermissions' 端点包含 **'permission' 参数**。此要求旨在通过指定被查询的权限来 **增强安全性**: [check it here](https://developer.atlassian.com/cloud/jira/platform/change-notice-get-my-permissions-requires-permissions-query-parameter/#change-notice---get-my-permissions-resource-will-require-a-permissions-query-parameter)
|
||
|
||
- 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`
|
||
```bash
|
||
#Check non-authenticated privileges
|
||
curl https://jira.some.example.com/rest/api/2/mypermissions | jq | grep -iB6 '"havePermission": true'
|
||
```
|
||
## 自动化枚举
|
||
|
||
- [https://github.com/0x48piraj/Jiraffe](https://github.com/0x48piraj/Jiraffe)
|
||
- [https://github.com/bcoles/jira_scan](https://github.com/bcoles/jira_scan)
|
||
|
||
## Atlasian 插件
|
||
|
||
如在这篇 [**博客**](https://cyllective.com/blog/posts/atlassian-audit-plugins) 中所述,在关于 [插件模块 ↗](https://developer.atlassian.com/server/framework/atlassian-sdk/plugin-modules/) 的文档中,可以检查不同类型的插件,例如:
|
||
|
||
- [REST 插件模块 ↗](https://developer.atlassian.com/server/framework/atlassian-sdk/rest-plugin-module): 暴露 RESTful API 端点
|
||
- [Servlet 插件模块 ↗](https://developer.atlassian.com/server/framework/atlassian-sdk/servlet-plugin-module/): 将 Java servlets 部署为插件的一部分
|
||
- [宏插件模块 ↗](https://developer.atlassian.com/server/confluence/macro-module/): 实现 Confluence 宏,即参数化的 HTML 模板
|
||
|
||
这是宏插件类型的一个示例:
|
||
```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 ("<h1>Hello " + map.get("Name") + "!</h1>");
|
||
} else {
|
||
return "<h1>Hello World!<h1>";
|
||
}
|
||
}
|
||
|
||
public BodyType getBodyType() { return BodyType.NONE; }
|
||
|
||
public OutputType getOutputType() { return OutputType.BLOCK; }
|
||
}
|
||
```
|
||
可以观察到,这些插件可能容易受到常见的网络漏洞,如XSS。例如,前面的例子是脆弱的,因为它反射了用户提供的数据。
|
||
|
||
一旦发现XSS,在[**这个github仓库**](https://github.com/cyllective/XSS-Payloads/tree/main/Confluence)中可以找到一些有效载荷,以增加XSS的影响。
|
||
|
||
## 后门插件
|
||
|
||
[**这篇文章**](https://cyllective.com/blog/posts/atlassian-malicious-plugin)描述了恶意Jira插件可能执行的不同(恶意)操作。你可以在[**这个仓库中找到代码示例**](https://github.com/cyllective/malfluence)。
|
||
|
||
以下是恶意插件可能执行的一些操作:
|
||
|
||
- **隐藏管理员的插件**:可以通过注入一些前端JavaScript来隐藏恶意插件。
|
||
- **提取附件和页面**:允许访问并提取所有数据。
|
||
- **窃取会话令牌**:添加一个端点,将在响应中回显头部(包括cookie),并添加一些JavaScript来联系它并泄露cookie。
|
||
- **命令执行**:当然可以创建一个执行代码的插件。
|
||
- **反向Shell**:或者获取一个反向Shell。
|
||
- **DOM代理**:如果Confluence在私有网络内,可以通过某个有访问权限的用户的浏览器建立连接,例如通过它联系服务器执行命令。
|
||
|
||
{{#include ../../banners/hacktricks-training.md}}
|