• Stars
    star
    146
  • Rank 252,700 (Top 5 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 11 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Application level, attached debug detect and jailbreak checking

iMAS security-checkanalytics

Background

The iMAS security-check security control offers a continuous jailbreak detect and debug attach checking. With this information, one can programatically decide to shutdown the app or other loss prevention techniques. The security control makes system calls at the application level β€” in particular, ptrace and getpid.

Vulnerabilities Addressed

  1. Debugger tool use
    • CWE-288: Authentication Bypass Using an Alternate Path or Channel

Installation

  • Add security-check repository as a submodule to your project
    • git submodule add [email protected]:project-imas/security-check.git vendor/security-check
  • Drag SecurityCheck.xcodeproj into the your project as a subproject
  • Add SecurityCheck Framework to target’s build phase - target dependancies (use +)
  • Add libSecurityCheck.a to targets's build phase - link binary with libraries
  • include #import <SecurityCheck/SecurityCheck.h> in your code at the app delegate level to start

Installation via CocoaPod

  • If you don't already have CocoaPods installed, do $ sudo gem install cocoapods in your terminal. (See the CocoaPods website for details.)
  • In your project directory, do pod init to create a Podfile.
  • Add pod 'SecurityCheck', :git => 'https://github.com/project-imas/security-check.git' to your Podfile
  • Run pod install
  • Include #import <SecurityCheck/SecurityCheck.h> in your code at the app delegate level to start

Usage

Place the following code at the app delegate level and call it early to detect security problems before the core code runs.

    //-----------------------------------
    // call back to weHaveAProblem
    //-----------------------------------
    cbBlock chkCallback  = ^{
        

        __weak id weakSelf = self;
        
        if (weakSelf) [weakSelf weHaveAProblem];
    };

    //-----------------------------------
    // jailbreak detection
    //-----------------------------------
    checkFork(chkCallback);
    checkFiles(chkCallback);
    checkLinks(chkCallback);
    
    dbgStop;
    dbgCheck(chkCallback);
    
    ...
    
    //** Note: Rename this function in your code
- (void) weHaveAProblem {
    
    NSLog(@"weHaveAProblem in AppDelegate");
    
        //** cause segfault
    //int *foo = (int*)-1; // make a bad pointer
    //printf("%d\n", *foo);       // causes segfault
    
    //** OR launch blank, black colored window that hangs the user
    SViewController *sc = [[SViewController alloc] init];
    _window.rootViewController = sc;
    [_window makeKeyAndVisible];

#if 1
    //** OR re-launch the splash screen, must be preceded by SViewController as that controller overwrites the rootcontroller
    //** which changes the app flow
    UIImageView *myImageView =[[UIImageView alloc]
                               initWithFrame:CGRectMake(0.0,0.0,self.window.frame.size.width,self.window.frame.size.height)];
    
    myImageView.image=[UIImage imageNamed:@"Default.png"];
    myImageView.tag=22;
    [self.window addSubview:myImageView ];
    [myImageView release];
    [self.window bringSubviewToFront:myImageView];
#endif
    
    //** OR make this thread stop and spin
    //volatile int dummy_side_effect;
    //
    //while (1) {  dummy_side_effect = 0; }
    //NSLog(@"Never prints.");


    //** recommend not EXITing as foresics can easily find exit(0) and replace with NOP
    //exit(0);
}

Sample App

The sample application demonstrates the use of the security-check security control.

See the sample application here.

License

Copyright 2013 The MITRE Corporation, All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

encrypted-core-data

v2.0 - iOS Core Data encrypted SQLite store using SQLCipher
Objective-C
785
star
2

app-password

Custom iOS user authentication mechanism (password with security questions for self reset)
Objective-C
90
star
3

about

About iMAS - iOS Mobile Application
JavaScript
88
star
4

memory-security

Tools for securely clearing and validating iOS application memory
Objective-C
81
star
5

securefoundation

Secure components enabling application authentication, secure file storage, app level file-based keychain, and shredding for files on disk
Objective-C
59
star
6

passcode-check

iMAS pascode-check, set passcode config profiles and check for conformance
Objective-C
45
star
7

encrypted_code_modules

ECM - mitigates static attacks - allows sections of source code to be encrypted into a .dylib at build time and decrypted at run-time
Objective-C
35
star
8

forced-inlining

Inlining functions can be a very effective method of duplicating sensitive code for increased security
Assembly
22
star
9

sentry-app

Security for your iDevice. Combines jailbreak detection, debugger detection, minimum device password requirements, app level password, and single sign on capabilities.
Objective-C
13
star
10

SCSampleApp

Security Check sample application
Objective-C
6
star
11

single-sign-on

Simple MDM Single Sign On solution for application level logins
Objective-C
5
star
12

system-monitor

View and blacklist/whitelist active connections and current processes on device.
C
3
star
13

project-imas.github.com

JavaScript
2
star
14

AppPasswordSampleApp

Multi-view iOS app secured with iMAS AppPassword controls
Objective-C
1
star