Pentest & Bug Bounty Resources and Techniques
  • Pentest & Bug Bounty Resources and Techniques
    • Introduction
    • Tests Checklist
    • OSINT
    • Communications Security
      • SSL/TLS
    • Networking
      • Subdomains Discovery
        • DNS & OSINT
        • DNS Brute force
          • Second DNS Brute-Force Round
      • Subdomain Takeover
      • Network Host Scan/Discovery
        • External/Internal
        • Internal only
      • Network Vulnerability Scanning
      • Network Hacking
      • Parsing
      • Reporting
    • Brute Force
      • Wordlists
      • Databases
      • SSH
    • Web
      • Endpoint Discovery
      • Infrastructure & Configuration
        • Headers
        • WAF Detection/ Evasion
      • Injection
        • GraphQL
        • Cross-Site Scripting (XSS)
        • SQL Injection
        • Payloads
      • SSRF & XXE
        • Labs & Resources
        • Tools
        • SVG SSRF Cheatsheet
        • XXE - XEE - XML External Entity
      • JWT Vulnerabilities (Json Web Tokens)
      • HTTP/S DoS
    • Mobile
      • Both
        • SAST
          • MobSF
        • DAST
          • Installing Frida and Objection
      • Android
        • Create a Lab
          • Rooting Android Emulator
          • Rooting Android Emulator Cheat Sheet
        • APK Certificates
        • SAST
          • APKs
            • Get Information from APK
            • GDA (GJoy Dex Analysizer)
            • Scanning APK for URIs, endpoints & secrets
            • Google Maps API Scanner
        • DAST
          • Rooting the Android Studio AVDs
          • non-Rooted devices
            • Bypass SSL Pinning - non-rooted devices
              • Method 1: apk-mitm
              • Instrumentation with Frida and Objection
                • Bypass SSL Pinning - Method 2: With Objection Explore
                • Bypass SSL Pinning - Method 3: With root_bypass.js
          • Rooted Devices
            • Run frida-server in the emulator or device
            • Inject Frida
            • Bypass SSL Pinning - rooted devices
              • Install Burp CA as a system-level CA on the device
      • iOS
        • SAST
          • Building a reverse iOS engineering environment for free
          • Test Vulnerabilities
  • Lets Practice
    • Virtual Machines
    • Vulnerable App
    • Guided Labs
    • CTFs
  • Group 1
    • AI
Powered by GitBook
On this page
  • App Transport Security (ATS) exceptions
  • Determining whether your app’s endpoints can support ATS
  • Use of obsolete/insecure libraries
  • Use of the insecure Random function(s)
  1. Pentest & Bug Bounty Resources and Techniques
  2. Mobile
  3. iOS
  4. SAST

Test Vulnerabilities

PreviousBuilding a reverse iOS engineering environment for freeNextVirtual Machines

Last updated 3 years ago

App Transport Security (ATS) exceptions

Manual See the Info.plist

unzip <appName>.ipa
cd Payload/<BundleName>.app/
plutil -convert xml1 Info.plist
open Info.plist

The .ipa is now unzipped and the Info.plist file is converted into a readable format and opened. Now, locate the “App Transport Security Settings,” and there you will find the current ATS configuration which will look something like this:

Determining whether your app’s endpoints can support ATS

Check whether your endpoints are already compatible with ATS. Do that using your MacOS device and the /usr/bin/nscurl --ats-diagnostics --verbose <https://yourdomain.com> Xcode command to verify if your endpoint is currently compatible.

Use of obsolete/insecure libraries

Within the C language, libraries or functions such as _sprintf, _strlen, _vsnprintf, _printf, _strncpy, _memcpy, _sscanf, _strcpy, _strcat, _vsprintf, _stat , _fopen are deprecated as they can lead to memory corruption so should no longer be used.

Usage of these represent a vulnerability that can be exploited by causing a buffer overflow, which is very difficult to exploit in the iOS ecosystem. However, it is considered a "good practice" not to use them.

You can evidence/discover when the binary may contain the following insecure API(s): _sprintf, _strlen, _vsnprintf, _printf, _strncpy, _memcpy, _sscanf, _strcpy, _strcat, _vsprintf, _stat , _fopen.

This is really useful to evidence the Binary makes use of insecure API(s) results from MobSF

References:

  • CVSS V2: 6 (medium)

  • CWE: CWE-676 - Use of Potentially Dangerous Function

  • OWASP Top 10: M7: Client Code Quality

  • OWASP MASVS: MSTG-CODE-8

1. Decompress the .ipa file

2. Open a terminal in the decompressed folder

3. Run the following command

otool -Iv <APP_NAME>.app/<APP_NAME> | grep -w <API>

4. Also you can ask for all the insecure APIs"

otool -Iv <APP_NAME>.app/<APP_NAME> | grep -w "_sprintf|_fopen|_strncat|_strncpy|_strtok|_vsnprintf|_stat|_strlen|_strcat|_strcpy|_sscanf|_chmod|_printf|_memcpy"

Use of the insecure Random function(s)

Under certain conditions, this weakness can expose the mobile app's data encryption or other randomization-based protection. For example, if encryption tokens are generated within the app.

References:

  • CVSS V2: 3 (low)

  • CWE: CWE-330 Use of Insufficiently Random Values

  • OWASP Top 10: M5 : Insufficient Cryptography

  • OWASP MASVS: MSTG-CRYPTO-6

While this vulnerability could be reported, it is important for code developers, who are the ones with access to the code, to validate whether these random but insecure functions are actually used for encryption since, for example, using an insecure random function to generate a random color on the screen for display is not a security issue since a cryptographically secure random number generator is not needed for this task, even if it can be predicted it would not be a problem.

1. Decompress the .ipa file

2. Open a terminal in the decompressed folder

3. Run the following command

otool -Iv <APP_NAME>.app/<APP_NAME> | grep -w <FUNCTION>

4. Also you can ask for all the insecure APIs"

otool -Iv <APP_NAME>.app/<APP_NAME> | grep -w "_random\|_srand"

See more in and

https://www.nowsecure.com/blog/2017/08/31/security-analysts-guide-nsapptransportsecurity-nsallowsarbitraryloads-app-transport-security-ats-exceptions/
https://vulncat.fortify.com/en/detail?id=desc.config.swift.insecure_transport_disabled_app_transport_security
If you see this, this application uses ATS bypass
This shows an endpoint which is able to use ATS