Skip to content

Commit d1d3b7a

Browse files
ajinabrahamNick Lupien
and
Nick Lupien
authored
Dep bump + Support HTTPS upgrade for Assetlinks check (#2484)
* Fix false positives caused in Android manifest analysis * Dep bumps + Support HTTPS upgrade for Assetlinks check * MobSF version bump to 4.3.0 --------- Co-authored-by: Nick Lupien <[email protected]>
1 parent 79b2d28 commit d1d3b7a

File tree

4 files changed

+203
-186
lines changed

4 files changed

+203
-186
lines changed

mobsf/MobSF/init.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
logger = logging.getLogger(__name__)
2020

21-
VERSION = '4.2.9'
21+
VERSION = '4.3.0'
2222
BANNER = r"""
23-
__ __ _ ____ _____ _ _ ____
24-
| \/ | ___ | |__/ ___|| ___|_ _| || | |___ \
25-
| |\/| |/ _ \| '_ \___ \| |_ \ \ / / || |_ __) |
26-
| | | | (_) | |_) |__) | _| \ V /|__ _| / __/
27-
|_| |_|\___/|_.__/____/|_| \_/ |_|(_)_____|
23+
__ __ _ ____ _____ _ _ _____
24+
| \/ | ___ | |__/ ___|| ___|_ _| || | |___ /
25+
| |\/| |/ _ \| '_ \___ \| |_ \ \ / / || |_ |_ \
26+
| | | | (_) | |_) |__) | _| \ V /|__ _| ___) |
27+
|_| |_|\___/|_.__/____/|_| \_/ |_|(_)____/
2828
""" # noqa: W291
2929
# ASCII Font: Standard
3030

mobsf/StaticAnalyzer/views/android/manifest_analysis.py

+18-11
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,32 @@ def assetlinks_check(act_name, well_knowns):
8383

8484

8585
def _check_url(host, w_url):
86+
"""Check for the presence of Assetlinks URL."""
8687
try:
8788
iden = 'sha256_cert_fingerprints'
8889
proxies, verify = upstream_proxy('https')
8990
status = False
9091
status_code = 0
9192

92-
r = requests.get(w_url,
93-
timeout=5,
94-
allow_redirects=False,
95-
proxies=proxies,
96-
verify=verify)
93+
urls = {w_url}
94+
if w_url.startswith('http://'):
95+
# Upgrade http to https
96+
urls.add(f'https://{w_url[7:]}')
9797

98-
status_code = r.status_code
99-
if status_code == 302:
100-
logger.warning('302 Redirect detected, skipping check')
101-
status = False
102-
if (str(status_code).startswith('2') and iden in str(r.json())):
103-
status = True
98+
for url in urls:
99+
r = requests.get(url,
100+
timeout=5,
101+
allow_redirects=False,
102+
proxies=proxies,
103+
verify=verify)
104104

105+
status_code = r.status_code
106+
if (str(status_code).startswith('2') and iden in str(r.json())):
107+
status = True
108+
break
109+
if status_code in (301, 302):
110+
logger.warning('Status Code: [%d], Redirecting to '
111+
'a different URL, skipping check!', status_code)
105112
return {'url': w_url,
106113
'host': host,
107114
'status_code': status_code,

0 commit comments

Comments
 (0)