Commit Graph

370 Commits

Author SHA1 Message Date
Itay Shakury
4e68ea4e15 Add Knowledge Base for reported vulnerabilities (#188) 2019-10-13 17:10:47 +03:00
SinithH
e982f291e9 fixed some typos (#193)
* Update README.md

* Update README.md

* Update README.md

* Replace missing "if"
2019-10-10 10:17:23 +01:00
Yehuda Chikvashvili
bc00bbd058 Change CVE hunters description (#183)
Make CVE hunters description more accurate
2019-10-02 16:32:09 +02:00
Yehuda Chikvashvili
a1feb06ec7 Ignore downstream version flag (#181)
* Ignore downstream version flag

This commit adds `--ignore-downstream` flag to kube-hunter.
Enabling the flag will make kube-hunter considering patched versions
as not vulnerable.
Resolves #179

* Add test cases and refine argument description
2019-09-19 21:57:39 +03:00
danielsagi
e0bacd6e7b New Hunters: DNS spoofing & ARP spoofing (#159)
* added arp passive hunter

* seperated arp and dns hunters, made them active and fixed some coe on arp

* added description for hunters, and refactored description for vulnerabilities

* minor typo

* replaced google.com with 1.1.1.1

* fixed comments

* fixed scapy

* validated output of get_kube_dns_ip_mac
2019-08-29 19:08:53 +03:00
danielsagi
a015f259a0 added linkage of previously discovered protocol, on filter (#176) 2019-08-29 16:46:35 +03:00
Yehuda Chikvashvili
8bb8e1f16c Fix plain report with high log level (#175)
This commit fixes issue #108
Report type plain didn't work with log level higher than INFO.
2019-08-29 14:34:44 +03:00
danielsagi
427a295c8c Adding visibility for dispatching (#166)
* minor addition to description

* added documantation in readme

* minor changes to logging levels and formatting

* changed example in readme

* fixed merge

* added info logging to http dispatch method

* changed description from environ to environment variables
2019-08-28 12:18:58 +03:00
danielsagi
0315af75cf Detection for 3 new CVES (#173)
* changed version hunting to be on a a new version disclosure vulnerability

* fixed version publish

* added logging and fixed typo

* changed whole way of comparing versions in cve hunter

* changed K8sVersionDisclosure vulnerability to one core vulnerability, that takes an endpoint. changed all usage

* added tests

* merged kubectl cve hunting with apiserver hunting. and simplified the code of apiserver cve hunting

* fixed tests to new names

* changed name of module to cves.py

* drastically improved the cve vulnerble detection utility function. now works with all types of versioning methods

* added packaging in requirementes.txt

* added another test, and improved logic on cve comparison for more complicated versions

* changed CveHunter to subscribe_once, to prevent duplicates duplicates

* fixed tests for new improvements

* removed unnecessary ternary on doc

* removed unnecessary join split

* improved compare function, made it util

* improved cve checking to use mapping

* added detection for CVE-2019-9512 and  CVE-2019-9514

* added detection for CVE-2019-11247 and added minor comments
2019-08-27 22:03:29 +03:00
danielsagi
2dad27a175 Decrease vulnerabilities on build (#170)
* changed python version to 3.8.rc and removed wireshark from build. also added a plugin to supress scapy's warnings about the manuf

* changed to alpine 3.10, on docker file and removed unnecessary logging suppression

* changed to python 3.7

* changed base image on builder as well
2019-08-27 11:27:17 +01:00
danielsagi
860062abeb Added Metrics Server Discovery - Distinct from Api Server (#167)
* added basic metrics server discovery

* improved discovery, and added KNOWN PORTS usage

* improved apiserver decision

* fixed bug with comparison of IP addresses in kubeservicehost

* improved description of api server discovery

* added checks with auth_token on discovery

* fixed bug in version requests and added to tests

* added an abstract 'unrecognized API' event, and a filter for it for classification

* changed filtering to be done on the same event

* fixed verify on session and removed unnecessary enum

* minor changes to comments

* added detailed explanation
2019-08-27 08:54:08 +01:00
danielsagi
259f707ecd Refactor And Major Bug Fixes in Version and CVE hunting (#162)
* changed version hunting to be on a a new version disclosure vulnerability

* fixed version publish

* added logging and fixed typo

* changed whole way of comparing versions in cve hunter

* changed K8sVersionDisclosure vulnerability to one core vulnerability, that takes an endpoint. changed all usage

* added tests

* merged kubectl cve hunting with apiserver hunting. and simplified the code of apiserver cve hunting

* fixed tests to new names

* changed name of module to cves.py

* drastically improved the cve vulnerble detection utility function. now works with all types of versioning methods

* added packaging in requirementes.txt

* added another test, and improved logic on cve comparison for more complicated versions

* changed CveHunter to subscribe_once, to prevent duplicates duplicates

* fixed tests for new improvements

* removed unnecessary ternary on doc

* removed unnecessary join split

* improved compare function, made it util

* improved cve checking to use mapping
2019-08-27 08:48:47 +01:00
danielsagi
44e6438d37 Changed name of Subnet scanning to - Interface Scanning (#169)
* changed Subnet/internal scanning to interface

* Change one more internal -> interface
2019-08-25 20:40:30 +03:00
danielsagi
f5b72d44b5 New Core Feature: Subscribe Once (#168)
* added a subscribe_once decorator

* created tests for core functionality, for now, subscibe and subscribe once
2019-08-13 15:44:41 +01:00
Tom Davidson
e3af42cbce Separate report "sending" into modules (#156)
* moved report output into dispatchers, stdout by default with config option of http(s)

* notes in arg config on how to configure http dispatcher

* removed some debug log visibility indicators

* missing import

* env vars more descriptive: KUBEHUNTER_HTTP_DISPATCH_METHOD and KUBEHUNTER_HTTP_DISPATCH_URL

* optimisation: delayed instantiation of the dispatcher until after selection to avoid instantiating unnecessarily

* refactor: config selection as per reporter selection

* bugfix: fall-back to default required if unknown reporter or dispatcher specified

* swapping urllib3 for requests

* corrected visibility levels for logging

* moving dispatchers into a file in reporters rather than it's own place to fit with theme and support dynamic module loading
2019-08-12 13:28:31 +03:00
danielsagi
cb90673bcb Added API Server discovery when running as pod (#160)
* added an implementation for scanning api server from env variable, without duplications, when running as pod

* fixed issue with convertion of ip address
2019-08-05 13:25:06 -07:00
danielsagi
e5db8b6b28 New Hunter: /var/log mount (#158)
* added pods data on ExposedPodsHandler event, for later use

* added /var/log write mount hunter. in 'mounts' module. also an active hunter which exploits run handler as well

* removed unnecesary variables

* changed active hunter description

* minor changes to vulnerability descriptions
2019-08-01 20:17:57 +03:00
danielsagi
91162297b3 Added System Logs Hunting & Improved Kubelet Hunting (#154)
* 1. added /logs Active hunter and tester.
2. changed kubelet handlers enum to be accessible as KubeletHandlers
3. added kubelet requests session to the event chain, for active hunters to use.

* added usage of event.session in the run active hunter
2019-07-10 14:57:25 +03:00
danielsagi
07db108511 Added pprof cmdline hunting (#150)
* added pprof/cmdline debug handler hunting on kubelet

* changed Name and Component of vuln

* removed preceding slash

* added verify=False
2019-07-10 11:37:26 +01:00
danielsagi
e4678843c9 Changed kubelet run handler test to be not a state changing operation (#136)
* changed kubelet run handler test to be not state-changing

* changed fake_container name to be more random

* changed run handler to GET and check for method not allowed
2019-07-10 11:29:15 +01:00
danielsagi
cc70c83ba4 Retire Support For Python 2 (#153)
* removed python2 from readme and travis

* changed except on caps hunter to except PermissionError, supports only from python3

* removed python2 support in main file

* changed cvehunter to use res.text in place of res.content (python3 returnes a bytes object for content)
2019-07-10 11:23:08 +01:00
danielsagi
911ec5eaf1 changed legacy host:port format to be 'location' in collector (#147) 2019-07-08 09:46:59 +01:00
danielsagi
5883e28971 Added new hunter for Capabilities (#146)
* added hunter for Capabilities, and a check for NET_RAW

* changed to Hunter from Discovery

* added description for hunter

* changed from PermissionError on net_raw check. for python2 support

* Clarify vulnerability description

Stating that this vulnerability only becomes a problem if a pod gets compromised
2019-07-04 12:39:41 +03:00
danielsagi
5185f28fff Added event filtering mechanism (#134)
* added event filtering mechanism, as well as a detailed explanation in src/README

* changed filter search to run only once for each event, also now returning None to indicate keeping of event

* expanded explanation of filtering in readme

* Tiny typo

* made changes for better readability, also filter should now return  None to indicate throwing of event

* changed apply filters loop to be simple and running on each publish.

* changed README

* added reassuring of parent event after filters

* moved event filtering to another function, now supporting trhoeing of event mid loop

* added note in README about event.previous

* Tiny text corrections

* More accurate comment

"Throwing an event" can actually mean triggering it (which is different from "throwing it _away_"). But I went for "discarded" here to be completely clear

* Remove superflous space that had crept in
2019-07-03 11:52:42 +01:00
danielsagi
049453ee15 changed run handler check to include all 4xx status codes (#142) 2019-06-27 09:55:56 +01:00
danielsagi
b2d2f5a01a New kubectl CVE hunter, detecting CVE-2019-11246 and CVE_2019_1002101 (#141)
* added a new hunter for CVE-2019-11246

* added KubectlClient component

* overriden location function on event to display a 'local machine' location

* added clarification about kubectl version --client operation

* Fix tiny typo

It reads better without the comma

* removed unnecessary debug message

* added CVE hunter for kubectl to allow more CVE checking.
2019-06-27 09:51:18 +01:00
danielsagi
f360c541ff Minor improve of task counting of queue (#139)
* changed way of task handler to be more safe. also added info about cases when one task is hanging

* removed queue_lock
2019-06-27 09:36:31 +01:00
Daniel Sagi
b7bcdd09cf better way of treating the printing, concatenating output 2019-06-24 22:42:03 +03:00
Daniel Sagi
1baca77754 Up until now if services were not discovered, vulnerabilities will not have shown. we want to show the, in any case. 2019-06-24 20:00:28 +03:00
Daniel Sagi
50ea9a2405 added more detailed explanation about exceptions in debug 2019-06-12 17:43:16 +03:00
danielsagi
30121b5010 Merge branch 'master' into fix_get_random_pod 2019-06-11 17:53:13 +03:00
danielsagi
ec3aca9547 Merge branch 'master' into insecure_port 2019-06-11 17:43:14 +03:00
Daniel Sagi
faf1db3d16 cleaned files to match master branch updates, also removed change of ExposedRunHandler evidence handling 2019-06-11 17:40:44 +03:00
Daniel Sagi
2168180ffb fixed issue with get_random_pod method, .next attribute on generator is deprecated in python3 2019-06-11 11:29:39 +03:00
nshauli
ac77c67ddd Add evidence counter to privileged container vulnerability 2019-06-05 11:48:25 +03:00
nshauli
f5c54428f8 Add hunter name to each event and to each vulnrability in json and yaml report 2019-06-03 16:17:33 +03:00
Liz Rice
1143b89332 Merge branch 'master' into insecure_port 2019-05-30 23:26:16 +01:00
Jan Kunzmann
0f3670dff5 Access cloud IP detection service via HTTPS 2019-05-23 13:03:18 +02:00
nshauli
ac7027dab6 1. Change hunter statistics to count vulnerabilities only.
2. Add --statistics flag support.
3. Show hunter statistics only if --statistics was set.
4. Few infrastructure improvements.
2019-05-20 21:32:52 +03:00
Liz Rice
229ff40a01 Fix bad merge
And a typo while I'm here
2019-05-14 14:07:33 +01:00
Liz Rice
7d038f50dc Merge branch 'master' into insecure_port 2019-05-14 12:00:51 +01:00
nshauli
b4df6b5298 Add support for hunters list as part of the reports.
Each reported hunter includes name, description and number of events.
Add severity field to each vulnerability report.
2019-05-14 12:44:30 +03:00
Liz Rice
1db39fd966 Include evidence on exposed run handler 2019-05-13 12:24:28 +01:00
Liz Rice
bfb14e229a Combine two debug messages, for clarity 2019-05-13 12:23:53 +01:00
Liz Rice
da832df36d Test for insecure port being open on port 8080 2019-05-13 12:23:23 +01:00
Liz Rice
4051fa708d Remove unused class 2019-03-20 11:57:46 +00:00
Liz Rice
fa99b4edd1 Remove unused class 2019-03-20 11:51:24 +00:00
Liz Rice
f10632f47e Merge branch 'master' into api-server-hunt-improvements 2019-03-18 17:58:12 +00:00
Liz Rice
71903ba942 Merge branch 'master' into fix-issue-99 2019-03-18 17:50:06 +00:00
Michael Cherny
c59b199a24 Removed unused variable 2019-03-11 00:56:24 +05:30