I have a mobile application where users give advertise, other users view and accept it. Recently, I began to notice that bots started to give their own advertisements. I have moderators but there a so much advertisements that it is impossible to check everything (another challenge, is that bargain happens instantly, in realtime). It is classical REST API. I googled a lot and to my surprise can't find any open source solution that protects from illegal bot activities. How do you tackle such cases? Is it possible to eliminate it at all or I can only make their life more difficult taking some measures?
How to tackle bots in REST APIs
2.2k Views Asked by Olav At
2
There are 2 best solutions below
Related Questions in ANDROID
- Is it possible to get a list of all the pages where I authenticated with my Google OpenID
- integrate login to my sites with OpenId or OAuth
- Use Bearer Token Authentication for API and OpenId authentication for MVC on the same application project
- PHP - Steam API Web Connect OpenID --> No redirect
- Identity Server OAuth Resource Owner Password Grant always returns invalid_client
- Validate an Access Token at the Resource Server and Respond Accordingly
- owin: Catch SecurityTokenExpiredException exception
- What exactly will happen to Google OpenId Connect to OpenID 2.0 mapping on Jan 1, 2017?
- Implementing Steam OpenID for iOS
- OAuth vs OpenID: confused about when to use one of these and why
Related Questions in IOS
- Is it possible to get a list of all the pages where I authenticated with my Google OpenID
- integrate login to my sites with OpenId or OAuth
- Use Bearer Token Authentication for API and OpenId authentication for MVC on the same application project
- PHP - Steam API Web Connect OpenID --> No redirect
- Identity Server OAuth Resource Owner Password Grant always returns invalid_client
- Validate an Access Token at the Resource Server and Respond Accordingly
- owin: Catch SecurityTokenExpiredException exception
- What exactly will happen to Google OpenId Connect to OpenID 2.0 mapping on Jan 1, 2017?
- Implementing Steam OpenID for iOS
- OAuth vs OpenID: confused about when to use one of these and why
Related Questions in BOTS
- Is it possible to get a list of all the pages where I authenticated with my Google OpenID
- integrate login to my sites with OpenId or OAuth
- Use Bearer Token Authentication for API and OpenId authentication for MVC on the same application project
- PHP - Steam API Web Connect OpenID --> No redirect
- Identity Server OAuth Resource Owner Password Grant always returns invalid_client
- Validate an Access Token at the Resource Server and Respond Accordingly
- owin: Catch SecurityTokenExpiredException exception
- What exactly will happen to Google OpenId Connect to OpenID 2.0 mapping on Jan 1, 2017?
- Implementing Steam OpenID for iOS
- OAuth vs OpenID: confused about when to use one of these and why
Related Questions in MOBILE-SECURITY
- Is it possible to get a list of all the pages where I authenticated with my Google OpenID
- integrate login to my sites with OpenId or OAuth
- Use Bearer Token Authentication for API and OpenId authentication for MVC on the same application project
- PHP - Steam API Web Connect OpenID --> No redirect
- Identity Server OAuth Resource Owner Password Grant always returns invalid_client
- Validate an Access Token at the Resource Server and Respond Accordingly
- owin: Catch SecurityTokenExpiredException exception
- What exactly will happen to Google OpenId Connect to OpenID 2.0 mapping on Jan 1, 2017?
- Implementing Steam OpenID for iOS
- OAuth vs OpenID: confused about when to use one of these and why
Related Questions in API-SECURITY
- Is it possible to get a list of all the pages where I authenticated with my Google OpenID
- integrate login to my sites with OpenId or OAuth
- Use Bearer Token Authentication for API and OpenId authentication for MVC on the same application project
- PHP - Steam API Web Connect OpenID --> No redirect
- Identity Server OAuth Resource Owner Password Grant always returns invalid_client
- Validate an Access Token at the Resource Server and Respond Accordingly
- owin: Catch SecurityTokenExpiredException exception
- What exactly will happen to Google OpenId Connect to OpenID 2.0 mapping on Jan 1, 2017?
- Implementing Steam OpenID for iOS
- OAuth vs OpenID: confused about when to use one of these and why
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
OPEN SOURCE BOT DETECTION
If you search Github for
bot detection
you will land on this page https://github.com/topics/bot-detection?q=bot+detection&unscoped_q=bot+detection, that at this moment contains 7 results, that aren't very relevant, but if you remove the query string, and use https://github.com/topics/bot-detection you get 36 results, where some may be relevant depending on your backend language. You can also search using the termsbrowser detection
,crawler detection
,device detection
, etc.Some of this repos rely on the
user-agent
and/or in the IP address to detect the bot, and this approach is easily bypassed, because theuser-agent
header is easy to spoof and nowadays the attackers are using bot farms to rotate the ips, thus making it very hard to block them.But should you use one of this repos? Why not, it's one more layer of defense, and at least you block the less sophisticated bots that don't run from a bot farm.
The Difference Between WHO and WHAT is Accessing the API Server
Before we dive in how you can tackle the problem I want to first clear a misconception that is usual among developers of any seniority level, the difference between Who vs What is accessing the API server.
I recommend you to read the article Why Does Your Mobile App Need An Api Key? where I go in detail about the difference between Who and What is accessing your API server, but for your convenience I will extract here the main takes from it:
So I want you to think about the Who as the user your API server will be able to Authenticate and Authorize access to the data, and think about the What as the software making that request in behalf of the user, that in your case are the bots.
THE API SERVER DEFENSES
You can make the life of an attacker harder by applying defense in depth, by adding as many layers of defense as you can afford, and is required by law for your use case.
WAF - Web Application Firewall:
The effectiveness, against APIs is weak, because it was designed more specifically for web apps that don't rely on API's, but still able to offer some degree of protection.
UBA - User Behavior Analytics:
A good example of a UBA solution is Recaptcha by Google, specially the reCAPTCHA V3:
When you use recaptcha V3 in a mobile app your API server can then verify the score for that request, but bear in mind that it only makes it more difficult to bypass, because if you search Google for bypass recaptcha V3 you will see a lot of solutions being offered as a service for attackers.
Lock the API server to the mobile app
It's possible for the API server to have a high degree of confidence that the request is indeed from your mobile app, and not from a bot by using the Mobile App Attestation concept, and I invite you to read my reply to the question How to secure an API REST for mobile app?, specifically the section A Possible Better Solution.
DO YOU WANT TO GO THE EXTRA MILE?
In any response to a security question I always like to reference the amazing work from the OWASP foundation.
For Mobile Apps
OWASP Mobile Security Project - Top 10 risks
OWASP - Mobile Security Testing Guide:
For APIS
OWASP API Security Top 10