How to protect the SMS registration service from an attack with bulk sms sending? - security

There is a registration service using SMS. The phone number is transmitted to the api of the service, then the service sends the code in SMS. How to protect the service from an attack using bulk SMS. For example, an attacker will send multiple API requests with different random phone numbers. It is possible to identify attempts to register by IP. But the provider can use one IP for a large number of users.
It is possible to limit the number of hits from one IP per minute.

you can add rate limit, doesn't it work?

Related

Security: protect from login connexion loop via multiple ip and multiple accounts

Assuming there is a mobile app that sends the mobile phone number to the backend, and the backend sends an SMS with a code to allow connection if the phone number exists. This works as intended.
But a user recently created many accounts and then made a script (?) that calls the backend route (10 times with 10 different accounts) then switches IP, calls the backend again with this new ip, etc. Every time they call the route, it generates a new SMS.
The only result is that many SMS are sent and it adds cost to the company.
Is there a way to prevent this?
Currently, a single user can not call more than 3 times the API without a successful login, but with many accounts rotation, it still generates a lot of SMS. And I guess the script can be improved.
Can we add protection API side, even if the IP changes and the headers are all correct?

Add rate limit to public api returning customer status (exists, not-exist) against email

I have api which will return user status i.e exists or not exists in the shop against email. Now the challenge here is to rate limit any specific user/bot which is sending multiples request. One solution is to use advanced cloudfare rate limit but its only support IP counting in core subscription which we have already but IP counting is not a good solution at all since it can be send from any corporate LAN having multiple users or proxy servers.
While if I go for normal server side solution we have node modules like express-rate-limit but I still think the user is coming to our server and then we are blocking them.
Not sure if we have any best solution on cdn level. Also how can I track a user request uniquely with IP address which attributes I can use.

SMS verification : what if user phone number changed?

I’m building an application and I’m thinking about asking user phone number to send a verification SMS. Though, imagine if the phone number is cancelled and attributed later to someone else. Then, the new person would be able to connect to my app in the name of the old one...
So is there any way to prevent this behavior ?
I want to make it like tinder : sign up possible by 2 different ways : (facebook connection and phone number) or (phone number and mail)
I have another question : I see that many sms sending services are not free (all of them actually). If I make an api with these services, anyone can send a lot of http request to it and make me pay 0,05€ times 100000000 ? And I can’t rely on IP adresses because with 3G an ip is not associated with a particular person...
To your first question:
You are describing Two Step Authentication (aka Two Step Verification) which you can read about in the Wikipedia page: Multi-Factor Authentication (MFA):
a method of confirming a user's claimed identity by utilizing something they know (password) and a second factor other than something they have or something they are. An example of a second step is the user repeating back something that was sent to them through an out-of-band mechanism.
You are correct that a phone number can change owners (as can an email address though over a longer time period on average). You are using their phone number as that out-of-band mechanism described above.
If the user has recently authenticated with their password, when you send the user an out-of-band code and they re-type that into an input box you have some degree of confidence that the end user both knows the password and has access to the SMS message and are choosing to trust that association.
You will need to consider if, and for how long, you can trust that association within the security context of the use case.
For example, adding two step verification when detecting the end-user has just authenticated on a device you have never seen before is a nice additional protection. However, using the out-of-band SMS verification in account recover could open up a big security hole. You do not want to bypass the authentication with something they know (password) in a password reset flow by simply having access to that SMS number. SMS is also not an appropriate mechanism for one-time-password (OTP).
If you want to offer you users more protections on their accounts look into implementing true MFA with software tokens (eg. Google Authenticator, Authy, etc.) and hard tokens (eg. FIDO U2F devices such as Yubikey, Google Titan, etc.).
To your second question:
You are correct, IP-based limiting is insufficient. With SMS services you are likely going to be making a server-side API call to the SMS provider. First check to see what security features your provider has out of the box. Next, protect your endpoint that is triggering the API calls to the SMS provider.
Rate limit the number of SMS messages to any one given recipient (eg. no more than X SMS messages to a single number per Y minute window)
Rate limit the number of SMS messages one person can make to different numbers (eg. no more than X different phone numbers per user per day).
Do not allow unauthenticated requests. The user should have already completed the first authentication step (something they know eg. username/password) before performing the out-of-band SMS step.
Protect the SMS form from Cross Site Forgery Requests (CSFR). Your back-end should only make the API call to the SMS provider if it knows the request came from your front-end and not another host.
Protect the SMS form from bot attacks. There are many approaches with Google ReCaptcha being one of the more common.

How to retrieve a phone number for a gprs request in a j2me application?

I am creating an j2me application in which for activation user sends a GPRS request request. Can we get the user phone number with his GPRS request?
I don't think it's possible, I mean up to MIDP2, I don't know about MIDP3 yet.
You must think of different mechanism to get the phone number, for instance is sending SMS via the application to Server SMS Gateway,
The mechanism goes like this :
- Your application send SMS to Server SMS gateway
- Server generate some random number and then save this random number to phone number match in database.
- And then SMS Gateway send SMS reply which contain the random number to the application.
- Your application retrieve the content of the SMS (which is the server generated random number) and save it to local DB.
- After this everytime you send any request (HTTP request) you send also the random number you have saved.
Therefore in the server you can find out which phone send the request.

J2ME High Secured app for m-commerce

I am creating a j2me application for mcommerce, which uses mobile internet(gprs). I wanted make it more secured by binding the application to the SIM card and the device. That is a user should be able to login to the system, only using his/her SIM card or from the registered mobile number.
To achieve this I need to fetch the mobile number.
So, on login i thought of Triggering an SMS from the server with a key, which the application reads and uses the key for the entire session. Here the challenge is, that sms should not go to the inbox.
Any suggestions pls?
Yes it can be achieved using the Wireless Messaging API. Have the MIDlet set up a server connection on a chosen port number, then send the SMS to that port number. It will go straight to your app, bypassing the inbox. If you use the Push Registry, you can even make the SMS start your app if it is not running.
It doesn't matter if the user sees the number in his/her inbox.
As long as the key is only used that session, it is her/his responsibility to not share the key with others.
The one thing you make sure is that ONLY the person who owns the SMS phonenumber gets the key and is able to log on.
This doesn't take care of the phone being stolen though.

Resources