• Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 4 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Static code analysis tool based on Elasticsearch

Stability Version Python Docker Pulls

What is Bughound?

Bughound Logo

Bughound is an open-source static code analysis tool that analyzes your code and sends the results to Elasticsearch and Kibana to get useful insights about the potential vulnerabilities in your code.

Bughound has its own Elasticsearch and Kibana Docker image that is preconfigured with dashboards to give you a strong visualization for the findings.

You can detect various types of vulnerabilities such as:

  • Command Injection.
  • XXE.
  • Unsafe Deserialization.
  • And more!

Bughound can analyze PHP and JAVA code for now, and it contains a group of unsafe functions for these languages.

I will make sure to add more and more functions/languages coverage with time, but for now the main focus is for the project stability itself.

Please note that Bughound results are not 100% accurate, it built to help you identify potential weaknesses during your analysis to investigate.

How it works?

First of all, Bughound will build a list of all the files inside your project based on the extension of the files you want to audit, then it will read each file and try to find any pre-defined unsafe functions for your project's language.

The analysis phase depends on pre-configured regex and some custom text matching to detect the potential vulnerabilities, so again, you need to do the manual analysis so you can check if these findings are exploitable.

Finally, it will send the results to the Bughound docker image which has a pre-configured Elasticsearch and Kibana that contain the customized dashboards for your findings.

The dashboards will give you details about the findings such:

  • Function name.
  • Category of the vulnerability.
  • Line number.
  • And much more!

Also using Kibana, you will be able to view the potentially vulnerable code snippet to start doing your analysis and tracing phase to check if it's exploitable or not.

Of course, you can use your own ELK stack if you want, and Bughound will do the initial configuration for you, but you will not have the pre-configured dashboards in this case.

Requirements

You can install all the requirements to run Bughound code using the following command:

pip3 install -r requirements.txt

That will make sure all the requirements are installed for the code.

Also, you need to install Docker in order to run the Bughound image, more regarding this in the next section!

If you want to use your own Elasticsearch and Kibana instances, skip the docker installation step

Installation

Make sure to get the latest version of Bughound using the following command:

git clone https://github.com/mhaskar/Bughound

And after installing the requirements in the previous step you can run Bughound using the following command:

./bughound.py

You will get the main screen of Bughound.

โ”Œโ”€[askar@hackbook]โ”€[/opt/bughound]
โ””โ”€โ”€โ•ผ $./bughound.py

.______    __    __    _______  __    __    ______    __    __  .__   __.  _______
|   _  \  |  |  |  |  /  _____||  |  |  |  /  __  \  |  |  |  | |  \ |  | |       \
|  |_)  | |  |  |  | |  |  __  |  |__|  | |  |  |  | |  |  |  | |   \|  | |  .--.  |
|   _  <  |  |  |  | |  | |_ | |   __   | |  |  |  | |  |  |  | |  . `  | |  |  |  |
|  |_)  | |  `--'  | |  |__| | |  |  |  | |  `--'  | |  `--'  | |  |\   | |  '--'  |
|______/   \______/   \______| |__|  |__|  \______/   \______/  |__| \__| |_______/



          \ /
          oVo
      \___XXX___/
       __XXXXX__
      /__XXXXX__\
      /   XXX   \
           V                  V1.0 Beta

[+] Example: ./bughound3.py --path vulnerable_code/ --language php --extension .php --name testproject

usage: bughound.py [-h] [--path PATH] [--git GIT] --language LANGUAGE
                   --extension EXTENSION --name NAME [--verbose [VERBOSE]]
bughound.py: error: argument --language is required
โ”Œโ”€[โœ—]โ”€[askar@hackbook]โ”€[/opt/bughound]
โ””โ”€โ”€โ•ผ $

Docker image installation

To install the Bughound docker image, you can simply do the following:

docker pull bughound/bughound

And that will pull the latest version of the image and save it to your machine.

Once we pulled the image, we can run it using the following command:

docker run --name bughound -p5601:5601 -p 9200:9200 bughound/bughound

That will run the image under a new container called bughound and expose the ports that are needed by Bughound to communicate Elasticsearch and Kibana to your host.

You may need to increase the max virtual memory in order to use the image, so please make sure to run this command:

sysctl -w vm.max_map_count=262144

After getting two things done, you are ready now to use Bughound!

Usage

To start the analysis process for your code, you should use Bughound.py file which has some options, to see these options via the help banner, you can use the following command:

โ”Œโ”€[โœ—]โ”€[askar@hackbook]โ”€[/opt/bughound]
โ””โ”€โ”€โ•ผ $./bughound.py -h

.______    __    __    _______  __    __    ______    __    __  .__   __.  _______
|   _  \  |  |  |  |  /  _____||  |  |  |  /  __  \  |  |  |  | |  \ |  | |       \
|  |_)  | |  |  |  | |  |  __  |  |__|  | |  |  |  | |  |  |  | |   \|  | |  .--.  |
|   _  <  |  |  |  | |  | |_ | |   __   | |  |  |  | |  |  |  | |  . `  | |  |  |  |
|  |_)  | |  `--'  | |  |__| | |  |  |  | |  `--'  | |  `--'  | |  |\   | |  '--'  |
|______/   \______/   \______| |__|  |__|  \______/   \______/  |__| \__| |_______/



          \ /
          oVo
      \___XXX___/
       __XXXXX__
      /__XXXXX__\
      /   XXX   \
           V                  V1.0 Beta

[+] Example: ./bughound3.py --path vulnerable_code/ --language php --extension .php --name testproject

usage: bughound.py [-h] [--path PATH] [--git GIT] --language LANGUAGE
                   --extension EXTENSION --name NAME [--verbose [VERBOSE]]

optional arguments:
  -h, --help            show this help message and exit
  --path PATH           local path of the source code
  --git GIT             git repository URL
  --language LANGUAGE   the used programming language
  --extension EXTENSION
                        extension to search for
  --name NAME           project name to use
  --verbose [VERBOSE]   show debugging messages
โ”Œโ”€[askar@hackbook]โ”€[/opt/bughound]
โ””โ”€โ”€โ•ผ $

Scan Local project

For example, to scan a local php project, you can use the following command:

./bughound.py --path /opt/dummyproject --language php --extension .php --name dummyproject

This command will create a new project called "dummyproject" in the Elasticsearch index, and crawl all the local files with the extension ".php" in the local path "/opt/dummyproject" and ship the results to Elasticsearch.

Scan remote git repository

Also, you can pull a remote project from git repository using --git switch like the following:

./bughound.py --git https://github.com/DummyCode/DummyProject --language php --extension .php --name dummyproject

Bughound will clone the code for you and save it in projects directory, then will scan it.

Preconfigured Dashboards

If you decided to use the official Bughound docker image, you will get a couple of ready to use dashboards that will help you to do your analysis.

The following dashboards are available so far:

  • Bughound main dashboard
  • Command injection dashboard
  • Deserialization dashboard
  • XXE dashboard

These dashboards will give you statistics about the functions and code snippets that was found in the code so you can start your analysis process.

More resources

For more information about Bughound check the following articles:

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details

More Repositories

1

Octopus

Open source pre-operation C2 server based on python and powershell
Python
727
star
2

DNSStager

Hide your payload in DNS
Python
602
star
3

RCEScanner

Simple python script to extract unsafe functions from php projects
Python
195
star
4

ExchangeFinder

Find Microsoft Exchange instance for a given domain and identify the exact version
Python
187
star
5

XMLDecoder-payload-generator

A simple python script to generate XML payloads works for XMLDecoder based on ProcessBuilder and Runtime exec
Python
149
star
6

Shellcode-In-Memory-Decoder

A simple C implementation to decoded your shellcode and writes it directly to memory
C
94
star
7

CVE-2020-8813

The official exploit for Cacti v1.2.8 Remote Code Execution CVE-2020-8813
Python
67
star
8

shellcode-process-injection

Simple C implementation to perform shellcode process injection via win32 APIs
C
59
star
9

XSSRadare

A Cross Site Scripting scanner using selenium webdriver
Python
54
star
10

Blinder

A python library to automate time-based blind SQL injection
Python
49
star
11

DNSKeyGen

A tool to exchange decryption keys for command and control (C2) beacons and implants through DNS records.
Python
39
star
12

MalleableC2-Profiles

A collection of Cobalt Strike Malleable C2 profiles
34
star
13

Octopus-C2-RedTeam-infrastructure-automation

Python
20
star
14

CVE-2020-14947

The official exploit for OCS Inventory NG v2.7 Remote Command Execution CVE-2020-14947
Python
19
star
15

CVE-2020-12078

The official exploit for Open-AudIT v3.3.1 Remote Code Execution CVE-2020-12078
Python
18
star
16

HTTPFuzzer

HTTPFuzzer is a simple python script to perform multiple fuzzing techniques for HTTP protocol
Python
14
star
17

CVE-2019-20224

The offical exploit for Pandora v7.0NG Post-auth Remote Code Execution CVE-2019-20224
Python
14
star
18

CVE-2019-16662

The official exploit for rConfig 3.9.2 Pre-auth Remote Code Execution CVE-2019-16662
Python
12
star
19

CVE-2019-13024

The official exploit code for Centreon v19.04 Remote Code Execution CVE-2019-13024
Python
11
star
20

Linux-Root-Kit

Simple Linux RootKit written in python
Python
10
star
21

CVE-2018-20434

The official exploit code for LibreNMS v1.46 Remote Code Execution CVE-2018-20434
Python
9
star
22

CVE-2019-15029

The official exploit code for FusionPBX v4.4.8 Remote Code Execution CVE-2019-15029
Ruby
7
star
23

CVE-2019-16663

The official exploit for rConfig 3.9.2 Post-auth Remote Code Execution CVE-2019-16663
Python
6
star
24

CVE-2023-0315

The official exploit for Froxlor Remote Code Execution CVE-2023-0315
Python
6
star
25

BlindSQLinjectionExploit

Python
5
star
26

powershell-extractor-elasticsearch

Python script to extract powershell scrips from elasticsearch based on windows event "4104"
Python
4
star
27

wifi-jammer

Python automated wifi jammer
Python
3
star
28

shellcodes

C
3
star
29

Stuff

Python
2
star
30

MicrosoftDCFTokenRequester

Simple and lazy script to request tokens from Microsoft using Device Code Flow
Python
2
star
31

auto_sniffer

Python
2
star
32

stem_finder

Python
1
star
33

audio_injector

python script to inject audio file to images and extract it
Python
1
star
34

transposition-cipher

Python
1
star
35

python_Backdoor

Python
1
star