Abstract
The rapid rise of "super-apps" like WeChat, TikTok, and Alipay has introduced a new paradigm of mini-apps—lightweight applications running within a host platform. This study investigates a systemic security flaw where developers mistakenly migrate sensitive server-side credentials into mini-app clients. We present KeyMagnet, a framework that uses semantic analysis to bridge the gap between intended and actual credential usage. By analyzing over 413,000 mini-apps across 21 platforms, we identified over 84,000 credential leaks in 54,728 apps, leading to 89 confirmed CVEs and demonstrating significant risks of account hijacking and sensitive data theft.
The Problem: Credential Migration
Super-apps provide a variety of sensitive services—such as payment processing, cloud storage, and user analytics—to mini-app developers. To access these services securely, the super-app platform issues credentials that are strictly intended to be stored and used on the developer's secure back-end server.
However, to reduce latency or server costs, or simply due to a lack of security expertise, many developers "migrate" these credentials directly into the mini-app client code. This exposure allows a malicious user to extract these "skeleton keys" from the client and use them to access sensitive super-app services directly, bypassing intended security boundaries. Existing security tools often fail to detect these leaks because the credentials lack fixed patterns and are often handled dynamically within the code.
Methodology: The KeyMagnet Framework
To address the challenge of identifying unstructured and dynamic credential leaks, we developed KeyMagnet. The framework operates in three primary stages to identify discrepancies between documented security requirements and real-world implementation.
- Server-side Credential Semantic Analysis: KeyMagnet automatically scrapes and parses official developer documentation from super-app platforms. It constructs a Credential-use Semantic Graph (CSG) that defines the "ground truth" for how specific APIs and credentials should be used (e.g., identifying which calls must originate from a server).
- Client-side Credential Semantic Analysis: The tool performs fine-grained data flow analysis on mini-app client code. By combining static code examination with dynamic simulation of user interactions, it builds a Client-side Behavior Graph (CBG) representing the actual data flows within the app.
- Semantic-based Similarity Analysis: Finally, KeyMagnet performs graph matching between the CSG and CBG. When a client-side behavior matches a pattern reserved for server-side operations, the tool flags a credential leakage.
Dataset and Large-Scale Analysis
Our study involved a massive crawl of the mini-app ecosystem using a custom tool, MiniCrawler. We collected a total of 413,775 mini-apps from 21 major platforms, including WeChat (214k), Baidu (86k), Alipay (93k), and TikTok (15k). This diverse dataset allowed us to categorize seven distinct types of leaked credentials, ranging from root credentials capable of deriving other keys to cryptographic keys used for sensitive user data encryption.
Key Findings and Impact
The scale of the vulnerability is significant. KeyMagnet identified 84,491 leaks affecting 54,728 unique mini-apps. The tool demonstrated high efficacy with 95.04% precision and 85.56% recall.
- Vulnerable Ecosystems: A major source of leakage stems from insecure third-party development templates. Vulnerabilities in a single popular template can propagate to tens of thousands of derivative apps.
- Cross-Platform Contamination: We observed instances where credentials for one platform (e.g., WeChat) were leaked within the mini-app version hosted on a different platform (e.g., Baidu).
- Real-World Exploitation: We confirmed the severity of these leaks by demonstrating account hijacking in a high-profile logistics app with over 100,000 users. By exploiting a leaked
encryptKey, we bypassed "One-Click Login" to access private user data, including health status and billing addresses.
Conclusion and Future Work
The "skeleton key" phenomenon represents a systemic failure in the mini-app security model. Our findings resulted in the assignment of 89 CVE IDs, prompting widespread patching efforts. While KeyMagnet is highly effective, future work will focus on improving dynamic coverage to bypass complex registration walls and handling custom encrypted network traffic. We aim to integrate reinforcement learning to further automate the exploration of mini-app behaviors across global platforms.
Summary updated