There is a flaw. The system is subject to brute force attack.
Suppose I am an attacker. I will create a manual for myself and send it along with an arbitrary phone number.
Next, Iβll just learn my way through possible SMS codes - if it's 6 digits, there are only 10 ^ 6 combinations. Brutfors will be in a matter of seconds, and then I will get access to the data of the person who has this phone.
In addition, as pointed out in the commentary to Phil, you can force you to send you an arbitrary number of SMS messages, which will actually lead to financial losses at no cost.
There is also no valid defense against this attack:
- If there is a limited amount of (N) attempts for a given UID, I will re-generate a guid every N attempts.
- If the number of phone requests for a certain amount of time is limited, I can perform a DoS / DDoS attack, inducing all possible numbers with fake requests - therefore, no one will be able to fulfill any requests.
Before an SMS message, authentication of a username / password or certificate is required . Also:
- Never use things like a GUID in cryptography / security protocols. GUIDs are deterministic (that is, knowing one value, you can predict the future). Using the built-in crypto library functions to generate random streams
- Never try to develop security protocols yourself. Never. There are an awful lot of reservations, even the creators of SSL 1.0 fell - and they were sharp guys, mind you. Itβs better to copy generic and proven schemas (a great example of Google auth).
source share