I have a mobile application (currently iOS and soon Android) that talks about a web service. No login and data is not private. Basically, the POST application sets the marker (lon, lat) and the GET contains the next 25 markers to be displayed on the map.
This is a very trivial application, and I cannot imagine anyone making a big effort to abuse a web service. However, I see that for someone there is interest in posting many markers. What bothers me the most is that someone is running a script that pushes many requests (using expensive bandwidth and making meaningless data in my application).
I slowly conclude that this is not possible. The best answer is don't do it. Do not provide a web service without authentication. Not many services are open. The Google You Tube API is open, but most are not. Unfortunately, I have no choice. Therefore, after several days of looking at it, here is my thinking. Keep in mind that I am very far from a security expert, and I am sure that my approach can be improved. But that may point you in the right direction. Hope someone more experienced can call back and fix / improve this. I found this article and the comments are especially helpful.
Message Level Security
I will protect msgs with hash encryption. Clients and the web service keep a copy of the shared secret, which is used as a salt to create a hash from the URL and all POST arguments. The hash is passed as an optional argument, and the hash is rebuilt and compared at the other end (using the shared key as a salt). This is very good until you understand that any mobile client code can be programmed in reverse order in minutes. At this moment, this line of defense is completely useless.
Customer measures
The client includes message rate limiting as a measure to limit the number of messages sent by honest users. And yet it is useless against an attacker who jailbreak a mobile device.
Server side security
Thus, the server side should have as many additional security measures as possible in order to be independent, based on the assumption that your client (and the shared secret) are compromised. Here is what I have:
One msg arg is UTC time, which is used to limit replay attacks. This should prevent the attacker from restarting the same msg on the server.
The server performs IP rate limiting. Yes, IPs are easy to fake, and switching between proxies is a game for children, but it helps when you have so little.
Of course, the server strictly checks all arguments, uses parameterized queries and does not return an exception.
Transport Security
Unfortunately, I am sure that issuing certificates for individual SSL clients is not possible without registration. And since I use the msg hash check (and my data is not private), I'm not quite sure what SSL brings to the table. However, I will probably use SSL (with one application certificate) because it adds another layer of security that is easy and cheap to deploy (albeit at the expense of additional connection time for each message).
The Gaping A big big hole in my approach
I warn that if the application becomes popular, someone will compromise the shared secret on the client. Just because they can, and they are likely to post it online. So it really comes down to the server side. Unfortunately, I do not have the ability to identify and block the attacker. I would love that very much.
Final request
After several days of research, that’s all I have. But I want more. I would especially appreciate any ideas aimed at reinforcing the server side. So, I put all my EXACT POINTS as generosity. Yes sir, all 97 points!