PIN anti-exhaustive method and system
By optimizing the PIN anti-exhaustion method in POS devices, we can judge whether input is allowed based on the PIN input time difference and the total number of times threshold, which solves the problem of user waiting time too long, and realizes the security and convenience of high-frequency PIN code input.
Patent Information
- Application Number
- CN202210481127.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-05
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-05-05
AI Technical Summary
In the POS device, users need to wait 2 minutes for repeated input after 4 consecutive PIN codes to enter the wrong PIN code, resulting in poor user experience and unable to improve transaction speed in high-frequency PIN code input scenarios.
By obtaining the current anti-exhaust data of the POS device, calculate the relationship between the PIN input time difference and the anti-exhaust period, and compare it with the threshold based on the total number of PIN input times, allow or reject PIN code input to prevent malicious cracking, and at the same time optimize the PIN input frequency in the anti-exhaust period.
It improves the input frequency of PIN code, improves the transaction speed and user experience of POS devices, prevents malicious cracking, and avoids adverse experiences caused by waiting.
Smart Images

Figure CN114782050B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of transaction security, and further to a PIN anti-exhaustiveness method and system. Background Art
[0002] Based on security design considerations, major manufacturers of POS equipment have developed security solutions to prevent malicious programs from being used to crack cardholders' PIN codes through exhaustive cracking.
[0003] At present, the commonly used method in the industry is the logic of entering the PIN code four times in 2 minutes, that is, a maximum of four PIN code entries are allowed within 120 seconds. To enter the fifth PIN code, you must wait for more than 120 seconds. In this way, the current RTC time needs to be recorded each time the PIN code is entered. A loop buf[4] with 4 members is designed to record the current PIN code input index idx, write the time of the first PIN code input (idx=0) into buf[0], the time of the second PIN code input (idx=1) into buf[1], and the time of the nth PIN code input (idx=n-1) into buf[(n-1)%4]. After the PIN code is entered four times, the array is overwritten in a loop, and the current time is compared with the corresponding time in the array to be written each time. If the difference is greater than 120 seconds, the PIN code input is allowed to update the write time and idx is incremented. Otherwise, the PIN code input is rejected.
[0004] In this solution, if a customer enters the wrong PIN code four times in a row within 2 minutes, they have to wait 2 minutes before re-entering the PIN code (here it is assumed that there is no upper limit on PIN code errors in the cash register backend), resulting in a poor user experience. Therefore, a POS machine PIN input protection method is needed that can protect PIN input while avoiding affecting the user experience. Summary of the Invention
[0005] In response to the above technical problems, the purpose of the present invention is to solve the technical problems of cracking the cardholder's PIN code through exhaustive enumeration and the user having to wait a long time before continuing the transaction in a high-frequency PIN code input scenario, thereby reducing the user's experience.
[0006] In order to achieve the above object, the present invention provides a PIN anti-exhaustiveness method, comprising the steps of:
[0007] Upon receiving a PIN code entry request, obtaining current anti-exhaustion data stored in the POS device; the current anti-exhaustion data includes the current anti-exhaustion period, the current period reference time, the current period input count threshold, and the current period total number of PIN entries, wherein the current period reference time is the time when the PIN code is first entered within the current anti-exhaustion period;
[0008] Calculating a first time difference between the current PIN input time and the current period reference time, and comparing the first time difference with the current anti-exhaustive period;
[0009] If the first time difference is less than the current anti-exhaustiveness period, compare the total number of PIN inputs in the current period with the input number threshold in the current period;
[0010] If the total number of PIN inputs in the current period is less than the input number threshold in the current period, allow the current PIN input and update the PIN count information in the current anti-exhaustiveness data;
[0011] If the total number of PIN inputs in the current period is greater than or equal to the current period input number threshold, the current PIN input is rejected.
[0012] According to another aspect of the present invention, the present invention further provides a PIN anti-exhaustiveness system, comprising:
[0013] an acquisition module, configured to, upon receiving a PIN code input request, obtain current anti-exhaustion data stored in the POS device; the current anti-exhaustion data including a current anti-exhaustion period, a current period reference time, a current period input count threshold, and a total number of PIN inputs in the current period, wherein the current period reference time is the time when the PIN code is first entered within the current anti-exhaustion period;
[0014] a calculation module, configured to calculate a first time difference between the current PIN input time and the current cycle reference time;
[0015] a processing module, configured to compare the first time difference with the current anti-exhaustion period; if the first time difference is less than the current anti-exhaustion period, compare the total number of PIN inputs in the current period with the input number threshold of the current period; if the total number of PIN inputs in the current period is less than the input number threshold of the current period, allow the current PIN code input and update the PIN count information in the current anti-exhaustion data; if the total number of PIN inputs in the current period is greater than or equal to the input number threshold of the current period, reject the current PIN code input.
[0016] Compared with the prior art, the PIN anti-exhaustiveness method and system provided by the present invention increases the frequency of PIN code input, improves the transaction speed of POS devices, and greatly enhances the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The preferred embodiments will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present invention.
[0018] Figure 1 This is a flow chart of an embodiment of a PIN anti-exhaustiveness method of the present invention;
[0019] Figure 2 It is a structural diagram of an embodiment of a POS device of the present invention;
[0020] Figure 3 is a flow chart of another embodiment of a PIN anti-exhaustiveness method of the present invention;
[0021] Figure 4 It is a flow chart of another embodiment of a PIN anti-exhaustiveness method of the present invention. DETAILED DESCRIPTION
[0022] In the following description, specific details such as specific system structures and technologies are provided for illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present application with unnecessary details.
[0023] It will be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections.
[0024] To simplify the drawings, only the parts relevant to the present invention are schematically shown in each figure. They do not represent the actual structure of the product. Furthermore, to simplify the drawings and facilitate understanding, in some figures, only one of the components with the same structure or function is schematically depicted or labeled. As used herein, "one" not only means "only one" but also "more than one."
[0025] It should be further understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0026] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific embodiments of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings and other embodiments can be obtained based on these drawings without inventive work.
[0028] In one embodiment, the reference Figure 1 and Figure 2 A PIN anti-exhaustiveness method, specifically applied to a POS device, comprises the steps of:
[0029] Upon receiving a PIN code input request, S1000 obtains current anti-exhaustion data stored in the POS device; the current anti-exhaustion data includes a current anti-exhaustion period, a current period reference time, a current period input count threshold, and a current period total number of PIN inputs, wherein the current period reference time is the time when the PIN code is first entered within the current anti-exhaustion period;
[0030] Specifically, such as Figure 2 As shown, the smart POS machine architecture of the present invention adopts the AP+SP approach. The AP (Application Processor, which is the main control chip) is installed with the Android system, and the transaction application runs on the AP. The SP (Secure Processor, which is the security chip) is loaded and runs the PIN anti-exhaustiveness method of the present invention.
[0031] After the POS device is powered on, both the AP and SP are powered on and started. After the POS device boots up and passes the initial self-test, the user can initiate a PIN code entry request using the POS device's user interface (touch or keystroke). This means the user can use the POS device to enter a PIN code to conduct a transaction. Each time the user enters a PIN code, the POS device records the time of each PIN entry, such as the last PIN entry time and the current PIN entry time.
[0032] S2000 calculates a first time difference between the current PIN input time and the current period reference time, and compares the first time difference with the current anti-exhaustive period;
[0033] Specifically, to prevent malicious programs from brute-forcing individual PINs, an anti-exhaustion cycle is set. This cycle periodically checks the total number of PIN entries at the POS terminal. Conventional practices limit the total number of PIN entries within a 60-minute anti-exhaustion cycle to no more than 120. Therefore, the POS terminal continuously checks to see if the total number of PIN entries exceeds the threshold within each anti-exhaustion cycle.
[0034] S3000: If the first time difference is less than the current anti-exhaustiveness period, compare the total number of PIN inputs in the current period with the input number threshold of the current period;
[0035] Specifically, the PIN code anti-exhaustive attack strategy of financial POS machines is to prevent high-frequency PIN code input to traverse the verification password attack strategy. It itself limits the frequency of PIN code input. However, during normal transactions, there are high-frequency and frequent transaction scenarios in certain time periods. Simple anti-exhaustive attack solutions cannot effectively meet the high-frequency and frequent transaction scenarios in these special time periods.
[0036] When the user successfully enters the PIN code, regardless of whether the entered PIN code is correct, the total number of PIN code inputs on the POS device increases by one. The PIN input time is recorded each time the PIN code is entered, and the PIN input time in the anti-exhaustive data is updated to the current PIN input time.
[0037] After determining that the first time difference between the current PIN input time (i.e., the current PIN input time of the present invention) and the reference input time (i.e., the current cycle reference time of the present invention) is less than the anti-exhaustiveness period, the main control chip further detects and determines whether the total number of PIN code inputs within the current anti-exhaustiveness period (i.e., the total number of PIN inputs in the current cycle of the present invention) is less than the current cycle input number threshold.
[0038] S4000: If the total number of PIN inputs in the current period is less than the input number threshold in the current period, allow the current PIN input and update the PIN count information in the current anti-exhaustiveness data;
[0039] S5000 If the total number of PIN inputs in the current period is greater than or equal to the input number threshold for the current period, reject the current PIN code input.
[0040] Specifically, if the main control chip determines that the total number of PIN code entries within the current anti-exhaustiveness cycle is greater than or equal to the current cycle input count threshold, it indicates that the entered PIN code may be abnormal or a malicious cracking attack. The POS device can issue an alarm and refuse the user to enter the PIN code. However, if the main control chip determines that the total number of PIN code entries within the current anti-exhaustiveness cycle is less than the current cycle input count threshold, the PIN code is allowed to be entered and the anti-exhaustiveness data in the backup memory is updated.
[0041] Denying a user a PIN code entry can be achieved by immediately shutting down the POS device, shutting down the kernel under the control of the POS device's operating system, or switching the POS device to a locked screen. For example, by modifying the POS operating system's parameters, the POS device's human-computer interface switches to a black or white screen. Regardless of the method used to deny a user a PIN code entry, any attempt to do so can deter unauthorized access. Allowing a user to enter a PIN code can be achieved by displaying a PIN entry box on the POS device's human-computer interface.
[0042] The present invention enables the operating system of the POS device to start an open state for the user who initiates the PIN code input request to allow the user to enter the PIN code only when the first time difference is less than the current anti-exhaustive verification period and the total number of PIN code inputs within the current anti-exhaustive verification period is less than the input number threshold of the current period through anti-exhaustive verification. If the anti-exhaustive verification fails, the operating system of the POS device is shut down, thereby eliminating the security risk of random or malicious attacks on the POS device.
[0043] The present invention uses a method to detect the total number of PIN entries in the current period and the duration of the current PIN entry (a first time difference) to determine whether to allow or deny a user's PIN entry, thereby preventing PIN exhaustion. Furthermore, based on the comparison of the total number of PIN entries in the current period with the current period's input threshold, as well as the comparison of the current PIN entry duration (the first time difference) with the current exhaustion prevention period, the current exhaustion prevention data stored in the POS device is updated. This not only ensures that the number of PIN entries within a certain time period does not exceed a predetermined number, but also protects PIN entry while avoiding impacting the user experience.
[0044] In one embodiment, a PIN anti-exhaustiveness method, specifically applied to a POS device, includes the steps of:
[0045] S0100 When the POS device is powered on, the current anti-exhaustive data stored in the backup memory is initialized to obtain structured data that conforms to a preset data structure;
[0046] S0200 loads the structure data into the global memory and performs an initialization self-check according to the structure data;
[0047] Specifically, when the POS device is powered on, the anti-exhaustive data is initialized to conform to the first preset data structure as follows:
[0048]
[0049] After the POS device is powered on, it performs anti-exhaustive initialization and loads the ST_SEC_RAM_PARA structure (i.e., structure data of the present invention) in the backup memory to the global memory to perform initialization self-test. In addition, the POS device also performs initialization self-test when setting or updating the anti-exhaustive cycle.
[0050] In one embodiment, the structured data includes a storage check value and non-storage check value information, wherein the non-storage check value information is data in the structured data excluding the storage check value; and performing the initialization self-check according to the structured data includes the steps of:
[0051] S0210: loading the structure data into the global memory, performing integrity verification based on the stored check value and the non-stored check value information, and performing legality verification based on the non-stored check value information;
[0052] Specifically, the non-stored check value information includes: influencing parameters and other information; the influencing parameters include the new anti-exhaustion period, the current anti-exhaustion period, and the total number of PIN inputs in the current period; the other information includes the anti-exhaustion policy version number and the current period reference time. The integrity check based on the stored check value and the non-stored check value information, and the legitimacy check based on the non-stored check value information, specifically includes the following steps:
[0053] S0211 calculates the non-stored check value information according to a preset encryption algorithm to obtain a calculated check value;
[0054] S0222 compares the calculated check value with the stored check value;
[0055] If the comparison results are consistent, the integrity check is confirmed to have passed.
[0056] S0224 If the comparison result is inconsistent, it is determined that the integrity check has failed;
[0057] S0225: Determine whether the influencing parameter satisfies a preset verification condition; the preset verification condition includes: the new anti-exhaustion period is less than or equal to a preset period threshold, the current anti-exhaustion period is less than or equal to a preset period threshold, the value is less than or equal to twice the current anti-exhaustion period, and the value is equal to the accumulated PIN count value;
[0058] S0226 If the influencing parameters satisfy all the preset verification conditions, it is determined that the legality check has passed;
[0059] S0227 If the influencing parameter does not meet any one of the preset verification conditions, it is determined that the legality check has failed.
[0060] Specifically, the anti-exhaustive data obtained after the above structural processing includes the content of "u8 version; ... u8RFU
[13] ". The CRC is used to verify the integrity of the anti-exhaustive data. Every time the POS device is turned on, the security chip is powered on and performs a check and judgment, that is, the integrity of the anti-exhaustive data stored in the backup memory is checked. The CRC check is not performed at other times, and the CRC value is only updated when the data is updated.
[0061] Updating the checksum CRC value (i.e., the stored checksum value of the present invention) ensures that the checksum passes when the POS device is powered off and then on again. This means that each time the POS device is powered on, the security chip performs a checksum. This can happen for two reasons: First, if there is no anti-exhaustive data, the power-on checksum will fail, requiring reinitialization of the anti-exhaustive data. Second, if the anti-exhaustive data is modified while the device is powered off (e.g., if the button battery is dead), the power-on checksum will identify the data anomaly and require reinitialization.
[0062] After the POS device is powered on, it performs anti-exhaustive initialization, that is, it initializes the anti-exhaustive data, loads the ST_SEC_RAM_PARA structure in the backup memory, that is, the anti-exhaustive data of the present invention that conforms to the preset data structure to the global memory, and completes the initialization self-check. The initialization self-check includes integrity self-check and legitimacy self-check. Among them, the integrity self-check is to calculate the anti-exhaustive data of the data other than crc in the ST_SEC_RAM_PARA structure, that is, to calculate the non-stored check value information (including version, new_period, period, cnt_all, sec_start, PIN cnt
[61] in the above-mentioned preset data structure) to obtain the calculated crc16 (that is, the calculated check value of the present invention) and the structure tail crc (the crc in the above-mentioned preset data structure, that is, the stored check value of the present invention) for comparison. If the calculated crc16 and the structure tail crc are equal, the integrity is passed. The legitimacy self-check is to determine whether the data of new_period (i.e., the new anti-exhaustive period of the present invention), period (i.e., the current anti-exhaustive period of the present invention), cnt_all (i.e., the total number of PIN inputs in the current period of the present invention), sec_start (i.e., the current period reference time of the present invention), and PIN cnt
[61] (i.e., the number of PIN inputs in the sub-time period of the present invention) are within the valid range, that is, to determine whether the influencing parameters meet all the contents of the preset verification conditions, wherein the preset verification conditions are as follows:
[0063] new_period<=60;
[0064] period<=60;
[0065] cnt_all<=2P, and cnt_all=PINcnt
[61] accumulation.
[0066] S0220: When the integrity check passes and the legitimacy check passes, determining that the POS device initialization self-test passes, so as to allow acquisition of the PIN code input request;
[0067] S0230: When the integrity check fails, or the integrity check passes but the legality check fails, the current anti-exhaustiveness data is re-initialized and the process ends.
[0068] Specifically, the above process can be used to determine whether the integrity check has passed and whether the validity check has passed. If the integrity check fails, or if the integrity check passes but the validity check fails, the POS device is determined to have failed the initialization self-test. Therefore, upon startup or if the initialization self-test fails according to the above process, the POS device will initialize the anti-exhaustiveness data to conform to the first preset data structure.
[0069] In one embodiment, the steps are further included:
[0070] Calculate the difference between the system time of the clock chip and the set time to obtain a third time difference;
[0071] If the set time is a future time after the system time, the current cycle reference time and the third time difference are summed to update the system time of the clock chip;
[0072] If the set time is a past time before the system time, the current cycle reference time and the third time difference are calculated to update the system time of the clock chip.
[0073] Specifically, in order to prevent malicious programs from cheating the anti-exhaustive period judgment by modifying the system time, Figure 4 As shown, the present invention also designs a time synchronization function to solve the hidden dangers caused by the system RTC update. RTC is the abbreviation of Real-Time Clock, which is a real-time clock, usually called a clock chip.
[0074] Preferably, the anti-exhaustive cycle update requires comparing the current cycle with the set cycle size, and determining that the current time from the current PIN input time exceeds the anti-exhaustive cycle before updating to the next anti-exhaustive cycle, otherwise waiting for the idle time of an anti-exhaustive cycle to enter the next anti-exhaustive cycle.
[0075] Upon receiving a PIN code input request, S1000 obtains current anti-exhaustion data stored in the POS device; the current anti-exhaustion data includes a current anti-exhaustion period, a current period reference time, a current period input count threshold, and a current period total number of PIN inputs, wherein the current period reference time is the time when the PIN code is first entered within the current anti-exhaustion period;
[0076] S2000 calculates a first time difference between the current PIN input time and the current period reference time, and compares the first time difference with the current anti-exhaustive period;
[0077] S2500 compares the first time difference with twice the current anti-exhaustive period. If the first time difference is greater than or equal to twice the current anti-exhaustive period, allow the current PIN code input and reset the current anti-exhaustive data to zero.
[0078] Specifically, the current anti-exhaustive data also includes a current cycle end time, and the current cycle end time is the time when the PIN code is last entered in the current anti-exhaustive cycle; and resetting the current anti-exhaustive data to zero includes the following steps:
[0079] S2510 sets the total number of PIN inputs in the current period to 1;
[0080] S2520 replaces the current cycle reference time with the current PIN input time, and replaces the current cycle end time with the current PIN input time.
[0081] Specifically, the difference between the current PIN input time and the current cycle reference time is calculated to obtain a first time difference, and it is determined whether the first time difference is greater than or equal to twice the current anti-exhaustive cycle. If the first time difference is greater than or equal to twice the current anti-exhaustive cycle, the POS device resets the current anti-exhaustive data to zero and allows the current PIN code to be entered.
[0082] Specifically, during use, there may be a situation where the first time difference between the current PIN input time and the current cycle reference time is too large. At this time, detecting the total number of PIN code inputs and the average time spent per time has lost its meaning. Therefore, after detecting the PIN code input request instruction acting on the POS machine, it is determined whether the first time difference between the current PIN input time and the current cycle reference time is greater than twice the current anti-exhaustive cycle. By comparing the first time difference with twice the current anti-exhaustive cycle, if the first time difference is greater than or equal to twice the current anti-exhaustive cycle, the anti-exhaustive data in the backup memory is directly reset to zero, and the open state is started for the user who initiated the PIN code input request to allow the user to enter the PIN code.
[0083] In a high-frequency PIN code input scenario, the present invention allows the user to re-enter the PIN code without waiting, thereby protecting the PIN input and increasing the transaction speed of the POS device, greatly improving the user experience.
[0084] S2600: If the first time difference is greater than or equal to the current anti-exhaustiveness period and less than twice the current anti-exhaustiveness period, allow the current PIN code input and update the current anti-exhaustiveness data according to the current PIN input time;
[0085] The updating of the current anti-exhaustiveness data according to the current PIN input time comprises the following steps:
[0086] S2610 calculates a second time difference between the first time difference and the current anti-exhaustive period;
[0087] S2620: performing a sum calculation based on the current cycle reference time and the second time difference to obtain an updated current cycle reference time, and replacing the current cycle reference time with the updated current cycle reference time;
[0088] S2630 calculates the number of PIN inputs between the current period reference time of the updated version and the current PIN input time, and accumulates the number of PIN inputs for this time;
[0089] S2670 calculates the sum of the statistical PIN input times and the accumulated PIN input times to obtain the updated total number of inputs in the current cycle, and replaces the total number of inputs in the current cycle with the updated total number of inputs in the current cycle.
[0090] Specifically, if the PIN input time is more than 80 minutes away from the current cycle base time, then one cycle has passed. In this case, the base time needs to be increased by 80-60=20 minutes, which means that the data of PINcnt[0-19] is invalidated. In order to facilitate the next calculation, the actual operation is to move the data of PINcnt[20-60] forward by 20 units, overwriting PINcnt[0-19].
[0091] S3000: If the first time difference is less than the current anti-exhaustiveness period, compare the total number of PIN inputs in the current period with the input number threshold of the current period;
[0092] S4000: If the total number of PIN inputs in the current period is less than the input number threshold in the current period, allow the current PIN input and update the PIN count information in the current anti-exhaustiveness data;
[0093] Specifically, the current anti-exhaustion data further includes count fields corresponding to all sub-time periods within the current anti-exhaustion period, the current anti-exhaustion period including 60 equally spaced sub-time periods, the count fields being used to record the number of PIN inputs within a sub-time period, the number of count fields being 61, and the 61st count field being used to record the number of PIN inputs within the first sub-time period of the next anti-exhaustion period; and updating the PIN count information in the current anti-exhaustion data includes the steps of:
[0094] S4100 counts the number of PIN entries in each sub-time period within the current anti-exhaustive cycle;
[0095] S4200 replaces the value of the count field of each sub-time period with the corresponding counted number of PIN inputs.
[0096] For details, please refer to the attached manual. Figure 3 During the use of the POS device, each time a PIN code is entered, the anti-exhaustion data is updated. Furthermore, if more than one cycle is exceeded, the current cycle base time needs to be updated. The present invention divides an anti-exhaustion cycle into 60 sub-cycles, each of which records the number of PIN code entries within its own time.
[0097] If the first time difference is greater than the anti-exhaustive period, the current cycle reference time and the total number of PIN code inputs in the backup memory are updated. If the current PIN code input is more than 30 minutes but less than 31 minutes from the current cycle reference time, then j = 29, and the PIN code is recorded in PIN cnt
[29] . If the current PIN code input is more than 31 minutes but less than 32 minutes from the current cycle reference time, then j = 30, and the PIN code is recorded in PIN cnt
[30] . And so on.
[0098] The purpose of updating the current cycle reference time in the backup memory is to prevent exhaustive attempts and enhance security. Therefore, if the anti-exhaustive attempt period P is set to 60 minutes, but the current PIN entry time is 80 minutes past the current cycle reference time, meaning the first time difference between the current PIN entry time and the reference entry time exceeds one anti-exhaustive attempt period, then the calibration time difference is calculated by subtracting the first time difference from the anti-exhaustive attempt period. The current cycle reference time and the calibration time difference are then added together, and the result is used to replace the previous current cycle reference time. For example, if the previous current cycle reference time was 14:30:00, December 29, 2021, then the current cycle reference time is incremented by 80-60 = 20 minutes, resulting in an updated current cycle reference time of 14:50:00, December 29, 2021. This invalidates the data in PIN cnt[0-19]. To facilitate the next calculation, the data in PIN cnt[20-60] is shifted forward by 20 units, overwriting PIN cnt[0-19].
[0099] Specifically, the current anti-exhaustiveness period is divided into equal parts according to preset sub-periods, and the security chip SP records the total number of PIN code inputs in each preset sub-period.
[0100] Since a 1-byte width [0 to 255] is used to record the number of PIN code inputs (1 / 60P), an error of 1 / 60P is introduced when the 60th input is made.
[0101] Assuming the period is 60 minutes,
[0102] PIN cnt[0] records the number of times the PIN code is entered in the [0-59] second period, which is called the 1st minute;
[0103] PIN cnt[1] records the number of times the PIN code is entered during the [60*1 to 60*1+59] second period, which is called the 2nd minute;
[0104] …
[0105] PIN cnt
[59] records the number of times the PIN code is entered in the period [60*59 to 60*59+59] seconds, which is called the 60th minute;
[0106] PIN cnt
[60] records the number of times the PIN code is entered during the period [60*60 to 60*60+59] seconds, which is called the 61st minute.
[0107] Assume that at the 59th second of the first minute, the PIN code is entered 120 times and recorded in PIN cnt[0] = 120. In the following time, the maximum number of PIN code entries in this cycle has been reached, so the PIN code entry is rejected until the 61st minute when the PIN code can be entered again. If the 120 times in the first second of the 61st minute are stored in PIN cnt
[60] , then from PINcnt[0] + PIN cnt
[60] = 240 times, the precise calculation time from 59 seconds to 60*60 seconds is 3541 seconds, which is less than one hour. However, the PIN code was entered 240 times in total. This is the source of the error.
[0108] To eliminate errors, the PIN cnt count is designed to be 61 bytes, which can record the time of 61 / 60P. The 61 / 60P time is used as the basis to determine whether the number of PIN code inputs exceeds 2P, which meets the requirement of 120 times in 1 hour.
[0109] Since the backup memory of the security chip SP is limited and cannot store enough time data, a method with errors is designed to record only a reference time sec_start, a time of the most recent PIN input sec_end, a 61-byte array PIN cnt
[61] , and a crc check field. After the security chip is powered on, the anti-exhaustive data is initialized to comply with the second preset data structure as follows:
[0110]
[0111]
[0112] The security chip SP includes a backup memory (BPK). Both the backup memory (BPK) and the RTC module are powered by a button cell battery on the circuit board. Data in the backup memory (BPK) is protected against power failures. However, the capacity of the backup memory (BPK) is very limited. The security chip SP in this embodiment of the present invention uses the domestically produced MH1902 chip, which has a BPK of only 128 bytes. Therefore, the anti-exhaustiveness data must be reduced in size, for example, by initializing the anti-exhaustiveness data to conform to the second preset data structure. If the memory is large enough, a circular array can be used to record the time of each PIN code, and the time interval can be determined based on the time, for example, by initializing the anti-exhaustiveness data to conform to the first preset data structure.
[0113] S5000 If the total number of PIN inputs in the current period is greater than or equal to the input number threshold for the current period, reject the current PIN code input.
[0114] The present invention compares the total number of PIN inputs in the current period with the input number threshold of the current period, compares the current PIN input time (first time difference) with the current anti-exhaustiveness period, and compares the current PIN input time (first time difference) with twice the current anti-exhaustiveness period. Based on the three comparison results, the current anti-exhaustiveness data stored in the POS device is updated, or it is determined whether to allow or deny the user to enter the PIN code. In a high-frequency PIN code input scenario, the PIN code can be entered again by setting a detection without the user waiting, avoiding the rigid setting of the anti-exhaustiveness period to limit the exhaustiveness. Instead, a flexible method is used to ensure that the number of PIN inputs within a certain time period does not exceed a predetermined number. This can not only protect PIN input but also prevent malicious programs from brute-force cracking of personal PIN codes, increase the frequency of PIN code input, and allow the user to enter the PIN again without waiting, thereby improving the transaction speed of the POS device and greatly improving the user experience.
[0115] The present invention implements the security requirements that the number of PIN code inputs within any one hour shall not exceed 120 times, i.e., an average of 30 seconds per time, and that powering on and off the machine will not affect the PIN code anti-exhaustive mechanism, and that modifying the system time will not affect the PIN code anti-exhaustive mechanism. The present invention can solve the high-frequency PIN code input situation in a certain period while meeting the security requirements, and curb the infinite attempts of malicious refresh programs or software. It perfectly solves the exhaustive attack on the PIN code and ensures the security of the PIN code during the transaction. When illegal elements carry out a power-off attack, the security chip of the present invention can also avoid exhaustive attacks after being powered on again, support higher frequencies and solve the speed and sudden power-off problems. The present invention can effectively eliminate the exhaustive attempt vulnerability caused by power off and greatly improve the security of the PIN code. The present invention solves the problem of slow reading and writing of data and the problem of low frequency of PIN code input by cleverly using the backup memory of the security chip to store anti-exhaustive data, thereby increasing the transaction speed and greatly improving the user experience.
[0116] In one embodiment, the input number threshold of the current cycle is twice the current anti-exhaustive cycle in value;
[0117] The value range of the current anti-exhaustive period is any one of [1min, 2min, 3min, 4min, 5min, 6min, 10min, 12min, 15min, 20min, 30min, 60min].
[0118] Specifically, to prevent malicious programs from brute-forcing individual PIN codes, the POS device is required to limit the number of PIN code entries to no more than 120 times within any hour, or an average of 30 seconds per entry. Therefore, the POS device's main control chip stores a pre-set anti-exhaustive cycle and a threshold for the number of PIN code entries in the current cycle. The anti-exhaustive cycle and the number of PIN code entries allowed within the anti-exhaustive cycle, or the threshold for the number of PIN code entries in the current cycle, must conform to the following formula:
[0119] 2Pn≤120;
[0120] Wherein, P represents the anti-exhaustive period, P is an integer and its value range is {P=60 / n, n∈positive integer}, and the unit of P is minute; n represents the multiple of the anti-exhaustive period, and its value range is [1, 60].
[0121] Specifically, 2P is the maximum number of PIN code entries within period P. n represents a multiple of the period, and n is an integer in the range [1, 60]. Therefore, 2Pn≤120. By transformation, we can get P≤(60 / n). When n is an integer, the values of P that are divisible by 60 are [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60]. This satisfies the requirement that the number of PIN code entries within any hour must not exceed 120.
[0122] When the anti-exhaustive cycle P is 60 minutes, n is 1, and the maximum number of PIN code inputs within a single anti-exhaustive cycle (i.e., the input number threshold within a single anti-exhaustive cycle, such as the input number threshold in the current cycle) = 120 times;
[0123] When the anti-exhaustive cycle P is 30 minutes, n is 2, and the maximum number of PIN code inputs in a single anti-exhaustive cycle = 60;
[0124] …
[0125] When the anti-exhaustive cycle P is 2 minutes, n is 30, and the maximum number of PIN code inputs in a single anti-exhaustive cycle is 4 times;
[0126] The values of P that are not divisible by 60 are: [7-9, 11, 13, 14, 16-19, 21-29, 31-59]. The number of PIN code entries within any hour is greater than 120, which does not meet the security requirement of POS devices to prevent exhaustive attempts.
[0127] For example, when the anti-exhaustion period P is 50 minutes and n is 1, the maximum number of PIN code entries within a single anti-exhaustion period is 100. A maximum of two anti-exhaustion periods can be entered in any hour. If the PIN code is entered 100 times at the beginning of the first anti-exhaustion period, plus the first minute of the second anti-exhaustion period, the PIN code can be entered 100 more times. The total time taken is 51 minutes. However, entering the PIN code 200 times does not meet the design goal. Therefore, the anti-exhaustion period cannot be set to 50 minutes. The same applies to other anti-exhaustion periods.
[0128] If the PIN code has not been entered within the current anti-exhaustiveness period after the self-test passes, the current PIN entry time stored in the main control chip is the time when the PIN code was last entered before the POS device was most recently shut down. Of course, if the PIN code has been entered within the current anti-exhaustiveness period after the self-test passes, the current PIN entry time stored in the main control chip is the time when the POS device most recently entered the PIN code. Therefore, after the self-test passes, the present invention calculates a first time difference between the current PIN entry time and the current cycle's reference time (i.e., first time difference = current PIN entry time - current cycle's reference time), and then determines whether the first time difference is greater than the current anti-exhaustiveness period.
[0129] The periodic input count threshold is not necessarily 120 times. The number of PIN code inputs within any hour must not exceed 120 times. The periodic input count threshold is proportional to the anti-exhaustiveness period. That is, the longer the anti-exhaustiveness period, the larger the periodic input count threshold.
[0130] In one embodiment, the POS device is equipped with a security chip and a button battery. The security chip is provided with a backup memory. The button battery supplies power to the security chip so that the backup memory stores the current anti-exhaustive data.
[0131] Specifically, the present invention utilizes a PCI-compliant security chip SP with a backup memory powered by a board-level coin cell battery. This backup memory protects recorded data from sudden power outages or memory corruption. The present invention utilizes this backup memory to implement a PIN code anti-exhaustiveness solution. This backup memory offers fast read and write speeds, supports a high PIN code frequency, and maintains data integrity after a power outage or restart.
[0132] For example, Figure 3 As shown, there are three cases. Here, we make an extreme assumption that P = 60 minutes and a PIN has been entered once. Then the current cycle reference time sec_start is the time of the previous PIN entry, and timeCost is the first time difference value of the present invention:
[0133] 1. Start entering the PIN code. Assuming that the last PIN entry was 121 minutes ago, the PIN entry time time-sec_start must be greater than 2 times the period (time-sec_start = timeCost > 2P), and then enter the anti-exhaustive data reset process.
[0134] 2. Start entering your PIN. Assuming the last PIN entry was 90 minutes ago (more than 1P), the current PIN entry time (time-sec_start = 90 minutes) is greater than 1 times the period but less than 2 times the period (time-sec_start = 90 > 1P). The process begins calculating the current PIN entry time, counting position j = i. The time period to be invalidated (timeCost-P) is calculated as (90-60) = 30. This means that the number of PIN entries within the 30 minutes starting from sec_start is invalidated. Additionally, the number of valid PIN entries is accumulated (PINcnt[30-60]) and temporarily stored in Tcnt. Furthermore, the current cycle base time is updated by 30 minutes (sec_start + 30). This overwrites the invalidated data (moving the data in PINcnt[30-60] to PINcnt[0-30] and setting the unused data in PINcnt[31-60] to 0). Finally, use the new current cycle reference time and the current PIN input time to make the difference time-sec_start=timeCost=P, store the current PIN input PINcnt
[60] =1, update cnt_all=Tcnt+1, and end.
[0135] 3. Start entering the PIN code. Assuming that the last time the PIN was entered was 30 minutes ago (less than 1P time), the difference between this PIN input time and the current cycle base time is time-sec_start=30min, which is less than 1 times the week (time-sec_start=30<1P). Then enter the process of updating the total PIN count. It is necessary to calculate the number of times the PIN was entered during this PIN input time and record it at location PINcnt
[29] (the number of PIN inputs in the 1st minute is stored in PINcnt[0], and the number of PIN inputs in the 30th minute is stored in PINcnt
[29] ). Update cnt_all+1 and end.
[0136] In one embodiment, a PIN anti-exhaustiveness system includes:
[0137] an acquisition module, configured to, upon receiving a PIN code input request, obtain current anti-exhaustion data stored in the POS device; the current anti-exhaustion data including a current anti-exhaustion period, a current period reference time, a current period input count threshold, and a total number of PIN inputs in the current period, wherein the current period reference time is the time when the PIN code is first entered within the current anti-exhaustion period;
[0138] a calculation module, configured to calculate a first time difference between the current PIN input time and the current cycle reference time;
[0139] a processing module, configured to compare the first time difference with the current anti-exhaustion period; if the first time difference is less than the current anti-exhaustion period, compare the total number of PIN inputs in the current period with the input number threshold of the current period; if the total number of PIN inputs in the current period is less than the input number threshold of the current period, allow the current PIN code input and update the PIN count information in the current anti-exhaustion data; if the total number of PIN inputs in the current period is greater than or equal to the input number threshold of the current period, reject the current PIN code input.
[0140] Specifically, this embodiment is a system embodiment corresponding to the above method embodiment. For specific effects, please refer to the above method embodiment, which will not be described in detail here.
[0141] Those skilled in the art will clearly understand that, for the sake of convenience and brevity of description, only the division of the above-mentioned program modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program units or modules to complete all or part of the functions described above. The program modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one processing unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software program unit. In addition, the specific names of the program modules are only for the purpose of distinguishing each other and are not used to limit the scope of protection of this application.
[0142] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0143] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0144] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be electrical, mechanical or other forms.
[0145] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0146] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0147] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0148] It should be noted that the above embodiments can be freely combined as needed. The above description is only a preferred embodiment of the present invention. It should be pointed out that those skilled in the art can make several improvements and modifications without departing from the principles of the present invention, and such improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A PIN anti-exhaustive method, characterized in that: Including steps: Upon receiving a PIN code input request, obtaining current anti-exhaustion data stored in the POS device; the current anti-exhaustion data includes a current anti-exhaustion period, a current period reference time, a current period input count threshold, and a total number of PIN inputs in the current period, wherein the current period reference time is the time when the PIN code is first entered within the current anti-exhaustion period; the POS device is equipped with a security chip and a button battery, the security chip having a backup memory, and the button battery powering the security chip so that the backup memory stores the current anti-exhaustion data; Calculate a first time difference between the current PIN input time and the current period reference time, compare the first time difference with the current anti-exhaustive period, and compare the first time difference with twice the current anti-exhaustive period; If the first time difference is greater than or equal to the current anti-exhaustive period and less than twice the current anti-exhaustive period, allow the current PIN code input and update the current anti-exhaustive data according to the current PIN input time; The updating of the current anti-exhaustiveness data according to the current PIN input time comprises the following steps: Calculating a second time difference between the first time difference and the current anti-exhaustive period; Add the current cycle reference time and the second time difference to obtain an updated current cycle reference time, and replace the current cycle reference time with the updated current cycle reference time; Calculate the number of PIN inputs between the current period reference time of the update version and the current PIN input time, and accumulate the number of PIN inputs; Adding the statistical PIN input times and the current PIN input times to obtain the updated total number of input times in the current cycle, and replacing the total number of input times in the current cycle with the updated total number of input times in the current cycle; If the first time difference is less than the current anti-exhaustiveness period, compare the total number of PIN inputs in the current period with the input number threshold in the current period; If the total number of PIN inputs in the current period is less than the input number threshold in the current period, allow the current PIN input and update the PIN count information in the current anti-exhaustiveness data; If the total number of PIN inputs in the current period is greater than or equal to the current period input number threshold, the current PIN input is rejected.
2. The PIN anti-exhaustive method according to claim 1, characterized in that: Also includes the steps: If the first time difference is greater than or equal to twice the current anti-exhaustive period, the current PIN code input is allowed and the current anti-exhaustive data is reset to zero.
3. The PIN anti-exhaustive method according to claim 1, characterized in that: The current anti-exhaustion data further includes count fields corresponding to all sub-time periods within the current anti-exhaustion period, the current anti-exhaustion period including 60 equally spaced sub-time periods, the count fields being used to record the number of PIN inputs within a sub-time period, the number of count fields being 61, the 61st count field being used to record the number of PIN inputs within the first sub-time period of the next anti-exhaustion period; and updating the PIN count information in the current anti-exhaustion data comprising the steps of: Count the number of PIN entries in each sub-time period within the current anti-exhaustive cycle; The value of the count field in each sub-time period is replaced with the corresponding counted number of PIN inputs.
4. The PIN anti-exhaustive method according to claim 2, characterized in that: The current anti-exhaustive data also includes the current cycle end time, which is the time when the PIN code was last entered during the current anti-exhaustive cycle. Resetting the current anti-exhaustive data to zero includes the following steps: Set the total number of PIN inputs in the current cycle to 1; The current cycle reference time is replaced by the current PIN input time, and the current cycle end time is replaced by the current PIN input time.
5. The PIN anti-exhaustive method according to claim 1, characterized in that: The input number threshold of the current cycle is twice the current anti-exhaustive cycle in value; The value range of the current anti-exhaustive period is any one of [1min, 2min, 3min, 4min, 5min, 6min, 10min, 12min, 15min, 20min, 30min, 60min].
6. The PIN anti-exhaustive method according to claim 1, characterized in that: The method includes the following steps before obtaining the current anti-exhaustive data stored in the POS device when a PIN code input request is received: When the POS device is powered on, the current anti-exhaustive data stored in the backup memory is initialized to obtain structured data that conforms to a preset data structure; The structure data is loaded into the global memory, and an initialization self-check is performed according to the structure data.
7. The PIN anti-exhaustive method according to claim 6, characterized in that: The structured data includes a storage check value and non-storage check value information, wherein the non-storage check value information is data in the structured data excluding the storage check value; and performing the initialization self-check according to the structured data includes the following steps: Performing an integrity check based on the stored check value and the non-stored check value information, and performing a legitimacy check based on the non-stored check value information; When the integrity check passes and the legitimacy check passes, determining that the POS device initialization self-test passes, so as to allow acquisition of the PIN code input request; When the integrity check fails, or the integrity check passes but the legality check fails, the current anti-exhaustiveness data is initialized again and the process ends.
8. The PIN anti-exhaustive method according to claim 7, characterized in that: The integrity check according to the stored check value and the non-stored check value information comprises the following steps: Calculate the non-stored check value information according to a preset encryption algorithm to obtain a calculated check value; comparing the calculated check value with the stored check value; If the comparison results are consistent, it is determined that the integrity check has passed; If the comparison result is inconsistent, it is determined that the integrity check has failed.
9. The PIN anti-exhaustive method according to claim 7, characterized in that: The non-stored check value information includes: influencing parameters and other information; the influencing parameters include the new anti-exhaustive cycle, the current anti-exhaustive cycle, and the total number of PIN inputs in the current cycle; the other information includes the anti-exhaustive strategy version number and the current cycle reference time; the legitimacy verification based on the non-stored check value information includes the following steps: Determining whether the influencing parameter satisfies a preset verification condition; the preset verification condition includes: the new anti-exhaustion period is less than or equal to a preset period threshold, the current anti-exhaustion period is less than or equal to a preset period threshold, the total number of PIN inputs in the current period is less than or equal to twice the current anti-exhaustion period, and the total number of PIN inputs in the current period is equal to the accumulated PIN count value; If the influencing parameters satisfy all the preset verification conditions, it is determined that the legitimacy check has passed; If the influencing parameter does not satisfy any one of the preset verification conditions, it is determined that the legality check has failed.
10. The PIN anti-exhaustive method according to claim 1, characterized in that: Also includes the steps: Calculate the difference between the system time of the clock chip and the set time to obtain a third time difference; If the set time is a future time after the system time, the current cycle reference time and the third time difference are summed to update the system time of the clock chip; If the set time is a past time before the system time, the current cycle reference time and the third time difference are calculated to update the system time of the clock chip.
11. A PIN anti-exhaustive system, characterized in that: include: An acquisition module, used to obtain the current anti-exhaustive data stored in the POS device when a PIN code input request is received; The current anti-exhaustiveness data includes a current anti-exhaustiveness period, a current period reference time, a current period input count threshold, and a current period total number of PIN inputs, wherein the current period reference time is the time when the PIN code is first entered within the current anti-exhaustiveness period; the POS device is equipped with a security chip and a button battery, the security chip is provided with a backup memory, and the button battery powers the security chip so that the backup memory stores the current anti-exhaustiveness data; a calculation module, configured to calculate a first time difference between the current PIN input time and the current cycle reference time; A processing module is used to compare the first time difference with the current anti-exhaustion period, and compare the first time difference with twice the current anti-exhaustion period; if the first time difference is greater than or equal to the current anti-exhaustion period and less than twice the current anti-exhaustion period, allow the current PIN code input and update the current anti-exhaustion data according to the current PIN input time; the updating of the current anti-exhaustion data according to the current PIN input time includes the steps of: calculating the second time difference between the first time difference and the current anti-exhaustion period; adding the current cycle base time and the second time difference to obtain an updated version of the current cycle base time, replacing the current cycle base time with the updated version of the current cycle base time; calculating the updated version of the current cycle base time The method further comprises the following steps: calculating the number of PIN inputs between the first time and the current PIN input time, and accumulating the number of PIN inputs for this period; summing the number of PIN inputs for this period and the number of PIN inputs for this period to obtain an updated total number of inputs for the current period, and replacing the total number of inputs for the current period with the updated total number of inputs for the current period; if the first time difference is less than the current anti-exhaustiveness period, comparing the total number of PIN inputs for the current period with the input number threshold for the current period; if the total number of PIN inputs for the current period is less than the input number threshold for the current period, allowing the current PIN code input and updating the PIN count information in the current anti-exhaustiveness data; and rejecting the current PIN code input if the total number of PIN inputs for the current period is greater than or equal to the input number threshold for the current period.
Citation Information
Patent Citations
Abnormal user account detection method and device, equipment and storage medium
CN111107057A