Summary
A SQL injection vulnerability in the /exam/user/profile.php page of the kashipara Online Exam System V1.0 allows crafted input in several profile fields to be interpreted directly as SQL.
When exploited, this can let a remote attacker execute arbitrary SQL commands, potentially gaining unauthorized access to sensitive exam and user data through the vulnerable POST parameters.
Affected context
The vulnerability occurs in the user profile functionality of the kashipara Online Exam System V1.0 at /exam/user/profile.php.
It specifically affects deployments where:
- User-supplied POST parameters (rname, rcollage, rnumber, rgender, rpassword) are concatenated into SQL statements.
- The underlying database calls are made without prepared statements or robust input validation.
- Application and database are reachable over the network, exposing the profile update endpoint to remote users or internet-facing traffic.
Exploit preconditions
- Attack surface: HTTP POST requests to /exam/user/profile.php.
- Required access: Ability to submit or intercept profile update requests (e.g., authenticated user session or exposed endpoint).
- Trigger point: Processing of the rname, rcollage, rnumber, rgender, or rpassword parameters in server-side SQL queries.
- Why exploitation is possible: The application incorporates raw parameter values into SQL without proper parameterization, escaping, or query abstraction, allowing attacker-controlled input to change the structure of the query.
Why this happens
This issue arises from constructing SQL statements by directly concatenating user-controlled data into query strings.
Instead of using parameterized queries or an ORM that separates code from data, the application likely embeds values from rname, rcollage, rnumber, rgender, and rpassword directly into SQL.
This pattern maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where untrusted input is not correctly handled before being passed to the database engine.
Potential impact
- An attacker may retrieve sensitive information such as user details, exam records, and credential data stored in the database.
- An attacker could modify or delete records, impacting exam results, user accounts, or configuration data.
- An attacker might create or escalate user accounts, potentially gaining administrative access within the application.
- In some configurations, the attacker can execute database-specific functions that may lead to remote code execution at the database or host level.
General mitigation guidance
Effective mitigation focuses on separating SQL logic from user data and reducing trust in all incoming parameters:
- Use parameterized queries (prepared statements) for all database interactions, binding user input as data rather than composing it into SQL strings.
- Adopt a database abstraction layer or ORM that enforces query parameterization and discourages raw string-based SQL.
- Apply strict server-side validation and normalization for profile fields (name, college, number, gender, password) based on expected formats and lengths, rejecting unexpected patterns instead of attempting to sanitize them.
- Limit database permissions for the application account to only the operations it genuinely needs, reducing impact if injection occurs.
- Centralize database access patterns so query construction is standardized and easier to review for unsafe string concatenation.
How teams detect issues like this
Detection commonly combines code-level inspection with behavioral monitoring:
- Static analysis: Configure security linters or SAST tools to flag string concatenation in SQL query construction and direct use of request parameters in database calls.
- Code review signals: Look for inline SQL built with interpolation (e.g., string concatenation with POST parameters) in PHP code, especially around profile update logic and other form handlers.
- Runtime monitoring: Use database logging or a web application firewall (WAF) to observe anomalous query patterns, such as queries with injected control characters or always-true conditions in WHERE clauses.
- Security testing: Incorporate automated and manual SQL injection tests into CI/CD or periodic security assessments, focusing on POST endpoints that modify user data.

