Testing for Client-side
Last updated
Last updated
Client-side SQL injection occurs when an application implements the technology and doesn't properly validate the input nor parametrize its query variables. This database is manipulated by using JavaScript (JS) API calls, such as openDatabase()
, which creates or opens an existing database.
The following test scenario will validate that proper input validation is conducted. If the implementation is vulnerable, the attacker can read, modify, or delete information stored within the database.
If the tested application implements the Web SQL DB, the following three calls will be used in the client-side core:
openDatabase()
transaction()
executeSQL()
The code below shows an example of the APIs' implementation:
After confirming the usage of executeSQL()
, the attacker is ready to test and validate the security of its implementation.
The following example shows how this could be exploited on the client-side:
To return information for all the users, instead of only the user corresponding to the attacker, the following could be used: 15 OR 1=1
in the URL fragment.
The Web SQL DB's implementation is based on .
For additional SQL Injection payloads, go to the scenario.
Follow the same remediation from the .