A method for automatically identifying abnormalities in QR codes
Through the method of generating probes and sending information, the bucket and needle structure is used to automatically identify the position of the QR code and judge the abnormal scanning behavior, which solves the problems of QR code abuse and safe area adjustment in QR code mobile payment, and realizes Highly accurate and automated security scanning area management.
Patent Information
- Application Number
- CN202410416903.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-04-08
AI Technical Summary
The existing technology has problems in QR code mobile payment, such as the QR code is abused in many places, the security area cannot be automatically adjusted after the QR code is moved, and the same device frequently scans the code to mislead the security area judgment.
Using the method of probe generation and information upload, new probes are generated through the embedded probe program, the device number and latitude and longitude information are recorded, and the communication message is encrypted and sent to the server. The server uses the bucket and needle structure to store the probes. Information, perform geo-fence interception, automatic identification of high-frequency code scanning anomalies and one code multi-location anomaly, and realize dynamic fault tolerance of safe code scanning areas.
The entire process is automated without manual intervention, which improves the accuracy of exception screening, avoids deviations in QR code position recognition and system errors, and ensures the security of QR codes and the normality of transactions.
Smart Images

Figure CN118014584B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of electronic payment and provides a method for automatically identifying abnormalities in a two-dimensional code. Background Art
[0002] Acquiring business is a legal and compliant financial business in the field of electronic payment in which buyers and sellers use software applications to conduct fund transactions. QR code acquiring is a common payment scenario in acquiring business. The principle is that the acquiring institution generates a payment QR code for the merchant. The payer uses an APP with a QR code scanning function to scan the merchant's payment QR code to open the merchant's checkout page, enter the payment amount on the page and select the payment method to complete the payment.
[0003] As a payment portal, the security of QR codes is particularly important. In order to avoid risks such as improper financial transactions and malicious attacks caused by QR codes being photographed and saved, remotely scanned, maliciously scanned, and abnormally shifted, and to ensure the authenticity, legality, and security of QR code acquiring services, the requirement to support the identification of abnormal scanning behaviors is proposed. By identifying abnormal scanning behaviors, risks of QR codes and merchants can be further reported and controlled.
[0004] One method is that when the acquiring institution generates a QR code for a merchant, it determines that the allowed scanning range of the QR code is consistent with the merchant's geographical business scope. That is, as long as the scanning end is within the merchant's permitted geographical business scope, it is regarded as a safe scanning behavior, which meets the general merchant's requirement of only conducting acquiring transactions within the province, city or district where they are located. The scanning behavior of the scanning end outside the merchant's geographical business scope is judged as abnormal scanning and the transaction is rejected.
[0005] One method is that when acquiring institutions generate QR codes for merchants, they set a precise geographic location for the QR code, that is, the longitude and latitude of the location where the QR code will be placed, and set a safe distance for the QR code to be scanned, that is, the distance between the scanner and the QR code. The circle with the QR code placement location as the center and the safe distance as the radius is the safe scanning range of the QR code. The payer scans the QR code and opens the merchant's cashier page. The page automatically obtains the longitude and latitude location information of the scanner and immediately sends it to the server. The server compares the distance between the scanner location and the longitude and latitude location of the QR code. Scanning behavior that exceeds the set safety range is judged as abnormal scanning and the transaction is rejected.
[0006] One method is that when acquiring institutions generate QR codes for merchants, they set a relative safety distance between multiple scanning terminals for the QR code, that is, the position distance between the scanning terminals that scan the same QR code twice in succession. When scanning the QR code to open the cashier page, the longitude and latitude location information of the scanned code is sent to the server, and the distance is compared with the longitude and latitude location information of the last scan of the QR code. If the location of the scanned QR code exceeds the pre-set safety distance range relative to the location of the last scan of the QR code, the current scan behavior is judged as abnormal scanning, the transaction is rejected, and the location of the current scan is not used as the basis for position verification for the next scan.
[0007] Although these existing methods can theoretically control the scanning of QR codes within a safe range and avoid problems such as improper financial transactions caused by QR codes being photographed and saved for remote scanning and abnormal code shifting, they all have the following defects and shortcomings in actual application scenarios.
[0008] 1. It is difficult to change the position of the QR code. The longitude and latitude location information and the safety range of the QR code are set by the acquiring institution when generating the QR code. The scanning of the QR code is limited to the recognized location range, and the QR code is allowed to move within a reasonable range, such as the change of transaction location of merchants in non-fixed business locations. These existing methods cannot realize normal transactions after the reasonable change of the QR code position. All of them need to notify the acquiring institution to update the position of the QR code to the new position before continuing the transaction. This increases the manpower maintenance of the QR code by the acquiring institution and the complex process of the merchant reporting the new location, resulting in the QR code cannot be easily changed in a reasonable and safe way.
[0009] 2. Frequent malicious scanning can easily lead to inaccurate anomaly detection. The latitude and longitude location information of the scanning end is immediately sent to the server from the application page opened after scanning the QR code. New location information will be sent for each scan. The server continuously accumulates the location information of each scanning end and incorporates it into the judgment basis of the safety range. If a single scanning end maliciously moves within the safety range and uses QR code photos for identification, or frequently submits new scanning locations to the server through software simulation, it will cause a large deviation between the safety range verified by the server and the location of the actual QR code, thereby affecting the normal QR code acquiring business. Summary of the invention
[0010] The purpose of the present invention is to solve the problems existing in QR code mobile payment that the QR code is abused in many places, the safety area cannot be automatically adjusted after the QR code is moved, and the frequent scanning of the same device misleads the safety area judgment.
[0011] In order to achieve the above-mentioned purpose, the present invention adopts the following technical means:
[0012] The present invention provides a method for automatically identifying abnormalities in a two-dimensional code, comprising the following steps:
[0013] Step 1: Probe generation and information upload. When the scanner scans the QR code and opens the page, the embedded probe program automatically generates a new probe, records the relevant information, and uploads it to the server.
[0014] Step 1.1: Scan the QR code on the scanner, and the probe program embedded in the page will generate a new probe before the page is opened;
[0015] Step 1.2: The new probe records the QR code number and collects the device number and longitude and latitude information of the current device;
[0016] Step 1.3: The probe encrypts the communication message composed of the probe number, longitude and latitude, QR code number, device number and current timestamp and sends it to the server.
[0017] Step 2: The needle bucket is referred to as a bucket. When the probe enters the bucket, the server receives the relevant information recorded by the probe and searches for the corresponding needle bucket. The target bucket and target layer are determined by comparing the longitude and latitude information. If the target bucket cannot be determined and the probe cannot be placed in any needle bucket, the server automatically creates a new needle bucket with the longitude and latitude position of the probe. The new needle bucket is referred to as a new bucket, and a corresponding time layer is created for the new bucket as the target layer. The probe is inserted into the target layer of the target bucket.
[0018] Step 2.1: The server parses the probe message, searches for all buckets whose "bucket ownership" is the corresponding QR code pointed to by the probe, and obtains the current bucket sequence table of the QR code;
[0019] Step 2.2: The server compares the longitude and latitude location information of the probe with the bucket sequence table, takes out the new bucket with the closest longitude and latitude, and marks it as a candidate bucket. If there is no candidate bucket, proceed to step 2.5;
[0020] Step 2.3: Calculate the distance between the probe position and the candidate bucket, and compare it with the radius of the safe scanning area of the candidate bucket;
[0021] Step 2.4: If the distance is less than the radius of the candidate bucket, the candidate bucket is upgraded to the target bucket and step 2.6 is executed. If the distance is greater than the radius of the candidate bucket security scanning area, step 2.5 is executed.
[0022] Step 2.5: The server creates a new bucket. The center of the new bucket is the latitude and longitude of the probe. The radius of the safe code scanning area defaults to 10 meters. The number of time layers is one, and the layer time is the number of "hours" of the probe timestamp. The bucket belongs to the QR code number of the probe. The new bucket is marked as a candidate bucket and step 2.6 is executed;
[0023] Step 2.6: Find the time layer from the target bucket that has the same number of hours as the probe timestamp.
[0024] If a time layer is found, mark the time layer as the target layer of the target bucket and execute step 2.7.
[0025] If no time layer is found, a new time layer is created based on the existing one of the target bucket and marked as the target layer of the target bucket;
[0026] Step 2.7: Insert the probe into the target layer of the target bucket.
[0027] Step 3: Identification of abnormal scanning behaviors, including automatic identification methods for geographical over-limit anomalies, high-frequency scanning anomalies, and one code being used in multiple locations.
[0028] Step 3.1: The server intercepts the probe with a geo-fence to determine whether the probe is within the geo-fence of the merchant.
[0029] Step 3.1.1: The server defines a geographic fence based on the merchant’s business scope;
[0030] Step 3.1.2: The server converts the probe's latitude and longitude information into a specific geographic location to determine whether it is within the geographic fence;
[0031] Step 3.1.3: If the probe is within the geo-fence, it is marked as a normal probe and the scanning behavior meets the requirements; if it is outside the geo-fence, it is marked as an abnormal probe of the area limit type and the scanning behavior does not meet the requirements. The server returns an abnormal response;
[0032] Step 3.1.4: After receiving the abnormal response, the scanner stops all operations and closes the page.
[0033] Step 3.2: The server selects the target bucket and the target layer of the target bucket by the QR code number and the probe position, and determines whether there is a probe with the same device number in the target layer to identify high-frequency code scanning anomalies;
[0034] Step 3.2.1: The server selects the target bucket by QR code number and probe location, and selects the target layer according to the scanning time;
[0035] Step 3.2.2: Determine whether the current probe has the same device number in the target layer. If not, store it in the target layer and mark it as normal, and mark the code scanning behavior as normal; if yes, store it in the target layer and mark it as "high-frequency abnormal probe", and mark the code scanning behavior as suspicious;
[0036] Step 3.2.3: If there are more than 10 "high-frequency abnormal probes" with the same device number in the target layer, the server will no longer accept the device probe and return an abnormal response to the scanner;
[0037] Step 3.2.4: After receiving the abnormal response, the scanner stops all operations and closes the page.
[0038] Step 3.3: The server periodically scores the needle barrels and identifies the anomalies of using the same code in multiple locations based on the scores.
[0039] Step 3.3.1: The server performs regular scoring on the needle bucket to obtain a needle bucket score table;
[0040] Step 3.3.1.1, the server retrieves the probe data of all needle barrels of the previous hour every hour;
[0041] Step 3.3.1.2, sort these probes by time;
[0042] Step 3.3.1.3, calculate the proportion of probes in each needle bucket in order to obtain the score of the needle bucket in the current period;
[0043] Step 3.3.1.4: If the same barrel number appears multiple times in the same batch, the registration with the highest score will be awarded;
[0044] Step 3.3.1.5, generate the needle bucket score table.
[0045] Step 3.3.2: Based on the needle bucket score table, identify abnormal scanning behaviors of using the same code in multiple locations;
[0046] Step 3.3.2.1: Collect the scores of each needle bucket in the last three hours;
[0047] Step 3.3.2.2: Determine whether the needle barrel score is above 90 points;
[0048] Step 3.3.2.3: The needle barrels that do not reach 90 points are marked as "split-type abnormal needle barrels".
[0049] Step 3.3.3: Respond to the identified abnormal behavior and prevent illegal scanning;
[0050] Step 3.3.3.1: The server detects the probe data of "split abnormal needle barrel";
[0051] Step 3.3.3.2: Mark the corresponding probe as “splitting abnormal probe”;
[0052] Step 3.3.3.3: Send a response of "scanning behavior detection abnormality" to the code scanning end;
[0053] Step 3.3.3.4: After receiving the abnormal response, the scanner stops the page operation and closes the page.
[0054] Step 4: Dynamic fault tolerance of the security scan area. When the security scan area of the new bucket created in step 2 overlaps with the security scan area of the existing bucket, the server performs a merge operation on the two buckets to generate a new bucket with a larger security scan area to cover the original two security scan areas, thereby dynamically adjusting the range of the security scan area.
[0055] Step 4.1: Calculate the distance between the center of the security code scanning area of the new bucket created in step 2 and the center of the security code scanning area of the candidate bucket;
[0056] Step 4.2: Determine whether the distance obtained in step 4.1 is greater than or equal to the sum of the radius of the safe code scanning area of the two buckets; if the result is yes, the new bucket is successfully created and the process ends; if the result is no, the new bucket is merged with the candidate bucket and step 4.3 is performed;
[0057] Step 4.3: Perform the bucket fusion operation and calculate the center point of the distance between the centers of the two buckets’ security code scanning areas as the center position of the new bucket’s security code scanning area.
[0058] The radius of the new bucket's security code scanning area is the sum of half the distance between the centers of the two buckets' security code scanning areas and the radius of the candidate bucket's security code scanning area.
[0059] Step 4.4: Create a new bucket with a larger safe code scanning area based on the center position of the safe code scanning area of the new bucket obtained in step 4.3 and the radius of the safe code scanning area, and merge the probes in the two buckets into the new bucket.
[0060] In the above scheme, a bucket is a data structure used by the server to store probe information. It has location and time attributes and is used to represent the aggregation of scan points within a period of time. The bucket is used to store and manage probe information related to a specific QR code.
[0061] Buckets are automatically generated on the server side. Based on the latitude and longitude location information of the probe, the server side determines which bucket to store the probe into. Buckets are divided into different time layers. The storage area of each time layer stores all probes within the corresponding hour. The bucket has a bucket number as a unique identification number and is associated with a specific QR code number. The QR code number indicates the ownership of the bucket.
[0062] Because the present invention adopts the above technical means, it has the following beneficial effects:
[0063] 1. The whole process is automated without manual intervention. The barrel and needle structure eliminates the need for manual position management of the QR code. Whether the QR code moves normally or the safe scanning area needs to be expanded or adjusted, the actual position of the current QR code can be automatically obtained by scanning and calculating the probe in the needle barrel, and abnormal scanning behavior can be automatically intercepted. When a system error occurs, the scanning safety area can be dynamically expanded through the automatic fusion of the barrel. The whole process can be achieved without stopping the service or manually adjusting any system parameters.
[0064] 2. The accuracy of abnormal identification is higher, and the data analysis results are closer to reality. The server registers the scanning device that scans the QR code, limits the number of scanning devices in the same period, and effectively intercepts high-frequency scanning of the same scanning end to avoid malicious scanning causing the server to deviate greatly from the QR code position. At the same time, the safe scanning area has the ability to dynamically expand, and the system error caused by the scanning position collection can be automatically expanded and adjusted in a targeted manner to avoid abnormal misjudgment when the actual scanning position is close but the position is distorted due to the error interception. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A geographic over-limit anomaly identification workflow in one possible embodiment;
[0066] Figure 2 A high-frequency code scanning anomaly identification workflow in a possible embodiment;
[0067] Figure 3 This is a one-code-multiple-location-multiple-use exception identification workflow in a possible embodiment. DETAILED DESCRIPTION
[0068] The following is a detailed description of the embodiments of the present invention. Although the present invention will be described and illustrated in conjunction with some specific embodiments, it should be noted that the present invention is not limited to these embodiments. On the contrary, modifications or equivalent substitutions made to the present invention should all be included in the scope of the claims of the present invention.
[0069] In addition, in order to better illustrate the present invention, numerous specific details are given in the following specific embodiments. It will be understood by those skilled in the art that the present invention can also be implemented without these specific details.
[0070] The present invention solves the above-mentioned shortcomings and achieves the following three purposes:
[0071] 1. Overcome the problem of illegal fund transactions caused by multiple uses of QR codes in multiple places. When the scanner scans the QR code to open the cashier page, the page automatically sends the longitude and latitude location information of the scanner. The server collects the location information sent by the scanner each time, and automatically manages the scanners with similar locations in a unified manner, that is, the safe scanning area. Every time a new scanner scans the code, it is determined whether it is in the safe scanning area based on the sent location information. If it is, it will also be included in the unified management and regarded as a safe scanning behavior; if not, it will be managed separately. All scanners that are not included in the unified management are regarded as abnormal scanning behaviors, ensuring that the QR code has only one safe scanning area at the same time, and preventing the QR code from being photographed or maliciously scanned remotely, resulting in the QR code being used in multiple places.
[0072] 2. Overcome the problem that the acquiring transaction cannot be carried out normally after the QR code is transferred within the permitted range, and the acquiring institution must be notified in advance to change the new location information of the QR code, resulting in the QR code not being able to change its position conveniently. Due to the needs of the actual scenario, after the QR code is moved to another new location, the scanner scans the QR code and sends the new location information. The server automatically continues to uniformly manage the scanners near the location at the new location. As the number of scanners at the new location continues to accumulate, the area is automatically upgraded to a safe scanning area during the current time period. The scanning behavior of the scanner in this area is regarded as safe scanning behavior, achieving the purpose of automatically switching the safe scanning position, ensuring that the QR code can still meet normal transactions after a reasonable transfer.
[0073] 3. Overcome the problem that the QR code is frequently scanned by the same device in the same time period and the location information of the scanner is sent multiple times, which misleads the server to judge the safe scanning area. When the scanner scans the QR code to open the page, in addition to sending the longitude and latitude location information, it also sends the current scanning timestamp and the scanner device number to the server. The server automatically merges the same scanning location of the same device number in the same time period into one, without multiple accumulation, to avoid the scanner maliciously sending location information to cause the server to misjudge the safe scanning area, to ensure the authenticity and effectiveness of the scanner's scanning of the QR code, and to ensure the authenticity and effectiveness of the safe scanning area.
[0074] 1. Overall structure. The core of the present invention includes the following concepts:
[0075] Probe: A device embedded in the code scanning end page that can accurately obtain the current code scanning location information and is used to represent the code scanning point information;
[0076] Geographical fence: The maximum allowed scanning range of a QR code. Geographical fences of different ranges are set for the QR code according to the business scope of the merchant to which the QR code belongs;
[0077] Safe scanning area: The area within a certain safe distance from the QR code and centered on the location where the QR code is placed is the safe scanning area. Scanning within the safe scanning area is considered normal scanning;
[0078] Probe bucket: The server uses a data structure named "bucket" to store probe information. It has attributes such as location and time, and is used to represent the aggregation of scanned points over a period of time.
[0079] Probe bucketing: The server stores the probe into the bucket according to the rules.
[0080] 2. Barrel and needle structure
[0081] The probe is embedded in the page that opens after the scanner scans the QR code. According to the legal business scope requirements of the merchant to which the QR code belongs, the QR code acquiring business can only be carried out in the merchant's business area. The probe represents the scanning point where the scanner APP scans the QR code. Therefore, the probe can only be used within the geographic fence of the QR code. Geographical fences are divided into standard fences and custom fences according to different setting methods. Standard fences use administrative divisions to set geographic fences, while custom fences use latitude and longitude to set geographic fences.
[0082] Standard fences are divided into the following types:
[0083] Provincial fence: The probe is used within the specified province and is prohibited from being used outside the set provincial geographical scope;
[0084] City fence: The probe is used within the designated city and is prohibited from being used outside the set city's geographical scope;
[0085] Regional fence: The probe is used within the designated district / county and is prohibited from being used outside the set district / county geographical scope;
[0086] Custom fences are divided into the following types:
[0087] Circular fence: Customize the center longitude and latitude and radius of the circle. Use outside the circle is prohibited.
[0088] Polygon fence: Customize the longitude and latitude of each vertex of the polygon. It is forbidden to use it outside the set polygon range.
[0089] The probe has the ability to obtain the information of the current scanning end in real time and send it to the server. The information sent by the probe is as follows:
[0090] Probe number: the unique identification number of the current probe, used to distinguish the uniqueness;
[0091] Latitude and longitude: The current latitude and longitude location information of the probe, accurate to 6 decimal places;
[0092] Timestamp: current specific timestamp, accurate to seconds;
[0093] Device number: the unique identification number of the device currently scanning the code;
[0094] QR code number: the QR code number being scanned by the scanner;
[0095] Here are some examples:
[0096]
[0097] Probe bucket structure: The "probe bucket" is a special data structure designed in this solution, which is used to store the probe information sent by the code scanning end. The probe bucket is automatically generated on the server side. The probe bucket structure consists of a "safe code scanning area" and a "time layer".
[0098] The safety code scanning area of the needle barrel is a standard circle. The longitude and latitude of the center of the safety code scanning area represent the position of the needle barrel. Whether a probe can be stored in the needle barrel is determined by the distance between the longitude and latitude of the probe and the longitude and latitude of the center of the safety code scanning area. If the distance between the two is less than the radius of the safety code scanning area, the probe can be stored in the needle barrel.
[0099] The time layer of the needle bucket divides the needle bucket into multiple different storage areas according to the time unit. The time unit is hour (h). Each storage area stores all probes in the corresponding hour. If there is no probe in the hour, there is no need to create the time layer of the hour. The first layer of the needle bucket is the bucket creation time of the bucket. Each layer of the bucket records the layer creation time of the layer, and the layer creation time is accurate to the hour.
[0100] The needle barrel has the following property information:
[0101] Barrel number: unique identification number of the needle barrel;
[0102] Bucket ownership: QR code number. A bucket only stores probes with the same QR code number.
[0103] Safety code scanning area: a circular area within a certain distance from the longitude and latitude specified when the bucket is created. This distance is the radius of the safety code scanning area.
[0104] Barrel position: The current latitude and longitude position information of the needle barrel, accurate to 6 decimal places, takes the latitude and longitude position of the center of the safe code scanning area;
[0105] Bucket creation time: The creation time of the first layer of the bucket is the bucket creation time;
[0106] Layer time: the time when each layer in the bucket was built, accurate to the hour. The layer time of the first layer in the bucket is the same as the bucket building time.
[0107] Here are some examples:
[0108]
[0109] Bucket position sequence: The size of the safe scanning area of the needle barrel is limited. After a needle barrel is created, its position is fixed and cannot be moved, while the QR code can be reasonably changed within the set geographic fence. Therefore, the normal scanning area of the scanner may shift with the change of the QR code position. Therefore, a QR code may correspond to multiple needle barrels in different positions to store all probes that scan the QR code. After the server receives the information of a probe that scans the QR code, in order to quickly locate and find the bucket that can currently store the probe, the server sorts the bucket positions based on the different geographical locations of multiple buckets and generates a bucket position sequence table for the QR code.
[0110] The bucket position sorting method is to sort in order of the longitude and latitude of each bucket position, first sorting by longitude from small to large, and then sorting by latitude from small to large. The final result is two sorting sequences. As the number of needle buckets increases, the sequence in the bucket position sequence table also changes dynamically.
[0111] An example of a bucket sequence table is as follows:
[0112]
[0113] 3. Working principle of using barrel and needle structure to record code scanning behavior
[0114] Working principle of the probe:
[0115] When the acquiring institution generates a QR code for a merchant, in addition to generating a QR code number, it must also set up a geographic fence on the server side for the merchant to conduct QR code acquiring business based on the merchant's legal business scope, that is, the maximum allowable scanning range within which the scanner is allowed to scan the merchant's QR code.
[0116] The scanning application software APP turns on the scan function. When the QR code is scanned to open the page, the probe program embedded in the page will automatically generate a new probe based on the QR code being scanned before the page is opened. The new probe has a unique probe number. The probe immediately records the QR code number of the QR code, automatically collects the device number of the current device and the latitude and longitude information of the current location, and encrypts the communication message composed of the probe number, longitude and latitude, QR code number, device number and current timestamp and sends it to the server.
[0117] Working principle of probe into barrel:
[0118] The server receives the probe message, decrypts the message to obtain the probe information, and registers the probe according to the following steps:
[0119] Step 1: Find all buckets whose "bucket belonging" is the corresponding QR code pointed to by the probe, and obtain the current bucket position sequence table of the QR code;
[0120] Step 2: The longitude and latitude position information of the probe is compared with the longitude sequence and latitude sequence in the bucket sequence table of step 1 by comparing the size, and the bucket with the closest longitude and latitude is taken out and marked as a candidate bucket;
[0121] Step 3: Calculate the distance between the probe position and the candidate bucket obtained in step 2, and compare the distance with the radius of the safe scanning area of the candidate bucket. If the distance is less than the radius of the candidate bucket, the candidate bucket is upgraded to the target bucket.
[0122] Step 4: Find the time layer with the same “hour” number as the probe timestamp from the target bucket in step 3, and mark it as the target layer of the target bucket;
[0123] Step 5: insert the probe into the target layer of the target barrel;
[0124] Automatic bucket and layer creation:
[0125] Bucket creation: If there is no candidate bucket in step 2 above or the distance between the probe position and the candidate bucket in step 3 is greater than the radius of the candidate bucket security code scanning area, it means that the probe cannot be placed in any bucket. The server automatically creates a new bucket with the latitude and longitude of the probe. The latitude and longitude of the probe is the center of the security code scanning area. The radius of the new bucket is 10 meters by default. The number of time layers is one layer. The layer time of this layer is the number of "hours" of the probe timestamp. The bucket belongs to the QR code number of the probe. The new bucket is marked as a candidate bucket and step 4 is continued.
[0126] Layer creation: If there is no time layer with the same "hour" number as the probe timestamp in the target bucket in step 4 above, a new time layer is automatically created based on the existing target bucket. The layer time is the "hour" number of the probe timestamp. The new layer is marked as the target layer, and step 5 is continued;
[0127] 4. Methods for Automatically Identifying Abnormal Scanning Behaviors
[0128] Automatic identification method of geographic over-limit anomaly:
[0129] Before the acquiring institution generates a QR code for payment for a merchant, it will set up a geographical fence for the merchant to conduct QR code acquiring business on the server side based on the merchant's legal business scope. The scanning APP scans the QR code to open the page, and the probe program embedded in the page automatically generates a new probe immediately.
[0130] After the probe automatically obtains the latitude and longitude location information of the current code scanning terminal, it sends the information to the server as required. The server performs geo-fencing interception on the probe as follows: Figure 1 shown.
[0131] Figure 1This is the workflow for automatic identification of geographic over-limit anomalies. After receiving the message information, the server parses and obtains the probe data. It is further divided into the following two situations according to the type of geographic fence set by the merchant's business scope:
[0132] Geofence is a standard fence
[0133] Automatic interception is carried out according to the administrative division scope. The server defines the administrative district that meets the requirements according to the merchant's specific business scope, that is, the geographical fence. For example, if the merchant's legal business scope is within the entire city of Chengdu, Sichuan Province, then the maximum limited scope for the merchant to carry out QR code acquiring business is "Chengdu".
[0134] The server converts the latitude and longitude location information of the probe into detailed information of specific provinces, cities and districts and specific geographical locations through the reverse address resolution method of the map tool, and determines whether the administrative district where the probe is currently located is within the business geographical fence of the merchant. If it is within the specified administrative district, the probe will be marked as a normal probe, and the scanning behavior of the code scanning end meets the geographical range requirements; if it exceeds the specified administrative district, the probe will be marked as an "area-limited abnormal probe", and the scanning behavior of the code scanning end does not meet the geographical range requirements. The server will no longer continue to execute and directly return to the scanning end "scanning behavior detection abnormality". After receiving the abnormal response information, the code scanning end will immediately stop all page operations and force the page to be automatically closed to avoid illegal intrusion of gray transactions.
[0135] Geofencing is a custom fence
[0136] In some special cases, the scope of a merchant's QR code business is not implemented according to administrative divisions, and needs to be customized in accordance with regulatory requirements. According to the customized parameters, the server defines a closed geographical range based on the geographic location, namely, a geographical fence. Depending on the set parameters, it is divided into circular fences and polygonal fences. The closed range is the maximum limited range for the merchant to conduct QR code acquiring business.
[0137] The server determines whether the latitude and longitude location information of the probe is within the range of the geographic fence. If it is within the custom range, the probe will be marked as a normal probe, and the scanning behavior of the scanner meets the geographic range requirements; if it exceeds the specified allowable range, the probe will be marked as an "area-limited abnormal probe", and the scanning behavior of the scanner does not meet the geographic range requirements. The server will no longer continue to execute and directly return to the "scanning behavior detection abnormality" to the scanner. After receiving the abnormal response information, the scanner will immediately stop all page operations and force the page to be automatically closed to avoid illegal intrusion by gray transactions.
[0138] Automatic identification method for high-frequency code scanning anomalies:
[0139] The scanner scans the QR code to open the page, and the probe program embedded in the page immediately generates a new probe. The probe automatically collects the latitude and longitude location information of the current scanner location, the current timestamp, the current scanner device number, and the number of the currently scanned QR code and sends them to the server. The server performs high-frequency scanning anomaly recognition on the probe. Figure 2 shown.
[0140] Figure 2 That is the workflow of automatic identification of high-frequency scanning anomalies. The server automatically selects the target bucket through the QR code number and the probe position, and then selects the target layer from the target bucket according to the current scanning time. From the many probes that already exist in the target layer, it is determined whether there is a probe with the same device number as the current probe. If not, the probe is stored in the target layer and marked as a normal probe, and the scanning behavior of the scanning end is marked as normal; if it already exists, the probe is stored in the target layer and marked as a "high-frequency abnormal probe", and the scanning behavior of the scanning end is marked as suspicious.
[0141] As the number of scans by the same device at the same time increases, if the number of "high-frequency abnormal probes" of the same device number in the target layer continues to accumulate to more than 10, the server will no longer accept the probes of the device and directly return the "scanning behavior detection abnormality" to the scanner. After receiving the abnormal response information, the scanner will immediately stop all page operations and force the page to close automatically to prevent the QR code from being attacked by malicious high-frequency scanning.
[0142] One code for multiple locations and multiple uses automatic identification method:
[0143] The server has the ability to regularly score the pin barrels. Every hour, the server automatically scores all the pin barrels of the previous hour. Based on the scoring results, it can automatically switch the QR code position and identify abnormal scanning behaviors such as using one code in multiple locations.
[0144] The scoring method and rules are as follows:
[0145] 1. For all needle barrels with the same QR code, take out all the probes in all layers corresponding to the previous hour, and arrange them in order from small to large in time;
[0146] 2. Traverse the ordered sequence from the beginning to the end of the column, count the adjacent probes with the same bucket number, and the percentage of the number of probes in the total number of probes in the batch is the score of the bucket in the current period;
[0147] 3. If the same barrel number appears multiple times in the same batch, the registration with the highest score will be awarded;
[0148] An example of a scoring table is as follows:
[0149]
[0150] According to the above table: At 12:00 on 2024.02.26, Bucket 1 scored 44.5 points, Bucket 2 scored 2.5 points, and Bucket 3 scored 20.5 points.
[0151] The server-side method for identifying anomalies of one code for multiple locations is as follows: Figure 3 shown.
[0152] According to the scores of each bucket in the last three hours, the transfer of the high-score bucket represents the normal transfer of the QR code position, while the bucket that has not reached more than 90 points in the last three hours is marked as the "splitting type abnormal needle bucket". If the probe sent by the subsequent scanner is placed in the "splitting type abnormal needle bucket" by the server again, the server will mark the probe as a "splitting type abnormal probe" and directly return the "scanning behavior detection abnormality" to the scanner. After receiving the abnormal response information, the scanner will immediately stop all page operations and force the page to be automatically closed to avoid the QR code being stolen or maliciously misappropriated and causing illegal gray transactions.
[0153] 5. Dynamic fault tolerance method for safe code scanning area
[0154] Two or more needle barrels may have overlapping safe scanning areas in terms of geographical location. In addition, there may be special situations where the barrels are close to each other, the probes in the barrels are all normal probes, and the scanning behaviors are all normal. Such special situations exist mainly due to the following reasons:
[0155] Due to technical reasons, the latitude and longitude information obtained by the probe is not accurate enough, resulting in a slight error in the latitude and longitude of the probe in normal code scanning behavior. The server determines that the probe is outside the safe code scanning area and the transaction is intercepted by mistake;
[0156] For some specially customized QR codes, the radius of the preset safe scanning area of the needle barrel is too small, resulting in normal scanning at a slightly longer distance being intercepted outside the safe scanning area;
[0157] Based on the above system errors caused by non-malicious human factors, this solution proposes a fault-tolerant technology that supports dynamic adjustment of the range size of the security scanning area. The specific method is as follows:
[0158] According to the automatic bucket creation method, if the distance between the probe position and the candidate bucket is greater than the radius of the candidate bucket's security code scanning area, it means that the probe cannot be placed in any bucket. The server automatically creates a new bucket with the probe's latitude and longitude. When creating a new bucket, the server automatically calculates the distance between the center of the new bucket's security code scanning area and the center of the candidate bucket's security code scanning area. Based on this distance, the server automatically performs the following operations:
[0159] 1. If the distance is greater than or equal to the sum of the safety code scanning area radii of the two buckets, the new bucket is successfully created;
[0160] 2. If the distance is less than the sum of the safety scanning area radii of the two buckets, the new bucket is automatically merged with the candidate bucket to generate a new bucket. The bucket fusion method is as follows: the center point of the distance between the centers of the safety scanning areas of the two buckets is used as the center position of the safety scanning area of the new bucket, and the sum of half of the distance between the centers of the safety scanning areas of the two buckets plus the radius of the safety scanning area of the candidate bucket is used as the radius of the safety scanning area of the new bucket. A new bucket is established, and the probes in the two buckets are also merged and stored in the new bucket;
[0161] By automatically merging the overlapping buckets in the safe scanning area, system errors caused by non-malicious human factors can be resolved. At the same time, the dynamic adjustment range of the safe scanning area is expanded, and the fault tolerance is stronger, avoiding false alarms of normal scanning behaviors, making the system abnormality identification more accurate, true, and reliable.
[0162] The key points of the present invention include:
[0163] 1. A special barrel and needle structure is designed to represent the relationship between the QR code and the scanner. The specific location of the QR code is no longer fixed by the server in advance, but a probe is used to identify a scanning behavior. The barrel position sequence table is used to realize the fast, efficient and accurate collection and storage of the probe by the needle barrel, which well expresses the relationship between the QR code position and the scanner position in each QR code scanning behavior. Then, by marking different types of abnormalities of the needle barrel and probe, abnormal scanning behavior can be dynamically sensed and targeted interception can be carried out, avoiding tedious problems such as the failure to scan the code due to manual position change in advance after the QR code is normally shifted.
[0164] 2. The time dimension is added to limit the abnormal judgment of the scanning behavior in the current time period. The abnormal judgment of the QR code scanning behavior is immediate. Whether it is remote code shifting, malicious high-frequency attacks or multiple uses of one code, it is only of reference significance to the scanning behavior in the current time period. The normal or abnormal historical full-volume scanning behavior cannot be used as the current judgment standard. By dynamically adding multiple time layers to the needle barrel to store probes by time, it is possible to automatically distinguish the scanning operation according to different time periods, thereby improving the accuracy, authenticity and immediacy of the QR code position in different time periods.
[0165] 3. Added a high-frequency scanning attack identification mechanism on the scanner side. By adding a probe to automatically identify and send the current device number, the server will merge the scanning behaviors of the same device in the same period of time with the same QR code and mark them as abnormal, so that a single scanning device cannot maliciously scan the same QR code with high frequency at the same time, avoiding the server's effective judgment of the current real position of the QR code affected by high-frequency scanning.
[0166] A dynamic fault-tolerance mechanism has been added to the safe code scanning area. The needle barrels with overlapping positions have the ability to automatically merge, and can be automatically merged according to the actual needs of the QR code scanning scene, realizing the automatic expansion of the code scanning safety area, improving the system's fault tolerance, and preventing normal code scanning behavior from being misjudged as abnormal code scanning behavior due to system errors.
Claims
1. A method for automatically identifying abnormalities in a two-dimensional code, characterized in that: The following steps are involved: Step 1: Probe generation and information upload. When the scanner scans the QR code and opens the page, the embedded probe program automatically generates a new probe, records the relevant information, and uploads it to the server. Step 2: The needle bucket is referred to as a bucket. When the probe enters the bucket, the server receives the relevant information recorded by the probe and searches for the corresponding needle bucket. The target bucket and target layer are determined by comparing the longitude and latitude information. If the target bucket cannot be determined and the probe cannot be placed in any needle bucket, the server automatically creates a new needle bucket with the longitude and latitude position of the probe. The new needle bucket is referred to as a new bucket, and a corresponding time layer is created for the new bucket as the target layer. The probe is inserted into the target layer of the target bucket. Step 2 includes the following steps: Step 2.1: The server parses the probe message, searches for all buckets whose "bucket ownership" is the corresponding QR code pointed to by the probe, and obtains the current bucket sequence table of the QR code; Step 2.2: The server compares the longitude and latitude location information of the probe with the bucket sequence table, takes out the new bucket with the closest longitude and latitude, and marks it as a candidate bucket. If there is no candidate bucket, proceed to step 2.5; Step 2.3: Calculate the distance between the probe position and the candidate bucket, and compare it with the radius of the safe scanning area of the candidate bucket; Step 2.4: If the distance is less than the radius of the candidate bucket, the candidate bucket is upgraded to the target bucket and step 2.6 is executed. If the distance is greater than the radius of the candidate bucket security scanning area, step 2.5 is executed. Step 2.5: The server creates a new bucket. The center of the new bucket is the latitude and longitude of the probe. The radius of the safe code scanning area defaults to 10 meters. The number of time layers is one, and the layer time is the "hour" number of the probe timestamp. The bucket belongs to the QR code number of the probe. The new bucket is marked as a candidate bucket and step 2.6 is executed; Step 2.6: Find the time layer from the target bucket that has the same number of "hours" as the probe timestamp, If a time layer is found, mark the time layer as the target layer of the target bucket and execute step 2.
7. If no time layer is found, a new time layer is created based on the existing one of the target bucket and marked as the target layer of the target bucket; Step 2.7: insert the probe into the target layer of the target barrel; Step 3: Identification of abnormal scanning behaviors, including automatic identification methods for geographical over-limit anomalies, high-frequency scanning anomalies, and one code used in multiple locations; Step 3.1: The server intercepts the probe with a geo-fence to determine whether the probe is within the geo-fence of the merchant. Step 3.2: The server selects the target bucket and the target layer of the target bucket by the QR code number and the probe position, and determines whether there is a probe with the same device number in the target layer to identify high-frequency code scanning anomalies; Step 3.3: The server periodically scores the needle barrels and identifies the anomalies of using the same code in multiple locations based on the scores; Step 3.3.1: The server performs regular scoring on the needle bucket to obtain a needle bucket score table; Step 3.3.1.1, the server retrieves the probe data of all needle barrels of the previous hour every hour; Step 3.3.1.2, sort the probe data by time; Step 3.3.1.3, calculate the proportion of probes in each needle bucket in order to obtain the score of the needle bucket in the current period; Step 3.3.1.4: If the same barrel number appears multiple times in the same batch, the registration with the highest score will be awarded; Step 3.3.1.5, generate a needle bucket score table; Step 3.3.2: Based on the pin bucket score table, identify abnormal scanning behaviors of using the same code in multiple locations; Step 3.3.2.1: Collect the scores of each needle bucket in the last three hours; Step 3.3.2.2: Determine whether the needle barrel score is above 90 points; Step 3.3.2.3: Mark the needle barrels that do not reach 90 points as "split abnormal needle barrels"; Step 3.3.3: Respond to the identified abnormal behavior and prevent illegal scanning; Step 3.3.3.1: The server detects the probe data of "split abnormal needle barrel"; Step 3.3.3.2: Mark the corresponding probe as "splitting abnormal probe"; Step 3.3.3.3: Send a "scanning behavior detection abnormality" response to the code scanning end; Step 3.3.3.4: After receiving the abnormal response, the scanner stops the page operation and closes the page; The scoring method and rules are as follows: For all needle barrels with the same QR code, take out all the probes in all layers corresponding to the previous hour, and arrange them in order from small to large in time; Traverse the ordered sequence from the beginning to the end of the column, count the adjacent probes with the same bucket number, and the percentage of the number of probes in the total number of probes in the batch is the score of the bucket in the current period; If the same barrel number appears more than once in the same batch, the registration with the highest score will be scored; Step 4: Dynamic fault tolerance of the security scan area. When the security scan area of the new bucket created in step 2 overlaps with the security scan area of the existing bucket, the server performs a merge operation on the two buckets to generate a new bucket with a larger security scan area to cover the original two security scan areas, thereby dynamically adjusting the range of the security scan area. Step 4 includes the following steps: Step 4.1: Calculate the distance between the center of the security code scanning area of the new bucket created in step 2 and the center of the security code scanning area of the candidate bucket; Step 4.2: Determine whether the distance obtained in step 4.1 is greater than or equal to the sum of the radius of the safe code scanning area of the two buckets; if the result is yes, the new bucket is successfully created and the process ends; if the result is no, the new bucket is merged with the candidate bucket and step 4.3 is performed; Step 4.3: Perform the bucket fusion operation and calculate the center point of the distance between the centers of the two buckets’ security code scanning areas as the center position of the new bucket’s security code scanning area; The radius of the new bucket's security code scanning area is the sum of half the distance between the centers of the two buckets' security code scanning areas and the radius of the candidate bucket's security code scanning area. Step 4.4: Create a new bucket with a larger safe code scanning area based on the center position of the safe code scanning area of the new bucket obtained in step 4.3 and the radius of the safe code scanning area, and merge the probes in the two buckets into the new bucket.
2. The method for automatically identifying abnormalities in a two-dimensional code according to claim 1, characterized in that: Step 1 includes the following steps: Step 1.1: Scan the QR code on the scanner, and the probe program embedded in the page will generate a new probe before the page is opened; Step 1.2: The new probe records the QR code number and collects the device number and longitude and latitude information of the current device; Step 1.3: The probe encrypts the communication message composed of the probe number, longitude and latitude, QR code number, device number and current timestamp and sends it to the server.
3. The method for automatically identifying abnormalities in a two-dimensional code according to claim 1, characterized in that: Step 3.1 includes the following steps: Step 3.1.1: The server defines a geographic fence based on the merchant’s business scope; Step 3.1.2: The server converts the probe's latitude and longitude information into a specific geographic location to determine whether it is within the geographic fence; Step 3.1.3: If the probe is within the geo-fence, it is marked as a normal probe and the scanning behavior meets the requirements; if it is outside the geo-fence, it is marked as an abnormal probe of the area limit type and the scanning behavior does not meet the requirements. The server returns an abnormal response; Step 3.1.4: After receiving the abnormal response, the scanner stops all operations and closes the page.
4. The method for automatically identifying abnormalities in a two-dimensional code according to claim 1, characterized in that: Step 3.2 includes the following steps: Step 3.2.1: The server selects the target bucket by QR code number and probe location, and selects the target layer according to the scanning time; Step 3.2.2: Determine whether the current probe has the same device number in the target layer. If not, store it in the target layer and mark it as normal, and mark the code scanning behavior as normal; if yes, store it in the target layer and mark it as "high-frequency abnormal probe", and mark the code scanning behavior as suspicious; Step 3.2.3: If there are more than 10 "high-frequency abnormal probes" with the same device number in the target layer, the server will no longer accept the device probe and return an abnormal response to the scanner; Step 3.2.4: After receiving the abnormal response, the scanner stops all operations and closes the page.
5. The method for automatically identifying abnormalities in a two-dimensional code according to claim 1, characterized in that: Bucket is a data structure used by the server to store probe information. It has location and time attributes and is used to represent the aggregation of scan points over a period of time. Buckets are used to store and manage probe information related to QR codes. Buckets are automatically generated on the server side. Based on the latitude and longitude location information of the probe, the server side determines which bucket to store the probe into. Buckets are divided into different time layers. The storage area of each time layer stores all probes within the corresponding hour. The bucket has a bucket number as a unique identification number and is associated with the QR code number. The QR code number indicates the ownership of the bucket.
Citation Information
Patent Citations
Chain merchant identification method and device, electronic equipment and storage medium
CN111415151A
