A smart CAPTCHA method
By executing JavaScript code on the client side and analyzing browser behavior and slider trajectory using AI prediction models, the CAPTCHA verification process is dynamically adjusted, solving the balance problem between security and user-friendliness in existing CAPTCHA methods and achieving higher recognition accuracy and stronger security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2026-03-06
AI Technical Summary
Existing CAPTCHA methods struggle to balance security and user-friendliness. Traditional CAPTCHAs are easily recognized by machines, and the various CAPTCHA types offered by existing third-party services are neither user-friendly nor secure enough.
By executing preset environment detection JavaScript code on the client side, combined with the SDK detection module and AI prediction model, the system collects and analyzes the user's browser behavior and slider trajectory to determine whether the operator is a human or a machine, and dynamically adjusts the CAPTCHA verification process.
It improves the accuracy of human-machine recognition, reduces the operational burden on normal users, enhances security and the attack threshold, and ensures system security and user experience.
Smart Images

Figure CN115879083B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine learning and browser security, and in particular to an intelligent CAPTCHA method. Background Technology
[0002] Verification codes, as a key element frequently appearing in human-computer interaction interfaces, are crucial components for identity verification and risk prevention. They serve as the first line of defense for user experience, playing a vital role in various scenarios such as registration, login, and transactions. They prevent unauthorized users from using automated software for malicious registration, spoofing, information theft, fraudulent claims for benefits or prizes, and password cracking, thereby safeguarding corporate financial security, marketing security, and information security.
[0003] Existing CAPTCHAs are mostly traditional alphanumeric text-based CAPTCHAs, image-based sliding CAPTCHAs with missing blocks, and even image-based content selection CAPTCHAs that are not user-friendly. Even for trusted users, each operation inevitably requires them to pop up and complete a CAPTCHA, thus degrading the user experience. Furthermore, simple image-based sliding CAPTCHAs, with existing OCR recognition technology, can easily locate the missing part of the slider and allow the machine to drag and complete the verification, resulting in low security.
[0004] Existing popular third-party CAPTCHA service providers offer solutions with up to nine CAPTCHA types, including sliding CAPTCHAs. However, these solutions still fall short of the requirement of not increasing the complexity of the user verification process while maintaining a certain level of security and attack threshold. Their main drawbacks are as follows:
[0005] The security of this scheme is achieved by alternating nine types of CAPTCHAs to increase the attack threshold. However, most of these CAPTCHA types are not user-friendly. For example, the Chinese character selection CAPTCHA is not user-friendly for users in non-Chinese-speaking countries, and the Gomoku (Five in a Row) CAPTCHA requires moving pieces to complete a five-in-a-row, which will exclude users unfamiliar with the Gomoku mechanism.
[0006] The one-click pass mode of this solution only checks whether the browser's webdriver property is empty. This property is easily modified, allowing users to pass directly without verifying the CAPTCHA.
[0007] The sliding CAPTCHA in this scheme only verifies the position of the slider notch and does not verify the sliding trajectory at all. However, current attack methods have made the identification of the slider notch position quite sophisticated, resulting in a very low attack threshold for ordinary slider notch CAPTCHAs and a lack of security.
[0008] Therefore, a smarter and simpler method of intelligent CAPTCHA is needed. Summary of the Invention
[0009] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide an intelligent verification code method.
[0010] To address the aforementioned technical problems, this invention provides an intelligent CAPTCHA method to improve the accuracy of judging human-computer interaction in browsers. This method executes preset environment detection JavaScript code in the client's browser and improves the accuracy of human-computer detection by comparing key parameters. When a user drags a slider to verify, a trajectory array is collected. The trajectory array is analyzed and the human-computer interaction result is predicted by constructing and training a prediction model within an AI prediction model. The method is characterized by creating an SDK detection module and an AI prediction model. The SDK detection module performs security verification on the user, and the AI prediction model assists in the human-computer verification of the CAPTCHA service. Specifically, it includes the following steps:
[0011] Step 1: The user opens a webpage that includes the smart verification code SDK. The smart verification code SDK has a built-in SDK detection module. When the smart verification code SDK is loaded, the SDK detection module starts collecting the judgment information from the user's browser. The judgment information is used for security verification. After being encrypted using a preset encryption algorithm, it is sent to the verification code service platform via the HTTP protocol.
[0012] Step 2: The verification code service platform receives the judgment information sent by the SDK detection module. Based on the preset judgment rules in the verification code service platform, it determines whether the browser operation comes from a human or a machine. After the judgment is completed, the result is returned to the smart verification code SDK.
[0013] Step 3: The smart verification code SDK receives the judgment result returned by the verification code service platform. If the result indicates a real person's operation, the verification code component is not initialized, and the user is guided to submit the form directly to complete the business operation. If the result indicates a machine operation, the verification code component is initialized and the user form submission button is bound, and then proceed to Step 4.
[0014] Step 4: The verification code component includes a sliding verification code. After the sliding verification code pops up, it is displayed in the webpage overlay. During the process of dragging the slider, the smart verification code SDK collects and records the slider information in real time. The slider information includes the slider coordinates, mouse or touch screen coordinates and drag trajectory during the slider dragging process. When the slider action stops, the smart verification code SDK will send the slider information to the verification code service platform.
[0015] Step 5: The verification code service platform receives the slider information, calls the preset AI prediction model to determine whether the operation of the slider information is a real person or a machine. If it is determined to be a real person's operation, it generates a secondary verification parameter key and returns it to the smart verification code SDK. This key is used by the business backend to confirm that the page operation on the business frontend has made a verification code verification request.
[0016] Step 6: The smart verification code SDK receives the judgment result from the verification code service platform in Step 5. If the result indicates that it is a real person operating, it calls the business front-end to submit the form to the business back-end; otherwise, it refreshes the verification code.
[0017] In step 1, the SDK detection module includes JavaScript code for executing and collecting judgment information. This judgment information includes: navigator.userAgent, navigator.webdriver, navigator.osCpu, navigator.platform, navigator.productSub, mouse actions, keyboard actions, and keyboard key values. The encryption algorithm is the DES symmetric encryption algorithm, encrypted using an agreed-upon key.
[0018] In step 2, the following determinations are made sequentially according to the determination rules:
[0019] Determine if the value of window.navigator.webdriver is true; if so, treat it as a machine; otherwise, treat it as a human.
[0020] Determine if window.navigator.userAgent contains the character "headless". If it does, it is considered a machine; otherwise, it is considered a human.
[0021] The system determines whether mouse and keyboard actions are triggered after entering the page. If so, it is considered a human action; otherwise, it is considered a machine action. The mouse actions include key press, key release, and scroll wheel movement. The keyboard actions include key press and key release.
[0022] When window.navigator.userAgent contains the characters android, iphone, ipad or cannot be recognized, determine whether it is a touch screen device. The method is to create a touchEvent. If the event is created successfully, it is determined to be a touch screen device and is considered as a human. Otherwise, it is a non-touch screen device and is considered as a machine.
[0023] The operating system type information includes OSCPU and Platform.
[0024] When `navigator.oscpu` is `win`, determine if `userAgent` contains `win`. If it does, it is considered a human; otherwise, it is considered a machine. When `oscpu` is `Linux` or `cros`, determine if `userAgent` contains `linux`. If it does, it is considered a human; otherwise, it is considered a machine. When `oscpu` is `mac`, determine if `userAgent` contains `mac`, `iphone`, or `ipad`. If it does, it is considered a human; otherwise, it is considered a machine.
[0025] When the platform includes Windows, determine whether the userAgent contains "Windows". If so, it is considered a human; otherwise, it is considered a bot. When the platform is Mac, iPad, or iPhone, determine whether the userAgent contains the corresponding "Mac", "iPhone", or "iPad". If so, it is considered a human; otherwise, it is considered a bot. When the platform is Linux, determine whether the OS is Linux. If so, it is considered a human; otherwise, it is considered a bot. When the platform is Android, determine whether the OS is Android. If so, it is considered a human; otherwise, it is considered a bot.
[0026] The compilation version number includes productSub.
[0027] If the userAgent contains one of opera, opr, chrome, or safari, check if navigator.productSub is 20030107. If it is, it is considered a human; otherwise, it is considered a machine. If the userAgent contains firefox, check if navigator.productSub is 20100101. If it is, it is considered a human; otherwise, it is considered a machine.
[0028] In step 3, the process of initializing the verification code includes initializing the image, secretKey, and token. The secretKey is used by the smart verification code SDK to encrypt and send the slider information to the verification code service platform. The token is used to uniquely identify this verification code SDK initialization request. At the same time, this token is stored in Redis for subsequent checks on the gap position and trajectory during human-machine verification to determine whether the request has been processed.
[0029] In step 4, the slider information includes a two-dimensional array recording the slider's drag coordinate trajectory. This two-dimensional array is collected and recorded every 20ms by a timer, using the coordinates of the mouse or touchscreen relative to the top-left corner of the page as the origin. The judgment, cleaning, and organization of this two-dimensional array specifically include:
[0030] If the two-dimensional array is shorter than 0.1s, it is considered a machine; if the two-dimensional array is longer than 5s, it is truncated.
[0031] Calculate the Euclidean distance for all adjacent items in the two-dimensional array, then divide by the time interval 0.02s to obtain the average velocity for each time interval, and construct the velocity array during the sliding process;
[0032] The difference between all adjacent items in the velocity array is calculated and then divided by the time interval 0.02s to obtain the acceleration array during the sliding process.
[0033] Between each item in the two-dimensional array, the y-axis difference is divided by the x-axis difference to obtain the direction within each time interval, forming a direction array. The y-axis difference and the x-axis difference are both preserved in sign.
[0034] The velocity array, acceleration array, and direction array constitute the feature array.
[0035] In step 5, the image gap position is a coordinate position randomly selected when the CAPTCHA initialization request slider image is used. The AI prediction model adopts the machine learning SVM classification algorithm, and is trained by supervising the learning of the external feature array as positive samples and the feature array generated by the machine script as negative samples. The AI prediction model's analysis and learning of the feature array includes: the proportion of negative values in the direction array, the frequency of positive and negative value changes in the direction array, and the trend of magnitude change in the acceleration array.
[0036] When both the gap coordinate position verification and the trajectory human-machine verification pass, a secondary verification parameter key will be generated and returned to the SDK. This key will be used by the business backend to confirm that the business frontend page operation has made a verification code verification request. At the same time, this secondary verification parameter key needs to be stored in Redis and cached for 3 minutes. After 3 minutes, the verification code will expire.
[0037] In step 6, when the business front end submits the form to the business back end, it needs to include the secondary verification parameter key from step 5. When the business back end receives the key, it needs to call the verification code backend service interface to check the validity of the verification by determining whether the key exists in Redis. If it exists, the verification is valid; otherwise, the verification is invalid.
[0038] The beneficial effects achieved by this invention are as follows:
[0039] 1. Secure users do not need to perform CAPTCHA verification. This invention uses an SDK located on the user's browser to detect the browser parameters and collect the user's browser behavior to determine whether the user's browser is a normal browser;
[0040] If the user is using a script to operate the browser, and the detection result is normal, the system considers the user to be in a safe browser environment and to perform normal browser operations. In this case, there is no need to pop up a verification code; the user can directly proceed to subsequent business operations after clicking the confirmation button. This is convenient for users and saves time and operating costs for normal users.
[0041] 2. Higher security and attack threshold. This invention uses AI machine learning classification algorithms to process the mouse / touchpoint trajectory when a user moves a slider. Without the user's awareness, it collects and analyzes key indicators such as speed, acceleration, and direction—essential for distinguishing between human and machine operation—for prediction. Attackers using script code will find it difficult to simulate the details of a human's sliding operation. Their control over speed, acceleration, and direction is often mechanical and rigid, leading the system to recognize it as machine operation, significantly raising the attack threshold and ensuring system security. Attached Figure Description
[0042] Figure 1 A simplified flowchart of a method according to an exemplary embodiment of the present invention; Detailed Implementation
[0043] This case involves an intelligent CAPTCHA method based on sliding trajectory human-machine recognition and browser parameter verification. It mainly consists of three modules that work together: a front-end SDK detection module, an application platform for CAPTCHA services, and an AI prediction model with a built-in prediction model. The SDK detection module is a piece of JavaScript code that is manually imported by the application developers into the page that requires the intelligent CAPTCHA function.
[0044] The present invention will be further described below with reference to the accompanying drawings and exemplary embodiments:
[0045] like Figure 1 The method flow shown in one embodiment of this case begins with the following steps:
[0046] Step 1: The webpage is opened, and the SDK begins collecting browser parameters, mouse and keyboard events, and sending them to the server. Specifically, when a user opens a webpage that includes the smart verification code SDK, the SDK, once loaded, begins collecting the user's browser's userAgent, webdriver, osCpu, platform, productSub, mouse events (including mouse button press, mouse button release, and mouse wheel scroll events), keyboard events (keyboard press and release events), and keyboard key values. The userAgent contains information such as browser type, version, and kernel. The webdriver indicates whether it's a browser driver. osCpu and platform indicate the operating system type of the browser. productSub is the current browser's build version number. The mouse and keyboard events capture the user's actions after entering the webpage; if no mouse or keyboard events are detected, it's highly likely the browser is bot-driven. After collecting all these parameters, the SDK notifies the verification code service platform via an HTTP request.
[0047] Step 2: The server makes a judgment based on preset parameters and conditions, and the result is fed back to the SDK. Specifically, the CAPTCHA service platform determines the likelihood that the browser is using automation based on the submitted parameters, using the following rules:
[0048] Determine if the value of window.navigator.webdriver is true; if so, treat it as a machine; otherwise, treat it as a human.
[0049] Determine if window.navigator.userAgent contains the character "headless". If it does, treat it as a machine; otherwise, treat it as a human.
[0050] The system determines whether normal mouse movement, click, and keyboard events are triggered after entering the page. These events include mouse press, mouse release, mouse movement, keyboard press, and keyboard release. Normal events are characterized by the fact that a mouse press event is always followed by a mouse release event, and a keyboard press event is always followed by a keyboard release event. If any of these events occur, it is considered a human action; otherwise, it is considered a machine action.
[0051] If window.navigator.userAgent contains characters such as android, iphone, ipad, etc. or cannot be recognized, determine whether it is a touch screen device. The method is to create a touchEvent. If the event is created successfully, it is determined to be a touch screen device; otherwise, it is a non-touch screen device. If it is a touch screen device, it is considered a human; otherwise, it is considered a machine.
[0052] When navigator.oscpu is win, determine whether userAgent contains win. If it does, it is considered a human; otherwise, it is considered a machine. When oscpu is linux or cros, determine whether userAgent contains linux. If it does, it is considered a human; otherwise, it is considered a machine. When oscpu is mac, determine whether userAgent contains mac, iphone, or ipad. If it does, it is considered a human; otherwise, it is considered a machine.
[0053] The system determines whether the userAgent contains "win" if the platform is Windows, and if so, it is considered a human; otherwise, it is considered a machine. Similarly, it determines whether the userAgent contains "mac," "iphone," or "ipad" if the platform is Mac, iPad, or iPhone, and if so, it is considered a human; if the platform is Linux, it determines whether the OS is Linux, and if so, it is considered a human; and if the platform is Android, it determines whether the OS is Android, and if so, it is considered a human; otherwise, it is considered a machine.
[0054] If userAgent contains opera, opr, chrome, or safari, check if navigator.productSub is 20030107. If it is, it is considered a human; otherwise, it is considered a machine. If userAgent contains firefox, check if navigator.productSub is 20100101. If it is, it is considered a human; otherwise, it is considered a machine.
[0055] The seven rules used for judgment comprehensively analyze the browser attack characteristics of the company's current network traffic, covering the characteristics of over 95% of attacking browsers. Attack methods are diverse; the vast majority of web crawler attacks are carried out through scripts manipulating headless browsers. These browsers are easily identifiable by their webdriver and userAgent parameters. Judging these two parameters helps identify most unmasked attackers. Furthermore, there are methods such as the "migratory browser" that allow attackers to customize browser parameters. Judgment is based on the correlation and consistency between userAgent, osCpu, platform, and productSub to identify and define actions that tamper with browser parameters as malicious attacks. The rules have been adjusted multiple times, and practical results show that different rule execution orders have various impacts on performance; the order of this solution offers the highest overall efficiency. Analysis of attacker attack feature samples shows that the feature with webdriver set to true has the highest proportion, and comparative analysis reveals that it also has the highest accuracy. The accuracy of identifying malicious attacks based on mouse and keyboard events has a large margin of error. In most cases, it is highly reliable for identifying general users, with an accuracy of up to 95%. However, due to differences in user browser type and version, the accuracy drops to 70% for older versions of Internet Explorer due to compatibility issues. After numerous rule changes and comparisons, and a balance between speed and accuracy, the final rule order in this solution was determined.
[0056] Step 3: If the system detects a human user, no CAPTCHA will pop up. If it detects a bot, the CAPTCHA will be initialized and displayed. Specifically, the CAPTCHA SDK receives the result from the CAPTCHA service platform. If it's a human user, the CAPTCHA initialization logic is not executed; the corresponding business logic is executed directly when the user clicks the submit button. If it's a bot, the CAPTCHA initialization logic will be executed. When the user clicks the submit button, the CAPTCHA will pop up. Only after the user completes the CAPTCHA verification will subsequent business logic continue. During CAPTCHA initialization, a GET interface is called. The GET interface returns the generated CAPTCHA background image and slider image. The correct image gap coordinates are stored in Redis for use in check requests to verify the submitted coordinates. This interface synchronously returns a token and a secretKey. The token uniquely identifies this CAPTCHA request and must be included in subsequent check requests. The secretKey is used to encrypt the image gap coordinates and slider trajectory array. The CAPTCHA SDK will not initialize components in all cases. Only when a bot is detected by preset rules will the CAPTCHA pop up and force the user to verify. In other cases, the CAPTCHA will not interfere with the user's actions, achieving a seamless user experience.
[0057] Step 4: The user slides the CAPTCHA slider to complete the verification. The final slider coordinates and sliding trajectory two-dimensional array are sent to the server for verification. Specifically: When the CAPTCHA pops up and the user clicks the slider, a timer is triggered. The timer uses the JavaScript setInterval method to set a temporary variable x for the user's touch point coordinates and captures user mouse / finger movement events (mousemove event on PC, touchmove event on touchscreen). Whenever an event is captured, the user's touch point coordinates are obtained and stored in the temporary variable x. The timer retrieves the value of the temporary variable x every 20ms. When the user's finger leaves the screen or the mouse button is released, the coordinate collection stops, and the collection of the two-dimensional coordinate array is completed. Before submitting the two-dimensional array to the backend, it needs to be standardized. The duration of the two-dimensional array needs to be repeatedly tested and preset. A preset duration that is too short will affect the accuracy of the judgment, and a preset duration that is too long will also affect the accuracy. In the process of repeated experimental comparisons, it was found that sample data with a duration of less than 0.1 seconds is extremely rare. Furthermore, due to the short duration of the two-dimensional array, the AI prediction model has difficulty accurately analyzing and predicting the results, with an accuracy rate below 85%. When the duration of the two-dimensional array is greater than 0.1 seconds, the prediction accuracy rises to 90%. When the duration of the two-dimensional array is greater than 5 seconds, due to data interference, the prediction accuracy begins to drop significantly to below 90%. Moreover, it is difficult for a normal user to move and align the slider gap within 0.1 seconds. Therefore, if the array duration is less than 0.1 seconds, it can be directly judged as a machine. At the same time, users can almost always complete the slider dragging within 5 seconds. An excessively long trajectory two-dimensional array will affect the judgment of the AI prediction model or introduce unnecessary interference. Therefore, trajectory two-dimensional array data exceeding 5 seconds is truncated. Submit the token, the encrypted gap coordinates, and the user's sliding trajectory two-dimensional array to the verification code service platform. Users must complete the steps required by the verification code.
[0058] Step 5: The AI prediction model is invoked to analyze the two-dimensional array of the sliding trajectory and predict whether the behavior is human-machine. Specifically, the backend processes the check request by first decrypting the coordinates of the image gap, then retrieving the correct coordinate value corresponding to the token from Redis for comparison. If the deviation is within a preset range, the position is determined to be correct, and the subsequent human-machine verification by the AI prediction model continues. If they do not match, the frontend is notified of verification failure. If the coordinate value in Redis is invalid, the frontend is notified of verification timeout and a retry is required. The human-machine verification by the AI prediction model involves decrypting the encrypted two-dimensional array of the user's sliding trajectory submitted by the frontend and sending it to the AI prediction model for prediction. Based on the returned human / machine result, the frontend is informed of verification success / failure. The AI prediction model needs to further extract features from the two-dimensional array of the user's sliding trajectory.
[0059] Calculate the Euclidean distance for all adjacent items in the two-dimensional array, then divide by the time interval 0.02s to obtain the average velocity for each time interval, and construct the velocity array during the sliding process;
[0060] The difference between all adjacent items in the velocity array is calculated and then divided by the time interval 0.02s to obtain the acceleration array during the sliding process.
[0061] Between each item in the two-dimensional array, the y-axis difference is divided by the x-axis difference to obtain the direction within each time interval, forming a direction array. The y-axis difference and the x-axis difference are both preserved in sign.
[0062] The velocity, acceleration, and direction arrays constitute the feature array. The AI prediction model's analysis and learning of the feature array includes: the proportion of negative values in the direction array, the frequency of positive-to-negative value transitions in the direction array, and the trend of magnitude changes in the acceleration array. In the initial analysis of the velocity, acceleration, and direction arrays of the sliding trajectories of 1.2 million manually scrolling users on the company's online platform, the following characteristics were identified: the proportion of negative values in the direction array is greater than 62%, concentrated in the latter part of the array; over 94% of the direction arrays have a positive-to-negative value transition frequency between 6 and 10 times; the acceleration magnitude change trend is initially fast and then slows down, with the rapid increase phase accounting for 26% to 32% of the time and the slow decrease phase accounting for 38% to 45% of the time. User sliding trajectories matching these characteristics are weighted towards human judgment in the AI prediction model. After these features are incorporated into the weight adjustment, the accuracy improves by 2%, and the false positive rate decreases by 13%, demonstrating significant effectiveness. The AI prediction model employs a machine learning SVM classification algorithm, using external feature arrays as positive samples and machine script-generated feature arrays as negative samples for supervised learning and training. This algorithm performs exceptionally well even with small sample sizes, achieving an accuracy of 96%. However, in practice, other similar algorithms suitable for small sample conditions struggle to reach such accuracy. For example, the KNN algorithm only achieves 92% accuracy with the same sample size. While decision tree algorithms offer similar accuracy, the generation of decision trees is unstable; even subtle differences in data can lead to different generated decision trees, making overfitting likely. In algorithm parameter tuning, priority is given to ensuring the pass rate of positive samples while also considering the recognition rate of negative samples. If verification is successful, a unique verification key is generated and stored in Redis for subsequent backend secondary verification. Step 6: The server returns the browser SDK result. Based on the result, the browser either re-swipes or submits a short business logic request. Specifically, the frontend receives the check request result; if verification is successful, the actual submission logic is triggered, with the submission parameters including the unique verification key generated upon successful verification. When the business backend processes the submission request, it first calls the secondary verification interface of the verification code service platform. The parameter is a unique verification key. If the key exists in Redis, the entire verification process is successful. If the key does not exist in Redis, it means that the verification timed out and the user needs to refresh the verification code to retry.
[0063] This invention primarily provides an intelligent CAPTCHA method, representing an innovative practice aimed at improving user-friendliness, security, and the attack threshold. The entire system comprises two key components: first, an AI model analyzes mouse / touchpoint trajectories collected by the browser SDK, considering direction, speed, and acceleration to distinguish between human and machine operations; second, the SDK performs a browser environment check during initialization, focusing on identifying whether the user's browser uses automated methods and whether the browser type matches the actual browser parameters to determine if the user is a bot. All these actions remain transparent to the user, minimizing operational complexity while effectively ensuring security.
[0064] The beneficial effects achieved by this invention are as follows:
[0065] 1. Secure users do not need to perform CAPTCHA verification. This invention uses an SDK located in the user's browser to detect the browser parameters and collect the user's browser behavior to determine whether the browser is legitimate and whether the user is using scripts to operate the browser. If the detection results are normal, the system considers the user to be in a secure browser environment and allows normal browser operations. In this case, no CAPTCHA is required; the user can directly proceed to subsequent business operations after clicking the confirmation button. This is convenient for users and saves time and operating costs for legitimate users.
[0066] 2. Higher security and attack threshold. This invention uses AI machine learning classification algorithms to process the mouse / touchpoint trajectory when a user moves a slider. Without the user's awareness, it collects and analyzes key indicators such as speed, acceleration, and direction—essential for distinguishing between human and machine operation—for prediction. Attackers using script code will find it difficult to simulate the details of a human's sliding operation. Controlling speed, acceleration, and direction in a mechanical and rigid manner will be easily identified as machine operation by the system, significantly raising the attack threshold and ensuring system security. Compared to existing technologies that simply analyze the coordinates of mouse clicks, this method offers higher accuracy and more reasonable judgment. Furthermore, compared to existing technologies that rely on simple feature analysis of acceleration and angle, this solution bases its judgment of acceleration and direction on a large amount of real-world online data, analyzing, quantifying, and extracting key features to improve the accuracy of the AI prediction model and reduce the false positive rate.
[0067] The above embodiments are not intended to limit the present invention in any way. Any other improvements and applications made to the above embodiments by equivalent transformations shall fall within the protection scope of the present invention.
Claims
1. A smart verification code method, characterized in that, Create an SDK detection module and an AI prediction model, verify the user's security through the SDK detection module, and assist the human-machine verification of the verification code service by building and training the AI prediction model, which includes the following steps: Step 1: The user opens a webpage that has introduced an intelligent verification code SDK, the SDK detection module is preset in the intelligent verification code SDK, when the intelligent verification code SDK is loaded, the SDK detection module starts to collect the user's browser judgment information, the judgment information is used for security verification, after encryption using the preset encryption algorithm, it is requested to the verification code service platform through the http protocol; Step 2: The verification code service platform receives the judgment information sent by the SDK detection module, judges whether the browser operation is from a human or a machine according to the preset judgment rules in the verification code service platform, and returns the result to the intelligent verification code SDK after the judgment is completed; Step 3: The intelligent verification code SDK receives the judgment result returned by the verification code service platform, if the result is real person operation, do not initialize the verification code component, guide the user to directly submit the form to complete the business operation; if the result is machine operation, initialize and bind the user form submission button to the verification code component, and enter step 4; Step 4: The verification code component includes a sliding verification code, the sliding verification code is displayed in the webpage floating layer after being popped up, the intelligent verification code SDK collects and records the sliding block information in real time during the sliding block dragging process, the sliding block information includes the sliding block coordinates, mouse or touch screen coordinates and dragging trajectory during the sliding block dragging process, when the sliding block action stops, the intelligent verification code SDK will send the sliding block information to the verification code service platform; Step 5: The verification code service platform receives the sliding block information, calls the preset AI prediction model to judge whether the sliding block information operation is a real person or a machine, if it is judged as a real person operation, generates a secondary verification parameter key and returns it to the intelligent verification code SDK, which is used to confirm the verification parameter submitted by the business front-end when the business back-end confirms the page operation of the business front-end verification request; Step 6: The intelligent verification code SDK receives the judgment result of the verification code service platform in step 5, if the result is a real person operation, it calls the business front-end to submit the form to the business back-end, otherwise it refreshes the verification code.
2. The intelligent verification code method of claim 1, wherein, In step 1, the SDK detection module includes a piece of javascript code for collecting judgment information, the judgment information includes: navigator.userAgent, navigator.webdriver, navigator.osCpu, navigator.platform, navigator.productSub, mouse action, keyboard action and keyboard key value, the encryption algorithm is DES symmetric encryption algorithm, which is encrypted using an agreed secret key.
3. The intelligent verification code method of claim 2, wherein, In step 2, according to the judgment rules, the following judgments are made in turn: Determine whether the value of window.navigator.webdriver is true, if yes, it is considered as a machine, otherwise it is considered as artificial; Determine whether the headless character is contained in the window.navigator.userAgent, if yes, it is considered as machine, otherwise it is considered as artificial; Determine the triggering of mouse action and keyboard action after entering the page, if yes, it is considered as artificial, otherwise it is considered as machine; the mouse action includes key pressing action, key lifting action and scroll wheel sliding action, and the keyboard action includes keyboard pressing action and keyboard lifting action; When the window.navigator.userAgent contains android, iphone, ipad characters or cannot be recognized, determine whether it is a touch screen device, the determination method is to create a touchEvent event, if it is successful, it is considered as a touch screen device, then it is considered as artificial, otherwise it is a non-touch screen device, and it is considered as machine; The operating system type information of the browser includes oscpu and platform, Determine whether the userAgent contains win when navigator.oscpu is win, if yes, it is considered as artificial, otherwise it is considered as machine; determine whether the userAgent contains linux when oscpu is linux, cros, if yes, it is considered as artificial, otherwise it is considered as machine; determine whether the userAgent contains one of mac, iphone or ipad when oscpu is mac, if yes, it is considered as artificial, otherwise it is considered as machine; Determine whether the userAgent contains win when platform contains win, if yes, it is considered as artificial, otherwise it is considered as machine; When platform is one of mac, ipad or iphone, determine whether the userAgent contains corresponding mac, iphone or ipad, if yes, it is considered as artificial, otherwise it is considered as machine; When platform is linux, determine whether the os is linux, if yes, it is considered as artificial, otherwise it is considered as machine; When platform is android, determine whether the os is android, if yes, it is considered as artificial, otherwise it is considered as machine; The compiled version number of the browser includes productSub, Determine whether navigator.productSub is 20030107 when the userAgent contains one of opera, opr, chrome, safari, if yes, it is considered as artificial, otherwise it is considered as machine; determine whether navigator.productSub is 20100101 when the userAgent contains firefox, if yes, it is considered as artificial, otherwise it is considered as machine.
4. The intelligent verification code method of claim 3, wherein, In step 3, the process of initializing the verification code includes initializing the picture, secretKey and token, the secretKey is used for the intelligent verification code SDK to encrypt and send the slider information to the verification code service platform; the token is used to uniquely identify this verification code SDK initialization request, and the token is stored in redis, which is used for subsequent checking of the picture gap position and trajectory man-machine verification to judge whether the request has been processed.
5. The intelligent verification code method of claim 4, wherein, In step 4, the slider information, the dragging coordinate trajectory of the slider is recorded as a two-dimensional array, the two-dimensional array is collected by the timer every 20ms to record the coordinates of the mouse or touch screen relative to the upper left corner of the page as the origin, and the judgment, cleaning and arrangement of the two-dimensional array specifically include: If the two-dimensional array is shorter than 0.1s, it is identified as a machine, and if the two-dimensional array is longer than 5s, it is truncated; The Euclidean distance of all adjacent items of the two-dimensional array is calculated, and then divided by the time interval 0.02s to obtain the average speed of each time interval, and a speed array in the sliding process is formed; The difference value of all adjacent items of the speed array is calculated, and then divided by the time interval 0.02s to obtain the acceleration array in the sliding process; Between each item of the two-dimensional array, the y-axis difference value / x-axis difference value is obtained to obtain the direction in each time interval, and a direction array is formed, and the y-axis difference value and the x-axis difference value both retain the sign; The speed array, acceleration array and direction array form a feature array.
6. The intelligent verification code method of claim 5, wherein: In step 5, the picture gap position is a coordinate position randomly selected when the slider picture of the verification code initialization request is verified, the AI prediction model adopts the machine learning svm classification algorithm, and is supervised and learned by using the feature array of the external source as the positive sample and the feature array generated by the machine script as the negative sample, the AI prediction model in the analysis and learning of the feature array includes: the proportion of negative values in the direction array, the frequency of positive and negative value transformation of the direction array, and the change trend of the numerical value of the acceleration array; When the gap coordinate position verification and the trajectory man-machine verification are passed, a secondary verification parameter key is returned to the SDK, which is used as a submission parameter for the business front-end page operation when the business back-end confirms that the verification code verification request is submitted, and the secondary verification parameter key needs to be stored in redis and cached for 3 minutes, after which the verification code is invalid.
7. The intelligent verification code method of claim 6, wherein, In step 6, the business front-end submits a form to the business back-end with the secondary verification parameter key in step 5, and the business back-end needs to call the verification code back-end service interface when receiving the key to verify the legality by judging whether the key exists in redis, if it exists, it means that the verification is legal, otherwise, the verification is not legal.
Citation Information
Patent Citations
Human-machine recognition method of CAPTCHA
CN108491714A
Method for realizing risk control rule configuration based on rule engine
CN113888050A