I recently entered the world of mobile security and pen-testing. I wanted to install GCC in a jailbroken iOS 8.3 and had to face lots of issues in finding the correct package for it. So I somehow managed to install and run my own C apps 🙂 I thought of sharing this with you, if you are too struggling like me here’s how I managed to install this.
First install OpenSSH and essential bash commands like apt-get, sed, ps, etc. After that you have to install few debian packages along with gcc. Download this zip file I made and drop it into any folder in your iPhone using a SFTP connection or a desktop file browser. After that install all the packages in it.
$ dpkg -i *.deb
Now if you write a classical Hello World program and compile and run you would get an error like this.
Illegal instruction: 4
For more information on the error refer to this. From that link I found out the way to patch for newer ARM architectures. You can also place this bash file as
"patch.sh" inside the
#!/bin/bash # https://osandamalith.wordpress.com sed -i'' 's/\x00\x30\x93\xe4/\x00\x30\x93\xe5/g;s/\x00\x30\xd3\xe4/\x00\x30\xd3\xe5/g;' $1 ldid -s $1
Now simply run
$ patch.sh programname
For running direct assembly programs you don’t need any patch. For example this simple program would directly run after assembling and linking.
.text.globl startstart:mov r2, 14adr r1, strmov r0, 1mov r12, 4swi 0x80mov r0, 0mov r12, 1swi 0x80str:.ascii "Hello, Osanda\n"
There might be many other ways as well. I hope you liked this 🙂