Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3355262
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:22:24+00:00 2026-05-18T02:22:24+00:00

Jailbroken iPhones get on my nerve as it taints some fundamental APIs on iOS,

  • 0

Jailbroken iPhones get on my nerve as it taints some fundamental APIs on iOS, by using MobileSubstrate.

http://www.iphonedevwiki.net/index.php/MobileSubstrate

I believe many apps use UDID as a mean to authenticate a device and/or a user since it’s semi-automatic and handy, but you should be aware of this problem: UIDevice is not as tamper-proof as it should be. There’s an app called UDID Faker, which easily enables you to spoof someone else’s UDID at runtime.

http://www.iphone-network.net/how-to-fake-udid-on-ios-4/

Here’s the source code of it:

//
//  UDIDFaker.m
//  UDIDFaker
//

#include "substrate.h"

#define ALog(...) NSLog(@"*** udidfaker: %@", [NSString stringWithFormat:__VA_ARGS__]);
#define kConfigPath @"/var/mobile/Library/Preferences/com.Reilly.UDIDFaker.plist"

@protocol Hook
- (NSString *)orig_uniqueIdentifier;
@end

NSString *fakeUDID = nil;

static NSString *$UIDevice$uniqueIdentifier(UIDevice<Hook> *self, SEL sel) {  

    if(fakeUDID != nil) {
                 ALog(@"fakeUDID %@", fakeUDID);
        /* if it's a set value, make sure it's sane, and return it; else return the default one */
                return ([fakeUDID length] == 40) ? fakeUDID : [self orig_uniqueIdentifier];

    }
    /* ... if it doesn't then return the original UDID */
    else {
        return [self orig_uniqueIdentifier];
    }
}

__attribute__((constructor)) static void udidfakerInitialize() {  

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        NSString *appsBundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
        ALog(@"Loading UDID Faker into %@", appsBundleIdentifier);


        NSDictionary *config = [NSDictionary dictionaryWithContentsOfFile: kConfigPath];
        fakeUDID = [config objectForKey: appsBundleIdentifier];
        [fakeUDID retain];

        if(fakeUDID != nil) {

                ALog(@"Hooking UDID Faker into %@", appsBundleIdentifier);
                MSHookMessage(objc_getClass("UIDevice"), @selector(uniqueIdentifier), (IMP)&$UIDevice$uniqueIdentifier, "orig_");
        }

    [pool release];
}

As you can see, uniqueIdentifier method in the UIDevice class now returns fakeUDID on any apps.

It seems that Skype and some other apps detect this sort of taint, but I don’t know how to do it.

What I wanted to do is: When tainted UIDevice is detected upon launch, alert and exit(0).

Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:22:24+00:00Added an answer on May 18, 2026 at 2:22 am

    There isn’t a truly safe way to check if the UDID is real. The UDID is got via liblockdown, which communicates to lockdownd via a secure channel to receive the UDID:

    +-----------+
    | your code |
    +-----------+
          |
    +----------+       +-------------+       +-----------+
    | UIDevice |<----->| liblockdown |<=====>| lockdownd |   (trusted data)
    +----------+       +-------------+       +-----------+
             untrusted user                   trusted user
    

    When the device is jailbroken, all 4 components can be replaced.


    One method to detect the presence of UDID Faker is to check if some identifications (files, functions etc.) unique to it exists. This is a very specific and fragile counter-attack, as when the method of detection is exposed, the spoofer could simply change the identification to conceal their existence.

    For example, UDID Faker relies on a plist file /var/mobile/Library/Preferences/com.Reilly.UDIDFaker.plist. Therefore, you could check if this file exists:

    NSString* fakerPrefPath = @"/var/mobile/Library/Preferences/com.Reilly.UDIDFaker.plist";
    if ([[NSFileManager defaultManager] fileExistsAtPath:fakerPrefPath])) {
       // UDID faker exists, tell user the uninstall etc.
    }
    

    it also defines the method -[UIDevice orig_uniqueIdentifier] which could be used to bypass the faker:

    UIDevice* device = [UIDevice currentDevice];
    if ([device respondsToSelector:@selector(orig_uniqueIdentifier)])
       return [device orig_uniqueIdentifier];
    else
       return device.uniqueIdentifier;
    

    Of course the spoofer could simply rename these things.


    A more reliable method lies in how Mobile Substrate works. Injected code must be located in a dylib/bundle, which is loaded into a memory region different from UIKit. Therefore, you just need to check if the function pointer of the -uniqueIdentifier method is within the acceptable range.

    // get range of code defined in UIKit 
    uint32_t count = _dyld_image_count();
    void* uikit_loc = 0;
    for (uint32_t i = 0; i < count; ++ i) {
       if (!strcmp(_dyld_get_image_name(i), "/System/Library/Frameworks/UIKit.framework/UIKit")) {
         uikit_loc = _dyld_get_image_header(i);
         break;
       }
    }
    
    ....
    
    IMP funcptr = [UIDevice instanceMethodForSelector:@selector(uniqueIdentifier)];
    if (funcptr < uikit_loc) {
       // tainted function
    }
    

    Anyway UDID Faker is a very high level hack (i.e. it can be easily avoided). It hijacks the link between UIDevice and liblockdown by supplying a fake ID.

    +-----------+
    | your code |
    +-----------+
          |
    +----------+       +-------------+       +-----------+
    | UIDevice |<--.   | liblockdown |<=====>| lockdownd |   (trusted data)
    +----------+   |   +-------------+       +-----------+
                   |   +------------+
                   ‘-->| UDID Faker |
                       +------------+
    

    Thus you could move the code asking the UDID lower to the liblockdown level. This can be used for apps for Jailbroken platforms, but this is not possible for AppStore apps because liblockdown is a private API. Besides, the spoofer could hijack liblockdown (it’s very easy, I hope no one does it), or even replace lockdownd itself.

                       +-----------+
                       | your code |
                       +-----------+
                             |
    +----------+       +-------------+       +-----------+
    | UIDevice |<--.   | liblockdown |<=====>| lockdownd |   (trusted data)
    +----------+   |   +-------------+       +-----------+
                   |   +------------+
                   ‘-->| UDID Faker |
                       +------------+
    

    (I’m not going to show how to use liblockdown here. You should be able to find sufficient information from the site you’ve linked to.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been following this tutorial: http://brandontreb.com/beginning-jailbroken-ios-development-building-and-deployment/ to get an application started by the name
I am new to titanium. Using a iPhone(Jailbroken)3GS with iOS 5.0.1. Titanium SDK 1.0.8
I'm working on an app for jailbroken iPhones. I'm trying to get only the
I have this jailbroken iPhone 3G with iOS version 4.2.1 (the latest supported version).
I have GuitarToolkit on my iPhone4S (iOS 5.01 - NOT jailbroken) It has a
I am developing an application for jailbroken iOS devices. I'd like to target booth
I have a jailbroken iPhone 4 running iOS 4.3.3 upon which I want to
I'm thinking about creating a plugin for jailbroken iPhones to record audio from apps.
I have a jailbroken Iphone 4 running iOS 5.0.1 and I'm trying to send
I know it's possible for jailbroken iPhones but does Apple provide any API for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.