Commit Graph

630 Commits

Author SHA1 Message Date
Liz Rice
2428e2e869 docs: fix broken CONTRIBUTING link (#361) 2020-07-03 11:59:53 +03:00
Abdullah Garcia
daf53cb484 Two new kubelet active hunters. (#344)
* Introducing active hunters:

- FootholdViaSecureKubeletPort
- MaliciousIntentViaSecureKubeletPort

* Format

Updating code according to expected linting format.

* Format

Updating code according to expected linting format.

* Format

Updating code according to expected linting format.

* Format

Updating code according to expected linting format.

* Testing

Update code according to expected testing standards and implementation.

* Update documentation.

- Added some more mitigations and updated the references list.

* f-string is missing placeholders.

- flake8 is marking this line as an issue as it lacks a placeholder when indicating the use of f-string; corrected.

* Update kubelet.py

- Add network_timeout parameter into requests.post and requests.get execution.

* Update kubelet.py

- Modified name of variable.

* Update kubelet.py and test_kubelet.py

- Remove certificate authority.

* Update kubelet.py and test_kubelet.py.

- Introducing default number of rm attempts.

* Update kubelet.py and test_kubelet.py.

- Introduced number of rmdir and umount attempts.

* Update kubelet.py

- Modified filename to match kube-hunter description.

* Update several files.

- Instated the use of self.event.session for GET and POST requests.
- Testing modified accordingly to complete coverage of changes and introduced methods.
- Requirements changed such that the required version that supports sessions mocking is obtained.

* Update kubelet.py

- Introduced warnings for the following commands in case of failure: rm, rmdir, and umount.

* Update kubelet.py

- Remove "self.__class__.__name___" from self.event.evidence.

* Update kubelet.py

- Remove unnecessary message section.

* Update files.

- Address class change.
- Fix testing failure after removing message section.

* Update kubelet.py

- Provide POD and CONTAINER as part of the warning messages in the log.

Co-authored-by: Abdullah Garcia <abdullah.garcia@jpmorgan.com>
Co-authored-by: Yehuda Chikvashvili <yehudaac1@gmail.com>
Co-authored-by: danielsagi <danielsagi2009@gmail.com>
2020-06-29 09:20:49 +01:00
danielsagi
d6ca666447 Minor hunting bug fixes (#360)
* fixed f string

* fixed wrong iteration on list when getting random pod

* added '/' suffix to path on kubelet debug handlers tests

* also fixed minor bug in etcd, protocol was refrenced on the hunter and not on the event

* ran black format

* moved protocol to be https

* ran black again

* fixed PR comments

* ran black again, formatting
2020-06-26 15:04:29 +01:00
danielsagi
3ba926454a Added External Plugins Support (#357)
* added plugins submodule, created two hookspecs, one for adding arguments, one for running code after the argument parsing

* implemented plugins application on main file, changed mechanism for argument parsing

* changed previous parsing function to not create the ArgumentParser, and implemented it as a hook for the parsing mechanism

* added pluggy to required deps

* removed unecessary add_config import

* fixed formatting using black

* restored main link file from master

* moved import of parser to right before the register call, to avoid circular imports

* added tests for the plugins hooks

* removed blank line space

* black reformat
2020-06-19 15:20:15 +01:00
Konstantin Weddige
78e16729e0 Fix typo (#354)
This fixes #353
2020-06-08 13:47:40 +01:00
danielsagi
78c0133d9d removed an unnecessary f-string on an info logging (#355) 2020-06-08 15:04:29 +03:00
Liz Rice
4484ad734f Fix CertificateDiscovery hunter for Python3 (#350)
* update base64 decode for python3

* chore: remove lint error about imports
2020-05-11 10:42:31 +01:00
Yehuda Chikvashvili
a0127659b7 Decouple config and argument parsing (#342)
* Make config initialized explicitly
* Add mypy linting
* Make tests run individually
Resolve #341
2020-04-26 19:37:16 +03:00
Yehuda Chikvashvili
f034c8c7a1 Removed unused imports (#338)
* Update snippets in README.md
The README file had deprecated code snippets
* Remove unnecessary imports
* Complete tests for hunters registration

Resolves #334
2020-04-23 02:31:07 +03:00
mormamn
4cb2c8bad9 Dashboard hunter not working (#337)
* Fix dashboard hunter regression
Fix #336.
Add tests for dashboard hunter

Co-authored-by: Yehuda Chikvashvili <yehudaac1@gmail.com>
v0.3.1
2020-04-13 04:06:13 +03:00
Yehuda Chikvashvili
14d73e201e Remove dynamic imports (#335)
* Remove plugins
Current usage of plugins is not pluggable and includes logging
stuff.
Move this to conf/logging.
* Removed dynamic imports
* Add tests for hunters registration
2020-04-13 02:56:13 +03:00
John Schaeffer
6d63f55d18 Updated logging init logic to not log on setting --log=none (#323)
* Fix "none" logging

Test for different logging levels, existing and none existing

Co-authored-by: yoavrotems <yoavrotems97@gmail.com>
Co-authored-by: Yehuda Chikvashvili <yehudaac1@gmail.com>
2020-04-12 16:56:53 +03:00
mormamn
124a51d84f Support ignoring IPs (#332)
* Support ignoring IPs

Closes #296
2020-04-07 21:47:50 +03:00
Yehuda Chikvashvili
0f1739262f Linting Standards (#330)
Fix linting issues with flake8 and black.
Add pre-commit congifuration, update documnetation for it.
Apply linting check in Travis CI.
2020-04-05 05:22:24 +03:00
mormamn
9ddf3216ab Optimize Cloud Discovery (#325)
* Optimized Cloud Discovery
Removed redundant actions of getting cloud type.
Make cloud discovery a lazy action.
Co-authored-by: Yehuda Chikvashvili <yehudaac1@gmail.com>
2020-03-29 22:59:38 +03:00
Yehuda Chikvashvili
e7585f4ed3 Logging revamped (#318)
* Refine logging
Use logger objects instead of global root logger
Fixes #308 
Co-authored-by: Yehuda Chikvashvili <yehudaac1@gmail.com>
2020-03-04 21:03:36 +02:00
Yehuda Chikvashvili
6c34a62e39 Network operations timeout (#317)
* Add network operations timeout

This commit adds --network-timeout flag, which value will be used for
network operations timeout configurable, so demanding user
can set it to desired value.
2020-03-04 16:59:18 +02:00
blrchen
69a31f87e9 Fix #127 Insecure Azure Cloud IP detection (#315)
* Fix Insecure Azure Cloud IP detection
Remove verify=False

Co-authored-by: blairch <15134348+blairch@users.noreply.github.com>
Co-authored-by: Yehuda Chikvashvili <yehudaac1@gmail.com>
2020-03-03 01:10:16 +02:00
dependabot[bot]
f33c04bd5b Bump nokogiri from 1.10.4 to 1.10.8 in /docs (#311)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.4 to 1.10.8.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.4...v1.10.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Liz Rice <liz@lizrice.com>
2020-03-02 15:23:39 +00:00
Yehuda Chikvashvili
11efbb7514 Fix Dockerfile build (#303)
* Fix Dockerfile build

The Docker build used a 2-step installation of requirements
and application.
This was broken by #272.

Fixes #300

* Add dependencies cache for docker build

Caching installation requirements saves time when building
v0.3.0
2020-02-27 14:37:25 +02:00
mormamn
ac5dd40b74 Urllib3 upgrade (#314)
* Upgrade urllib3
resolves #307
2020-02-27 00:17:08 +02:00
mormamn
bf646f5e0c Fix broken reporting (#313)
Added instance creation of reporters and dispatcher objects
Fixes #312
2020-02-26 22:40:16 +02:00
mormamn
a8128b7ea0 Cleanup conf refactor (#310)
Reorganize config files, and argparse.
Resolves #289
Resolves #292
2020-02-25 12:29:18 +02:00
Yehuda Chikvashvili
e75c0ff37b Add PyInstaller build (#302)
* Add PyInstaller build

Use PyInstaller to generate single binary.
Use staticx to generate a single static binary.

Resolves #301

* Add test Makefile target

Add test to Makefile.
Add requests_mock to dev dependencies.
2020-02-18 17:31:10 +02:00
Liz Rice
fe187bc50a Correct KB link (#299) v0.3.0-rc1 2020-02-14 17:44:58 +00:00
Yehuda Chikvashvili
77227799a4 Add Makefile (#298)
Added Makefile with some helpful utils such as build, lint and clean
2020-02-12 17:32:28 +02:00
Vipul Gupta
df12d75d6d Packaging Kube-Hunter for PyPi (#272)
* Inital Commit

Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipulgupta2048@gmail.com>

* Suggestions implemented as suggested

Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipulgupta2048@gmail.com>

* Package with setuptools

Use setuptools to package kube-hunter as redistributable file.
Once packages, it can be pushed to PyPi.
The package version is taken from git tags (using setuptools_scm).

Closes #185

* Ignore __main__.py script in code coverage

The entrypoint script should not be tested but rather be calling
to tested modules.
Ideally, __main__ should only make a call to single function from
another tested module.

* Update requirements files

Use install_requires from setup.cfg file as single source of truth
for dependencies.
Install regular dependencies when installing dev dependencies.

* Symlink kube-hunter.py to entry point

Support the old way to run kube-hunter via the main script by making
a link to the new kube_hunter/__main__.py script.

Co-authored-by: Yehuda Chikvashvili <yehudaac1@gmail.com>
2020-02-10 21:35:31 +02:00
Yehuda Chikvashvili
a4a8c71653 Fix empty report (#281)
* Fix empty report when active hunting

Running kube-hunter active hunting with plain report
did not show any report.
This commit changes Vulnerability.vid default value
to "None" (previously None)

Closes #280

* Improve debug and exception messages

Debugging hunters execution is hard due to lack of debug
information. No indication is made when a hunter starts.
Exceptions where printed without stack trace, which made
it difficult to follow.
2020-01-09 19:04:33 +02:00
Yehuda Chikvashvili
fe3dba90d8 Refactor configuration (#283)
* Remove __main__ references and create a top-level config module

* Move conf module into separate standalone package

* Deprecate install_imports.py script

* Rename root package to kube_hunter

The previous src root package name was too generic and not unique,
so it can be used as external name.
Change `src` to `kube_hunter` so it can be referenced in a clear way.
Addtional changes made on the way:
* Make imports absolute
* Formatting

Relates to #185

* remove todos

Co-authored-by: Ryan Lahfa <masterancpp@gmail.com>
Co-authored-by: Itay Shakury <itay@itaysk.com>
2019-12-29 14:18:58 +02:00
Oleg Butuzov
fd4d79a853 adding codecoverage (#198) 2019-11-30 08:45:33 +00:00
Liz Rice
3326171c7a docs: clarify that job.yaml is an example (#279) 2019-11-27 18:42:35 +02:00
Liz Rice
4c82b68f48 Merges #225 (#278)
* Fix typos

* Fix review comments
2019-11-26 21:11:33 +02:00
Yehuda Chikvashvili
1d7bdd6131 Consider patched versions as not vulnerable by default (#220)
* Consider patched versions as not vulnerable by default

Change `--ignore-downstream` to `--ignore-patched-versions` and
invert it's effect.
From now on, kube-hunter will not alert patched components as default
behavior.

Resolves #194

* Rename flag --ignore-patched-versions to --include-patched-versions
v0.2.0
2019-11-26 20:28:30 +02:00
Itay Shakury
14c49922da mention KB in the readme (#276)
Co-Authored-By: Liz Rice <liz@lizrice.com>
2019-11-15 21:54:14 +02:00
Greg Jacobs
1c443eb6e4 Fixes for typos and readability in Readme.md and KB (#248) 2019-11-12 14:08:47 +02:00
Itay Shakury
12f5b75733 Refactor reporters and add KB URL to reports (#275)
* refactor reporters and add kburl

* rename json reporter file to align with other reporters
2019-11-10 15:21:36 +02:00
s-nirali
7b77945ebd Fix some linting issues (#267) 2019-11-08 13:07:37 +02:00
Ryan Lahfa
a266c9068f Locking: Use a RAII/Defensive style to prevent issues when exceptions are thrown (#269) 2019-11-07 19:10:37 +02:00
Anuj Singh
67af48fa9a Create a sitemap (#258) 2019-11-05 21:48:05 +02:00
Yehuda Chikvashvili
efd23433ff Support macOS (#273)
Upgrade scapy to version 2.4.3 and above.
This commit fixes IndexError that was raised when running
kube-hunter from macOS.

Resolves #262
2019-11-05 12:53:44 +02:00
Itay Shakury
8cc90db8f5 add kb index (#252) 2019-10-30 20:38:16 +02:00
Itay Shakury
0157ac83ce add .venv to gitignore (#256) 2019-10-28 23:40:16 +02:00
Rohith
031c4b9707 reponding to bug request https://github.com/aquasecurity/kube-hunter/issues/246 (#249)
/usr/bin/env python generally is defaulted to the version set by the linux flavour. On some distros it's python 2 and 3 on others, changing it to python3 might work
2019-10-26 19:05:13 +03:00
Raj Chowdhury
25333b201f Typo fix (#247)
Fixed Minor typos in README
2019-10-25 11:54:27 -07:00
Nithin-183
bde288ceb3 Update README.md (#237) 2019-10-25 11:42:10 -07:00
Arpit Pandey
f61f624d29 Fix typos in code comments (#227) 2019-10-23 19:10:01 +03:00
Ryan Lahfa
d424fcd7c8 Use set rather than list to test membership in O(1) (#231) 2019-10-23 18:34:19 +03:00
Itay Shakury
04fc39c810 build article titles from metadata (#238)
* rename id to vid to avoid conflict with jekyll's id

* build article title from metadata
2019-10-23 18:22:37 +03:00
Ramshah Jahangir
59543346d2 updating pul request template (#242)
* updating pul request template

* fixing typos
2019-10-23 18:12:43 +03:00
Itay Shakury
6b4f13e84a update ruby gems used for the kb website (#236) 2019-10-23 14:03:00 +03:00