Evaluating Large Language Models in detecting Secrets in Android Apps
Preprint
Abstract
Mobile apps often embed authentication secrets, such as API keys, tokens, and client IDs, to integrate with cloud services. However, developers often hardcode these credentials into Android apps, exposing them to extraction through reverse engineering. Once compromised, adversaries can exploit secrets to access sensitive data, manipulate resources, or abuse APIs, resulting in significant security and financial risks. Existing detection approaches, such as regex-based analysis, static analysis, and machine learning, are effective for identifying known patterns but are fundamentally limited: they require prior knowledge of credential structures, API signatures, or training data. In this paper, we propose SecretLoc, an LLM-based approach for detecting hardcoded secrets in Android apps. SecretLoc goes beyond pattern matching; it leverages contextual and structural cues to identify secrets without relying on predefined patterns or labeled training sets. Using a benchmark dataset from the literature, we demonstrate that SecretLoc detects secrets missed by regex-, static-, and ML-based methods, including previously unseen types of secrets. In total, we discovered 4828 secrets that were undetected by existing approaches, discovering more than 10 "new" types of secrets, such as OpenAI API keys, GitHub Access Tokens, RSA private keys, and JWT tokens, and more. We further extend our analysis to newly crawled apps from Google Play, where we uncovered and responsibly disclosed additional hardcoded secrets. Across a set of 5000 apps, we detected secrets in 2124 apps (42.5%), several of which were confirmed and remediated by developers after we contacted them. Our results reveal a dual-use risk: if analysts can uncover these secrets with LLMs, so can attackers. This underscores the urgent need for proactive secret management and stronger mitigation practices across the mobile ecosystem.Keywords
All Related Versions
This publication has 10 references indexed in Scilit:
- Automatically Detecting Checked-In Secrets in Android Apps: How Far Are We?Empirical Software Engineering, 2025
- LAMD: Context-Driven Android Malware Detection and Classification with LLMs2025
- How far are app secrets from being stolen? a case study on androidEmpirical Software Engineering, 2025
- AppPoet: Large language model based android malware detection via multi-view prompt engineeringExpert Systems with Applications, 2024
- Improving Logic Bomb Identification in Android Apps via Context-Aware Anomaly DetectionIEEE Transactions on Dependable and Secure Computing, 2024
- A Credential Usage Study: Flow-Aware Leakage Detection in Open-Source ProjectsIEEE Transactions on Information Forensics and Security, 2023
- InviSeal: A Stealthy Dynamic Analysis Framework for Android SystemsDigital Threats: Research and Practice, 2023
- Optimizing Leak Detection in Open-source Platforms with Machine Learning Techniques2021
- How Bad Can It Git? Characterizing Secret Leakage in Public GitHub Repositories2019
- AndroZoo2016