Solved

Can an iOS app do this?

Posted on 2011-03-02
12
526 Views
Last Modified: 2012-05-11
Is it possible to create an iPad/iPhone application that submits information to a web service and have the web service validate that the incoming data is coming from the iPad.iPhone app and not being generated by some other application?

Keep in mind that the app will be distributed to the iPads/iPhones and, as such, is subject to tinkering by hackers.
0
Comment
Question by:cerksees
  • 6
  • 5
12 Comments
 
LVL 8

Expert Comment

by:nwtechdesk
ID: 35024100
Hackers have various skills so I would not be so bold as to say this is a hackproof solution, but:

ipad/iphone apps do not get installed without a special license key generated by apple.  Installing code into the app based on the key, that gets transmitted in an encrypted format, to the website, seems like a good way of locking down your source.
0
 

Author Comment

by:cerksees
ID: 35024183
I am also thinking that I may have to revert to something that I HATE....captcha.

At least with captcha, I can be reasonably sure that an actual human is doing the data entry - even if it is done on an unsupported platform.

0
 
LVL 13

Expert Comment

by:SpeedyApocalypse
ID: 35117158
I do not believe that I understand specifically what you are asking.

Do you wish to have data sent to your server, but you do not want the server address to be seen by anyone but yourself?  Just as well, you would like to validate the data server side?  Also, you do not want the sent data to be able to be seen by anyone but the server?  By "distributed", do you mean by App Store, AdHoc, etc?

0
 

Author Comment

by:cerksees
ID: 35118319
No.  I want to be sure that any data coming to the server was coming from a legitimate, live iPhone or iPad.

I am not sure this is possible.  

The reason I mentioned captcha was as a way to make sure that data being sent to the server was being sent by a human.

I think that it may be too easy to fake the data stream to positively identify iPhones and iPads as being actual devices and not just a bot masquerading as an iPhone or iPad.
0
 
LVL 13

Expert Comment

by:SpeedyApocalypse
ID: 35118391
Well, I have a solution for you :-)

With every form submit, you can store and send the device's UDID or Unique Device Identifier.  Any bot will not be able to send this and you will definitely know that it is being sent from an iPad or iPhone if the UDID is included.

To retrieve the UDID, you can use this statement:

[UIDevice currentDevice].uniqueIdentifier

Open in new window


For the web side, I would do something like this as the URL (where "u" is a GET parameter):

http://www.test.com/?u=asdfghjklasdfghjklasdfghjklasdf

Open in new window


The UDID will be a 40 digit code of either letters or numbers.

Then, with PHP...

if (isset($_GET['u'])) {

    // the udid was sent

    if (strlen($_GET['u']) == 40) {

        // UDID is valid and is 40 characters long

    } else {

        // spam bot

    }

} else {

    // spam bot

}

Open in new window


I mean, it can be fooled but as long as they don't get the URL that you are sending your requests to, you will be good to go.  
0
 
LVL 13

Expert Comment

by:SpeedyApocalypse
ID: 35118394
Also, if you see multiple requests from the same UDID, you have the option to blacklist that UDID from the submitting as it is completely unique.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:cerksees
ID: 35118603
But the same UUID will be able to send in data multiple times.  In fact, the more the better.

And, couldn't any script kiddie grab the UUID and fake the rest with a simple app or bot?

That's why I thought the captcha thing would at least eliminate the bots - even if the people were using an application not on an iDevice.

This is not a matter of national securit or anything...I just want to be fair to the people that use the app in the correct manner and protect them (as much as I can) from unfair competition.  Know what I mean?
0
 
LVL 13

Expert Comment

by:SpeedyApocalypse
ID: 35118617
I said that you *could* blacklist a UDID... not that you had to.

iOS applications can NOT be decompiled in any form and they will not be able to see your code.  As long as you keep your URL to submit data safe, nobody will be able to submit data to you.  Suppose someone did find it and just sent data without including a 40 character UDID, it would error out and the data would be sent.  If a UDID is included in your request for data submission, you know that it came from an actual device rather than a computer.

As for a "script kiddie" or even a computer saavy person, not any would be able to:

- decompile your application
- find your URL and realize that it takes a 40 character UDID
- create another application or spoof the UDID with requests

Just verify that a UDID is included like the code above and you will be fine.  
0
 

Author Comment

by:cerksees
ID: 35118716
Actually it would be pretty easy to do....

Share your internet connection from your Windows PC.  Run Wireshark on your Windows PC and capture the throughput when you connect your iDevice to the PC's shared internet connection and run the app.

Then, just sift through the HTTP for the UUID.  The URL will be plain text.

You could use HTTPS so the hacker would have a more difficult time figuring out what was being sent...but that may not be that difficult to figure out either.  I guess it would depend on the encryption being used.

A more secure encryption method may be to use a different, random public/private key set to encrypt the data before it is sent out of the app.  The public portion of the key could be obtained from the https web service when the app connects.  Random characters could be sprinkled into the data to make finding useful data more difficult.

The people I am most worried about are the hackers that look at it as a challenge and then spread apps to Androids and others to screw with the data collection from the rightful users.

Are you saying that iPad/iPhone apps cannot be hacked or that the average user will not be able to do it?
0
 

Author Comment

by:cerksees
ID: 35118722
In fact, once you find the URL, you can do a man-in-the-middle attack to capture the handshake for the HTTPS connection and you will have the data you need to decrypt the data stream and look around all you want.

Maybe its something I just shouldn't worry about....
0
 
LVL 13

Accepted Solution

by:
SpeedyApocalypse earned 500 total points
ID: 35118724
Well, wire-sniffing would be a possibility.  However, you can look into Base-64 or Triple-DES encryption.  Or heck, make your own encryption cipher and keys as you stated.

The application's code will be completely safe as it cannot be decompiled... at all.
0
 

Author Closing Comment

by:cerksees
ID: 35118855
Very helpful!  Thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article I'm going to cover the basics and usages of NSInvocation. What is NSInvocation? Apple Developer Reference describes NSInvocation this way: An NSInvocation is an Objective-C message rendered static, that is, it is an action tur…
Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now