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

Add Nikto boefje that scans for outdated software #3409

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

Souf149
Copy link
Contributor

@Souf149 Souf149 commented Aug 27, 2024

Changes

Added a Nikto boefje written in javascript and a normalizer that scans/reports webservers for outdated software.

This boefje also makes use of #3383 to create a finding without having to create a new normalizer. (which could be removed since a normalizer also gets added with this pr)

Demo

image
image

QA notes

After enabling the Nikto boefje and normalizer, create an IPAddress or Hostname of a website and give it a clearance level of 3 or higher.
After doing this a new task should be created which will scan for outdated software.
(When adding a hostname with the name cynalytics.nl you should get a finding of an outdated software.)


Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.
  • This PR only contains functionality relevant to the issue.
  • I have written unit tests for the changes or fixes I made.
  • I have checked the documentation and made changes where necessary.
  • I have performed a self-review of my code and refactored it to the best of my abilities.
  • Tickets have been created for newly discovered issues.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.

Checklist for code reviewers:

  • The code does not violate Model-View-Template and our other architectural principles.
  • The code prioritizes readability over performance where appropriate.
  • The code does not bypass authentication or security mechanisms.
  • The code does not introduce any dependency on a library that has not been properly vetted.
  • The code contains docstrings, comments, and documentation where needed.

Checklist for QA:

  • I have checked out this branch, and successfully ran a fresh make reset.
  • I confirmed that there are no unintended functional regressions in this branch:
    • I have managed to pass the onboarding flow
    • Objects and Findings are created properly
    • Tasks are created and completed properly
  • I confirmed that the PR's advertised feature or hotfix works as intended.
  • I checked the logs for errors and/or warnings and made issues where necessary

What works:

  • bullet point + screenshot (if useful) per tested functionality

What doesn't work:

  • bullet point + screenshot (if useful) per tested functionality

Bug or feature?:

  • bullet point + screenshot (if useful) if it is unclear whether something is a bug or an intended feature.

Souf149 and others added 30 commits July 31, 2024 10:07
@Souf149 Souf149 requested a review from a team as a code owner August 27, 2024 13:30
Comment on lines 6 to 8
"IPAddressV4",
"IPAddressV6",
"Hostname"
Copy link
Contributor

@underdarknl underdarknl Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to start Nikto on Ipports that we know are talking http/https.
This way we avoid nikto on services that are not webservers, or even better:

It looks like there's also a way to differentiate between different hostnames on the same IP, so scanning on websites could also make sense as that would provide the best data-set including any differences between ipv4 and ipv6 addresses or the same host. Use the cli argument -host+ for this combined with -nolookup to make sure we connect only to the ip and -port we provide with the hostname we want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have looked more into it and think using the OOI HostnameHTTPURL would be perfect. It has a hostname, port, and scheme which has everything. I was not able to find information from IpPort whether it was a webserver or not (unless you meant looking at the port's number).

-h+ is supposed to be an alias for -host+ although this is not specified in nikto's wiki. I will make sure to use -nolookup.

Copy link
Contributor Author

@Souf149 Souf149 Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The boefje now makes use of HostnameHTTPURL which tells the boefje whether its HTTP or HTTPS and contains a hostname as well.

In theory IPAddressHTTPURL could also be used, I plan to add this once the boefje is satisfactory.

In the current example -nolookup does not get used because I make use of the hostname.

Nikto boefje now consumes `HostnameHTTPURL`
Fixed issue of perl not being able to handle https requests
Copy link
Contributor

@ammar92 ammar92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general. Just a suggestion about the variables

Comment on lines +5 to +29
"PROXYHOST": {
"title": "PROXYHOST",
"maxLength": 256,
"type": "string"
},
"PROXYPORT": {
"title": "PROXYPORT",
"maxLength": 256,
"type": "string"
},
"PROXYUSER": {
"title": "PROXYUSER",
"maxLength": 256,
"type": "string"
},
"PROXYPASS": {
"title": "PROXYPASS",
"maxLength": 256,
"type": "string"
},
"USERAGENT": {
"title": "USERAGENT",
"maxLength": 256,
"type": "string"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you could use the HTTP_PROXY (and optionally HTTPS_PROXY) for this? This is a common proxy URI configuration. This will save a few variables and make the form less complex (given that it has a good example, e.g. http://user:[email protected]:3128/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are config variables required for Nikto. If we would make the boefje's schema less complex, then it would move the complexity to the code of the boefje.

I believe since the user chooses to activate the Nikto boefje, they would know that Nikto requires these variables which would make them self-explaining.

Comment on lines +9 to +12
"PROXYHOST",
"PROXYPORT",
"PROXYUSER",
"PROXYPASS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See earlier remark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

4 participants