-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Vulnerability Report Enhancement #20424
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
Vulnerability Report Enhancement #20424
Conversation
Gemfile
Outdated
| gem 'metasploit_data_models', git: 'git@github.com:cdelafuente-r7/metasploit_data_models.git', branch: 'MS-9930_resource_layered_services' | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been added to make testing possible before the metasploit_data_models PR is landed. This will need to be removed before landing this PR
Neat. Is there any way we can do this programmatically? Automatically populating vulnerabilities for every module which returns |
| service = (port ? host.services.find_by_port(port.to_i) : nil) | ||
|
|
||
| vuln_info[:service] = service if service | ||
| if session.exploit.respond_to?(:service_details) && session.exploit.service_details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This takes advantage of the #service_details method, which some modules implement. For now, the lib/msf/core/exploit/remote/http_client.rb mixin implement it. Maybe we can enforce exploit modules to implemented it in the future.
For example:
https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/tomcat_mgr_upload.rb#L428
https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/exploit/remote/http_client.rb#L932
|
@bcoles, See the previous implementation: https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/ui/console/module_command_dispatcher.rb#L177 |
0b71adf to
3a8499a
Compare
Thanks. I tried to verify this before posting, but as usual the database config is broken in my dev environment. |
43f4854 to
7a41ca5
Compare
46d565c to
2df584b
Compare
2df584b to
7f876c6
Compare
lib/msf/core/db_manager/service.rb
Outdated
| return | ||
| end | ||
| service_obj.state ||= Msf::ServiceState::Open | ||
| service_obj.info ||= '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably propagate the service info here.
| service_obj.info ||= '' | |
| service_obj.info = service[:info] if service[:info] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the heads up. This has been addressed in b628c75
|
Will hold off on landing this until the following is resolved. |
|
I also tested the
Everything seems to be backwards compatible and worked as expected: |
|
The last commit (d9d4e6d) fixes a bug found by @smcintyre-r7 (see cdelafuente-r7#4 (comment)). The issue was that deleting a service automatically delete its children via |
6f55274 to
12323eb
Compare
|
Everything seems to be working as intended. The previous issue has also been fixed and services can now be deleted in bulk: |
Release NotesUpdates how vulnerabilities and services are reported by adding a resource field to both models. It also add a parents field to make layered services possible. An optional resource field can now be provided and the existing service field has been updated to also accept an option hash. |
a29034f to
baeb61f
Compare
- update `#report_service` and `#report_vuln` - update vulnerability report when a session is established - update CheckCode and `#cmd_check` to report a vulnerability when Vulnerable checkcode is returned - update `vulns` and `services` commands to display the `resource` and parent services - specs
baeb61f to
fbea976
Compare
|
CI failures unrelated to these changes. |





This PR updates how vulnerability and services are reported by adding a
resourcefield to both models. It also add aparentsfield to make layered services possible.This PR needs to be landed prior this one.
Description
#report_serviceand#report_vulnhave been updated to add the necessary logic for resources and layered services. An optionalresourcefield can now be provided and the existingservicefield has been updated to also accept an option hash. For example:Services can also include a
resource. Note that this field is not validated and any key/value pair is accepted, as long as it is a valid hash. It will be serialized and stored as a JSONB in the database.Services can also have parents to better describe the service layers. For example:
This can be set from a call to
#report_service:or calling
#report_vuln:Note that a service can have multiple parents (e.i.
Web Appcan haveHTTPandHTTPSparent services). An array of hashes can be passed as a value of theparentskey:This PR updates the way a vulnerability is reported report when a session is established and adds the service used by the exploit that got a session.
It updates
CheckCodeand thecheckcommand to report a vulnerability when aVulnerablecheckcode is returned. It is now possible to pass avulnargument with the vulnerability details that will be passed to#report_vuln:Finally, it updates the
vulnsandservicescommands to display theresourceand parent services.Verification
./msfdb reinitto update the schemamsfconsolecheckand make sure it returns aVulnerableCheckCodevulnscommandservicescommand (alsoservices -vreport_vulnfollowing the new schema (see above)vulnscommandservicescommandScenarios