0x01 前言
常见的js实现加密的方式有:md5、base64、shal,写了一个简单的demo作为测试。
0x02 代码
login.html
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>用户登录</title> <script type="text/ecmascript" src="md5.js"></script> <script> function checkInput() { var password_input = document.getElementById('password'); var password_md5 = document.getElementById('password_md5'); // set password password_md5.value =hex_md5(password_input.value); return true; } </script> </head> <body> <form action="login.php" method="post" onsubmit="return checkInput()"> 用户:<input type="text" id="username" name="username"> <br/> 密码:<input type="password" id="password"> <br/> <input type="hidden" id="password_md5" name="password"> <input type="submit" value="提交" /> </form> </body> </html>
提交表单,进行抓包,可以发现密码字段密码进行了加密处理:
0x03 Web暴力猜解
方式一:Burp Suite
使用Intruder进行暴力猜解,Intruder支持多种爆破模式、加密和编码支持。常见的md5、base64、shal加密方式,都可以用burpsuite直接处理。
四种爆破方式:单一字典爆破、多字段相同字典爆破、多字典位置对应爆破、聚合式爆破。
最常用的应该是在爆破用户名和密码的时候,使用聚合方式枚举了。
1、抓包发送到Intruder,标记相关参数,选择 第四种模式“Cluster bomb”
2、分别选择用户名字典和密码字典,在设置密码字典的时候,选择md5加密方式对密码字段进行加密处理
3、开始进行爆破,根据返回字段长度判断是否成功,成功获取用户名和密码字段的MD5值 admin:21232f297a57a5a743894a0e4a801fc3
4、md5解密成功,获得用户名密码 admin/admin
参考链接:
JS实现密码加密
http://www.cnblogs.com/mofish/archive/2012/02/25/2367858.html
js实现表单提交submit(),onsubmit
https://www.cnblogs.com/web-wjg/p/7894657.html