CVE-2026-68927: MobSF: SSRF port restriction bypass in assetlinks_check
Summary
MobSF's Android App Link assetlinks checker validates only the manifest android:host value with validhost(), but then appends the separate android:port value into the URL used for the server-side request. This bypasses the current port restriction in validhost() and lets a crafted APK cause MobSF to fetch http://host:<attacker-port>/.well-known/assetlinks.json or https://host:<attacker-port>/.well-known/assetlinks.json.
Impact
An authenticated user who can upload or trigger analysis of a crafted APK can cause the MobSF server to make an outbound request to an attacker-selected port during Android manifest analysis. When the host is controlled by the attacker and uses DNS rebinding, the validation lookup can resolve to a public IP while the later HTTP client lookup resolves to an internal address, allowing SSRF to internal services on non-80/443 ports.
This is not arbitrary URL SSRF. The path remains fixed to /.well-known/assetlinks.json, and redirects are disabled. The bypass is that the final fetched URL is assembled after the host-only validation, so the current port guard is not applied to the actual URL.
Root cause
validhost() rejects ports other than 80 and 443 when a port is included in the string being validated:
python port = parsed.port ... if port and port not in (80, 443): return False
In getbrowsableactivities(), only the host attribute is passed to validhost():
python host = data.getAttribute(f'{ns}:host') port = data.getAttribute(f'{ns}:port') ... if not validhost(host): logger.warning('Invalid Host: %s', host) continue shost = f'{scheme}://{host}' if port and isnumber(port): curl = f'{shost}:{port}{WELLKNOWNPATH}' else: curl = f'{shost}{WELLKNOWNPATH}' wellknown[curl] = shost
checkurl() then fetches the assembled URL after checking only path, query, and params:
python purl = urlparse(url) if (purl.path != WELLKNOWNPATH or len(purl.query) > 0 or len(purl.params) > 0): logger.warning('Invalid Assetlinks URL: %s', url) continue r = requests.get(url, timeout=5, allowredirects=False, proxies=proxies, verify=verify)
Reproduction
Use an Android manifest with a browsable App Link data tag that has a benign-looking host and a restricted port:
xml <activity android:name=".DeepLink" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="http" android:host="rebind.example" android:port="22" /> </intent-filter> </activity>
A safe local proof with DNS and HTTP monkeypatching shows that MobSF validates only rebind.example, then fetches a URL that preserves the unchecked port:
text wellknown map: {'http://rebind.example:22/.well-known/assetlinks.json': 'http://rebind.example'} requests.get calls: [('http://rebind.example:22/.well-known/assetlinks.json', {'timeout': 5, 'allowredirects': False, 'proxies': None, 'verify': True})] findings: [{'url': 'http://rebind.example:22/.well-known/assetlinks.json', 'host': 'http://rebind.example', 'statuscode': 200, 'status': True}] VULNERABLE: validhost validated only rebind.example, but assetlinkscheck fetched unchecked port 22 via http://rebind.example:22/.well-known/assetlinks.json
The same code pattern is present in latest release v4.4.6 and current main.
Remediation
Validate the final URL after all manifest components have been applied. In particular:
1. Build curl, then run validation on the full URL, including scheme, hostname, port, path, query, and params. 2. Reject android:port values other than 80 and 443 before appending them to the URL. 3. Prevent DNS rebinding by pinning the validated DNS result to the outbound connection or otherwise ensuring the actual HTTP request cannot resolve to a different address than the validation step. 4. Keep allowredirects=False for the existing redirect mitigation.
Other sources
MobSF is a mobile application security testing tool used. Prior to 4.5.1, getbrowsableactivities in mobsf/StaticAnalyzer/views/android/manifestanalysis.py validates only an Android manifest android:host value with validhost before appending a separately supplied android:port to the URL fetched by checkurl, allowing an authenticated user to upload a crafted APK that makes requests to an attacker-selected nonstandard port at /.well-known/assetlinks.json. With an attacker-controlled hostname and DNS rebinding between validation and the requests.get connection, the request can reach an internal service, although redirects remain disabled and the path is fixed. This issue is fixed in version 4.5.1.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/mobsfto a version that resolves this vulnerability.Fixed in 4.5.1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.5.1 - Configuration
Update MobSF so that in android manifest analysis, android:port is validated/restricted (only allow 80 and 443) and the final assembled URL (after applying manifest host + port) is validated, not just the android:host string. Keep allow_redirects=False and the path fixed to /.well-known/assetlinks.json while enforcing the final-URL validation.
MobSF assetlinks_check (Android manifest_analysis.py) android:port handling = Reject any android:port values other than 80 and 443 before appending them to the URL used for the server-side request - Configuration
Modify assetlinks_check to validate the complete URL (scheme, hostname, port, path, query, params) after combining manifest android:host and android:port, so the existing port restriction cannot be bypassed via host-only validation followed by later URL assembly.
MobSF Android App Link assetlinks checking logic URL validation scope = Validate the final assembled URL after all manifest components have been applied - Compensating control
Prevent DNS rebinding between the validation step and the HTTP request by pinning the validated DNS result to the outbound connection, or otherwise ensuring the address resolved for the later requests.get cannot differ from the validation lookup.
Event History
Frequently Asked Questions
Which deployments are realistically exposed?
Instances running MobSF before version 4.5.1 are affected when an authenticated user can upload an APK for static analysis. The issue is exposed through Android manifest processing in the assetlinks_check flow.
What does an attacker need to exploit this?
An attacker needs authenticated access and the ability to submit a crafted APK. Exploitation also requires an attacker-controlled hostname and DNS rebinding between hostname validation and the outbound requests.get connection.
What is the available remediation?
Upgrade MobSF to version 4.5.1. The provided data does not describe an alternative mitigation for installations that cannot be upgraded immediately.
How can I investigate possible exploitation?
Review whether APKs processed before upgrading contained crafted Android manifest host and port values that could cause requests to nonstandard ports. Relevant requests use the fixed path /.well-known/assetlinks.json and do not follow redirects.