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

Fix #17969 Assign empty hash to variable status #17970

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

YiDa858
Copy link
Contributor

@YiDa858 YiDa858 commented May 7, 2023

Assign a nil value to the variable status to fix issue #17969

@bcoles
Copy link
Contributor

bcoles commented May 7, 2023

This fixes the crash although is unlikely to fix the underlying issue.

What caused a code path with a nil status to be reached?

@YiDa858
Copy link
Contributor Author

YiDa858 commented May 7, 2023

The variable is assigned in the loop. When the loop ends, status['status'] will be accessed.
If I don't assign the variable before the loop begin, status['status'] is always undefined according to the output.

plugins/nessus.rb Outdated Show resolved Hide resolved
@gwillcox-r7
Copy link
Contributor

@YiDa858 Any update on implementing the suggested fix from @cdelafuente-r7 and testing it out?

@sjanusz-r7
Copy link
Contributor

sjanusz-r7 commented Sep 11, 2023

I've implemented the suggested change nil -> {}.

nessus_db_import

Before (throws):

msf6 > nessus_scan_list -c
Scan ID  Name                    Owner  Started  Status     Folder
-------  ----                    -----  -------  ------     ------
5        My Host Discovery Scan  msf             canceled   3
8        My Basic Network Scan   msf             canceled   3
14       MyNewScan               msf             completed  3

msf6 > nessus_db_import 14
[*] Exporting scan ID 14 is Nessus format...
[+] The export file ID for scan ID 14 is 940963288
[*] Checking export status...
[*] Export status: loading
[*] Export status: ready
[-] Error while running command nessus_db_import: undefined local variable or method `status' { ... }

After (works):

msf6 > nessus_scan_list -c
Scan ID  Name                    Owner  Started  Status     Folder
-------  ----                    -----  -------  ------     ------
5        My Host Discovery Scan  msf             canceled   3
8        My Basic Network Scan   msf             canceled   3
14       MyNewScan               msf             completed  3

msf6 > nessus_db_import 14
[*] Exporting scan ID 14 is Nessus format...
[+] The export file ID for scan ID 14 is 1751507142
[*] Checking export status...
[*] Export status: loading
[*] Export status: ready
[*] The status of scan ID 14 export is ready
[*] Importing scan results to the database...
[*] Importing data of 192.168.207.132
[+] Done

nessus_scan_export

Before (throws):

msf6 > nessus_scan_export 14 'Nessus'
[+] The export file ID for scan ID 14 is 1254750517
[*] Checking export status...
[*] Export status: loading
[*] Export status: ready
[-] Error while running command nessus_scan_export: undefined local variable or method `status' { ... }

After (works):

msf6 > nessus_scan_export 14 'Nessus'
[+] The export file ID for scan ID 14 is 187847318
[*] Checking export status...
[*] Export status: loading
[*] Export status: ready
[+] The status of scan ID 14 export is ready

@sjanusz-r7 sjanusz-r7 changed the title Fix #17969 Assign a nil value to variable status Fix #17969 Assign empty hash to variable status Sep 11, 2023
@sjanusz-r7 sjanusz-r7 merged commit 0fcba5e into rapid7:master Sep 11, 2023
32 checks passed
@sjanusz-r7 sjanusz-r7 added the rn-fix release notes fix label Sep 11, 2023
@sjanusz-r7
Copy link
Contributor

Release Notes

Fixed an error in nessus_db_import and nessus_scan_export commands that prevented them from completing successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin rn-fix release notes fix
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants