Unauthenticated SQL Injection in Code-Projects Simple School Management System 1.0
The search endpoint concatenates a user-supplied POST parameter directly into an SQL query without authentication. An attacker could manipulate the query to retrieve database information, such as the database version and name, through the search response.
Published on medium.com
Cyber Security
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Code-Projects publishes small PHP/MySQL applications for learning and practice. One of them is Simple School Management System, version 1.0, a school administration application distributed as source code. The report looks at a single feature: the staff search. The endpoint School/search.php accepts a search term in the POST parameter s and returns the matching rows from the staff table, filtering on the teacher name column TNAME.
The problem type is CWE-89, Improper Neutralization of Special Elements used in an SQL Command (SQL Injection). The researcher is Jatin Patidar, publishing as jatin.security.
Setup
No third-party accounts, production systems or real user data were accessed.
The reproduction environment ran PHP 8.3.6 and MariaDB 10.11. The source archive carries build metadata indicating PHP 5.4.12 and MySQL 5.6.12, but those original runtime versions were not independently used for live reproduction.
The endpoint requires no authentication and no particular role: it is reachable as an unauthenticated user. The HTTP method used is POST.
Finding it
The report shows the search term being pasted straight into the query string in School/search.php. The code in the report is:
$sql = “SELECT * FROM staff WHERE TNAME LIKE ‘{$_POST[“s”]}%’ “;
The value of $_POST["s"] is interpolated into the SQL text before the trailing % of the LIKE pattern. There is no parameterised query and no escaping step for this operation.
The second thing that made it worth pursuing is that the endpoint performs no authentication or authorisation check, so the injection is reachable without an account.
Exploitation
All of the following was done against the researcher's own isolated local lab with synthetic data.
Step 1: Confirm the injection with a UNION-based payload
The researcher sent a POST request to School/search.php with a UNION-based payload in s. The transmitted request is preserved in the evidence package as a cURL trace, evidence/vuln1_search_UNION.trace. The report does not reproduce the payload text itself; it describes the result.
The UNION-based test caused attacker-controlled SQL output to be evaluated by the database and rendered in the HTTP response. In other words, database-generated output from the injected query appeared in the HTTP response.
Step 2: Read data back from the response
During the local test the response exposed the database version and the database name. That confirms the injected query's output columns are reflected in the page, which is what makes a UNION-based extraction practical: the attacker chooses which expressions appear in the result set and reads them from the HTML.
Step 3: Confirm with a Boolean-based payload
A Boolean-based test changed the returned staff search results. The Boolean-based test changed the returned staff search results, a signal that the input is interpreted as SQL.
Evidence package
The report lists the artefacts collected for independent reproduction and verification:
evidence/EVIDENCE.txt: consolidated test transcript, including requests, responses and before/after database row counts.evidence/vuln1_search_UNION.trace: cURL trace showing the transmitted request.evidence/vuln1_search_UNION.response.html: raw HTTP response demonstrating the injected SQL output.evidence/vuln1_search_UNION.resp_headers.txt: HTTP response headers.CVE_disclosure.md: consolidated vulnerability disclosure document.
The raw request and response evidence is included so that someone else can reproduce and verify the finding.
Root cause
The defect is string concatenation of user input into SQL. The POST parameter s is placed directly inside the LIKE pattern in the query, so any quote or SQL syntax the attacker supplies becomes part of the statement the database parses. The application does not use parameterised queries for this operation.
Nothing in front of the query stops it. The endpoint enforces no authentication or authorisation check, so the injection is not gated behind a login. The report does not describe any input filtering or other control that would have blocked the payloads; parameterised queries are absent.
Impact
An unauthenticated attacker who can reach the affected endpoint may be able to manipulate the SQL query and retrieve database information through the vulnerable search functionality. The demonstrated effect is disclosure: the local test returned the database version and database name.
The researcher proposes CVSS v3.1 7.5 High, explicitly as a researcher-proposed score subject to CNA assessment:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
The vector describes a network-reachable issue with low attack complexity, no privileges required, no user interaction, unchanged scope, high confidentiality impact and no integrity or availability impact. The report is careful about the limits: no operating-system-level access or production-system compromise is claimed, and the impact should be assessed on the attached reproduction evidence.
Fix
No fix is described as having been applied. The suggested remediation is to use parameterised SQL queries or prepared statements for all user-controlled input, and not to concatenate POST parameters directly into SQL statements. The researcher also recommends reviewing the other database queries in the application for the same unsafe query-construction pattern.
Variants to test
- Other LIKE-based searches. Any endpoint that builds a
LIKEpattern from a request parameter is a candidate. A positive result is a single quote in the parameter producing a database error or a changed result set, followed by a UNION payload whose output appears in the page. - Other unauthenticated endpoints in the same application. The report notes that
School/search.phphas no authentication check; other handlers in the same codebase are worth checking for the same pattern. A positive result is reaching the query and observing injected output without logging in. - Boolean differential. Send a condition that is always true and one that is always false in the same parameter and compare the returned rows. A positive result is two clearly different result sets for otherwise identical requests.
- UNION column mapping. Increase the number of columns in the injected SELECT until the query succeeds and the chosen expressions appear in the response. A positive result is the database version or database name rendered in the HTML.
- Other request methods and parameters on the same handler. The report only covers POST parameter
s; checking whether the handler also reads the same value from GET or from other fields is a reasonable next step. A positive result is the same injection behaviour through a different entry point.
CVE request tracking
The report records a MITRE request tracking identifier, CAN-2026–2041649, and states plainly that this is a request tracking identifier, not an assigned CVE ID.
What happened, in plain words
A small school administration program, Simple School Management System version 1.0, has a search box for finding staff members. You type a name, the program looks it up in its database, and it shows you the matching people. The researcher, Jatin Patidar (publishing as jatin.security), found that this search box does not treat what you type as plain text. It pastes your text directly into the instruction it sends to the database. That means a person who types the right kind of text can change the instruction itself; in the local test the response exposed the database version and its name. No login is needed to reach the search page.
This kind of flaw is called SQL injection. SQL is the language databases understand, and injection means the attacker's text gets mixed into that language instead of staying separate from it. The report classifies it as CWE-89, which is simply the catalogue number for this family of bug: the program fails to neutralise special characters that have meaning inside an SQL command.
Everything below was tested on the researcher's own computer, in an isolated lab, using made-up records. No real school, no real user and no live website was involved.
The product and the feature
Code-Projects publishes small applications written in PHP and MySQL for people to learn from and practise on. PHP is a programming language commonly used to build websites; MySQL is a database, a program that stores data in tables and answers questions about it. One of these applications is Simple School Management System, version 1.0, a school administration tool distributed as source code, meaning you download the files and run them yourself.
The report looks at one feature only: the staff search. The page behind it is School/search.php. It takes a search term from a form field named s, sends it to the database, and returns the rows from the staff table whose teacher name column, TNAME, matches. A table is like a spreadsheet: rows are records, columns are fields. The staff table holds one row per staff member, and TNAME is the column holding their names.

The image sits at the start of the report, next to the heading "Problem Type", and introduces the classification: CWE-89, Improper Neutralization of Special Elements used in an SQL Command, commonly called SQL Injection.
The setup
"Local" means the application ran on the researcher's own machine, not on the internet. "Synthetic" means the data was invented for the test.
The reproduction environment ran PHP 8.3.6 and MariaDB 10.11. MariaDB is a database program that works like MySQL. The source archive carries build metadata indicating PHP 5.4.12 and MySQL 5.6.12, but those original runtime versions were not independently used for live reproduction.
The endpoint requires no authentication and no particular role: it is reachable as an unauthenticated user. Authentication means proving who you are, usually by logging in. Authorisation means being allowed to do something once you are known. This page checks neither, so anyone who can load it can use it. The HTTP method used is POST. HTTP is the language browsers and servers use to talk; a method is the type of request. GET is what happens when you click a link or load a page, and the details travel in the address bar. POST is what happens when you submit a form, and the details travel in the body of the request, out of sight.
Finding it
The report shows the search term being pasted straight into the query text. The code in the report is:
$sql = “SELECT * FROM staff WHERE TNAME LIKE ‘{$_POST[“s”]}%’ “;
Line by line, in plain words:
$sqlis a variable, a named box that holds a value. Here the box is going to hold the text of an SQL command.SELECT * FROM staffmeans "give me every column of every row in the staff table".WHERE TNAME LIKEadds a filter: only keep rows where the teacher name matches a pattern.LIKEis a pattern match rather than an exact comparison.‘{$_POST[“s”]}%’is the dangerous part.$_POST["s"]is PHP's way of reading the value the user typed into the form field nameds. The curly braces around it tell PHP to drop that value into the surrounding text. So whatever the user typed becomes part of the command.- The
%after it is a wildcard meaning "anything can follow", so searching foranfindsAnand,Anitaand so on. - The single quotes around the whole thing mark the start and end of a piece of text inside SQL. Text between quotes is data, not instructions.
There is no parameterised query and no escaping step for this operation. Escaping means putting a backslash or similar in front of special characters so they lose their meaning; parameterised queries are a safer way of sending values separately from the command, explained in the fix section below.
The second thing that made it worth pursuing is that the endpoint performs no authentication or authorisation check, so the injection is reachable without an account.
Exploitation
All of the following was done against the researcher's own isolated local lab with synthetic data.
Step 1: Confirm the injection with a UNION-based payload
The researcher sent a POST request to School/search.php with a UNION-based payload in s. A payload is the crafted input an attacker sends. UNION is an SQL keyword that glues the results of two queries together: the original staff search, plus a second query the attacker supplies. In the lab, the injected query's output appeared in the HTTP response.
The transmitted request is preserved in the evidence package as a cURL trace, evidence/vuln1_search_UNION.trace. cURL is a command-line tool for sending HTTP requests by hand, and a trace is a recording of exactly what was sent. The report does not reproduce the payload text itself; it describes the result.
The UNION-based test caused attacker-controlled SQL output to be evaluated by the database and rendered in the HTTP response. In other words, database-generated output from the injected query appeared in the HTTP response. "Rendered" means shown in the page the browser displays.
Step 2: Read data back from the response
During the local test the response exposed the database version and the database name. The database version is the make and release number of the database software, and the database name is the label of the data store. Neither is something a staff search should ever reveal. Seeing them proves the injected query's output columns are reflected in the page, which is what makes a UNION-based extraction practical: the attacker chooses which expressions appear in the result set and reads them from the HTML. HTML is the markup language pages are built from, and reading values out of it is just looking at the page source.
Step 3: Confirm with a Boolean-based payload
A Boolean-based test changed the returned staff search results. Boolean means true or false. The idea is to inject a condition that is always true, then one that is always false, and compare. The Boolean-based test changed the returned staff search results, a signal that the input is interpreted as SQL.
Evidence package
The report lists the artefacts collected for independent reproduction and verification:
evidence/EVIDENCE.txt: consolidated test transcript, including requests, responses and before/after database row counts.evidence/vuln1_search_UNION.trace: cURL trace showing the transmitted request.evidence/vuln1_search_UNION.response.html: raw HTTP response demonstrating the injected SQL output.evidence/vuln1_search_UNION.resp_headers.txt: HTTP response headers.CVE_disclosure.md: consolidated vulnerability disclosure document.
A transcript is a written record of what was sent and received. Response headers are the small block of metadata a server sends before the page content, such as the content type and server software. The raw request and response evidence is included so that someone else can reproduce and verify the finding.
Root cause
The defect is string concatenation of user input into SQL. Concatenation means joining pieces of text end to end. The POST parameter s is placed directly inside the LIKE pattern in the query, so any quote or SQL syntax the attacker supplies becomes part of the statement the database parses. The application does not use parameterised queries for this operation.
Nothing in front of the query stops it. The endpoint enforces no authentication or authorisation check, so the injection is not gated behind a login. The report does not describe any input filtering or other control that would have blocked the payloads. Parameterised queries are absent.
Impact
An unauthenticated attacker who can reach the affected endpoint may be able to manipulate the SQL query and retrieve database information through the vulnerable search functionality. The demonstrated effect is disclosure: the local test returned the database version and database name.
The researcher proposes CVSS v3.1 7.5 High, explicitly as a researcher-proposed score subject to CNA assessment. CVSS is a standard way of scoring how serious a vulnerability is, on a scale up to 10. A CNA is the organisation authorised to assign identifiers and scores for a product. The vector string is:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Each part of that string is a short code:
AV:Nmeans the attack vector is network: reachable over a network, not requiring physical access.AC:Lmeans attack complexity is low: no special conditions are needed.PR:Nmeans no privileges are required: no account or login.UI:Nmeans no user interaction: the victim does not have to click anything.S:Umeans scope is unchanged: the impact stays within the vulnerable component.C:Hmeans confidentiality impact is high: data can be read.I:Nmeans integrity impact is none: data is not shown to be changed.A:Nmeans availability impact is none: the service is not shown to be knocked offline.
The report is careful about the limits: no operating-system-level access or production-system compromise is claimed, and the impact should be assessed on the attached reproduction evidence.
Fix
No fix is described as having been applied. The suggested remediation is to use parameterised SQL queries or prepared statements for all user-controlled input, and not to concatenate POST parameters directly into SQL statements. A parameterised query, or prepared statement, is a way of sending the command and the values separately: the database receives the shape of the query first, with a placeholder where the value goes, and then receives the value on its own. The value can never be read as instructions, because it never becomes part of the command text. The everyday comparison is a form letter with a blank line: you fill in the blank, but you cannot rewrite the rest of the letter.
The researcher also recommends reviewing the other database queries in the application for the same unsafe query-construction pattern.
Variants to test
- Other LIKE-based searches. Any endpoint that builds a
LIKEpattern from a request parameter is a candidate. A positive result is a single quote in the parameter producing a database error or a changed result set, followed by a UNION payload whose output appears in the page. - Other unauthenticated endpoints in the same application. The report notes that
School/search.phphas no authentication check; other handlers in the same codebase are worth checking for the same pattern. A positive result is reaching the query and observing injected output without logging in. - Boolean differential. Send a condition that is always true and one that is always false in the same parameter and compare the returned rows. A positive result is two clearly different result sets for otherwise identical requests.
- UNION column mapping. Increase the number of columns in the injected SELECT until the query succeeds and the chosen expressions appear in the response. A positive result is the database version or database name rendered in the HTML.
- Other request methods and parameters on the same handler. The report only covers POST parameter
s; checking whether the handler also reads the same value from GET or from other fields is a reasonable next step. A positive result is the same injection behaviour through a different entry point.
CVE request tracking
The report records a MITRE request tracking identifier, CAN-2026–2041649, and states plainly that this is a request tracking identifier, not an assigned CVE ID. MITRE is the organisation that runs the CVE programme, and CVE IDs are the public catalogue numbers given to known vulnerabilities. A tracking identifier is just a receipt for a request that has been filed; it does not mean a number has been granted.
Glossary
- Authentication: proving who you are, usually by logging in.
- Authorisation: being allowed to do something once you are known.
- Boolean: true or false; a Boolean-based test sends a condition that is always true and one that is always false and compares the results.
- CNA: the organisation authorised to assign vulnerability identifiers and scores for a product.
- Concatenation: joining pieces of text end to end, so that one becomes part of the other.
- cURL: a command-line tool for sending HTTP requests by hand.
- CVE ID: a public catalogue number given to a known vulnerability.
- CVSS: a standard way of scoring the severity of a vulnerability, up to 10.
- CWE-89: the catalogue entry for SQL injection, formally Improper Neutralization of Special Elements used in an SQL Command.
- Database: a program that stores data in tables and answers questions about it.
- Endpoint: a specific page or address in an application that accepts requests.
- Escaping: putting a marker in front of special characters so they lose their meaning.
- GET: an HTTP request type used when loading a page or clicking a link, with details in the address bar.
- HTML: the markup language pages are built from.
- HTTP: the language browsers and servers use to talk to each other.
- HTTP method: the type of an HTTP request, such as GET or POST.
- LIKE: an SQL keyword for pattern matching rather than exact comparison.
- MariaDB: a database program that works like MySQL.
- MITRE: the organisation that runs the CVE programme.
- MySQL: a widely used database program.
- Parameterised query (prepared statement): sending the command and the values separately so the values can never be read as instructions.
- Payload: the crafted input an attacker sends.
- PHP: a programming language commonly used to build websites.
- POST: an HTTP request type used when submitting a form, with details in the request body.
- Rendered: shown in the page the browser displays.
- Response headers: the small block of metadata a server sends before the page content.
- SQL: the language databases understand.
- SQL injection: a flaw where user input becomes part of an SQL command instead of staying separate data.
- Synthetic data: invented records used for testing.
- Table: a set of records in a database, like a spreadsheet.
- Trace: a recording of exactly what was sent in a request.
- Transcript: a written record of what was sent and received during a test.
- UNION: an SQL keyword that glues the results of two queries together.
- WAF (web application firewall): a filter that inspects incoming requests and blocks suspicious ones.
- Wildcard: a character such as
%that stands for "anything can follow".