| 제목 | code-projects.org STUDENT WEB PORTAL IN PHP WITH SOURCE CODE 1.0 SQL Injection |
|---|
| 설명 | STUDENT WEB PORTAL IN PHP WITH SOURCE CODE SQL-INJECT
Student Web Portal In PHP With Source Code - Source Code & Projects
Summary
Student Web Portal In PHP With Source Code - Source Code & Projects contains a SQL Injection vulnerability in due to unsafe string concatenation of user-controlled input into an SQL query. An unauthenticated remote attacker can supply a crafted parameter to manipulate the database query logic, potentially enabling data disclosure and other impacts depending on database privileges and deployment configuration.check_user.phpusername
Vulnerability Details
Vulnerability Class: SQL Injection
CWE: CWE-89 (Improper Neutralization of Special Elements used in an SQL Command)
Affected Endpoint: /check_user.php?username=...
Affected Parameter: (HTTP GET)username
Affected Component/File: check_user.php
Database/API: MySQL via mysqli
Vulnerable Code (excerpt):
$query = "select * from user where user_name='".$_GET['username']."'";
$table = mysqli_query($connection, $query);
Root Cause User input from is directly concatenated into an SQL statement without parameterization, allowing an attacker to inject SQL syntax and alter query semantics.$_GET['username']
Impact
Depending on the environment and database permissions, exploitation may allow:
Manipulation of the username-existence check logic (inconsistent “already exist” vs “available” results)
Blind SQL Injection (boolean/time-based) to infer database contents even when errors are suppressed
Potential sensitive data disclosure if the database account has broader read access
The exact impact depends on DB privileges, MySQL configuration (e.g., multi-statement settings), application behavior, and any upstream security controls.
Severity / CVSS
Recommended CVSS v3.1 Base Score: 7.5 (High) Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Rationale: Remote, low complexity, no authentication, no user interaction; primary risk is confidentiality.
Remediation
Primary Fix: Use prepared statements (parameterized queries) and reduce query scope.
Secure Patch Example (mysqli prepared statement):
<?php
error_reporting(0);
include 'config.php';
if (isset($_GET['username'])) {
$username = $_GET['username'];
$stmt = mysqli_prepare($connection, "SELECT 1 FROM user WHERE user_name = ? LIMIT 1");
if ($stmt) {
mysqli_stmt_bind_param($stmt, "s", $username);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
if (mysqli_stmt_num_rows($stmt) === 1) {
echo "Username already exist.";
} else {
echo "Username Available";
}
mysqli_stmt_close($stmt);
}
}
?> |
|---|
| 원천 | ⚠️ https://github.com/Qing-420/cve/blob/main/sql.md |
|---|
| 사용자 | TrySec (UID 94998) |
|---|
| 제출 | 2026. 01. 29. PM 12:27 (3 개월 ago) |
|---|
| 모더레이션 | 2026. 02. 07. AM 09:50 (9 days later) |
|---|
| 상태 | 수락 |
|---|
| VulDB 항목 | 344860 [code-projects Student Web Portal 1.0 /check_user.php 사용자 이름 SQL 주입] |
|---|
| 포인트들 | 20 |
|---|