暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Web渗透-漏洞挖掘之身份认证

红客突击队 2021-12-13
769

红客突击队



Web渗透-漏洞挖掘之身份认证


前言
手动漏洞挖掘的原则
    所有变量
    所有头
    Cookie的变量
    逐个变量删除
1、身份认证
    使用常用弱口令/基于字典的密码暴力破解
    测试是否锁定账号
    测试基于手机号的用户名破解,可以在站内论坛收集用户信息
    查看错误秘密提升信息,可以判断用户名或者密码错误
    密码嗅探工具可以直接获取密码
2、方法
主要针对会话 SessionID
    使用嗅探工具等获取SessionID
    注入到浏览器对应的phpcookie里
    就可以获取访问权限
    也可以在url里输入sessionID来登录
    注意测试 SessionID 是否长期不变的
    破译 SessionID 生成算法
    • Sequencer
    • 私有算法
    • 预判下一次登录时生成的 SessionID
    • 登出后返回测试
3、dvwa测试
在dvwa里输入IP地址发现,是执行 ping 测试,发现和shell里ping 3 次结果一样
猜测是系统指令
尝试符号 “;”、"&"、"&&"、"|"、"||"和各类系统指令
可以发现漏洞
根据源码有

# 低安全级别的情况下,服务器未进行任何过滤
<?php
if( isset( $_POST[ 'submit' ] ) ) {
$target = $_REQUEST[ 'ip' ];
// Determine OS and execute the ping command.
if (stristr(php_uname('s'), 'Windows NT')) {
$cmd = shell_exec( 'ping ' . $target );
echo '<pre>'.$cmd.'</pre>';
} else {
$cmd = shell_exec( 'ping -c 3 ' . $target );
echo '<pre>'.$cmd.'</pre>';
}
}
?>




# 中安全级别进行了简单的过滤,替换:'&&' => '',';' => '',使其无效。
<?php
if( isset( $_POST[ 'submit'] ) ) {
$target = $_REQUEST[ 'ip' ];
// Remove any of the charactars in the array (blacklist).
$substitutions = array(
'&&' => '',
';' => '',
);
$target = str_replace( array_keys( $substitutions ), $substitutions, $target );
// Determine OS and execute the ping command.
if (stristr(php_uname('s'), 'Windows NT')) {
$cmd = shell_exec( 'ping ' . $target );
echo '<pre>'.$cmd.'</pre>';
} else {
$cmd = shell_exec( 'ping -c 3 ' . $target );
echo '<pre>'.$cmd.'</pre>';
}
}
?>




#高安全级别进行严格的过滤,不再存在命令执行漏洞
Command Execution Source
<?php
if( isset( $_POST[ 'submit' ] ) ) {
$target = $_REQUEST["ip"];
$target = stripslashes( $target );
// Split the IP into 4 octects
$octet = explode(".", $target);
// Check IF each octet is an integer
if ((is_numeric($octet[0])) && (is_numeric($octet[1])) && (is_numeric($octet[2])) && (is_numeric($octet[3])) && (sizeof($octet) == 4) ) {
// If all 4 octets are int's put the IP back together.
$target = $octet[0].'.'.$octet[1].'.'.$octet[2].'.'.$octet[3];
// Determine OS and execute the ping command.
if (stristr(php_uname('s'), 'Windows NT')) {
$cmd = shell_exec( 'ping ' . $target );
echo '<pre>'.$cmd.'</pre>';
} else {
$cmd = shell_exec( 'ping -c 3 ' . $target );
echo '<pre>'.$cmd.'</pre>';
}
}
else {
echo '<pre>ERROR: You have entered an invalid IP</pre>';
}
}
?>

结语
主要学习身份认证的漏洞挖掘的方法

文章转载自红客突击队,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论