| Título | PHPGurukul Employee Record Management System 1.3 SQL Injection |
|---|
| Descrição | A critical chained SQL injection vulnerability exists in PHPGurukul Employee Record Management System (ERMS) v1.3. This vulnerability exploits the application's failure to sanitize session variables after a successful login, leading to a severe Second-Order SQL Injection.
(CWE-89: SQL Injection, CWE-501: Trust Boundary Violation, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
Phase 1 (Source & Session Pollution): An unauthenticated remote attacker targets the authentication endpoints (/admin/index.php or /loginerms.php). By leveraging a crafted UNION SELECT payload combined with hex-encoding, the attacker bypasses authentication and persists a malicious SQL fragment directly into the server-side session variables ($_SESSION['aid'] or $_SESSION['uid']).
Phase 2 (Trigger & Second-Order SQLi): When the attacker accesses any of the internal endpoints (e.g., myeducation.php, admin/adminprofile.php) with the polluted session cookie, the backend application blindly concatenates this polluted session variable directly into new SQL queries. This triggers the second-order SQL injection, allowing the execution of arbitrary SQL commands (e.g., time-based blind injection).
While one-stage SQL injections in loginerms.php (CVE-2025-5210) and adminprofile.php (CVE-2025-5838) are publicly known, this report demonstrates a novel Chained Exploitation Technique. The login vulnerability is utilized solely as a vector to poison the session state, which subsequently alters the execution logic of multiple otherwise unrelated internal endpoints, bypassing their direct input sanitization. Notably, endpoints like admin/welcome.php do not accept any direct user input parameters; they are vulnerable solely because they consume the polluted session variable.
Proof of Concept (PoC):
Environment: PHP 7.0.9, MySQL.
Step 1: Pollute the Session variable via the login interface.
Send the following POST request to /loginerms.php:
POST /loginerms.php HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Email=%27+UNION+SELECT+0x3120414e4420534c454550283229+--+-&Password=probe&login=login
(Note: The hex string 0x3120414e4420534c454550283229 decodes to 1 AND SLEEP(2))
Step 2: Trigger the Second-Order SQL Injection.
Access /myeducation.php with the polluted session cookie:
GET /myeducation.php HTTP/1.1
Host: localhost
Cookie: PHPSESSID=<polluted_session_id>
Verification Metrics:
Time-Based Blind Assertion: The payload executes WHERE EmpID=1 AND SLEEP(2). The endpoint response time increases from a baseline of ~15ms to > 2015ms.
Semantic Assertion: Unquoted educational/experience endpoints render application state changes via UNION, switching markers from False to True (e.g., displaying "Your Education details already added=True").
Affected Endpoints (Sinks):
admin/adminprofile.php, admin/welcome.php, admin/includes/header.php, myprofile.php, welcome.php, includes/header.php, myeducation.php, myexp.php, editmyeducation.php, editmyexp.php.
Remediation:
1. Use parameterized prepared statements (mysqli_prepare) for all SQL queries to separate code from data.
2. Do not store raw user input in session variables.
3. Since primary keys are numeric, strictly cast session variables upon retrieval (e.g., $uid = intval($_SESSION['uid'])) before using them in queries. Regenerate session IDs upon login. |
|---|
| Fonte | ⚠️ https://gist.github.com/LMortalv/ac4a1f72faa24f1ca1e2348e9bb66b78 |
|---|
| Utilizador | Mortal_ (UID 102852) |
|---|
| Submissão | 09/11/2026 14h51 (há 21 dias) |
|---|
| Moderação | 30/11/2026 17h01 (21 days later) |
|---|
| Estado | Duplicado |
|---|
| Entrada VulDB | 310306 [PHPGurukul Employee Record Management System 1.3 /loginerms.php Email Injeção SQL] |
|---|
| Pontos | 0 |
|---|