iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 8
2
Security

Web Security 魔法使攻略系列 第 8

Web Security 魔法使攻略─SQL injection 起手式

「第一次接觸 SQL 語法的時候是攻擊資料庫的時候。」
不知道有多少人有這種經驗,第一次接觸 SQL 居然是這種情況,
首先我們要先知道 SQL 是什麼,
SQL 就是資料庫當中用來查詢資料的語言,
所謂資料庫就是存放資料的地方。

所謂資料庫的結構:

  • 資料庫名稱 > 資料格名稱 > 資料欄位名稱 > 資料
    • database > table > column
      在 MySQL 當中有一個存放資料庫中繼資料的地方 information_schema
      通常壞人會來透過 SQLi 的弱點來這裡取得資料庫名稱、資料表名稱和欄位名稱,
      進而竊取到敏感的資料。
      中繼資料的地方
  • SCHEMA_NAME 資料庫的名稱 information_schema.schemata
  • TABLE_NAME 資料表的名稱 information_schema.tables
  • COLUMN_NAME 資料欄位名稱 information_schema.columns
  • 所以你可以去 information_schema.schemata 找到 schema_name
    • 然後去 information_schema.tables 利用 table_schema 找到 table_name
    • 進而用 information_schema.columns 中的 table_name 找到 column_name

推薦文章

-information-schema


上一篇
Web Security 魔法使攻略─PHP 是世界上最好的語言
下一篇
Web Security 魔法使攻略─SQLI II
系列文
Web Security 魔法使攻略30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言