




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1解密APP加密数据1介绍案例⼀:案例⼆:使⽤objection介绍如今,在做APP安全测试的时候,越来越多的APP数据使⽤加密传输,⼀般的做法都需要去逆向APP并寻找到加解密算法今天主要介绍⼀下iOS的⼀些逆向基础知识,教⼤家碰到加密数据的APP后该如何去解密今天主要是针对两款有不同加密⽅式的iOS应⽤,难度由低到⾼案例⼀:⾸先解决挂代理抓不到包的问题使⽤objectioniossslpinningdisable绕过证书绑定PAGEPAGE10在登录处抓包发现,request包和response包都为加密传输:appmon提供的scriptshack.lu提供的scripts通过参考github上的js脚本,改写了个较为全⾯的hook.js脚本:PlainText
复制代码//IntercepttheCCCryptcall.Interceptor.attach(Module.findExportByName('libcommonCrypto.dylib',pt'),{onEnter:function(args){//Savetheargumentsthis.operation =args[0]this.CCAlgorithm=args[1]this.CCOptions =args[2]this.keyBytes =args[3]this.keyLength =args[4]this.ivBuffer =args[5]this.inBuffer =args[6]this.inLength =args[7]this.outBuffer =args[8]this.outLength =args[9]this.outCountPtr=16console.log('CCCrypt('+'operation:' +this.operation +','+'CCAlgorithm:'+this.CCAlgorithm+','+'CCOptions:' +this.CCOptions +','+'keyBytes:' +this.keyBytes +','+'keyLength:' +this.keyLength +','+'ivBuffer:' +this.ivBuffer +','+'inBuffer:' +this.inBuffer +','+'inLength:' +this.inLength +','+'outBuffer:' +this.outBuffer +','+'outLength:' +this.outLength +','+'outCountPtr:'+this.outCountPtr29if(this.operation==0){//Showthebuffershereifthisanencryptionoperationconsole.log("Inbuffer:")console.log(hexdump(ptr(this.inBuffer),{length:this.inLength.toInt32(),header:true,ansi:true37 }))console.log("Key:")console.log(hexdump(ptr(this.keyBytes),{length:this.keyLength.toInt32(),header:true,ansi:true43 }))44 console.log("IV:")46474846474849505152535455565758596061626364656667686970717273747545ansi:true}))}},onLeave:function(retVal){if(this.operation==1)//Showthebuffershereifthisadecryptionoperationconsole.log("Outbuffer:")console.log(hexdump(ptr(this.outBuffer),{length:Memory.readUInt(this.outCountPtr),header:true,ansi:true}))console.log("Key:")console.log(hexdump(ptr(this.keyBytes),{length:this.keyLength.toInt32(),header:true,ansi:true}))console.log("IV:")console.log(hexdump(ptr(this.ivBuffer),{length:this.keyLength.toInt32(),header:true,ansi:true}))}}})使⽤fridahookCCCrypt函数operation:0x0代表加密,0x1代表解密,CCAlgorithm:0x0指加密⽅式是kCCAlgorithmAES128,CCOptions:0x1指模式是cbc,key=DATA_KEY20150116和iv=20150116参阅CommonCryptor.h各参数意义案例⼆:在登录处抓包发现,request包和response包都为加密传输:使⽤hook.js脚本发现hook不到⽼⽅法,⾸先使⽤frida-ios-dump对该APP进⾏⼀键dumpfrida-ios-dump,该⼯具基于frida提供的强⼤功能通过注⼊js实现内存dump然后通过python⾃动拷⻉到电脑⽣成ipa⽂件,通过配置完成之后真的就是⼀条命令砸壳砸壳完成后会⽣成ipa⽂件,我们解压缩然后使⽤IDA加载完⼆进制⽂件然后在String窗⼝搜索loginbypassword(这个是登录时的信息),搜索后进⼊对应的类,接下来我们进⼊这个类看它⽤了哪些⽅法找到这个字符串引⽤的代码位置之后双击callWebAPI:data:method:ssl:completionHandler:找到[WebServicecallWebAPI:data:method:ssl:completionHandler:]然后F5⼀下浏览该类发现可以看到data等关键加密信息,接着我们尝试搜索data前⾯的setValue:forKey[_priv_NBSSafeMutableDictionarysetValue:forKey:]查看该类发现⽆结果,返回上⼀步重新查看加密所在的类v87由v86WebServicereturnDictionaryWithDataPath:](v11,returnDictionaryWithDataPath:,v201)返回查看returnDictionaryWithDataPath:v8=+[RSAencryptString:privateKey:](&OBJC_CLASS___RSA, encryptString:privateKey:,v4,v6);v4由convertToJsonData:返回(明⽂)v6由AppPrivate返回(密钥)查看密钥返回函数AppPrivate和encryptString:privateKey函数然后使⽤frida进⾏hook使⽤objectionPlainPlainText复制代码ioshookingwatchmethod“+[RSAencryptString:privateKey:]”–dump-argsioshookingwatchmethod“+[RSAencryptString:privateKey:]”–dump-return直接使⽤objection的这两句命令可以达到同样的效果附JS:PlainText
复制代码if(ObjC.available){try{varclassName="RSA";varfuncName="+encryptString:privateKey:"; varhook=eval('ObjC.classes.'+className+'["'+funcName'"]');console.log("[*]ClassName:"+className);console.log("[*]MethodName:"+funcName);Interceptor.attach(hook.implementation,{onEnter:function(args){varparam1=newObjC.Object(args[2]);console.log("args[2]->"+param1);12varparam2=newObjC.Object(args[3]);console.log("args[3]->"+param2);15 },on
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 工业自动化技术发展现状
- 工业遗产改造为文化创意产业园的实践
- 工作场所优化与管理创新
- 工业设计与产品创新策略探讨
- 工作中的安全意识与防护技能
- 工程招标投标与合同管理
- 工作场合的手机使用礼仪
- 工厂布局规划与优化方法
- 工厂机械设备的安全管理
- 市场分析与预测方法探讨
- 《哈尔滨工程大学学报》模板
- DB14T 1049.1-2020 山西省用水定额 第1部分:农业用水定额
- 二、施组报审表
- 配载平衡基础培训
- 医疗废物管理相关法律、法规介绍
- 漯河医学高等专科学校辅导员招聘考试行政管理教师岗笔试面试历年真题库试卷
- 政审在校证明
- 变电站一次通流-通压试验方法的探讨与实践
- 线槽灯安装施工工法
- 自由公差对照表(共3页)
- 约克YS螺杆式冷水机组_《操作手册》6-3
评论
0/150
提交评论