{"id":"PYSEC-2026-3690","summary":"MobSF has SSRF port restriction bypass in assetlinks_check","details":"## Summary\n\nMobSF's Android App Link assetlinks checker validates only the manifest `android:host` value with `valid_host()`, but then appends the separate `android:port` value into the URL used for the server-side request. This bypasses the current port restriction in `valid_host()` and lets a crafted APK cause MobSF to fetch `http://host:\u003cattacker-port\u003e/.well-known/assetlinks.json` or `https://host:\u003cattacker-port\u003e/.well-known/assetlinks.json`.\n\n## Impact\n\nAn 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.\n\nThis 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.\n\n## Root cause\n\n`valid_host()` rejects ports other than 80 and 443 when a port is included in the string being validated:\n\n```python\nport = parsed.port\n...\nif port and port not in (80, 443):\n    return False\n```\n\nIn `get_browsable_activities()`, only the host attribute is passed to `valid_host()`:\n\n```python\nhost = data.getAttribute(f'{ns}:host')\nport = data.getAttribute(f'{ns}:port')\n...\nif not valid_host(host):\n    logger.warning('Invalid Host: %s', host)\n    continue\nshost = f'{scheme}://{host}'\nif port and is_number(port):\n    c_url = f'{shost}:{port}{WELL_KNOWN_PATH}'\nelse:\n    c_url = f'{shost}{WELL_KNOWN_PATH}'\nwell_known[c_url] = shost\n```\n\n`_check_url()` then fetches the assembled URL after checking only path, query, and params:\n\n```python\npurl = urlparse(url)\nif (purl.path != WELL_KNOWN_PATH\n    or len(purl.query) \u003e 0\n        or len(purl.params) \u003e 0):\n    logger.warning('Invalid Assetlinks URL: %s', url)\n    continue\nr = requests.get(url,\n                 timeout=5,\n                 allow_redirects=False,\n                 proxies=proxies,\n                 verify=verify)\n```\n\n## Reproduction\n\nUse an Android manifest with a browsable App Link data tag that has a benign-looking host and a restricted port:\n\n```xml\n\u003cactivity android:name=\".DeepLink\" android:exported=\"true\"\u003e\n  \u003cintent-filter\u003e\n    \u003caction android:name=\"android.intent.action.VIEW\" /\u003e\n    \u003ccategory android:name=\"android.intent.category.BROWSABLE\" /\u003e\n    \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n    \u003cdata android:scheme=\"http\" android:host=\"rebind.example\" android:port=\"22\" /\u003e\n  \u003c/intent-filter\u003e\n\u003c/activity\u003e\n```\n\nA safe local proof with DNS and HTTP monkeypatching shows that MobSF validates only `rebind.example`, then fetches a URL that preserves the unchecked port:\n\n```text\nwell_known map: {'http://rebind.example:22/.well-known/assetlinks.json': 'http://rebind.example'}\nrequests.get calls: [('http://rebind.example:22/.well-known/assetlinks.json', {'timeout': 5, 'allow_redirects': False, 'proxies': None, 'verify': True})]\nfindings: [{'url': 'http://rebind.example:22/.well-known/assetlinks.json', 'host': 'http://rebind.example', 'status_code': 200, 'status': True}]\nVULNERABLE: valid_host validated only rebind.example, but assetlinks_check fetched unchecked port 22 via http://rebind.example:22/.well-known/assetlinks.json\n```\n\nThe same code pattern is present in latest release `v4.4.6` and current main.\n\n## Remediation\n\nValidate the final URL after all manifest components have been applied. In particular:\n\n1. Build `c_url`, then run validation on the full URL, including scheme, hostname, port, path, query, and params.\n2. Reject `android:port` values other than 80 and 443 before appending them to the URL.\n3. 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.\n4. Keep `allow_redirects=False` for the existing redirect mitigation.","aliases":["CVE-2026-68927","GHSA-95px-34x5-p37h"],"modified":"2026-08-19T12:45:09.684313274Z","published":"2026-08-19T11:56:27.673423Z","references":[{"type":"WEB","url":"https://github.com/MobSF/Mobile-Security-Framework-MobSF/security/advisories/GHSA-95px-34x5-p37h"},{"type":"WEB","url":"https://github.com/MobSF/Mobile-Security-Framework-MobSF/pull/2627"},{"type":"WEB","url":"https://github.com/MobSF/Mobile-Security-Framework-MobSF/commit/62563ca429a75b3e5d47a13b958e1d2e7d5e2bbf"},{"type":"PACKAGE","url":"https://github.com/MobSF/Mobile-Security-Framework-MobSF"},{"type":"WEB","url":"https://github.com/MobSF/Mobile-Security-Framework-MobSF/releases/tag/v4.5.1"},{"type":"PACKAGE","url":"https://pypi.org/project/mobsf"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-95px-34x5-p37h"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-68927"}],"affected":[{"package":{"name":"mobsf","ecosystem":"PyPI","purl":"pkg:pypi/mobsf"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.5.1"}]}],"versions":["3.2.6","3.2.7","3.2.8","3.2.9","3.3.3","3.3.5","3.4.0","3.4.3","3.4.6","3.5.0","3.6.0","3.6.9","3.7.6","3.9.7","4.1.3","4.3.0","4.3.2","4.4.0","4.4.2","4.4.5"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/mobsf/PYSEC-2026-3690.yaml"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:L/I:N/A:N"}]}