iOS安全攻防(六):使用class-dump-z分析支付宝app

2024-05-28 01:58

本文主要是介绍iOS安全攻防(六):使用class-dump-z分析支付宝app,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

为了了解支付宝app的源码结构,我们可以使用class-dump-z工具来分析支付宝二进制。


1.下载配置class_dump_z


前往 https://code.google.com/p/networkpx/wiki/class_dump_z ,下载tar包,然后解压配置到本地环境

  1. $ tar -zxvf class-dump-z_0.2a.tar.gz  
  2. $ sudo cp mac_x86/class-dump-z /usr/bin/  



2.class_dump支付宝app


  1. $ class-dump-z Portal > Portal-dump.txt  
  2.   
  3. @protocol XXEncryptedProtocol_10764b0  
  4. -(?)XXEncryptedMethod_d109df;  
  5. -(?)XXEncryptedMethod_d109d3;  
  6. -(?)XXEncryptedMethod_d109c7;  
  7. -(?)XXEncryptedMethod_d109bf;  
  8. -(?)XXEncryptedMethod_d109b8;  
  9. -(?)XXEncryptedMethod_d109a4;  
  10. -(?)XXEncryptedMethod_d10990;  
  11. -(?)XXEncryptedMethod_d1097f;  
  12. -(?)XXEncryptedMethod_d10970;  
  13. -(?)XXEncryptedMethod_d10968;  
  14. -(?)XXEncryptedMethod_d10941;  
  15. -(?)XXEncryptedMethod_d10925;  
  16. -(?)XXEncryptedMethod_d10914;  
  17. -(?)XXEncryptedMethod_d1090f;  
  18. -(?)XXEncryptedMethod_d1090a;  
  19. -(?)XXEncryptedMethod_d10904;  
  20. -(?)XXEncryptedMethod_d108f9;  
  21. -(?)XXEncryptedMethod_d108f4;  
  22. -(?)XXEncryptedMethod_d108eb;  
  23. @optional  
  24. -(?)XXEncryptedMethod_d109eb;  
  25. @end  

查看得到的信息是加过密的,这个加密操作是苹果在部署到app store时做的,所以我们还需要做一步解密操作。



3.使用Clutch解密支付宝app


1)下载Clutch
iOS7越狱后的Cydia源里已经下载不到Clutch了,但是我们可以从网上下载好推进iPhone
地址:Clutch传送门


2)查看可解密的应用列表

  1. root# ./Clutch   
  2.   
  3. Clutch-1.3.2  
  4. usage: ./Clutch [flags] [application name] [...]  
  5. Applications available: 9P_RetinaWallpapers breadtrip Chiizu CodecademyiPhone FisheyeFree food GirlsCamera IMDb InstaDaily InstaTextFree iOne ItsMe3 linecamera Moldiv MPCamera MYXJ NewsBoard Photo Blur Photo Editor PhotoWonder POCO相机 Portal QQPicShow smashbandits Spark tripcamera Tuding_vITC_01 wantu WaterMarkCamera WeiBo Weibo    


3)解密支付宝app

  1. root# ./Clutch Portal  
  2.   
  3. Clutch-1.3.2  
  4. Cracking Portal...  
  5. Creating working directory...  
  6. Performing initial analysis...  
  7. Performing cracking preflight...  
  8. dumping binary: analyzing load commands  
  9. dumping binary: obtaining ptrace handle  
  10. dumping binary: forking to begin tracing  
  11. dumping binary: successfully forked  
  12. dumping binary: obtaining mach port  
  13. dumping binary: preparing code resign  
  14. dumping binary: preparing to dump  
  15. dumping binary: ASLR enabled, identifying dump location dynamically  
  16. dumping binary: performing dump  
  17. dumping binary: patched cryptid  
  18. dumping binary: writing new checksum  
  19. Censoring iTunesMetadata.plist...  
  20. Packaging IPA file...  
  21.   
  22. compression level: 0  
  23.     /var/root/Documents/Cracked/支付宝钱包-v8.0.0-(Clutch-1.3.2).ipa  
  24.   
  25. elapsed time: 7473ms  
  26.   
  27. Applications Cracked:   
  28. Portal  
  29.   
  30. Applications that Failed:  
  31.   
  32. Total Success: 1 Total Failed: 0  



4)导出已解密的支付宝app

从上一步骤得知,已解密的ipa位置为:/var/root/Documents/Cracked/支付宝钱包-v8.0.0-(Clutch-1.3.2).ipa
将其拷贝到本地去分析




4.class_dump已解密的支付宝app


解压.ipa后,到 支付宝钱包-v8.0.0-(Clutch-1.3.2)/Payload/Portal.app 目录下,class_dump已解密的二进制文件

  1. $ class-dump-z Portal > ~/Portal-classdump.txt  

这回就可以得到对应的信息了:

  1. @protocol ALPNumPwdInputViewDelegate <NSObject>  
  2. -(void)onPasswordDidChange:(id)onPassword;  
  3. @end  
  4.   
  5. @protocol ALPContactBaseTableViewCellDelegate <NSObject>  
  6. -(void)shareClicked:(id)clicked sender:(id)sender;  
  7. @end  
  8.   
  9. @interface MMPPayWayViewController : XXUnknownSuperclass <SubChannelSelectDelegate, UITableViewDataSource, UITableViewDelegate, CellDelegate, UIAlertViewDelegate> {  
  10. @private  
  11.     Item* channelSelected;  
  12.     BOOL _bCheck;  
  13.     BOOL _bOpenMiniPay;  
  14.     BOOL _bNeedPwd;  
  15.     BOOL _bSimplePwd;  
  16.     BOOL _bAutopayon;  
  17.     BOOL _bHasSub;  
  18.     BOOL _bFirstChannel;  
  19.     BOOL _bChangeSub;  
  20.     BOOL _bClickBack;  
  21.     UITableView* _channelListTableView;  
  22.     NSMutableArray* _channelListArray;  
  23.     NSMutableArray* _subChanneSelectedlList;  
  24.     NSMutableArray* _unCheckArray;  
  25.     UIButton* _saveButton;  
  26.     UILabel* _tipLabel;  
  27.     MMPPasswordSwichView* _payWaySwitch;  
  28.     MMPPopupAlertView* _alertView;  
  29.     UIView* _setView;  
  30.     int _originalSelectedRow;  
  31.     int _currentSelectedRow;  
  32.     NSString* _statusCode;  
  33.     ChannelListModel* _defaultChannelList;  
  34. }  
  35. @property(assign, nonatomic) BOOL bClickBack;  
  36. @property(retain, nonatomic) ChannelListModel* defaultChannelList;  
  37. @property(retain, nonatomic) NSString* statusCode;  
  38. @property(assign, nonatomic) int currentSelectedRow;  
  39. @property(assign, nonatomic) int originalSelectedRow;  
  40. @property(retain, nonatomic) UIView* setView;  
  41. @property(retain, nonatomic) MMPPopupAlertView* alertView;  
  42. @property(retain, nonatomic) MMPPasswordSwichView* payWaySwitch;  
  43. @property(assign, nonatomic, getter=isSubChannelChanged) BOOL bChangeSub;  
  44. @property(assign, nonatomic) BOOL bFirstChannel;  
  45. @property(assign, nonatomic) BOOL bHasSub;  
  46. @property(assign, nonatomic) BOOL bAutopayon;  
  47. @property(assign, nonatomic) BOOL bSimplePwd;  
  48. @property(assign, nonatomic) BOOL bNeedPwd;  
  49. @property(assign, nonatomic) BOOL bOpenMiniPay;  
  50. @property(assign, nonatomic) BOOL bCheck;  
  51. @property(retain, nonatomic) UILabel* tipLabel;  
  52. @property(retain, nonatomic) UIButton* saveButton;  
  53. @property(retain, nonatomic) NSMutableArray* unCheckArray;  
  54. @property(retain, nonatomic) NSMutableArray* subChanneSelectedlList;  
  55. @property(retain, nonatomic) NSMutableArray* channelListArray;  
  56. @property(retain, nonatomic) UITableView* channelListTableView;  
  57. -(void).cxx_destruct;  
  58. -(void)subChannelDidSelected:(id)subChannel;  
  59. -(void)switchCheckButtonClicked:(id)clicked;  
  60. -(void)checkboxButtonClicked:(id)clicked;  
  61. -(void)onCellClick:(id)click;  
  62. -(void)showSubChannels;  
  63. -(void)tableView:(id)view didSelectRowAtIndexPath:(id)indexPath;  
  64. -(id)tableView:(id)view cellForRowAtIndexPath:(id)indexPath;  
  65. -(int)tableView:(id)view numberOfRowsInSection:(int)section;  
  66. -(float)tableView:(id)view heightForRowAtIndexPath:(id)indexPath;  
  67. -(int)numberOfSectionsInTableView:(id)tableView;  
  68. -(void)setTableViewFootView:(id)view;  
  69. -(void)setTableViewHeaderView:(id)view;  
  70. -(id)tableView:(id)view viewForHeaderInSection:(int)section;  
  71. -(id)tableView:(id)view viewForFooterInSection:(int)section;  
  72. -(float)tableView:(id)view heightForHeaderInSection:(int)section;  
  73. -(float)tableView:(id)view heightForFooterInSection:(int)section;  
  74. -(void)alertView:(id)view clickedButtonAtIndex:(int)index;  
  75. -(void)clickSave;  
  76. -(void)netWorkRequestWithPwd:(id)pwd;  
  77. -(void)setPayWaySwitchStates:(id)states;  
  78. -(void)changePayWaySwitch:(id)aSwitch;  
  79. -(void)scrollToSelectedRow;  
  80. -(void)didReceiveMemoryWarning;  
  81. -(void)viewDidLoad;  
  82. -(void)applicationEnterBackground:(id)background;  
  83. -(void)dealloc;  
  84. -(void)goBack;  
  85. -(BOOL)isChannelsSetChanged;  
  86. -(id)subChannelCode:(int)code;  
  87. -(id)subChannelDesc:(int)desc;  
  88. -(id)initWithDefaultData:(id)defaultData;  
  89. -(id)initWithNibName:(id)nibName bundle:(id)bundle;  
  90. -(void)commonInit:(id)init;  
  91. @end  



5.分析支付宝源码片段


1)使用了@private关键字限制成员访问权限
但是实际上,在Objective-C编程中,使用@private连Keypath访问都拦不住的


2)抛出了冗长的成员对象
这非常有利分析程序结构




6.进一步思考


1)如何利用 class-dump 结果,结合 cycript 进行攻击呢?
2)class-dump-z 如此强大,有什么方法可以减少暴露的信息吗?


接下来的博文将针对上面的思考,继续总结~

这篇关于iOS安全攻防(六):使用class-dump-z分析支付宝app的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1009222

相关文章

C语言中联合体union的使用

本文编辑整理自: http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=179471 一、前言 “联合体”(union)与“结构体”(struct)有一些相似之处。但两者有本质上的不同。在结构体中,各成员有各自的内存空间, 一个结构变量的总长度是各成员长度之和。而在“联合”中,各成员共享一段内存空间, 一个联合变量

Tolua使用笔记(上)

目录   1.准备工作 2.运行例子 01.HelloWorld:在C#中,创建和销毁Lua虚拟机 和 简单调用。 02.ScriptsFromFile:在C#中,对一个lua文件的执行调用 03.CallLuaFunction:在C#中,对lua函数的操作 04.AccessingLuaVariables:在C#中,对lua变量的操作 05.LuaCoroutine:在Lua中,

Vim使用基础篇

本文内容大部分来自 vimtutor,自带的教程的总结。在终端输入vimtutor 即可进入教程。 先总结一下,然后再分别介绍正常模式,插入模式,和可视模式三种模式下的命令。 目录 看完以后的汇总 1.正常模式(Normal模式) 1.移动光标 2.删除 3.【:】输入符 4.撤销 5.替换 6.重复命令【. ; ,】 7.复制粘贴 8.缩进 2.插入模式 INSERT

Lipowerline5.0 雷达电力应用软件下载使用

1.配网数据处理分析 针对配网线路点云数据,优化了分类算法,支持杆塔、导线、交跨线、建筑物、地面点和其他线路的自动分类;一键生成危险点报告和交跨报告;还能生成点云数据采集航线和自主巡检航线。 获取软件安装包联系邮箱:2895356150@qq.com,资源源于网络,本介绍用于学习使用,如有侵权请您联系删除! 2.新增快速版,简洁易上手 支持快速版和专业版切换使用,快速版界面简洁,保留主

如何免费的去使用connectedpapers?

免费使用connectedpapers 1. 打开谷歌浏览器2. 按住ctrl+shift+N,进入无痕模式3. 不需要登录(也就是访客模式)4. 两次用完,关闭无痕模式(继续重复步骤 2 - 4) 1. 打开谷歌浏览器 2. 按住ctrl+shift+N,进入无痕模式 输入网址:https://www.connectedpapers.com/ 3. 不需要登录(也就是

[职场] 公务员的利弊分析 #知识分享#经验分享#其他

公务员的利弊分析     公务员作为一种稳定的职业选择,一直备受人们的关注。然而,就像任何其他职业一样,公务员职位也有其利与弊。本文将对公务员的利弊进行分析,帮助读者更好地了解这一职业的特点。 利: 1. 稳定的职业:公务员职位通常具有较高的稳定性,一旦进入公务员队伍,往往可以享受到稳定的工作环境和薪资待遇。这对于那些追求稳定的人来说,是一个很大的优势。 2. 薪资福利优厚:公务员的薪资和

iOS HTTPS证书不受信任解决办法

之前开发App的时候服务端使用的是自签名的证书,导致iOS开发过程中调用HTTPS接口时,证书不被信任 - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAu

Toolbar+DrawerLayout使用详情结合网络各大神

最近也想搞下toolbar+drawerlayout的使用。结合网络上各大神的杰作,我把大部分的内容效果都完成了遍。现在记录下各个功能效果的实现以及一些细节注意点。 这图弹出两个菜单内容都是仿QQ界面的选项。左边一个是drawerlayout的弹窗。右边是toolbar的popup弹窗。 开始实现步骤详情: 1.创建toolbar布局跟drawerlayout布局 <?xml vers

Python应用开发——30天学习Streamlit Python包进行APP的构建(9)

st.area_chart 显示区域图。 这是围绕 st.altair_chart 的语法糖。主要区别在于该命令使用数据自身的列和指数来计算图表的 Altair 规格。因此,在许多 "只需绘制此图 "的情况下,该命令更易于使用,但可定制性较差。 如果 st.area_chart 无法正确猜测数据规格,请尝试使用 st.altair_chart 指定所需的图表。 Function signa

C#中,decimal类型使用

在Microsoft SQL Server中numeric类型,在C#中使用的时候,需要用decimal类型与其对应,不能使用int等类型。 SQL:numeric C#:decimal