Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save only unique intent priorities in findings #2474

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@
'name': 'Data SMS Receiver Set on Port: %s Found. [android:port]',
},
'high_intent_priority_found': {
'title': 'High Intent Priority (%s)<br>[android:priority]',
'title': 'High Intent Priority (%s) - {%s} Hit(s)<br>[android:priority]',
'level': 'warning',
'description': ('By setting an intent priority higher than another'
' intent, the app effectively overrides '
'other requests.'),
'name': 'High Intent Priority (%s). [android:priority]',
'name': 'High Intent Priority (%s) - {%s} Hit(s) [android:priority]',
},
'high_action_priority_found': {
'title': 'High Action Priority (%s)<br>[android:priority] ',
Expand Down
10 changes: 8 additions & 2 deletions mobsf/StaticAnalyzer/views/android/manifest_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,12 +761,18 @@ def manifest_analysis(app_dic, man_data_dic):
dataport = data.getAttribute(f'{ns}:port')
ret_list.append(('sms_receiver_port_found', (dataport,), ()))
# INTENTS
processed_priorities = {}
for intent in intents:
if intent.getAttribute(f'{ns}:priority').isdigit():
value = intent.getAttribute(f'{ns}:priority')
if int(value) > 100:
ret_list.append(
('high_intent_priority_found', (value,), ()))
if value not in processed_priorities:
processed_priorities[value] = 1
else:
processed_priorities[value] += 1
for priority, count in processed_priorities.items():
ret_list.append(
('high_intent_priority_found', (priority, count,), ()))
# ACTIONS
for action in actions:
if action.getAttribute(f'{ns}:priority').isdigit():
Expand Down
Loading