Anti-replay attack identification method based on OTP algorithm
By introducing the OTP algorithm, encrypted transmission and multi-factor authentication into dynamic password authentication, the security vulnerability of replay attacks in the existing technology is solved, achieving efficient anti-replay attack capabilities and improving the security of dynamic password authentication.
Patent Information
- Application Number
- CN202410913944.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing offline dynamic password authentication technology has security vulnerabilities in the face of replay attacks. Attackers can intercept legitimate data packets during the authentication process and resend them at a later time to impersonate legitimate users for access.
Adopting an anti-replay attack identification method based on the OTP algorithm, by introducing time-related dynamic codes, encrypted transmission, user behavior analysis and multi-factor authentication, combined with dynamic password cards and RSA encryption algorithms, unpredictable challenge strings and response characters are generated string to ensure the uniqueness and security of each authentication process.
Effectively resist replay attacks, improve the security of dynamic password authentication, ensure the uniqueness and security of each authentication process, promptly detect and respond to abnormal login behaviors, avoid user misoperation or information leakage, and enhance the reliability of identity authentication.
Smart Images

Figure CN118764208A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network security, and more specifically, to an identification method for preventing replay attacks based on an OTP algorithm. Background Art
[0002] Dynamic password authentication technology can effectively resist most network attacks against static password authentication, and its security has been significantly improved, especially it can effectively resist network eavesdropping, interception / replay, password leakage, social engineering and other attacks. However, when subjected to forged hosts, password guessing, denial of service and other attacks, many dynamic password authentication systems still have security vulnerabilities. This requires more careful and comprehensive considerations when designing dynamic password authentication solutions to effectively resist various types of network attacks.
[0003] Although the existing offline dynamic password authentication technology can effectively resist most attacks against dynamic password authentication, it still has security loopholes when facing replay attacks. Replay attacks refer to attackers intercepting legitimate data packets during the authentication process and resending them at a later time to impersonate legitimate users to access. In order to solve this problem, the present invention proposes an improved authentication method for preventing replay attacks based on the OTP algorithm. Summary of the invention
[0004] In order to overcome the above-mentioned defects of the prior art, the present invention provides an anti-replay attack authentication method based on the OTP algorithm, which effectively resists replay attacks and improves the security of dynamic password authentication by introducing time-related dynamic codes, encrypted transmission, user behavior analysis, and multi-factor authentication, so as to solve the problems raised in the above-mentioned background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: an anti-replay attack identification method based on OTP algorithm, comprising the following steps:
[0006] S1: The user holds a corresponding challenge / response device based on the OTP algorithm, i.e., a dynamic password card, which has a built-in seed key generation algorithm and encrypted RSA algorithm;
[0007] S2: When a user needs to access the system, the system generates a random code as a challenge string (challenge). The random code generation is unpredictable and the probability of duplicate codes is extremely low. The challenge string is sent to the user;
[0008] S3: The user enters the challenge string into the dynamic password card. The dynamic password card generates a time-related dynamic code (Ntime) based on the OTP algorithm. The Ntime is not directly displayed to the user, but is temporarily stored in the system and the dynamic password card. The Ntime generated at the same time is the same, and the Ntime generated at different times is different;
[0009] S4: The dynamic password card uses Ntime as plain text and the challenge string (challenge) as the key, calculates the corresponding response string (plogin) through the RSA encryption algorithm, and dynamically displays the response string Plogin and the dynamic code Ntime to the user;
[0010] S5: The user inputs the response string Plogin displayed in real time into the system. After receiving Plogin, the system also uses Ntime as plain text and the challenge string (challenge) as the key to calculate the current response string (Pcurrent) through the RSA encryption algorithm;
[0011] S6: The system compares the response string Plogin input by the user with the response string Pcurrent calculated by the system. If the two are equal, the verification is successful and the user is allowed to access the system; if they are not equal, the verification fails and the access is denied;
[0012] S7: The verification time interval can be set by yourself, generally not exceeding 20 minutes, and the response string Pcurrent is not displayed on the user interface and is not visible to the user.
[0013] Preferably, the seed key generation algorithm built into the dynamic password card is used to generate the seed key required by the OTP algorithm, ensuring the uniqueness and security of the dynamic code Ntime generated each time.
[0014] Preferably, the communication process between the dynamic password card and the system adopts encrypted transmission to ensure the security of the challenge character string and the response character string during the transmission process.
[0015] Preferably, the system also includes a user behavior analysis module for monitoring user login behavior. When abnormal login behavior is detected, the system can automatically trigger a security alarm or take other security measures.
[0016] Preferably, the dynamic password card supports multi-factor authentication. In addition to authentication based on the OTP algorithm, it can also be combined with other biometric technologies (such as fingerprint recognition, facial recognition) for identity authentication to further improve security.
[0017] Preferably, the RSA encryption algorithm formula is:
[0018] First, select two large prime numbers p and q;
[0019] Next, calculate n = p × q, where n is used as the modulus;
[0020] Then, select an integer e less than such that (e is part of the public key);
[0021] Finally, calculate the modular inverse d of e with respect to i.e., (d is the private key);
[0022] Then the public key is (e, n) and the private key is (d, n);
[0023] The encryption process is as follows: If m is the plaintext message (and m < n), then the ciphertext c is calculated as c = m е mod n;
[0024] The decryption process is as follows: Given the ciphertext c, the plaintext m can be recovered by m = c d mod n.
[0025] Technical effects and advantages of the present invention:
[0026] 1. By introducing a time-related dynamic code and an encrypted transmission mechanism, it is ensured that the challenge string and the response string in each authentication process are unique and cannot be replayed, having a high ability to prevent replay attacks;
[0027] 2. Through the built-in seed key generation algorithm and the encrypted RSA algorithm in the dynamic password card, the security of the generated dynamic code and response string is ensured. At the same time, the system also includes a user behavior analysis module, which can timely detect and respond to abnormal login behaviors;
[0028] 3. The verification time interval can be set by itself, and the response string Pcurrent is not displayed on the user interface, avoiding the risk of user misoperation or information leakage;
[0029] 4. The dynamic password card supports multi-factor authentication, and other biometric technologies can be combined for identity verification according to actual needs, further improving security. Description of the Drawings
[0030] Figure 1 is the overall flowchart of the present invention. Detailed Embodiments
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] As attached Figure 1 The illustrated method for preventing replay attacks based on the OTP algorithm comprises the following steps:
[0033] S1: The user holds a corresponding challenge / response device based on the OTP algorithm, i.e., a dynamic password card, which has a built-in seed key generation algorithm and encrypted RSA algorithm;
[0034] S2: When a user needs to access the system, the system generates a random code as a challenge string (challenge). The random code generation is unpredictable and the probability of duplicate codes is extremely low. The challenge string is sent to the user;
[0035] S3: The user enters the challenge string into the dynamic password card. The dynamic password card generates a time-related dynamic code (Ntime) based on the OTP algorithm. The Ntime is not directly displayed to the user, but is temporarily stored in the system and the dynamic password card. The Ntime generated at the same time is the same, and the Ntime generated at different times is different;
[0036] S4: The dynamic password card uses Ntime as plain text and the challenge string (challenge) as the key, calculates the corresponding response string (plogin) through the RSA encryption algorithm, and dynamically displays the response string Plogin and the dynamic code Ntime to the user;
[0037] S5: The user inputs the response string Plogin displayed in real time into the system. After receiving Plogin, the system also uses Ntime as plain text and the challenge string (challenge) as the key to calculate the current response string (Pcurrent) through the RSA encryption algorithm;
[0038] S6: The system compares the response string Plogin input by the user with the response string Pcurrent calculated by the system. If the two are equal, the verification is successful and the user is allowed to access the system; if they are not equal, the verification fails and the access is denied;
[0039] S7: The verification time interval can be set by yourself, generally not exceeding 20 minutes, and the response string Pcurrent is not displayed on the user interface and is not visible to the user.
[0040] The seed key generation algorithm built into the dynamic password card is used to generate the seed key required by the OTP algorithm, ensuring the uniqueness and security of the dynamic code Ntime generated each time.
[0041] The communication process between the dynamic password card and the system adopts encrypted transmission to ensure the security of the challenge string and the response string during the transmission process.
[0042] The system also includes a user behavior analysis module for monitoring user login behavior. When abnormal login behavior is detected, the system can automatically trigger a security alarm or take other security measures.
[0043] The dynamic password card supports multi-factor authentication. In addition to authentication based on the OTP algorithm, it can also be combined with other biometric technologies (such as fingerprint recognition, facial recognition) for identity authentication to further improve security.
[0044] In specific implementation, when a user holds a dynamic password card based on the OTP algorithm and needs to access the system, the system generates a challenge string and sends it to the user. After the user enters the challenge string into the dynamic password card, the dynamic password card generates a dynamic code Ntime and a response string Plogin based on the OTP algorithm and the built-in seed key generation algorithm, and dynamically displays both to the user. After the user enters Plogin into the system, the system also calculates Pcurrent and compares and verifies it with the Plogin entered by the user. If the verification is successful, the user is allowed to access the system; if the verification fails, access is denied and corresponding security measures are triggered.
[0045] The following are the steps for user login:
[0046] Users log into the software, enter their username and password, and can also authenticate through fingerprint or facial recognition;
[0047] The authentication server determines whether the user name and password are correct or whether the user is an authenticated user. If correct, the system generates a random challenge string challenge, such as "123456" and displays the challenge number;
[0048] The system displays the challenge string "123456" to the user through an interface or other means, or sends it to the user through SMS, email, etc.;
[0049] The user enters the received challenge string "123456" into the dynamic password card. This can be done by key input or scanning a QR code;
[0050] The dynamic password card is based on the OTP algorithm internally. Combining the challenge string "123456" and the current time (or other dynamic factors), it generates a one-time dynamic plaintext (Ntime). This Ntime is the original data before encryption;
[0051] Then, the dynamic password card uses the built-in RSA encryption algorithm. With the challenge string "123456" as the public key and Ntime as the plaintext, it encrypts to generate the response string (Plogin);
[0052] The dynamic password card displays the encrypted response string (Plogin) to the user. The user needs to read the response string Plogin and input it into the system's login interface;
[0053] The system also uses the Ntime generated by the challenge string "123456" and the assumed current time as the plaintext, and uses the same RSA encryption algorithm as the dynamic password card (but decrypts with the private key because RSA is an asymmetric encryption) to generate a response string (Pcurrent);
[0054] The system compares the Plogin input by the user with the Pcurrent it generates;
[0055] If Plogin is consistent with Pcurrent, the verification is successful and the user is allowed to access the system;
[0056] If they are inconsistent, the verification fails and the user is denied access.
[0057] Specifically, the algorithm formula for RSA encryption is:
[0058] First, select two large prime numbers p and q;
[0059] Next, calculate n = p × q, and n is used as the modulus;
[0060] Then, select an integer е less than such that (е is part of the public key);
[0061] Finally, calculate the modular inverse d of е with respect to , that is, (d is the private key);
[0062] Then the public key is (е, n), and the private key is (d, n);
[0063] The encryption process is: if m is the plaintext message (and m < n), then the ciphertext c is calculated as c = m е mod n;
[0064] The decryption process is: given the ciphertext c, the plaintext m can be obtained through m = cd mod n to restore.
[0065] The identity authentication of the challenge / response mechanism has extremely high security. Since the RSA algorithm is irreversible, the plaintext cannot be deduced from the obtained ciphertext, achieving a good degree of unbreakability. Secondly, since the generation of plaintext is related to time, although the algorithm is unique, the plaintext generated at different times is also different, which has a good resistance to replay attacks. Even if the time is the same and the generated plaintext is the same, the ciphertext value obtained is still uncontrollable because the challenge number is randomly generated. Therefore, this protection scheme can prevent illegal users from stealing passwords, illegal logins and operations from many aspects. Only when the user holds the specified challenge / response dynamic password card can the correct response number be calculated for legal login and operation, thereby ensuring that the user is a legitimate user holding the specified dynamic password card.
[0066] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An authentication method for preventing replay attacks based on OTP algorithm, characterized in that; The following steps are involved: S1: The user holds a corresponding challenge / response device based on the OTP algorithm, i.e., a dynamic password card, which has a built-in seed key generation algorithm and encrypted RSA algorithm; S2: When a user needs to access the system, the system generates a random code as a challenge string (challenge). The random code generation is unpredictable and the probability of duplicate codes is extremely low. The challenge string is sent to the user; S3: The user enters the challenge string into the dynamic password card. The dynamic password card generates a time-related dynamic code (Ntime) based on the OTP algorithm. The Ntime is not directly displayed to the user, but is temporarily stored in the system and the dynamic password card. The Ntime generated at the same time is the same, and the Ntime generated at different times is different; S4: The dynamic password card uses Ntime as plain text and the challenge string (challenge) as the key, calculates the corresponding response string (plogin) through the RSA encryption algorithm, and dynamically displays the response string Plogin and the dynamic code Ntime to the user; S5: The user inputs the response string Plogin displayed in real time into the system. After receiving Plogin, the system also uses Ntime as plain text and the challenge string (challenge) as the key to calculate the current response string (Pcurrent) through the RSA encryption algorithm; S6: The system compares the response string Plogin input by the user with the response string Pcurrent calculated by the system. If the two are equal, the verification is successful and the user is allowed to access the system; if they are not equal, the verification fails and the access is denied; S7: The verification time interval can be set by yourself, generally not exceeding 20 minutes, and the response string Pcurrent is not displayed on the user interface and is not visible to the user.
2. According to claim 1, a method for identifying anti-replay attacks based on the OTP algorithm, characterized in that: The seed key generation algorithm built into the dynamic password card is used to generate the seed key required by the OTP algorithm, ensuring the uniqueness and security of the dynamic code Ntime generated each time.
3. The method for preventing replay attacks based on the OTP algorithm according to claim 2, characterized in that: The communication process between the dynamic password card and the system adopts encrypted transmission to ensure the security of the challenge string and the response string during the transmission process.
4. The method for preventing replay attacks based on the OTP algorithm according to claim 3, characterized in that: The system also includes a user behavior analysis module for monitoring user login behavior. When abnormal login behavior is detected, the system can automatically trigger a security alarm or take other security measures.
5. The method for identifying the anti-replay attack based on the OTP algorithm according to claim 4, characterized in that: The dynamic password card supports multi-factor authentication. In addition to authentication based on the OTP algorithm, it can also be combined with other biometric technologies (such as fingerprint recognition, facial recognition) for identity authentication to further improve security.
6. The method for preventing replay attacks based on the OTP algorithm according to claim 5, characterized in that: The algorithm formula of the RSA encryption is: First, choose two large prime numbers p and q; Then, ntp×q is calculated, and n is used as the modulus; Then, select a An integer е such that (е is part of the public key); Finally, calculate е about The modular inverse t, that is (t is the private key); Then the public key is (е, n) and the private key is (t, n); The encryption process is as follows: If m is the plaintext message (and m < n), then the ciphertext c is calculated as c ≡ m^t mod n е m^o mod n; The decryption process is: given a ciphertext c, the plaintext m can be decrypted by mtc t motn to recover.
Citation Information
Patent Citations
Security key device for secure cloud services, and system and method of providing security cloud services
CN104615929A
OTP and user behavior-based certification and authorization method in mobile cloud computing environment
CN105099690A
Otp algorithm-based identification method for preventing replay attacks
CN112087438A
