Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protect script from bots and unwanted requests posting data

Tags:

android

php

token

I'm modifying an Android app that utilizes a webapp via a webview. Currently the the code base for the webapp is written in ColdFusion - so all the session management is done in CF. There are certain hooks in the webapp that force the Android app to do native functions and sometimes call external scripts in PHP.

These php scripts get data posted to them (userid, friendid, etc) - currently the php scripts just make sure there is valid data being posted, then process the request if the data is present and valid.

I am looking for ways to increase the security of these php scripts to prevent bots / malicious users from posting false data to these pages - at this point nothings stopping anyone sending a correct userid/friendid and having the script from executing.

Session management would be the first line of defense, but since the webapp is in a different language I can't use that - and sometimes the php scripts are on a different domain completely (same server though).

The other method I considered was on sign up creating a user token to associate with a user, and saving this on the Android side of things - then when requesting these php scripts send the userid and token. And verify the token for that user matches in the remote database - this would make it harder to guess posting credentials for malicious user. Clearly not the best because the token is stored locally and going over the wire, but I digress.

Question are there any better methods to use in order to protect these lone php scripts from being executed, with out the use of session management? Does my token idea make any sense?

Note: I can use SSL on any / all requests.

like image 340
bMon Avatar asked Mar 01 '12 03:03

bMon


People also ask

What is bot protection?

F5 bot protection delivers proactive, multi-layered security that blocks and drops bad bot traffic before it can hit your network, mitigating bots that perform account takeovers, vulnerability reconnaissance, and denial-of-service attacks targeted at your network or app layer.

What is bot in cyber security?

A bot is a piece of malware that infects a computer to carry out commands under the remote control of the attacker.


1 Answers

I know exactly what you need, if you're up to the task. Your API needs to impliment OAuth2.0.

What OAuth can provide you is a secure way to pass information to and from your service while making sure that all secret information is kept private and that only the correct people can access that information. It gives each user a unique signature.

OAuth is used by Facebook, Google, Twitter and more to give developers a secure way to access information while keeping everyone from doing things they shouldn't be doing.

OAuth has support for ColdFusion, Java, PHP, C#, dotNet, VB.net, LIST, Javascript, Perl, Python, Ruby, and more.

http://oauth.net/

like image 167
Steven McConnon Avatar answered Nov 12 '22 16:11

Steven McConnon