问答
发起
提问
文章
攻防
活动
Toggle navigation
首页
(current)
问答
商城
实战攻防技术
漏洞分析与复现
NEW
活动
摸鱼办
搜索
登录
注册
某众测前端解密学习记录
渗透测试
某次大型金融公司众测,抓包发现都是加密数据,经过Jsrpc与autoDecoder学习调试后,最后也是成功还原数据包,挖掘出高危漏洞。分享经验,希望对大家有所帮助。
0x00 前言 ======= 相信不少朋友挖掘src时或金融项目中,遇到数据包加密的目标直接放弃,其实不然,随着时代变迁,此类项目只会越来越多,掌握破解之法才是关键。 0X01 分析前端加密函数 ------------- 1-1找到加密解密函数位置 开启f12,控制台中找到对应加解密Js位置  打上断点,开始调试  找到相关函数,点击步入  找到关键解密函数 ```php r = JSON.parse(Object(u["a"])(e, window.cxcrmAesKey)); ```  0x02 jsrpc注入 ============ 项目地址:<https://github.com/jxhczhl/JsRpc> 2-1 --- 控制台中注入此项目中resouces/JsEnv\_Dev.js 启动项目  ```php // 注入环境后连接通信 var demo = new Hlclient("ws://127.0.0.1:12080/ws?group=zzz&name=hlg"); ``` group与name自行修改  测试是否通信成功  2-2 注入环境变量 (此动作要在页面调试中追踪到相关函数才能执行,不然会报错) ---------------------------------------- ```php 加密: window.enc = Object(u["b"]) 解密: window.dec = Object(u["a"]) ```  2-3 多参数调用 --------- ```php demo.regAction("dec", function (resolve,param) { //这里还是param参数 param里面的key 是先这里写,但到时候传接口就必须对应的上 res=dec(param,window.cxcrmAesKey) resolve(res); }) demo.regAction("enc", function (resolve,param) { //这里还是param参数 param里面的key 是先这里写,但到时候传接口就必须对应的上 res=enc(param,window.cxcrmAesKey) resolve(res); }) ```  0x03 联动autoDecoder ================== jsrpc设置好后,就可以联动f神写的autoDecoder了,先上一张原理图  f神在项目中也提供了flasktest.py,这里要修改一下结合jsrpc提供的接口,代码如下(与前文设置参数要对应) ```from import requests import json from urllib.parse import quote app = Flask(__name__) url = "http://localhost:12080/go" @app.route('/encode',methods=["POST"]) def encrypt(): param = request.form.get('dataBody') # 获取 post 参数 #print(json.dumps(param)) param_headers = request.form.get('dataHeaders') # 获取 post 参数 param_requestorresponse = request.form.get('requestorresponse') # 获取 post 参数 data = { "group": "zz", "name": "gg", "action": "enc", "param": json.dumps(param) } res = requests.post(url, data=data) #这里换get也是可以的 encry_param = json.loads(res.text)['data'] print(encry_param) if param_requestorresponse == "request": return param_headers + "\r\n\r\n\r\n\r\n" + encry_param return encry_param @app.route('/decode',methods=["POST"]) def decrypt(): param = request.form.get('dataBody') # 获取 post 参数 param_headers = request.form.get('dataHeaders') # 获取 post 参数 param_requestorresponse = request.form.get('requestorresponse') # 获取 post 参数 print(param) data = { "group": "zz", "name": "gg", "action": "dec", "param": param } res = requests.post(url, data=data) #这里换get也是可以的 decrypt_param = json.loads(res.text)['data'] print(decrypt_param) if param_requestorresponse == "request": return param_headers + "\r\n\r\n\r\n\r\n" + decrypt_param else: return decrypt_param if __name__ == '__main__': app.debug = True # 设置调试模式,生产模式的时候要关掉debug app.run(host="0.0.0.0",port="8888") ```  抓包测试下是否调试成功   调试成功后在burp里插件里选项改为接口加解密  抓包后选择加密部分右键点击插件Decode-即可解密  0X04 总结 ------- 后续调试出明文后,也是成功挖掘出高危漏洞  既然已经联动burp后续可以联动Mitmproxy,xray,sqlmap等,解决了加密问题后思路就跟常规渗透一样了 参考: [jxhczhl/JsRpc: 远程调用(rpc)浏览器方法,免去抠代码补环境 (github.com)](https://github.com/jxhczhl/JsRpc) <https://mp.weixin.qq.com/s/mcvAeEEyvjmV4E4xoaHVUQ> <https://github.com/f0ng/autoDecoder>
发表于 2024-04-15 10:13:29
阅读 ( 6867 )
分类:
渗透测试
13 推荐
收藏
3 条评论
罗辑
2024-04-15 17:54
学到了,高危在向我招手了
请先
登录
后评论
ALI
2024-04-19 16:46
6
请先
登录
后评论
旧城以西
2024-09-14 15:46
大佬,这加密顺序看不懂啊,param = request.form.get('dataBody') # 获取 post 参数(这获取的是明文数据吗)
请先
登录
后评论
请先
登录
后评论
lei_sec
2 篇文章
×
发送私信
请先
登录
后发送私信
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因:
×
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!