cqu-login-password-reverse
Overview
This article is an article focusing on the Chongqing University Unified Identity Authentication System (authserver.cqu.edu.cn) front-end password encryption reverse engineering practical notes. We will use the browser developer tools to find the encryption entry step by step, disassemble its internal logic, and finally use Python to completely reproduce the encryption process and simulate the login request.
The target system uses a common AES-128-CBC mode for password encryption, and combines the salt value prefix and random IV generated by a custom random character set, so that the ciphertext generated by the same plaintext password is different every time it is encrypted, effectively preventing attacks such as rainbow tables.
Disclaimer: This article is only used to learn and research front-end reverse technology. Please do not use the methods in this article for any illegal means. When using it, you should comply with the school's network and information security regulations.
Browser reverse analysis: locating encrypted entrance
First, we need to find the core code of password encryption through Chrome DevTools (other modern browsers operate similarly).
Step 1: Open the login page and developer tools
Visit the login page:http://authserver.cqu.edu.cn/authserver/login
pressF12Open the developer tools, switch to the Network panel, and check Preserve log to prevent the request record from being lost after the page jumps.
Step 2: Trigger login and capture packets
Enter an arbitrary username and password (Do not use a real password, it is only used to trigger the request) and click the "Login" button. At this point you will see aPOSTRequest, filter keywordsloginYou can locate it quickly.
The core parameters of the request include:
username: clear text usernamepassword: A string of Base64-encoded ciphertextlt、dllt、executionWait for one-time parameters
focus onpasswordway of generating.
Step 3: Locate the encryption function
trackpasswordThe following common methods are used to generate parameters:
- Network panel search: Enter in the search box
encryptorpwdDefaultEncryptSalt(common encryption salt name), you can quickly find relevant code snippets. - XHR breakpoint + call stack traceback: Add one on the right side of the Sources panel
XHR/fetch Breakpoint, the breakpoint URL is set to*login*, click Login again. The request will be paused before being sent. At this time, trace upward through the Call Stack on the right, and you can find the JavaScript code that initiated the encrypted call.
Eventually, we will embed the<script>The complete encryption logic is located within the tag.
Core dismantling of encryption process
The located encryption code mainly consists of three parts, which are analyzed one by one below.
1. AES-128-CBC underlying implementation
The system directly uses the classic CryptoJS library to encapsulate AES encryption. The core functions are as follows:
Key Points:
- Key length is fixed at 16 bytes (corresponds to AES-128)
- Encryption mode is CBC, padding method is Pkcs7
- The encryption result is directly converted into a Base64 string, which is the same as what is seen in the packet capture.
passwordConsistent format
2. Custom random string generation
In order to make the encryption result of the same password different every time, the system uses a character set that removes confusing characters to generate random salt values and IVs.
As you can see, the character set has been removedoOLl、9gq、Vv、Uu、I1These easily confused characters can avoid errors during display or debugging.
3. Password encryption main function
main functionencryptAESIt is the entrance to the front-end call, which combines the random salt prefix, original password, random IV and fixed key:
Processing Flow:
- Generate a 64-bit random string as the salt prefix
- will
随机前缀 + 明文密码Splicing to obtain the data to be encrypted - Generate a 16-digit random string as IV
- Use the fixed key issued by the background (
aesKey) for AES-128-CBC encryption
Complete reproduction of the login process
To simulate a complete login, in addition to the encrypted password, you also need to obtain the encryption key dynamically issued by the server and the one-time parameters required for login from the login page (such aslt、execution)。
Preparation
- Install the required Python libraries:
Tips:
PyExecJSRely on local Node.js environment, please make sure Node.js is installed.
- Organize the front-end encryption code into an independent JS file and save it as
cqu_encrypt.js. Note: If executed in Node.js environment, you need to keeprequire("crypto-js")statement; if you copy the browser code directly, you may need to make corresponding adjustments. It is recommended to install crypto-js in the same directory first:
Python complete code
The following code will be completed: get the login page → extract the key and parameters → call JS encryption → send a simulated login request.
Supporting front-end JS code (cqu_encrypt.js)
Security analysis and precautions
- Key Exposure Risk: Encryption Key
pwdDefaultEncryptSaltWritten directly in the login page's JavaScript in clear text, any attacker with access to the login page can obtain it. This makes front-end encryption mainly play a role in preventing the leakage of plain text logs, but cannot resist the threat of man-in-the-middle attacks or active key extraction. - Randomness Design: A 64-bit random salt value is spliced in front of the password during each encryption, and then a random IV is used for CBC encryption. This ensures that the same password generates different ciphertext each time, effectively resisting rainbow table attacks and increasing the difficulty of ciphertext comparison and analysis.
- Transport Layer Security: Current access uses the HTTP protocol. Even if the password is encrypted, the entire session flow is still exposed to the unencrypted channel, and there is a risk of being tampered with or stolen by a middleman. It is recommended that the system be upgraded to HTTPS to provide transport layer protection.
- Learning Purpose: This article is for technical communication only. Please do not use the method for illegal purposes. Unauthorized testing of the system may violate laws, regulations and school rules.
Summarize
This article locates the front-end encryption code of Chongqing University’s unified identity authentication system through browser developer tools, disassembles the AES-128-CBC encryption mode, custom random salt value and IV generation logic in detail, and uses Python + PyExecJS to completely reproduce the password encryption process, and finally realizes a simulated login request.
This is a very typical front-end encryption case for unified identity authentication in universities/enterprises. After mastering this analysis idea and reproduction method, you can quickly respond to the reverse needs of similar systems. I hope this tutorial can provide some help for your front-end reverse learning journey.
Reminder again: Please study and test relevant technologies under the premise of legality and compliance.

