← 输入框|github.com|刷新
Skip to content

Nikto parser unable to handle error cases #604

Closed

Description

@EndPositive

🐞 Bug report

Describe the bug

The Nikto parser is unable to properly parse findings when Nikto could not find a webserver (returns error as raw finding).

Steps To Reproduce

With Nikto installed, run a scan on a domain without a running webserver.

apiVersion: execution.securecodebox.io/v1
kind: Scan
metadata:
  name: nuclei-scan
  namespace: securecodebox-scanners
spec:
  parameters:
  - -host
  - google.com
  - -port
  - "8080"
  - -Tuning
  - 1,2,3,5,7,b
  scanType: nikto

Nikto logs

- Nikto v2.1.6
---------------------------------------------------------------------------
+ No web server found on google.com:8080
---------------------------------------------------------------------------
+ 0 host(s) tested

Nikto raw findings

{"id": "000029","OSVDB": "0","url":"/","msg":"No web server found on google.com:8080"}}

Parser logs

Starting Parser
Fetching result file
Fetched result file
Parser failed with error:
TypeError: Cannot read property 'filter' of undefined
    at parse (/home/app/parser-wrapper/parser/parser.js:47:26)
    at main (/home/app/parser-wrapper/parser-wrapper.js:126:22)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Furthermore, running Nikto on an unresolvable domain name, results in an empty raw findings file. Parser crashes with the same error.

Expected behavior

If there are no findings, or if Nikto encounters an error, the parser should not crash. The parser should create a finding of Nikto's error.

System (please complete the following information):

secureCodeBox v3.0.1

Activity

  1. added
    scannerImplement or update a security scanner
    on Aug 20, 2021
  2. rfelber commented on Aug 20, 2021

    @rfelber
    Member

    Good catch 👍🏻 Thx for reporting this issue.

  3. added this to the v3.1.0 milestone on Aug 20, 2021
  4. assigned and unassigned on Aug 24, 2021
  5. SebieF commented on Aug 24, 2021

    @SebieF
    Contributor

    Unfortunately we could not reproduce the nikto raw findings, instead we got an empty json file (with 0 Bytes). How did you get the raw (invalid) json file
    (i.e. {"id": "000029","OSVDB": "0","url":"/","msg":"No web server found on xxxx:80"}})?

    But you are right that the parser should not crash.

  6. JohannesZahn commented on Aug 24, 2021

    @JohannesZahn
    Contributor

    I added a unit test for this case and will fix the problem as soon as I can .

  7. self-assigned this
    on Aug 24, 2021
  8. EndPositive commented on Aug 24, 2021

    @EndPositive
    ContributorAuthor

    I've updated the OP with a concrete example scan for "No webserver found" crash. I had originally redacted the domain name because it was internal.

  9. JohannesZahn commented on Aug 25, 2021

    @JohannesZahn
    Contributor

    @EndPositive Thanks for the example. I assume the closing bracket at the end of the output is a typo right?

  10. EndPositive commented on Aug 25, 2021

    @EndPositive
    ContributorAuthor

    It is actually not. I'm not sure why Nikto adds it.

  11. J12934 commented on Aug 25, 2021

    @J12934
    Member

    Nikto has produced invalid XML before, thought I had fix it with sullo/nikto#637 but it seems like there is still an edge case left when there is no host found as the first bracket is never opened.

    I think we'd should rather try to fix this in Nikto first before we try to fix / parse the invalid json.

  12. JohannesZahn commented on Aug 25, 2021

    @JohannesZahn
    Contributor

    I'll have a look what messes up the nikto result

  13. JohannesZahn commented on Aug 25, 2021

    @JohannesZahn
    Contributor

    I opened an issue on nikto side sullo/nikto#740. I think if the expected output is produced by nikto our parser should work fine. Also in nikto v2.5 (not yet released) the problem does not occure anymore it seems to me.

    {
       "host":"www.example.com",
       "ip":"93.184.216.34",
       "port":"8080",
       "banner":"",
       "vulnerabilities":[
          {
             "id":"0",
             "method":"GET",
             "url":"",
             "msg":"Unable to connect to www.example.com:8080."
          }
       ]
    }
  14. self-assigned this
    on Aug 26, 2021
  15. modified the milestones: v3.1.0, v3.2.0 on Sep 20, 2021
  16. linked a pull request that will close this issueUpdated `nikto` to latest release v2.5.0 #668on Sep 27, 2021
  17. modified the milestones: v3.2.0, v3.3.0 on Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugBugsscannerImplement or update a security scanner

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions