Giter VIP home page Giter VIP logo

smbtakeover's Introduction

smbtakeover

A technique to unbind and rebind 445/tcp on Windows without loading a driver, loading a module into LSASS, or rebooting the target machine. Implemented to ease the burden of SMB-based NTLM relays while operating over C2. Technical analysis of the technique is dicussed in more detail during the Relay Your Heart Away: An OPSEC Concious Approach to 445 Takeover presentation at x33fcon.

PoCs written in both Python and BOF format. Both utilize RPC over TCP (ncacn_ip_tcp) as transport when targeting remote machines.

Operational Usage Notes

Please see this section of the associated blog post for an overview of operational usage considerations. The highlights include:

  1. Disabling these services effectively disables the target's ability to leverage namedpipes and and the server-side of SMB-based communication (CIFS, etc). Understand what the target machine is used for, especially if the target is critical / production infrastructure. The services will resume normal functionality once re-enabled.
  2. Occasionally there is slightly different series of services that need to be disabled. I've seen this occur in some version of Windows Server, as well as if certain third-party networking drivers are installed. This won't prevent you from using this technique. You can enumerate service dependencies backwards from srvnet and see if there are additional dependents to consider.
  3. You don't have to use this PoC to abuse this technique! Your favorite tool to interact with service control manager (SCM) should work.
    • Make sure you understand if the tool of your choice leverages ncacn_ip_tcp or ncacn_np as transport for RPC. If it uses the latter (named pipes) then you won't be able to communicate remotely with the target to re-enable.

Setup (for Python implementation)

Create a Python virtual environment and pip install impacket.

  1. git clone https://github.com/zyn3rgy/smbtakeover.git
  2. cd smbtakeover
  3. python3 -m virtualenv venv
  4. source venv/bin/activate
  5. python3 -m pip install impacket
  6. python3 smbtakeover.py -h

Example Usage

Python

BOF

  1. bof_smbtakeover localhost check
  2. bof_smbtakeover 10.0.0.21 stop
  3. bof_smbtakeover localhost start

Credits

smbtakeover's People

Contributors

zyn3rgy avatar

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.