Skip to content

Commit 84164b4

Browse files
committed
Should also rescue JSON::ParserError for banner parsing
1 parent e1ebc6c commit 84164b4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/auxiliary/scanner/http/gitlab_user_enum.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ def run_host(_ip)
4646
)
4747

4848
if res && res.code == 200 && res.body
49-
version = JSON.parse(res.body)
49+
begin
50+
version = JSON.parse(res.body)
51+
rescue JSON::ParserError
52+
fail_with(Failure::Unknown, 'Failed to parse banner version from JSON')
53+
end
54+
5055
git_version = version['gitlab_version']
5156
git_revision = version['gitlab_rev']
5257
print_good("GitLab version: #{git_version} revision: #{git_revision}")

0 commit comments

Comments
 (0)