[转]iOS Tutorial – Dumping the Application Heap from Memory

?Source:https://blog.netspi.com/ios-tutorial-dumping-the-application-heap-from-memory/

An essential part of pentesting iOS applications is analyzing the runtime of the application. In this blog, I will be covering how to dump the heap from an iOS application. I will also be releasing a little script to run on the iOS device to dump the heap of a specified application for you.

You can download the script from the?NetSPI Git Hub. The script basically wraps around GDB, but only dumps the ranges in memory that have “sub-regions”. These sub-regions are usually where I find active credentials, anything that is currently being used in the UI, or instantiated class properties. This technique currently only works for IOS 7 and lower or until there is a working GDB version for IOS 8. You also cannot use the version GDB from the default Cydia repositories. You have to use the fixed version in this repository here: “http://cydia.radare.org” or here is a direct link to the deb package: “http://cydia.radare.org/debs/gdb_1708_iphoneos-arm.deb“. Below are a few screenshots of the process, and how the script works.

First, we launch the application that we want to capture the heap for and log in.

After we log into the app, we will keep it at the first main screen which in this case is the user’s timeline.

Now we will SSH into the device, so that we can leave the application running without the app being put in the background by iOS.

Above is the output that the script provides during runtime. Here we are giving the binary name that we want the script to dump.

Above are all the .dmp files that we can now start searching through for the credentials or any other sensitive data. You can usually find encryption keys or passwords from any instantiated classes that use encryption or contain the login process. I personally use a combination of the “strings” command and “xxd” as a hex dumper but you can use any hex editor that works for you.

This technique can be used to determine if the application is not removing sensitive information from memory once the instantiated classes are done with the data. All applications should deallocate spaces in memory that deal with classes and methods that were used to handle sensitive information, otherwise you run the risk of the information sitting available in memory for an attacker to see.

I’ve included the GDB commands that are used in the script:

  • info mach-regions (look for sub-regions)
  • dump binary memory heap1.dmp <sub-region range from above>

Tags:?GDB,?Heap,?iOS,?Memory

?

?

时间: 2024-10-12 22:29:57

[转]iOS Tutorial – Dumping the Application Heap from Memory的相关文章

C语言错误: CRT detected that the application wrote to memory after end of heap buffer

CRT detected that the application wrote to memory after end of heap buffer 多是中间对其进行了一些操作,在程序结束处,释放内存的时候,引起错误: HEAP CORRUPTION DETECTED:after Normal block(#***) at 0x****.CRT detected that application wrote memory after end of heap buffer. 错误原因: 以对内在操

CRT detected that the application wrote to memory after end of heap buffer.

很多人的解释都不一样,  我碰到的问题是,开辟的内存空间小于操作的内存空间.也就是说,我free的内存越界了. 这是我开辟链表结构体内存的代码: 1 PNODE Create() { 2 int len; //total count of nodes to be created. 3 int i; 4 int val; //temp value for the current node. 5 printf("enter the size of nodes:"); 6 scanf(&qu

ios学习路线—Objective-C(堆(heap)和栈(stack))

Objective-C的对象在内存中是以堆的方式分配空间的,并且堆内存是由你释放的,即release 栈由编译器管理自动释放的,在方法中(函数体)定义的变量通常是在栈内,因此如果你的变量要跨函数的话就需要将其定义为成员变量. 1.栈区(stack):由编译器自动分配释放,存放函数的参数值,局部变量等值.其操作方式类似于数据结构中的栈. 2.堆区(heap):一般由程序员分配释放,若程序员不释放,则可能会引起内存泄漏.注堆和数据结构中的堆栈不一样,其类是与链表. 操作系统iOS 中应用程序使用的计

[vs执行报错] CRT detected that the application wrote to memory after end of heap buffer

CRT 是c/c++ run-time lib , 是程序执行时所需的核心库. 这个错误是由于以对内在操作的过程中.所写的地址超出了.所分配内在的边界 有个建议是: 1.内存申请多少释放多少,释放掉你申请过的内存,不要乱释放. 2.不能释放已经释放的内存.

[vs运行报错] CRT detected that the application wrote to memory after end of heap buffer

CRT 是c/c++ run-time lib , 是程序运行时所需的核心库. 这个错误是因为以对内在操作的过程中,所写的地址超出了,所分配内在的边界 有个建议是: 1.内存申请多少释放多少,释放掉你申请过的内存,不要乱释放: 2.不能释放已经释放的内存:

【iOS】No suitable application records found

昨天提交 Apple 审核时遇到这个问题,如图: 原来是还没在 iTunes Connect 创建 APP ... 后来想想还真是脑子一时没反应过来……

使用Application Uploader工具在windows、linux下上传iOS App

我们知道发布一个app,一般是用到苹果的application loader助手上传应用,用过的都知道使用起来很繁琐,经常出错.而且只能运行在mac系统上,需要一定的硬件条件. 而上架辅助工具Application Uploader,可以实现在windows,linux或mac上,不需要应用程序加载器和mac计算机,就可以发布app到app store,试用了下,感觉不错,分享给各位开发者,方便大家. Application Uploader是一个专门为IOS app上架的开发助手,可以快速,轻

【转】iOS:堆(heap)和栈(stack)的理解--简介

Objective-C的对象在内存中是以堆的方式分配空间的,并且堆内存是由你释放的,即release 栈由编译器管理自动释放的,在方法中(函数体)定义的变量通常是在栈内,因此如果你的变量要跨函数的话就需要将其定义为成员变量. 1.栈区(stack):由编译器自动分配释放,存放函数的参数值,局部变量等值.其操作方式类似于数据结构中的栈. 2.堆区(heap):一般由程序员分配释放,若程序员不释放,则可能会引起内存泄漏.注堆和数据结构中的堆栈不一样,其类是与链表. 操作系统iOS 中应用程序使用的计

iOS:堆(heap)和栈(stack)的理解

Object-c的对象在内存中是以堆的方式分配内存空间的,并且堆内存是由你释放的,即release 1.栈区(stack):由编译器自动分配释放,存放函数的参数值,局部变量等值.其操作方式类似于数据结构中的栈. 2.堆区(heap):一般由程序员分配释放,若程序员不释放,则可能会引起内存泄漏.注堆和数据结构中的堆栈不一样,其类是与链表. 操作系统iOS 中应用程序使用的计算机内存不是统一分配空间,运行代码使用的空间在三个不同的内存区域,分成三个段:"text segment ",&qu