User login password verification method, system and device for preventing SCA and storage medium
By randomly selecting digits for comparison and using delay processing in user login password verification, the problem of vulnerability to side channel attacks in the existing technology is solved, and the timeliness and security of password verification are improved.
Patent Information
- Application Number
- CN202410792796.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-10-01
AI Technical Summary
In the current user login password verification, the existing technology compares each digit in turn and returns an error immediately, which is prone to side-channel attacks and cannot effectively prevent hackers from cracking through the length of the return time.
By obtaining the length of the password to be verified, if it is inconsistent, an error will be returned immediately; if it is consistent, the number of digits will be randomly selected for comparison, and a randomly generated time delay will be processed during the comparison process to prevent hackers from judging the wrong number of digits through the return time.
It improves the timeliness of user password verification, effectively prevents side-channel attacks through random bit selection and delay processing, and enhances security.
Smart Images

Figure CN118734288A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a method, system, device and storage medium for verifying a user login password to prevent SCA. Background Art
[0002] With the continuous deepening of informatization, the use of information products can be encountered everywhere in daily life. When using these systems, the most direct and primary step is user login, and the verification of whether the user login password is correct is used as the criterion for user verification. At present, when verifying the user password, the information system uses an overall comparison method to determine whether the password is consistent with the one recorded at the time of registration. This method is time-consuming and is not conducive to the timeliness calculated in milliseconds in the current big data high concurrency environment. In order to reduce time consumption, another method is to compare by length and each bit. First compare the length. If the length is inconsistent, immediately return the password error. If it is consistent, then compare each bit of the password in turn to see if it is the same. If it is different, immediately return the password error. However, this method cannot avoid an attack method called SCA (Side Channel Attack). In this method, if the length is different, an error is returned immediately; compare each bit in turn, and if it is wrong, the password error is also returned immediately. Since it is returned immediately, hackers will brute-force the password one by one according to the length of the return time, and since it is cracked one by one according to the number of digits, the complexity of the password combination cannot prevent this cracking method. Summary of the invention
[0003] The purpose of the present invention is to provide a user login password verification method, system, device and storage medium to prevent SCA, which is used to solve the problem that in the prior art, each bit is compared in sequence during login password verification and a password error is immediately returned when an error occurs, which is easily susceptible to SCA attacks.
[0004] The present invention solves the above problems through the following technical solutions:
[0005] Get the password length L of the password to be verified. If L is inconsistent with the length of the user password, return a password error; otherwise, randomly select one of the bits between 1-L, and compare whether the bit of the password to be verified is consistent with that of the user password. If they are inconsistent, return a password error; otherwise, continue to randomly select one of the bits between 1-L except the bits that have been compared, and compare the bit of the password to be verified with that of the user password, and so on, until all the bits are compared, and return a password correct.
[0006] Furthermore, if L is inconsistent with the length of the user password, a first random time is generated, and a delay process is performed according to the first random time, and then a password error is returned.
[0007] Furthermore, the first random time is randomly generated according to the length of the user password.
[0008] Further, the bit of the password to be verified is compared with the bit of the user password to see if they are consistent. If they are inconsistent, a second random time is generated, and a delay process is performed according to the second random time, and then a password error is returned.
[0009] Furthermore, the second random time is randomly generated according to the number of times the bits of the password to be verified are compared with the user password.
[0010] A user login password verification system for preventing SCA, comprising:
[0011] The password length verification module is used to compare the length of the password to be verified with the length L of the user password. If they are consistent, the password digit comparison module is started, otherwise the result feedback module is fed back;
[0012] The password bit comparison module is used to randomly select a bit that has not been compared in 1-L, and compare whether the bit of the password to be verified is consistent with the user password. If they are consistent, the comparison will continue until all the bits are compared, and the correct password will be fed back to the result feedback module; otherwise, the wrong password will be fed back to the result feedback module;
[0013] The result feedback module is used to prompt the user whether the received password is correct or incorrect.
[0014] Furthermore, it also includes a delay module, which is used to generate a random time according to the length of the user password and / or the number of password digit comparisons, and instruct the result feedback module to perform delay processing and then prompt the user if the received password is wrong.
[0015] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the method for verifying a user login password to prevent SCA is implemented when the processor executes the program.
[0016] A computer storage medium stores a computer program, which, when executed by a processor, implements the user login password verification method to prevent SCA.
[0017] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0018] The present invention is conducive to improving the timeliness of user password verification by judging the password length rather than the overall judgment. At the same time, the password consistency judgment based on random bits and delayed calculation processing effectively prevent the SCA attack of hackers, thereby improving the security of the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0020] The present invention is further described in detail below in conjunction with examples, but the embodiments of the present invention are not limited thereto.
[0021] Embodiment 1:
[0022] Combined with Figure 1 As shown, a method for preventing SCA from verifying a user login password includes:
[0023] Receive the password to be verified passed by the user, obtain the password length L of the password to be verified, if L is inconsistent with the length of the user password, generate a random time according to the length of the correct password, and perform delay processing according to the random time, and then return a password error; if they are consistent, randomly select one of them between 1-L, such as the Mth bit, 1≤M≤L, and compare whether the Mth bit of the password to be verified is consistent with the Mth bit of the user password. If they are consistent, continue to randomly select one of them, such as N bits, N≠M, and compare them. At the same time, record the number of comparison rounds P, and so on, until all bits are compared and the password is returned to be correct; if there is an inconsistency during the comparison process, generate a random time by comparing the current number of rounds P, and perform delay processing according to the random time, and then return a password error.
[0024] An example of how to generate random time is as follows:
[0025] Based on the number of rounds currently judged and the length of the correct password, and taking into account the time it takes for the computer's underlying processing of each step and the overall time of the method, random generation is performed. The rules are as follows:
[0026] The correct password length is L, the current number of rounds of judgment is P (if the length judgment is wrong, P=0), the starting value of the random time range is: t=20*(LP)-10 (t is 0 when L=P), and the end value is: 20*(LP)+10. A value is randomly generated within this range, and the time unit is milliseconds, and then the delay calculation process (sleep(t)) is performed.
[0027] If there is an inconsistency in the password length verification and the password number of digits comparison, the random time generated before returning the password error can also be a randomly selected time that is unrelated to the password length and the number of password comparison rounds, as long as it can disrupt the hacker's judgment of the number of erroneous digits based on the password error prompt time.
[0028] This password verification method mainly relies on three methods: password length judgment, password consistency judgment, and random delay time generation. The user calls the password verification method, and the method internally judges whether the password is correct based on three methods, and then returns the result. The password length judgment is mainly used to judge whether the number of digits of the password parameter passed by the user is the same as the correct password; the password consistency judgment uses a random bit selection method within the password length range to judge whether each digit of the password parameter passed by the user is the same as the correct password; the random delay is used to set the return time of the result to a random value. Judging by password length rather than overall judgment is conducive to improving the timeliness of user password verification. At the same time, the password consistency judgment based on random bit selection and delay calculation processing effectively prevents hackers' SCA attacks and improves the security of the method. Ensure the security of users' login information and prevent user privacy leakage.
[0029] Embodiment 2:
[0030] A user login password verification system for preventing SCA, comprising:
[0031] The password length verification module is used to compare the length of the password to be verified with the length L of the user password. If they are consistent, the password digit comparison module is started, otherwise the result feedback module is fed back;
[0032] The password bit comparison module is used to randomly select a bit that has not been compared in 1-L, and compare whether the bit of the password to be verified is consistent with the user password. If they are consistent, the comparison will continue until all the bits are compared, and the correct password will be fed back to the result feedback module; otherwise, the wrong password will be fed back to the result feedback module;
[0033] The result feedback module is used to prompt the user whether the received password is correct or incorrect.
[0034] Furthermore, it also includes a delay module, which is used to generate a random time according to the length of the user password and / or the number of password digit comparisons, and instruct the result feedback module to perform delay processing and then prompt the user if the received password is wrong.
[0035] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the method for verifying a user login password to prevent SCA is implemented when the processor executes the program.
[0036] A computer storage medium stores a computer program, which, when executed by a processor, implements the user login password verification method to prevent SCA.
[0037] Although the present invention is described herein with reference to the illustrative embodiments of the present invention, the above embodiments are only preferred embodiments of the present invention, and the embodiments of the present invention are not limited to the above embodiments. It should be understood that those skilled in the art can design many other modifications and embodiments, which will fall within the scope and spirit of the principles disclosed in this application.
Claims
1. A method for verifying a user login password to prevent SCA, characterized in that: include: Get the password length L of the password to be verified. If L is inconsistent with the user password length, return a password error. Otherwise, randomly select one of the bits between 1-L, compare the bit of the password to be verified with the bit of the user password to see if they are consistent. If they are inconsistent, return a password error; otherwise, continue to randomly select one of the bits between 1-L except the bits that have been compared, compare the bit of the password to be verified with the bit of the user password, and so on, until all the bits are compared, and return a password that is correct.
2. The method for verifying user login passwords to prevent SCA according to claim 1, characterized in that: If L is inconsistent with the length of the user password, a first random time is generated, and a delay process is performed according to the first random time, and then a password error is returned.
3. The method for verifying user login passwords to prevent SCA according to claim 2, characterized in that: The first random time is randomly generated according to the length of the user password.
4. The method for verifying user login passwords to prevent SCA according to claim 1, characterized in that: Compare the bit of the password to be verified with the bit of the user password to see if they are consistent. If they are inconsistent, generate a second random time, perform delay processing according to the second random time, and then return a password error.
5. The method for verifying user login password to prevent SCA according to claim 4, characterized in that: The second random time is randomly generated according to the number of times the bits of the password to be verified are compared with the user password.
6. A user login password verification system to prevent SCA, characterized in that: include: The password length verification module is used to compare the length of the password to be verified with the length L of the user password to see if they are consistent. If they are consistent, the password digit comparison module is started, otherwise, feedback is given to the result feedback module; The password bit comparison module is used to randomly select a bit that has not been compared in 1-L, and compare whether the bit of the password to be verified is consistent with the user password. If they are consistent, the comparison will continue until all the bits are compared, and the correct password will be fed back to the result feedback module; Otherwise, feedback the password error to the result feedback module; The result feedback module is used to prompt the user whether the received password is correct or incorrect.
7. The user login password verification system for preventing SCA according to claim 6, characterized in that: It also includes a delay module, which is used to generate a random time according to the length of the user password and / or the number of password digit comparisons, and instruct the result feedback module to perform delay processing and then prompt the user if the received password is wrong.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method for verifying the user login password to prevent SCA according to any one of claims 1 to 5 is implemented.
9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for verifying a user login password to prevent SCA as claimed in any one of claims 1 to 5 is implemented.
