iOS LLM API Key Leakage
Abstract
The rapid integration of large language models (LLMs) into mobile applications has introduced a new class of credential security risk: leaked credentials that grant unauthorized access to LLM inference services, which can cause financial damage to the developer side. Prior work has studied credential leakage across various platforms, with a primary focus on Android Apps. However, to date, no empirical study has systematically investigated how LLM API key leakage occurs in iOS applications. In this paper, we conducted the first in-depth empirical study of API key leakage in LLM-integrated applications. We constructed a high-quality dataset of 444 iOS applications by filtering from 1092 candidate apps through a standardized evaluation process. To capture key leakage, we developed LLMKeyLens, a dynamic analysis framework that detects LLM API key leakage in iOS applications. LLMKeyLens automates traffic interception, provider-specific key extraction, and active validity confirmation, requiring neither source code access nor binary decryption. We apply LLMKeyLens to 444 applications. Our analysis reveals that 282 applications expose exploitable LLM API credentials in network traffic, spanning at least ten LLM providers. We identify three distinct leakage patterns. The most prevalent is JWT-based token leakage (48%), followed by unauthenticated backend proxy access (33%) and plaintext API key transmission (19%). To assess remediation effectiveness, we re-analyzed the same 282 vulnerable applications three months after responsible disclosure. Comparing the two scans, only 28% of applications had remediated the reported vulnerability, while 72% remained exploitable. The persistent vulnerabilities stem from unauthenticated backends and broken JWT implementations. Our findings reveal that LLM API key leakage is both prevalent and persistent in the iOS ecosystem, exposing a systemic gap between real-world developer practice and secure integration principles. With only 28% of vulnerable applications remediated after disclosure, our results suggest that secure LLM integration requires not only developer awareness but also explicit security guidance from providers and platform-level enforcement mechanisms.