Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SQL Injection〈期末報告〉
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
eric wang
June 07, 2013
0
200
SQL Injection〈期末報告〉
2013/06/10 , 資料庫期末報告@F308
eric wang
June 07, 2013
Tweet
Share
More Decks by eric wang
See All by eric wang
84分的不同凡響
ericwang8230
0
86
那些企業實習的大小事
ericwang8230
1
61
Kruskal's algorithm〈期末報告〉
ericwang8230
0
110
嵌入式系統讀書會成果發表〈決賽〉
ericwang8230
0
140
Wireless Security〈期末報告〉
ericwang8230
0
130
Featured
See All Featured
Believing is Seeing
oripsolob
1
55
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
Paper Plane (Part 1)
katiecoart
PRO
0
4.2k
Utilizing Notion as your number one productivity tool
mfonobong
3
220
How to train your dragon (web standard)
notwaldorf
97
6.5k
30 Presentation Tips
portentint
PRO
1
220
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
86
Crafting Experiences
bethany
1
49
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
140
How STYLIGHT went responsive
nonsquared
100
6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Transcript
SQL Injection 駭客的填空遊戲 2013/06/10 ,資料庫期末報告@F308 王仁宏(Blue Wang) Bluewang1211[at]gmail.com
About Me 王仁宏(Blue Wang) 「駭」你好 資安社團 Founder Hacks in Taiwan
Conference2012台灣駭客年會 101年度資安系列競賽 對於資訊安全有高度興趣, 卻沒有相關天份的一個人。
About Me 100,101台灣區電腦化運動競技大賽 清潔機器人程式設計_佳作 家用服務機器人程式設計_冠軍 2012新瑞展翅微電腦應用大賽_佳作 2012I-Star國家創新發明大賽_佳作
[email protected]
http://blue-wang.blogspot.tw/
Agenda 1.認識SQL Injection SQL Injection 原理 影響的系統 2.駭客看得跟你不一樣 SQL Injection
攻擊(Demo) SQL Injection 防禦
Define: Security
TOP1 SQL Injection
SQL Injection 資料庫注入攻擊
SQL Injection 不是病毒
SQL Injection 寫入特殊SQL程式碼攻擊
1.利用SQL對於字串解析的服務進行注入。 2.利用正常查詢的功能,將攻擊代碼注入 SQL中執行。 3.攻擊者繞過身分認證機制,取得資料庫權 限,竊取資料或竄改、破壞資料庫。
那換個說法講 不懂嗎?
SQL Injection (男女關係版本)
SQL Injection 原理
http://weihsin.twbbs.org/weihsin/photo/hochi/050708/%E5%BF%AB%E6%A8%82%E3%84%8 9%E7%9D%A1%E8%A6%BA%E6%99%82%E5%85%89.jpg
1.前端(User) Web URL 2.後端(Manage) Web Application SQL
None
你會做什麼?
1. 2. 1.馬上登入帳號 2.馬上辦一個帳號 3.Goto 1.
http://iphoto.ipeen.com.tw/photo/comment/3/5/9/cgma2ca91db5443266c9e8f8dd6d18b6e07781.jpg
1. 4. 3. 2. 看看這些地方可不可以 注入一些奇怪的指令
那後端呢?
http://163.13.175.7/vb100/vb100team01/pic/database.GIF
DML DDL DCL 後端SQL語法
這些曾老師上課都講過了 還好
None
None
XD
DELETE – 從Table 中刪除 data INSERT INTO – 插入新資料 到Table
SELECT – 查詢Table內data UPDATE – 更新 Table內data DML
ALTER TABLE – 改變或更新資料表(屬性) CREATE TABLE – 建立新的資料表 DROP TABLE
– 刪除資料表 DDL
資料控制語言 用來控制資料庫內部的交易處理以及維護 系統效能的指令 賦予、刪除、撤回權限與角色 DCL
SELECT <欄位> FROM <表單名稱> [WHERE <條件表達式>] [ORDER BY <欄位>] 常用SQL語法
那就直接看範例吧 不懂嗎?
"SELECT Username FROM Users WHERE Username = ' " &
strUsername & " ' AND Password = ' " & strPassword & " ' "
在登入網頁輸入( ' or 1=1-- ) 則傳到資料庫中的字串會變成 User Input Web ''SELECT
Username FROM Users WHERE Username = ' " & strUsername & " ' AND Password = ' " & strPassword & " ' "
http://www.lu-chen.com/pic/download/src/n52_20111017134529.jpg 接下來,就是見證奇蹟的時刻
見證奇蹟的時刻 ''SELECT Username FROM Users WHERE Username = ' '
or 1=1-- ' AND Password = ' ' or 1=1-- ' " ''SELECT Username FROM Users WHERE Username = ' " & strUsername & " ' AND Password = ' " & strPassword & " ' " User Input:( ' or 1=1-- )
SQL Injection 影響系統
1.Server Ex:Apache、IIS… 2.Web Ex:php、asp、jsp... 3.SQL Ex: Ms-SQL、MySQL、Oracle…
http://2.bp.blogspot.com/- YHninX46Z5Q/T5dC5h3lIlI/AAAAAAAADpo/DQbGb8_jrP8/s1600/_N8F0909.jpg Live Demo
如何保護自己?
1.過濾特殊字元 Ex: -- 、 ' 等 2.過濾輸入條件 Ex:INSERT、SELECT、UPDATE等 3.設定白/黑名單 Ex:
哪些可以輸入 / 哪些不能輸入
4.把入口藏起來 Ex:Port 1433、1434 5.檢查非預期的輸入 Ex:給小孩測試(?)
6.不提供錯誤訊息給使用者 Ex:攻擊者可藉由回報的錯誤訊息得知 資料庫的結構 Ex:建議將錯誤輸入重導到適當網頁
很安全的防禦會讓使用者 And 管理者很難操作。
安全和便利性 是非常兩難的一件事情。
網路法律問題多多, 請勿隨意攻擊未經授權的機器。
http://i.imgur.com/YQmnuqe.png
https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak- prn1/536987_657862564227620_1894612253_n.jpg
1.From SQL injection to shell https://pentesterlab.com/from_sqli_to_shell.html 2.SQL injection http://www.microsoft.com/taiwan/sql/sql_injection_g1.htm 3.BackTrack
Linux fan page http://backtrack-page.blogspot.jp/2013/03/sql-injection.html Reference
不過癮嗎?
2013 Hacks In Taiwan Conference Cyberwar : In hack we
trust.
http://hitcon.org/2013/
Q&A <
[email protected]
>