114 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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}}