Reading list
Learn SQL injection from real reports
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.
12 reports, easiest first.
-
Bypassing airport security via SQL injection
The FlyCASS login page for airline administrators was vulnerable to SQL injection in the username field, allowing an attacker to log in as an airline administrator. From there, the attacker could add arbitrary people as authorised crewmembers for KCM and CASS, letting them skip airport security screening and access airliner cockpits.
A login form usually checks your username and password against a database. Here the site pasted whatever you typed straight into the database command, so a cleverly crafted username could trick the database into saying the login was correct. That let the researchers become an airline administrator and register fake crewmembers who could then bypass airport security checks.
The lesson. Likely the username was concatenated directly into the login SQL query instead of being passed as a parameter, so input could alter the query's logic.
-
Dolibarr : unauthenticated contacts database theft
An unauthenticated attacker could access the entire contacts database of a Dolibarr instance by exploiting a SQL LIKE wildcard in a public AJAX endpoint. This allowed retrieval of all customer, supplier, and employee contact details, including private notes.
A public web page in the Dolibarr software let anyone search for contacts by email without logging in. The search used a database pattern that could be tricked with a special character to return every contact instead of just one. This meant anyone could download the whole contact list, including private notes.
The lesson. The public AJAX endpoint passed user-supplied email input directly into a SQL LIKE query without proper escaping or authentication, allowing wildcard injection.
-
SQL-Injektion in Hafenverwaltung YABOOK erlaubt Umgehung der Authentisierung
The login form of the YABOOK harbour management web application was vulnerable to SQL injection in the username field, allowing an unauthenticated attacker to bypass authentication and log in as administrator. The same flaw allowed full compromise of the application, including reading and manipulating all data and extracting unsalted MD5 password hashes.
The login page built a database query by pasting the typed username straight into it. By typing special characters, an attacker could change the meaning of that query so the database always said the login was correct, even without knowing any password. This let them get in as the administrator and read or change everything in the application.
The lesson. Likely the application concatenated user input directly into the SQL login query instead of using parameterised queries, so crafted input altered the query logic.
-
coTURN Administrator Web Portal SQL injection vulnerability
The coTURN administrator web portal builds an SQL query by inserting the submitted username directly into the statement, so a crafted login can return an arbitrary password and bypass authentication. An attacker could then access the administrator portal, even when it is deactivated, and reactivate it.
The login page takes what you type as a username and pastes it straight into a database command. By typing special database characters, an attacker can change that command so the database returns a password the attacker already knows, letting them log in without knowing the real one. This is called SQL injection.
The lesson. The username from the login request is inserted into an SQL statement without sanitisation or parameterisation.
-
Exploring Web Vulnerabilities with ThreatByte: From Exploitation
The ThreatByte application had SQL injection in the file search and reflected XSS in the search input. An attacker could extract user credentials, crack MD5 hashes, log in as admin, and steal session cookies to take over accounts.
SQL injection lets an attacker type database commands into a search box, so the app runs them and shows private data. Reflected XSS lets an attacker put a script in a link; when a victim clicks it, the script runs in their browser and can steal their login cookie.
The lesson. Likely the application built SQL queries by inserting user input directly into the query string and marked user input as safe in HTML templates, disabling escaping.
-
Animals with a Base64 String to Unauthenticated SQL Injection (Intigriti Challenge 0926)
The challenge page took a Base64-encoded animal name from a URL parameter, decoded it, and inserted it directly into a SQL query without sanitisation. An attacker could inject SQL commands to read arbitrary data from the database, including a secret table containing the flag.
The website let you pick an animal picture by putting a coded name in the web address. The site decoded that name and pasted it into a database command without checking it. By adding extra database instructions to the name, an attacker could make the site show secret information from the database.
The lesson. The application decoded the Base64 parameter and concatenated it directly into a SQL query without using prepared statements or input validation.
-
Secure Code Audit 01: A Login and Avatar Upload in PHP
A PHP page for a community forum contains several security flaws: SQL injection in the login query, unrestricted file upload, local file inclusion, reflected XSS, hardcoded database credentials, and weak MD5 password hashing. An attacker could log in as any user without a password, upload and execute a PHP shell to run commands on the server, read arbitrary files, and steal session cookies.
This is a code review of a small PHP login and avatar upload page. The code trusts user input in several places: it pastes a username straight into a database query, saves uploaded files under their original name into a web folder, and includes a file named by a URL parameter. Each of these lets an attacker do something the developer did not intend, such as bypassing the password check or running their own code on the server.
The lesson. The code passes untrusted user input directly into SQL, file system paths, and include statements without validation, sanitisation, or encoding.
-
Taking over 60k spyware user accounts with SQL injection
The Catwatchful stalkerware service had an unauthenticated SQL injection in its getDevice API endpoint, allowing an attacker to dump the entire user database including plaintext passwords. This gave full control over all ~62,000 user accounts.
A SQL injection is a way to sneak database commands into a website's input, like a search box, so the site runs your commands instead of its own. Here, the attacker could ask the server to return all user records, including passwords stored without encryption. That let them take over every account on the service.
The lesson. Likely the application built SQL queries by directly inserting user-supplied input (the imei parameter) without proper sanitisation or parameterised queries.
-
[query-mysql] SQL Injection due to lack of user input sanitization allows to run arbitrary SQL queries when fetching data from database
The query-mysql module builds SQL queries by concatenating user input directly into the query string, so an attacker can inject SQL and retrieve or manipulate any data in the database.
SQL injection is when user input is inserted into a database command without being cleaned, so an attacker can change the command. Here, the module puts values like a username straight into the SQL text, letting an attacker add extra SQL that returns all rows in a table.
The lesson. The module constructs SQL queries by concatenating user-supplied values directly into the query string without escaping or parameterisation.
-
I Asked PostgreSQL a Question It Wasn’t Supposed to Answer
The category filter parameter was inserted directly into a SQL query without sanitisation, allowing UNION-based SQL injection. An attacker could extract usernames and passwords from a hidden users table and log in as administrator.
The website took whatever you typed into the category filter and pasted it directly into a database command. By adding extra database instructions, the author made the site reveal a hidden table of usernames and passwords. This is called SQL injection, and it happens when user input is treated as code instead of plain data.
The lesson. The application concatenated the user-supplied category value directly into a SQL query instead of using parameterised queries.
-
Milesight MilesightVPN requestHandlers.js LoginAuth SQL injection vulnerability
The login function in MilesightVPN builds a SQL query by concatenating user input, allowing an attacker to inject SQL and bypass authentication. An attacker can send a crafted request to log in as any user without knowing the password.
The login page checks your username and password by putting them directly into a database command. Because it does not separate the input from the command, someone can type special characters that change the command's meaning. This lets them log in without a valid password.
The lesson. The SQL query is built by concatenating user input directly into the string instead of using a prepared statement.
-
I Bypassed an Android Login Screen with One Line of Text — Here’s the Code That Let Me Do It
The Allsafe Android app's login screen concatenated user input directly into a SQL query, allowing an attacker to bypass authentication and dump all user credentials. The app also stored passwords as unsalted MD5 hashes, making them trivially crackable.
The app built its login check by gluing together text from the username box and the password box into a database command. By typing special characters, a user could change the meaning of that command so it always said 'yes' and also printed every stored username and password. The passwords were stored in a weak, easily reversed form.
The lesson. The app used raw SQL string concatenation with unparameterised user input in SQLiteDatabase.rawQuery(), and additionally stored passwords as unsalted MD5 hashes.