iOS/Android Developer Security Basics
5 (2)

Click to rate this post!
[Total: 2 Average: 5]
Unsplash.com

I couldn’t find a single place that covers the mobile developer security (must know) basics, this will be again like a chat between two developers (Lulu πŸ‘©πŸΌβ€πŸ’») and (Sam πŸ¦–)

πŸ‘©πŸΌβ€πŸ’»: What are the risks of not having good security precautions? I can see we spend big money on security.
πŸ¦–: There are over 500 reported incidents of data-breach each year, It’s estimated that each incident costs 3.5M~5.0M USD on average.
If you look at statistics, you can see that remote jobs increased these costs by 15%, since attackers would have more opportunities of attacking a target that is spread on different locations.

πŸ‘©πŸΌβ€πŸ’»: When people talk about security, the server is being presented as the bottleneck, why would a mobile developer be concerned with security if the website is secure?
πŸ¦–: The weakest link is the bottleneck, if the client is poorly written, you should expect a lot of attacks on the server, also, users spend about 90% of their time on mobile rather than web browsers.

πŸ‘©πŸΌβ€πŸ’»: But you are an iOS developer, and I develop for Android, would your tips and hints be applicable to Android too? oh, I almost forgot that both are based on Linux.
πŸ¦–: wait, they are not both based on Linux, iOS is aΒ Unix-like Operating SystemΒ which isΒ based on Darwin(BSD)Β operating system, while Android is Linux-based Operating SystemΒ and is an open source mobile operating system, there are a lot of precautions that are applicable on both OSs.

πŸ‘©πŸΌβ€πŸ’»: I was asking myself in the past, why not rely on HTTPS and that’s it?
πŸ¦–: HTTPS protects users from other users, it doesn’t protect the server or the application sensitive data itself.

πŸ‘©πŸΌβ€πŸ’»: What are the mobile weak points? what can be hacked?
πŸ¦–: Network , Disk, USB Port, etc…

πŸ‘©πŸΌβ€πŸ’»: That looks like a lot of terminology, can you explain the basics?
πŸ¦–: You will be good to go if you know these as a start.


TermBasic Explanation.
Authentication establish a user’s identity
Authorizationgrant a user an access to a resource, look up the difference between Authorization and Authentication
Cryptographythe study of concepts like Encryption, decryption.
Encryptionmeans of securing digital data using one or more mathematical techniques, along with a password or “key” used to decrypt the information
Decryptionthe conversion of encrypted data to its original form.
Hashinga hash function is any function that can be used to map data of arbitrary size to fixed-size values, used mainly for fingerprinting.
Forensicsa branch of digital forensic science pertaining to evidence found in computers and digital storage media.
Sniffingprocess of monitoring and capturing all data packets passing through given network
HTTPSHypertext Transfer Protocol Secure, a web protocol
SSLSecure Sockets Layer
TLSTransport Layer Security (TLS)
IP SpoofingIP spoofing is the creation of Internet Protocol (IP) packets which have a modified source address in order to either hide the identity of the sender
Reverse Engineeringis a process in which software, machines, aircraft, architectural structures and other products are deconstructed to extract design information from them.
MITMMan in the middle, it’s a type of a cyber attack where they secretly relay and possibly alter the data between two parties.
XSSCross Site Scripting (XSS)
SQL Injection:Read About it here.
OWASPOpen Web Application Security Project (OWASP)
MASVSMobile Application Security Verification Standard, it’s a sister project of OWASP Mobile Security testing guide.
Binarya non-text encoded file
Mach-O binaryUnder NeXTSTEP, OPENSTEP, macOS, and iOS, multiple Mach-O files can be combined in a multi-architecture binary
Basic Terminology


πŸ‘©πŸΌβ€πŸ’»: Why would people with a jailbroken device be a threat on the app itself, a jailbreak only make the user hackable, right?
πŸ¦–: No, The best practice, is to prevent people with Jailbroken devices from running your app, see my x04_checker repo, iOS Developers can use it to prevent jailbroken devices from running their applications.

Jailbreaking is the process of exploiting the flaws of a locked-down electronic device to install software other than what the manufacturer has made available for that device. It allows the owner to gain full access to the root of the operating system and access all the features, you must know that 100% jailbreak detection is not possible, we need to make (bypassing jailbreak detection) time-consuming, because an attacker can steal the developer info, and thus steal the app info.

πŸ‘©πŸΌβ€πŸ’»: They say debugging and print statements can be a security vulnerability, is this true?
πŸ¦–: Print normally only works on development builds, print will still send the data to the usb interface.

As you mentioned print, It’s a heavy command though, even if your debugging device is not connected in debug mode with Xcode, leaving print statement of heavy objects might make your app slower during development, but anyway, this is not our topic.

Keep in mind, NSLog will be left even in Distribution builds, any normal user can see the logs using the macOS console app, I used them when debugging opening the app using a notification when it’s terminated, this is not easy to do in Xcode directly, anyway, just use NSLog carefully, and treat the error log files with care, don’t log sensitive data, or leave trace of code symbols.

πŸ‘©πŸΌβ€πŸ’»: What about certificate pinning?
πŸ¦–: Certificate pinning simply prevents people from having the victim installing an incorrect certificate and making altered requests, you simply make the certificate a static asset in the binary, so an attacker can not have the victim installing another fake certificate to have them impersonated.

πŸ‘©πŸΌβ€πŸ’»: What about sensitive static strings?
πŸ¦–: Never have your sensitive strings inside plist or any asset file, this is the most basic tip you should never miss.
πŸ‘©πŸΌβ€πŸ’»: Wait Sam, I downloaded a facebook apk online, and ran a simple command to scan the binary for strings that look similar to google api keys, that begin with AIz, and I can see this, any explanation why this is not hidden in the binary?

 strings targetFile | grep "targetString"

using the strings command on macos

πŸ¦–: There are multiple ways google makes sure that a request is authentic, from comparing hashes, to domain binding to bundle ids etc… again, you need to have your sensitive data hidden, this is not an excuse.

πŸ‘©πŸΌβ€πŸ’»: Why is it said to be risky to use 3rd party libraries when developing sensitive apps like banks?
πŸ‘¨πŸ»β€πŸ’»: In normal cases, libraries are fine, just make sure that they are being audited, NPM libraries had a lot of these, for sensitive apps, it’s better to avoid them altogether.

πŸ‘©πŸΌβ€πŸ’»: If I follow all of these tips, I will be completely secure?
πŸ¦–: The sad news is, No, there are a lot of other attacks, like URL-scheme attacks, when you define a url scheme, your app responds to that scheme, so for instance, you create a scheme myapp://. all links starting with your scheme will directly launch your app. A universal link doesn’t include your scheme in the url but they will still launch your application, apple allows other apps to the register the same url.
πŸ‘©πŸΌβ€πŸ’»: the alternative is universal links?
πŸ¦–: correct!

πŸ‘©πŸΌβ€πŸ’»: That was a huge amount of info for a starter, any final thoughts?
πŸ¦–: 100% Security for any Application is not possible but we can try to make the attacking/cracking of iOS App as much harder as possible.

Security is not always about “make accessing the data impossible”. sometimes it is about cost and likelihood of retrieval versus importance of the data.

More tips on top of my head:

  • Avoid Objective-C if possible, it’s very easy to reverse engineer.
  • Don’t write sensitive data into logs.
  • Disable Keyboard caching (3rd party keyboard)
  • Password/Pin should not be exposed during user interaction – Don’t include sensitive data in backup.
  • User Credentials should be stored in (keystore, keychain…).
  • SSL Pinning.
  • App Transport Security – Certificate Pinning.
  • Integrity Check.
  • Prevent Running on rooted devices.
  • Detect JailBreak, (Jail Monkey library).
  • Use WebView carefully.
  • Securing Data on disk.
  • Securing Data across a network connection.
  • Secure application logic.
  • prevent Reverse Engineering (even if there is no sensitive data, if your app is novel, you don’t want people to see the code)
  • Don’t share sensitive data with 3rd party
  • Avoid keywords like (β€œjail”,”security”,”cydia”,”apt”) in variable & function names
  • Hide the JB check deep in the app, not in appdelegate…
  • Some Jailbreaks are permanent, and are done by exploiting security flaws in hardware.
Book Offer50% OFF in Books Book Offer

Easily Tiling Images in interface builder, without code !
5 (1)

Click to rate this post!
[Total: 1 Average: 5]
images, with and without tiling

Tiling images in interface builder directly without code is easy…

1- add an image into assets catalogue.
2- select the asset, go to “editor” menu, then choose “Show Slicing”.
3- the asset image will show up as darker, with a button labeled “Start Slicing”, and you will be able to select the slicing type.


4- select how you want the image tiled, in normal cases you will have the setup like this, zeroed Left, Right, Top and Bottom, and the Width & Height as the image dimensions.


5- for tilability, the image content mode should be fill, not fit.

Keep experimenting, and go wild with your Imagination, sample of playing with small tilable images I have..