定位与hook

定位:
第一种情况: 重放攻击有效, 删参数重放攻击 也有效 之后进行稳定性测试.
第二种情况: 重放攻击有效,删参数重放攻击出现问题,寻找最优解, 关键参数处理(找接口,固定值,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)

  • 5
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值