Uses Sharphound, Bloodhound and Neo4j to produce an actionable list of attack paths for targeted remediation.

Overview

GoodHound

PyPI - Downloads

   ______                ____  __                      __
  / ____/___  ____  ____/ / / / /___  __  ______  ____/ /
 / / __/ __ \/ __ \/ __  / /_/ / __ \/ / / / __ \/ __  / 
/ /_/ / /_/ / /_/ / /_/ / __  / /_/ / /_/ / / / / /_/ /  
\____/\____/\____/\__,_/_/ /_/\____/\__,_/_/ /_/\__,_/   
                                                         

Attackers think in graphs, defenders think in actions, management think in charts.

GoodHound operationalises Bloodhound by determining the busiest paths to high value targets and creating actionable output to prioritise remediation of attack paths.

ko-fi

I'm lucky enough to do this for a living. Any donations will be passed on to my local foodbank, animal sanctuary and animal rescue centres.

Usage

Quick Start

For a very quick start with most of the default options, make sure you have your neo4j server running and loaded with SharpHound data and run:

pip install goodhound
goodhound -p "neo4jpassword"

This will process the data in neo4j and output 3 csv reports in the current working directory.

Demo

Documentation

All documentation can be found in the wiki

Acknowledgments

  • The py2neo project which makes this possible.
  • The PlumHound project which gave me the idea of creating something similar which suited my needs.
  • The aclpwn for the idea around exploit cost.
  • The Bloodhound Gang Slack channel for Cypher help.
  • The BloodHound project for changing the world and for continuing their support for the Open-Source community even when having a commercial offering.
Comments
  • Error with goodhound.py when [0] == None

    Error with goodhound.py when [0] == None

    Location: https://github.com/idnahacks/GoodHound/blob/main/goodhound.py#L185

    When I run this code, I see that I have a few entries where the group is "None". Currently, I am doing this to resolve:

    df = pd.DataFrame(allresults)
    allresults = df[~df[0].isna()].values.tolist()
    

    Error:

    sorted(allresults, key=lambda i: (i[0], -i[5]))
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    TypeError: '<' not supported between instances of 'NoneType' and 'str'
    

    Testing:

    df = pd.DataFrame(allresults)
    len(df[df[0].isna()])
    4
    
    bug 
    opened by thecasual 10
  • Password with & symbol

    Password with & symbol

    Do not use the standard neo4j password and our password contained a & symbol, the password not parsed properly from the parameters and is being seen as a command.

    help wanted 
    opened by lucasni2 3
  • Add query to pull users with paths that do not rely on them being in a group

    Add query to pull users with paths that do not rely on them being in a group

    Individual users with a path are not captured by the groups query. While this is kind of by design as the intention is to get the most exposed (busiest) paths, these other paths can exist and should be included.

    enhancement 
    opened by idnahacks 2
  • Add check for paths to principals that can perform DCSync

    Add check for paths to principals that can perform DCSync

    As DCSync requires both GetChanges and GetChanges all I think it needs to be a separate query to the main one,

    The script needs to look for these principals, check whether they will already by picked up by the main query and if not run a shortestpath to these principals query..

    enhancement 
    opened by idnahacks 1
  • Bloodhound 4.1 issue with highvalue attribute

    Bloodhound 4.1 issue with highvalue attribute

    The latest version of Bloodhound (4.1) currently has a bug where it doesn't set the highvalue property for anywhere where it's not TRUE. This means the queries in GoodHound will not pull results properly.

    I'll work around this by setting it manually.

    bug 
    opened by idnahacks 1
  • Bloodhound query output

    Bloodhound query output

    If the Bloodhound query output can be adjusted to show the exact path, rather than the start - end nodes this will rapidly speed up using these queries for reporting.

    enhancement 
    opened by idnahacks 1
  • Memory usage problem

    Memory usage problem

    Hi,

    I am having issues with neo4j using too much memory as a result of goodhound execution, I have not been able to get goodhound to finish running at all because of this, even with a low '-r' parameter.

    I have set the max heap size to 28GB, even then it fails with the error below, I cannot tell what specific query is causing this. Can the script or query be optimized in anyway to avoid this problem?

    DEBUG:Adding connection pool for profile ConnectionProfile('bolt://localhost:7687')
    DEBUG:Trying to acquire connection from pool <py2neo.client.ConnectionPool object at 0x000001CEE1CA48D0>
    DEBUG:[#0000] C: (Dialing <localhost:7687>)
    DEBUG:[#EB39] S: (Accepted)
    DEBUG:[#EB39] C: <BOLT>
    DEBUG:[#EB39] C: <PROTOCOL> 4.3~4.0 | 4.0 | 3.0 | 2.0
    DEBUG:[#EB39] S: <PROTOCOL> 4.3
    DEBUG:[#EB39] C: HELLO {'user_agent': 'py2neo/2021.2.3 Python/3.11.1-final-0 (win32)', 'scheme': 'basic', 'principal': 'neo4j', 'credentials': '*******'}
    DEBUG:[#EB39] C: (Sent 133 bytes)
    DEBUG:[#EB39] S: SUCCESS {'server': 'Neo4j/4.4.12', 'connection_id': 'bolt-138', 'hints': {}}
    DEBUG:Releasing connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> from thread <_MainThread(MainThread, started 3432)>
    DEBUG:Connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> does not belong to pool <py2neo.client.ConnectionPool object at 0x000001CEE1CA48D0>
    DEBUG:Connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> acquired by thread <_MainThread(MainThread, started 3432)>
    DEBUG:Releasing connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> from thread <_MainThread(MainThread, started 3432)>
    Warming up database
    DEBUG:Attempting to acquire read-write connection to default database
    DEBUG:Using connection pool <py2neo.client.ConnectionPool object at 0x000001CEE1CA48D0>
    DEBUG:Trying to acquire connection from pool <py2neo.client.ConnectionPool object at 0x000001CEE1CA48D0>
    DEBUG:Connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> acquired by thread <_MainThread(MainThread, started 3432)>
    DEBUG:[#EB39] C: RUN 'MATCH (n) OPTIONAL MATCH (n)-[r]->() RETURN count(n.name) + count(r.isacl)' {} {}
    DEBUG:[#EB39] C: PULL {'n': -1, 'qid': -1}
    DEBUG:[#EB39] C: (Sent 99 bytes)
    DEBUG:[#EB39] S: SUCCESS {'t_first': 15, 'fields': ['count(n.name) + count(r.isacl)']}
    DEBUG:[#EB39] S: RECORD * 1
    DEBUG:[#EB39] S: SUCCESS {'bookmark': 'FB:', 'type': 'r', 't_last': 31939, 'db': 'neo4j'}
    DEBUG:Releasing connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> from thread <_MainThread(MainThread, started 3432)>
    INFO:Setting cost.
    DEBUG:Attempting to acquire read-write connection to default database
    DEBUG:Using connection pool <py2neo.client.ConnectionPool object at 0x000001CEE1CA48D0>
    DEBUG:Trying to acquire connection from pool <py2neo.client.ConnectionPool object at 0x000001CEE1CA48D0>
    DEBUG:Connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> acquired by thread <_MainThread(MainThread, started 3432)>
    DEBUG:[#EB39] C: RUN 'MATCH (n)-[r:MemberOf]->(m:Group) SET r.cost = 0' {} {}
    DEBUG:[#EB39] C: PULL {'n': -1, 'qid': -1}
    DEBUG:[#EB39] C: (Sent 73 bytes)
    DEBUG:[#EB39] S: SUCCESS {'t_first': 12547, 'fields': []}
    DEBUG:[#EB39] S: FAILURE {'code': 'Ne
    o.TransientError.General.OutOfMemoryError', 'message': "There is not enough memory to perform the current task. Please try increasing 'dbms.memory.heap.max_size' in the neo4j configuration (normally in 'conf/neo4j.conf' or, if you are using Neo4j Desktop, found through the user interface) or if you are running an embedded installation increase the heap by using '-Xmx' command line flag, and then restart the database."}
    DEBUG:[#EB39] C: RESET
    DEBUG:[#EB39] C: (Sent 6 bytes)
    DEBUG:[#EB39] S: SUCCESS {}
    DEBUG:Releasing connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> from thread <_MainThread(MainThread, started 3432)>
    DEBUG:Releasing connection <py2neo.client.bolt.Bolt4x3 object at 0x000001CEE2085510> from thread <_MainThread(MainThread, started 3432)>
    WARNING:Error setting cost!
    
    opened by ag-michael 0
  • Nested group memberships

    Nested group memberships

    sometimes a path shows up twice if one group is a member of another group. An if statement to see if $group ismember of $group then break might work and might even speed up the process

    bug 
    opened by idnahacks 0
Releases(v1.1.2)
  • v1.1.2(Mar 22, 2022)

    Changelog

    1.1.2

    • Fix bug with userpath call
    • Move hosted image away from github

    1.1.1

    • Add logo to report (Important stuff!)

    1.1

    • Update the weakest links function to include bloodhound query
    • Add basic HTML report

    1.0.1

    • Improve the ability to select the sql-path

    1.0

    • Upload to Pypi and update installation docs

    0.8

    • Restructure files to follow pypi structure
    • Make BloodHound 4.1 patch optional
    • Add changelog
    • Add more options relating to logging and output
    • Add error handling to neo4j connection
    • Add error handling to file output
    • change parameter for output dir to -d as this made more sense
    • remove custom query option as it could just end up messy
    • switch to pathlib for determining filepaths
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Mar 16, 2022)

  • v1.1.0(Mar 11, 2022)

  • v1.0.1(Mar 10, 2022)

  • v1.0.0(Feb 25, 2022)

Owner
idna
idna
com_media allowed paths that are not intended for image uploads to RCE

CVE-2021-23132 com_media allowed paths that are not intended for image uploads to RCE. CVE-2020-24597 Directory traversal in com_media to RCE Two CVEs

KIEN HOANG 67 Nov 9, 2022
Open Source Tool - Cybersecurity Graph Database in Neo4j

GraphKer Open Source Tool - Cybersecurity Graph Database in Neo4j |G|r|a|p|h|K|e|r| { open source tool for a cybersecurity graph database in neo4j } W

Adamantios - Marios Berzovitis 27 Dec 6, 2022
Mert Güvençli 142 Jan 5, 2023
This is python script that will extract the functions call in all used DLL in an executable and then provide a mapping of those functions to the attack classes defined and curated malapi.io.

F2Amapper This is python script that will extract the functions call in all used DLL in an executable and then provide a mapping of those functions to

Ajit Kumar 3 Sep 3, 2022
DirBruter is a Python based CLI tool. It looks for hidden or existing directories/files using brute force method. It basically works by launching a dictionary based attack against a webserver and analyse its response.

DirBruter DirBruter is a Python based CLI tool. It looks for hidden or existing directories/files using brute force method. It basically works by laun

vijay sahu 12 Dec 17, 2022
A repository to detect the ARP spoofing in any devices and prevent Man in the Middle(MITM) attack using Python3

arp_spoof_detector A repository to detect the ARP spoofing in any devices and prevent Man in the Middle(MITM) attack using Python3 Usage: git clone ht

Surya Das N 1 Oct 30, 2021
SARA - Simple Android Ransomware Attack

SARA - Simple Android Ransomware Attack Disclaimer The author is not responsible for any issues or damage caused by this program. Features User can cu

Termux Hackers 99 Jan 4, 2023
Aiminsun 165 Dec 21, 2022
Generate malicious files using recently published homoglyphic-attack (CVE-2021-42694)

CVE-2021-42694 Generate malicious files using recently published homoglyph-attack vulnerability, which was discovered at least in C, C++, C#, Go, Pyth

js-on 17 Dec 11, 2022
A (completely native) python3 wifi brute-force attack using the 100k most common passwords (2021)

wifi-bf [LINUX ONLY] A (completely native) python3 wifi brute-force attack using the 100k most common passwords (2021) This script is purely for educa

Finn Lancaster 20 Nov 12, 2022
Generate malicious files using recently published bidi-attack (CVE-2021-42574)

CVE-2021-42574 - Code generator Generate malicious files using recently published bidi-attack vulnerability, which was discovered in Unicode Specifica

js-on 7 Nov 9, 2022
python script for hack gmail account using brute force attack

#Creator: johnry #coded by john ry GBrute python script for hack gmail account using brute force attack Commands apt update && apt upgrade git clone h

null 6 Dec 9, 2022
Facebook account cloning/hacking advanced tool + dictionary attack added | Facebook automation tool

loggef Facebook automation tool, Facebook account hacking and cloning advanced tool + dictionary attack added Warning Use this tool for educational pu

Md Josif Khan 149 Aug 10, 2022
Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack

O365DevicePhish Microsoft365_devicePhish Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack This is a simple proof-of-concept script t

Trewis [work] Scotch 4 Sep 23, 2022
Attack SQL Server through gopher protocol

Attack SQL Server through gopher protocol

hack2fun 17 Nov 30, 2022
Buff A simple BOF library I wrote under an hour to help me automate with BOF attack

What is Buff? A simple BOF library I wrote under an hour to help me automate with BOF attack. It comes with fuzzer and a generic method to generate ex

0x00 3 Nov 21, 2022
Implementation of an attack on a tropical algebra discrete logarithm based protocol

Implementation of an attack on a tropical algebra discrete logarithm based protocol This code implements the attack detailed in the paper: On the trop

null 3 Dec 30, 2021
Simple script for looping a Denial Of Service (DoS) attack over one single mac address in range

Bluetooth Simple Denial Of Service (DoS) Legal Note This project is made only for educational purposes and for helping in Proofs of Concept. The autho

null 1 Jan 9, 2022