定位:
第一种情况: 重放攻击有效, 删参数重放攻击 也有效 之后进行稳定性测试.
第二种情况: 重放攻击有效,删参数重放攻击出现问题,寻找最优解, 关键参数处理(找接口,固定值,set-cookie/js逆向),流程完善,代码总结, 稳定测试.
第三种情况: 重放攻击无效, 关键参数猜测与处理(找接口/固定值/set-cookie), 进行测试请求 删参数寻找最优解, 同上.
第四种情况: 重放攻击短期有效,参数过期.关键参数处理,删参数重放攻击,流程完善与代码总结.稳定性测试,短期内崩溃,重新查看是否为参数问题,加上参数在进行稳定性测试
第五种情况,重放攻击无效,在3的基础上炸了.
hook:
简单函数hook(不涉及this指向)
对象属性调用函数(涉及this指向)
document.createElement
_createElement = Document.prototype.createElement
Document.prototype.createElement = function(){
debugger;
return _createElement.call(this, arguments[0])}
push:
_push =Array.prototype.push
Array.prototype.push = function () {
console.log(1111)
return _push.call(this,arguments[0])
}
函数定义获得xxx方法:
Function.prototype.xxx = function(){console.log(2)}
浏览器上极大多数函数都可以hook重写,个别函数可能无法重写
hook函数是可以检测测到的比如上述push,用toString方法检测
a = [1]
a.push.toString()
//'function () {\n console.log(1111)\n return _push.call(this,arguments[0])\n}'
重写toString
document.createElement.toString = function(){
return 'function createElement() { [native code] }'
}
(function(){}).toString.call(document.createElement)
Funcrion.prototype.toString = function(){
console.log(22222)
}
对象部分的hook
对象属性:一般采用修改其描述符的方法进行hook
Object.defineProperty.为对象里面的属性设置描述符的方法.
cookie的赋值不是单纯的替换而是拼接,小心递归栈溢出
_cookie = document.cookie
Object.defineProperty(document, 'cookie',{
set: function(val){
debugger;
},
get: function(){
return _cookie;
}
同时描述符的修改也会被检测.方法:Object.getOwnPropertyDescriptor
Object.getOwnPropertyDescriptor(document, 'cookie')
对象本体的hook
一般情况下选择使用ES6的新语法:代理 Proxy
global = new Proxy(window,{
get:function(){
console.log(arguments)
}
})
关于对象,一部分可以,剩下的不行,特别是与window相关的内容.
类似 location(控制网页url),document(控制文档流),window(控制全局js)
本文详细探讨了在不同情况下如何应对重放攻击,涉及参数处理、关键接口定位、稳定测试,以及如何利用hook技术重写浏览器函数,特别关注document.createElement、Array.prototype.push等。还介绍了对象属性的描述符修改和使用Proxy进行对象代理的方法。
500

被折叠的 条评论
为什么被折叠?



