byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.37k stars 1.64k forks source link

configparser.NoSectionError: No section: 'BloodHound' #519

Closed IlanKalendarov closed 2 years ago

IlanKalendarov commented 2 years ago

Describe the bug CME not working with some commands

To Reproduce Steps to reproduce the behavior: run the command cme smb <IP> -u <user> -p <pass> -M handlekatz or cme smb <IP> -u <user> -p <pass> -M nanodump

Crackmapexec info

Additional context Note - Also tested on a different machine with python 3.8 installed

Traceback (most recent call last):
  File "/root/.local/bin/cme", line 8, in <module>
    sys.exit(main())
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/crackmapexec.py", line 254, in main
    asyncio.run(
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/crackmapexec.py", line 102, in start_threadpool
    await asyncio.gather(*jobs)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/crackmapexec.py", line 68, in run_protocol
    await asyncio.wait_for(
  File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
    return await fut
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/protocols/smb.py", line 125, in __init__
    connection.__init__(self, args, db, host)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/connection.py", line 62, in __init__
    self.proto_flow()
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/connection.py", line 98, in proto_flow
    if self.login() or (self.username == '' and self.password == ''):
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/connection.py", line 275, in login
    if self.plaintext_login(self.domain, user, password): return True
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/protocols/smb.py", line 366, in plaintext_login
    add_user_bh(self.username, self.domain, self.logger, self.config)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/helpers/bloodhound.py", line 7, in add_user_bh
    if config.get('BloodHound', 'bh_enabled') != "False":
  File "/usr/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.9/configparser.py", line 1149, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'BloodHound'
lefayjey commented 2 years ago

A workaround is to disable Bloodhound by adding the following to the ~/.cme/cme.conf configuration file:

[BloodHound]
bh_enabled = False

Edit: Apparently by upgrading crackmapexec using pip, the configuration file cme.conf remains the same and needs to be modified manually

IlanKalendarov commented 2 years ago

A workaround is to disable Bloodhound by adding the following to the ~/.cme/cme.conf configuration file:

[BloodHound]
bh_enabled = False

Edit: Apparently by upgrading crackmapexec using pip, the configuration file cme.conf remains the same and needs to modified manually

I've tried to do that and now it says:

    sys.exit(main())
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/crackmapexec.py", line 254, in main
    asyncio.run(
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/crackmapexec.py", line 102, in start_threadpool
    await asyncio.gather(*jobs)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/crackmapexec.py", line 68, in run_protocol
    await asyncio.wait_for(
  File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
    return await fut
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/protocols/smb.py", line 125, in __init__
    connection.__init__(self, args, db, host)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/connection.py", line 62, in __init__
    self.proto_flow()
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/connection.py", line 100, in proto_flow
    self.call_modules()
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/connection.py", line 132, in call_modules
    self.module.on_admin_login(context, self)
  File "/root/.local/pipx/venvs/crackmapexec/lib/python3.9/site-packages/cme/modules/nanodump.py", line 53, in on_admin_login
    with open(self.nano_path + self.nano, 'wb') as nano:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/shared/nano.exe'

It seems from the module's code that it tries to decode the base64 encoded binary and write it to disk but fails for some reason.

shoxxdj commented 2 years ago

A workaround is to disable Bloodhound by adding the following to the ~/.cme/cme.conf configuration file:


[BloodHound]

bh_enabled = False

Edit: Apparently by upgrading crackmapexec using pip, the configuration file cme.conf remains the same and needs to modified manually

Thanks this workaround is good enough to solve :)

mpgn commented 2 years ago

Remove the config file ~/.cme/cme.conf and then you are good to go

7MinSec commented 2 years ago

Just stopped by to thank you all for this post. REALLY needed the new modules on a pentest and was running into this error. Now I'm GTG. Have a great weekend.

tarekxxx commented 2 years ago

i disable bh_enabled = False

and same problem even remove cme.conf

same i cant solve this 10 days same in everything

n0rbest commented 2 years ago

Remove the config file ~/.cme/cme.conf and then you are good to go

Not working

Jaker1965 commented 1 year ago

Remove the config file ~/.cme/cme.conf and then you are good to go

Not working

This worked for me - THANKS!