Examining the Database
Database Version
Different databases provide different ways of querying their version. You often need to try out different queries to find one that works, allowing you to determine both the type and version of the database software.
The queries to determine the database version for some popular database types are as follows:
Database type | Query |
---|---|
Microsoft, MySQL |
|
Oracle |
|
PostgreSQL |
|
For example, you could use a UNION
attack with the following input:
This might return output like the following, confirming that the database is Microsoft SQL Server, and the version that is being used:
information_schema
From MySQL 5.0, a default database named information_schema
was added for providing database metadata, such as table names and column names. You can query information_schema.tables
to list the tables in the database:
Next, you can then query information_schema.columns
to list the columns in individual tables:
On Oracle, you can obtain the same information with slightly different queries. You can list tables by querying all_tables
:
And you can list columns by querying all_tab_columns
:
Reference
Last updated