Skip to content

Commit ab0d4e4

Browse files
committed
strict port check
1 parent 62a8f1c commit ab0d4e4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mobsf/MobSF/security.py

+5
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ def valid_host(host):
271271
path = parsed.path
272272
query = parsed.query
273273
params = parsed.params
274+
port = parsed.port
274275

275276
# Allow only http and https schemes
276277
if scheme not in ('http', 'https'):
@@ -280,6 +281,10 @@ def valid_host(host):
280281
if not hostname:
281282
return False
282283

284+
# Validate port - only allow 80 and 443
285+
if port and port not in (80, 443):
286+
return False
287+
283288
# Check for URL credentials
284289
if '@' in domain:
285290
return False

0 commit comments

Comments
 (0)