QQ Music sign value reverse engineering practice: cracking the signature algorithm packaged by Webpack
🎯 Actual goal: capture QQ Music PC TOP list page (https://y.qq.com/n/ryqq/toplist/62)中,接口请求携带的`sign`parameters and restore its generation process. 🧩 Applicable scenarios: front-end applications using modular packaging tools such as Webpack, a general reverse analysis method that hides core logic.
1. Preliminary analysis: looking for encryption entrance
1.1 Network request positioning
Open the Network panel of Chrome DevTools and refresh the list page. Enter in the filter boxmusics.fcgQuickly filter the request and you can see that this interface returns list data. Click on the request details and view the Payload tag. You will find several key parameters:
Obviously,signis a dynamically generated check value, and our goal is to find its generating function and simulate it.
1.2 Initial exploration of global variable search
Traditional reverse engineering usually searches globally directly in the Sources panel.sign, or try printing possible global variables in the Console. Try this first:
window.dddexists and is a function, but_PBut couldn't find it. This implies that QQ Music uses modular packaging and the core functions are encapsulated internally.
💡 Practical Tips: The difficulty in reversing modern front-end frameworks often lies not in the algorithm itself, but in how to extract the target function from the "black box" packaged by Webpack.
2. General identification and analysis of Webpack architecture
2.1 Quick judgment of Webpack features
QQ Music uses the extremely common Webpack modular packaging. It can be quickly identified through these characteristics:
- Open the JS file loaded by the page (usually large in size, hundreds of KB to several MB) and search
__webpack_require__or an older version of the keywordwebpackJsonp; - Enter in the Console
window.webpackJsonp, if it returns an array/function, it can basically be determined to be packaged by Webpack; - If none of the above are found, pay attention to see if there are similar
window.ddd(0)This custom exposed loading entry.
2.2 Customize the Webpack structure of the exposed entry
QQ Music does not use the defaultwebpackJsonpglobal array, but exposedwindow.dddas a loader. After restoration, its core structure is roughly as follows (this is a simplified version refined during reverse engineering, not the original compressed code):
After understanding this structure, we know that as long as the Hook loader is used, we can "peep" what's inside the module when it is exported.
3. Reverse positioning_PSteps to Signature Function
3.1 Find and trigger module loading
Confirm firstwindow.dddactual usage. In the Network panel,musics.fcgHit an XHR breakpoint at the location before launching (Sources > XHR/fetch Breakpoints Add/cgi-bin/musics.fcg), the page will stop before the request is sent after refreshing. Observing the call stack, you can find calls like this:
In other words, the entire module system needs to load the module with ID 0 for initialization before other modules can be used.
3.2 Hook loader, tracking exported modules
Now, we write a simple Hook script in the Console to letwindow.dddPrint the log every time the module is loaded, and check whether the export contains what we are thinking about_P:
After running, if the console appears✅ 找到 _P 签名函数所在模块!warning indicates that the positioning is successful. At this point you can directly view the exported objects of the module, which include_Pmethod. Next, you only need to dig out the relevant code and analyze the algorithm logic.
4. Frequently asked questions and solutions
4.1 Incomplete environment completion
when you try to put_PWhen a function is simulated and called in Node.js, there is a high probability of encounteringxxx is not definederror. This is because the module uses global objects in the browser environment (such aswindow、navigator、documentwait).
The solution is in two steps:
- Locate missing items: Find the missing browser objects or methods one by one based on the error message;
- Construct simulation object: Add the corresponding simulation code at the top of the script. For example:
💡 Advanced skills: can be used
ProxyProxy an empty object and intercept access to unknown properties, so that you can quickly know what properties the code reads and avoid writing a bunch of useless completions.
5. Summary
The core of this reverse engineering practice is not how complex a certain encryption algorithm is, but rather demonstrates a set of general reverse process for Webpack packaging architecture:
- Locate the core interface and encryption parameters through the Network panel;
- Global search to find the custom module loader (here
window.ddd); - Hook loader, checks whether the target function is included when the module is exported (
_P); - Extract the module code, complete the necessary browser environment, and finally reproduce the signature in any JS environment.
As long as you master this idea, you can handle it calmly whether it is QQ Music or other front-end applications that are also packaged with Webpack and only expose custom loading entries. I wish you success on your reverse journey!

