A method and system for identity recording, retention and switching for unauthorized testing
By using the built-in browser to record and automatically refresh the session identity information in the overprivileged test, the tedious problems of frequent login and account switching are solved, the testing efficiency and stability are improved, and the account management and session maintenance are realized, and a variety of test scenarios are adapted to various test scenarios. .
Patent Information
- Application Number
- CN202411170721.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-26
AI Technical Summary
In the vertical overriding test of multi-user system, the tedious process of frequently switching accounts, entering passwords and verification codes greatly reduces the testing efficiency and may trigger the account locking mechanism, resulting in interruption of the test.
Provides a method of identity recording, maintaining and switching, using a built-in browser to record session identity information, and periodically refresh the keep-alive address through the session maintenance policy, reducing login verification steps, and realizing automated account management and session active status maintenance.
Improve the test speed, avoid the risk of login restriction, enhance the stability and reliability of the test, simplify session identity management, and adapt to multiple test scenarios.
Smart Images

Figure CN118694699B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of network security testing, and in particular relates to a method and system for identity recording, maintaining and switching for unauthorized testing. Background Art
[0002] In the testing of related functions involving multi-user systems, such as multi-user interactive business process testing and vertical unauthorized vulnerability testing, it is often necessary to frequently switch between multiple different accounts, frequently enter account passwords and verification codes to log in, and frequently modify account cookies to test unauthorized access. Such a testing process is very cumbersome and greatly reduces the efficiency of the test.
[0003] Taking the common vertical override test as an example, the specific process is as follows:
[0004] First, create two or more user accounts with different permission levels in the system. Here, we take two accounts as an example. One is a common user A, whose permission is limited to general function operations; the other is an administrator user admin, who has advanced permission to perform specific management tasks (such as adding, deleting, modifying, and checking).
[0005] Next, use user A and administrator admin to log in to the system in turn, and record the various types of identity information generated after they successfully log in, such as cookies, JSON Web Token (JWT), etc. At the same time, record their corresponding roles or specific permission lists in detail for subsequent comparative analysis.
[0006] After logging in as an administrator, a series of sensitive operations exclusively for administrators are performed, such as adding, deleting, modifying system resources or querying high-level data. During these operations, network packet capture tools are used to synchronously capture and save all relevant data packets involved in these operations. These data packets contain not only the specific content of the operations performed, but also the identity information of the administrator user.
[0007] To simulate the behavior of ordinary user A trying to access the administrator's privileges beyond his authority, we replaced the original administrator cookie with the cookie of user A in the obtained administrator data packet. This operation is intended to simulate user A's attempt to use his own identity credentials to execute functions that should be controlled by administrator privileges.
[0008] After replacing the cookie, resend the previously captured administrator operation request to observe whether the system will allow the request to complete the operation that should only be performed by the administrator after receiving the request carrying the user A cookie.
[0009] Finally, strictly verify the actual execution results of the request resubmitted after replacing the cookie of user A. If the system fails to effectively block these requests, resulting in user A successfully performing tasks that were originally limited to administrators, then it can be confirmed that there is a vertical privilege escalation vulnerability. On the contrary, if the system properly blocks such privilege escalation behaviors, it indicates that within the scope of this test, the system's permission control mechanism is effective and no obvious vertical privilege escalation issues are found.
[0010] According to the above process, we can see that the traditional unauthorized testing process has the following defects:
[0011] 1. Account management is cumbersome: When faced with a large number of test accounts, finding, remembering and entering the corresponding account passwords becomes a tedious task, affecting the testing process.
[0012] 2. Frequent login verification: Frequent account switching means executing the login process multiple times, including entering verification codes or performing other identity authentication steps, which greatly increases the testing burden.
[0013] 3. Login restriction risk: Too frequent login attempts may trigger the account lock mechanism of the system under test, such as the number of SMS authentication limits, forcing the test work to be interrupted.
[0014] 4. Switching is troublesome: When conducting vertical unauthorized access testing, you may need to log in to multiple accounts at the same time and modify the login credentials (such as cookies) of different users to simulate unauthorized access. Such operations are complex and easily affected by factors such as session expiration, resulting in additional login costs. Summary of the invention
[0015] In view of the problems existing in the prior art of cumbersome account management, frequent login verification and difficulty in switching identities, the present invention proposes a method for recording, maintaining and switching identities for unauthorized testing, the purpose of which is to improve test efficiency and enhance test stability and reliability.
[0016] To achieve the above-mentioned purpose, the technical solution adopted by the present invention is to provide a method for recording, maintaining and switching an identity for unauthorized testing, comprising the following steps:
[0017] Step 1: Use the built-in browser to log in to the target site as the target and record the session identity information, and configure the session persistence policy;
[0018] Step 2: The system will record the session identity information and automatically refresh the keep-alive address periodically according to the session retention strategy to maintain the active status of the test account;
[0019] Step 3: Before performing the unauthorized access test, the user selects or switches to a target session identity from the session identity information;
[0020] Step 4: Initiate a specific request or data replay operation to the test site. At this time, the request automatically carries the identity information of the selected session to complete the unauthorized identity test.
[0021] Preferably, the session identity information in step one includes non-standard request header information and Cookie information.
[0022] Preferably, step 1 uses built-in browser technology to directly capture the credential information during login and guide the user to log in to the target system through the built-in browser.
[0023] Preferably, in step one, the backend system captures and stores these credential data in a database in real time, a static session identity management database, to achieve a preliminary accumulation of session identities.
[0024] Preferably, in step 2, the user customizes the refresh frequency through the front-end configuration interface, and then the back-end automatically sends a request to the target website and maintains the session based on the configuration information, and then stores the policy parameters in the database.
[0025] Preferably, step three includes a session management system, where users can query, add, modify and delete session information through a graphical interface; a front-end and back-end separation design is adopted, with the front-end displaying a friendly interface and the back-end connecting to a database to respond to user management needs in real time.
[0026] Preferably, in step 4, a drop-down menu is integrated into the front-end test interface, and the user selects a recorded session identity. When the selection is completed, the back-end system automatically adjusts the header information and cookie information of the request according to the selected identity and executes the test instruction.
[0027] A system for identity recording, retention and switching for unauthorized testing, comprising the following modules: a session identity recording module, a session retention module, a session identity management module, and a session identity testing module;
[0028] Session identity recording module: guides users to use the built-in browser to log in to the target site as the target identity step by step. The system will record the non-standard request header information and cookie information, and then enter the session maintenance module;
[0029] Session persistence module: according to the requirements of the session persistence policy, it automatically refreshes the keep-alive address periodically and then enters the session identity management module;
[0030] Session identity management module: The configured session identity data will be stored in the static session identity management module for addition, deletion, modification, and search, and then enter the session identity test module;
[0031] Session identity test module: When the user selects or switches the session identity during request interception and data replay, the system automatically modifies the request packet according to the non-standard request header information and cookie information recorded by the selected identity, completing the unauthorized test effect by modifying the test session identity.
[0032] Preferably, the session identity management module records and stores non-standard request header information and Cookie information; the session maintenance strategy includes setting a keep-alive address and setting a keep-alive period.
[0033] Preferably, each module communicates through a data transmission mechanism within the system, and the user interacts with the system through a unified operation interface, which converts the user's input into system commands to control the operation of each module.
[0034] Compared with the prior art, the technical solution of the present invention has the following advantages / benefits:
[0035] 1. Improve testing speed by automating account management and reducing login verification steps.
[0036] 2. Avoids the risk of login restrictions, automatically maintains the session active, and enhances the stability and reliability of the test.
[0037] 3. The session identity management module centrally stores and manages session identity information, improving management efficiency.
[0038] 4. Using modular design, the modules can be flexibly configured and expanded to adapt to various test scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 The present invention is a flow chart of a method for recording, maintaining and switching identities for unauthorized testing.
[0041] Figure 2 is a schematic diagram of an embodiment of the present invention.
[0042] Figure 3 The present invention is a schematic diagram of a system for recording, maintaining and switching identities for unauthorized testing. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. Therefore, the detailed description of the embodiments of the present invention provided below is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention.
[0044] Example 1: In the tests of related functions involving multi-user systems, such as business process tests of multi-user interactions and vertical unauthorized access vulnerability tests, it is often necessary to frequently search and enter the account and password to log in, and when switching the test account to log in, it is necessary to enter the verification code or perform other identity authentication multiple times. Frequent attempts to log in or switch accounts may trigger the website's account lock mechanism, such as the number of SMS authentication restrictions, etc., resulting in forced interruption of the test, and the need to log in to multiple accounts at the same time, and to detect whether vertical unauthorized access is possible by modifying the login credentials of different users. Some accounts may also expire due to long-term inactivity and need to be re-logged in.
[0045] Such a testing process is very cumbersome and greatly reduces the efficiency of the test.
[0046] like Figure 1 As shown, in order to solve the above problems, the present invention provides a method for identity recording, retention and switching for unauthorized testing.
[0047] The following steps are involved:
[0048] Step 1: Use the built-in browser to log in to the target site as the target and record the session identity information, and configure the session persistence policy;
[0049] The configured session retention policy includes the keep-alive address and keep-alive period. After the user logs in to the website with the account and password, the website will mark the session tag. During the session period, the user does not need to log in repeatedly with the account and password. However, when the website finds that the user has not continued to visit after a period of time, for the sake of security and releasing resources, the session will be automatically logged out, and the user will be asked to log in again with the account and password.
[0050] After the user logs in, the website will mark the session as logged in, and the website will have a session expiration time. The expiration time for each website may be different, some are half an hour, and some are 5 minutes. If the session expiration time of a website is 10 minutes, the countdown starts after the user successfully logs in. After 1 minute, the user visits an important business page (a website page that requires login authorization to access, and the address of this page is called a keep-alive address), then the timer will reset the timer, restore the session expiration time to 10 minutes, and restart the countdown. If the user does not visit the core business page after 10 minutes, the website will log out of the session and the user must log in again.
[0051] Therefore, in order to keep the session logged in for a long time, a keep-alive period is set, such as requesting a keep-alive address every 1 minute, and constantly resetting the website's session expiration timer to keep the website session logged in.
[0052] Step 2: The system will record the session identity information and automatically refresh the keep-alive address periodically according to the session retention strategy to maintain the active status of the test account;
[0053] Step 3: Before performing the unauthorized access test, the user selects or switches to a target session identity from the session identity information;
[0054] Step 4: Initiate a specific request or data replay operation to the test site. At this time, the request automatically carries the identity information of the selected session to complete the unauthorized identity test.
[0055] The session identity information in step 1 includes non-standard request header information and cookie information.
[0056] Step 1 uses built-in browser technology to directly capture the login credential information and guide the user to log in to the target system through the built-in browser.
[0057] In step one, the backend system captures and stores these credential data in the database in real time, the static session identity management database, and realizes the initial accumulation of session identities.
[0058] Credential data includes: Cookie, authentication header, Token. This information is associated with the session information saved by the website server. After the user logs in to the website with the account and password, the website randomly generates login credentials such as Cookie or Token, and places this information in the user's browser. When the browser visits the website next time, there is no need to log in again, just carry Cookie or Token to complete the login. Cookie and Token are associated with the user's session information. When the session expires, Cookie and Token will also become invalid.
[0059] Step 2: Through the front-end configuration interface, the user customizes the refresh frequency, and then the back-end automatically sends a request to the target website and maintains the session based on the configuration information, and then stores the policy parameters in the database.
[0060] The policy parameters include the keep-alive address, initial cookie, keep-alive period, and proxy server of the target website that the user needs to configure.
[0061] After the user logs in to the browser with the account and password, a cookie, token and request header authentication information will be randomly generated and sent to the browser. The browser needs to carry this information for subsequent requests. The present invention allows the user to log in through the browser using the account and password, and then records the cookie, token and request header authentication information sent back by the website (referred to as login credentials), and according to the timer set by the user, every certain period of time (keep-alive period), sends the address of the website that can only be accessed after logging in (keep-alive address), so that the expiration countdown timer of the website session is continuously reset to prevent the login status from expiring.
[0062] Step three includes a session management system, where users can query, add, modify and delete session information through a graphical interface. It adopts a front-end and back-end separation design, with the front-end displaying a friendly interface and the back-end connecting to the database to respond to user management needs in real time.
[0063] In step 4, a drop-down menu is integrated in the front-end test interface, and the user selects the recorded session identity. When the selection is completed, the back-end system automatically adjusts the header information and cookie information of the request according to the selected identity and executes the test instructions.
[0064] The present invention reduces the login verification steps, automatically maintains the session, automatically maintains the active status of all test accounts, avoids re-login due to session expiration, improves test continuity, and improves test efficiency.
[0065] The present invention effectively avoids the account lockout problem caused by frequent logins through the automatic session maintenance function, automatically maintains the active status of all test accounts, ensures that the test process will not be interrupted due to session expiration, and enhances stability and reliability.
[0066] Users interact with the system through a unified operating interface, realizing centralized management and operation of test accounts and improving the accuracy and efficiency of operations.
[0067] The present invention not only solves many pain points encountered in traditional unauthorized testing, such as cumbersome account management, frequent login verification, login restriction risks and troublesome identity switching, but also achieves a comprehensive improvement in test efficiency, stability and user experience through a series of innovative designs, providing strong technical support for the field of network security testing.
[0068] Example 2: Figure 2 As shown, a method for recording, maintaining and switching identities for unauthorized testing is to first create a new session, then create a new tab in the browser and open the target URL. Then log in to the test account at the target URL and extract the session information of the current browser, and provide an interface to provide other tools with the session name, description, target URL, cookie information, and non-header information. Then turn on the "maintain session" switch and refresh the page periodically according to the system's "session retention settings". Next, the user tests on other tools:
[0069] If you turn off the "Keep Session" switch, the session refresh will stop;
[0070] If you close the tab, the session is closed;
[0071] If you close a tool, you can directly close other tools and end the entire testing process.
[0072] Example 3: Figure 3 As shown, a system for identity recording, retention and switching for unauthorized testing is constructed based on business processes and consists of four major modules: identity recording, session retention, identity management and unauthorized testing. Each module focuses on its core function and works together.
[0073] It includes the following modules: session identity recording module, session holding module, session identity management module, and session identity testing module;
[0074] Session identity recording module: guides users to use the built-in browser to log in to the target site as the target identity step by step. The system will record the non-standard request header information and cookie information, and then enter the session maintenance module;
[0075] Session persistence module: according to the requirements of the session persistence policy, it automatically refreshes the keep-alive address periodically and then enters the session identity management module;
[0076] Session identity management module: The configured session identity data will be stored in the static session identity management module for addition, deletion, modification, and search, and then enter the session identity test module;
[0077] Session identity test module: When the user selects or switches the session identity during request interception and data replay, the system automatically modifies the request packet according to the non-standard request header information and cookie information recorded by the selected identity, completing the unauthorized test effect by modifying the test session identity.
[0078] The session identity management module records and stores non-standard request header information and Cookie information; the session retention strategy includes setting a keep-alive address and setting a keep-alive period.
[0079] Each module communicates through the system's internal data transmission mechanism. Users interact with the system through a unified operating interface, which converts user input into system commands to control the operation of each module.
[0080] Through the session identity recording module, testers only need to log in once, and there is no need to log in manually frequently in subsequent tests, which reduces operation time.
[0081] The session identity testing module allows users to quickly switch between different session identities during the test process. It is easy to operate and significantly reduces the workload of testers.
[0082] The session identity management module centrally stores and manages all session identity information for easy management.
[0083] And through modular design, the modules of the system can communicate through an efficient data transmission mechanism, support flexible configuration and expansion, adapt to different testing requirements and environmental changes, and improve the versatility and future applicability of the system.
[0084] Since Web authentication mostly relies on Cookies and specific HTTP headers, the present invention adopts built-in browser technology to directly capture the credential information at the time of login, and designs an intuitive guidance interface to guide users to log in to the target system through the built-in browser. At the same time, the back-end system captures and stores these credential data in the database in real time, realizing the initial accumulation of session identity.
[0085] Considering that user interaction can prevent session expiration in actual use, the present invention innovatively introduces a periodic automatic refresh mechanism to simulate user active behavior. Through the front-end configuration interface, users can customize the refresh frequency, and the back-end automatically sends requests to the target website based on these configurations to maintain the session, and also stores these policy parameters in the database, ensuring the continuous availability of the test account.
[0086] In view of the actual needs of unauthorized testing, the present invention simplifies the switching process of test accounts. The front-end test interface integrates a drop-down menu, allowing users to quickly select a recorded session identity. Once the session identity is selected, the back-end system automatically adjusts the header information and cookies of the request according to the selected identity, and seamlessly executes the test instructions, which greatly speeds up the test process and ensures the accuracy and convenience of the test.
[0087] The above are only preferred embodiments of the present invention. It should be noted that the above preferred embodiments should not be regarded as limiting the present invention, and the protection scope of the present invention should be based on the scope defined by the claims. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the spirit and scope of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A method for recording, maintaining and switching session identities for unauthorized testing, characterized in that: The following steps are involved: Step 1: Use the built-in browser to log in to the target site as the target user and record the session identity information. Then, configure the session persistence policy, including the keepalive address and keepalive period. Step 2: The system records the session identity information and automatically refreshes the keepalive address periodically according to the session persistence policy to maintain the active status of the test account; Step 3: Before performing the unauthorized access test, the user selects or switches to the target session identity from the session identity information; Step 4: Initiate a data replay operation on the test site. At this time, the request automatically carries the identity information of the selected session to complete the unauthorized identity test.
2. The method for recording, maintaining and switching session identities for unauthorized testing according to claim 1, wherein: The session identity information in step 1 includes non-standard request header information and cookie information.
3. The method for recording, maintaining and switching session identities for unauthorized testing according to claim 1, wherein: The step 1 uses built-in browser technology to directly capture the credential information during login and guide the user to log in to the target system through the built-in browser.
4. The method for recording, maintaining and switching session identities for unauthorized testing according to claim 1, wherein: In step 1, the back-end system used accumulates session identities by capturing and storing these credential data in a database in real time; the credential data includes cookies, authentication headers, and tokens.
5. The method for recording, maintaining and switching session identities for unauthorized testing according to claim 4, characterized in that: In step 2, the user customizes the refresh frequency through the front-end configuration interface, and then the back-end automatically sends a request to the target website and maintains the session based on the configuration information, and then stores the policy parameters in the database; the policy parameters include the keep-alive address, initial cookie, keep-alive period, and proxy server that the user needs to configure for the target website.
6. The method for recording, maintaining and switching session identities for unauthorized testing according to claim 5, characterized in that: Step three includes a session management system, where users can query, add, modify, and delete session information through a graphical interface. The system adopts a front-end and back-end separation design, with the front-end displaying a friendly interface and the back-end connecting to a database to respond to user management needs in real time.
7. The method for recording, maintaining and switching session identities for unauthorized testing according to claim 6, wherein: In step 4, the front-end test interface used integrates a drop-down menu, and the user selects the recorded session identity. When the selection is completed, the back-end system automatically adjusts the header information and cookie information of the request according to the selected identity and executes the test instructions.
8. A system for recording, maintaining, and switching session identities for unauthorized testing, for implementing the method of claim 1, characterized in that: It includes the following modules: session identity recording module, session maintenance module, session identity management module, and session identity testing module; Session identity recording module: guides users step by step to use the built-in browser to log in to the target site as the target identity. The system will record non-standard request header information and cookie information, and then enter the session persistence module; Session persistence module: According to the requirements of the session persistence policy, it automatically refreshes the keep-alive address periodically and then enters the session identity management module; Session Identity Management Module: The configured session identity data will be stored in the session identity management module for addition, deletion, modification, and search, and then enter the session identity test module; Session identity testing module: When the user selects or switches the session identity during request interception and data replay, the system automatically modifies the request packet based on the non-standard request header information and cookie information recorded by the selected identity, completing the unauthorized test by modifying the test session identity.
9. The system for recording, maintaining and switching session identities for unauthorized testing according to claim 8, characterized in that: The session identity management module records and stores non-standard request header information and Cookie information; the session maintenance strategy includes setting a keep-alive address and setting a keep-alive period.
10. The system for recording, maintaining and switching session identities for unauthorized testing according to claim 8, characterized in that: The modules communicate with each other through the data transmission mechanism within the system. Users interact with the system through a unified operation interface, which converts user input into system commands to control the operation of each module.
