• Stars
    star
    318
  • Rank 131,872 (Top 3 %)
  • Language
    C
  • License
    Other
  • Created about 12 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

THIS REPO IS OBSOLETE. USE https://github.com/rapid7/metasploit-payloads INSTEAD

This repository has been merged into metasploit-payloads

Please note that this repository has been merged into a unified repository for meterpreters: https://github.com/rapid7/metasploit-payloads

The history has been preserved, along with prehistory from metasploit-framework: https://github.com/rapid7/metasploit-payloads/tree/master/c/meterpreter

If you have any local branches, please rebase them on the new repository. See #110 for discussion of why we merged these repositories back together.

meterpreter >

This is the new repository for the Meterpreter source, which was originally in the Metasploit Framework source.

Building - Windows

As of commit a2888b1b4862819c9aae81bf46d8c92d8164c598, Meterpreter is built with Visual Studio 2013 Express for Desktop or any paid version of Visual Studio 2013. Earlier toolsets on Windows are no longer supported -- this includes Visual Studio 2012. Make sure that the version that you download is Visual Studio Express 2013 for Windows Desktop -- dependng on your operating system, if you get the wrong version of VS2013, the installer will complain about needing "a more recent version of Windows." If you are using a dedicated build machine, your best bet is to uninstall Visual Studio 2012 if your only project is Meterpreter.

Visual Studio 2013 requires .NET 4.5.1 in order to run, and as a result isn't compatible with Windows XP due to the fact that .NET 4.5 will not run on Windows XP. However, this does not mean that Metepreter itself will not run on Windows XP, it just means that it's not possible to build it on Windows XP.

Windows Meterpreter has the following repositories set up as submodule dependencies:

For Meterpreter to build correctly, these submodules must be initialised and updated, like so:

$ git clone https://github.com/rapid7/meterpreter
$ cd meterpreter
$ git submodule init && git submodule update

At this point the dependencies will be ready to use and Meterpreter should be ready to build.

Occasionally, new versions of OpenSSL are released and need to be incorporated into the Meterpreter build. See the README under source/openssl/lib for build instructions. You will also need to refresh the header files from the source tarball as well. TODO: This entire process appears automatable given a proper build environment.

An example of updating OpenSSL is detailed in Pull Request #86.

Running the Build

Open up a Visual Studio command prompt by selecting Developer Command Prompt for VS2013 from the Start menu. Alternatively you can run vcvars32.bat from an existing command line prompt, just make sure it's the VS2013 one if you have multiple versions of VS installed on your machine.

Once you have your environment variables set up, change to the root folder where the meterpreter source is located. From here you can:

  • Build the x86 version by running: make x86
  • Build the x64 version by running: make x64
  • Build both x86 and x64 versions by running: make

The compiled binaries are written to the output/x86 and output/x64 folders.

If you are not a Rapid7 employee, make sure you build the source using the debug or release configurations when inside Visual Studio. If you attempt to build r7_debug or r7_release you will get compiler errors due to missing libraries.

If you build the source from the command line the toolset will choose the most appropriate build configuration for you and hence calling make should "Just Workโ„ข".

If you are a Rapid7 employee you will need the PSSDK source in order to build the extra components using the r7_* build configurations.

If submodule dependencies are not found on the file system, the script should display an error message like so:

Meterpreter's submodule dependencies can't be found.
From your git console, please run:
  $ git submodule init && git submodule update

Building - POSIX

You will need:

  • A compiler toolchain (build-essential package on Ubuntu)
  • gcc-multilib, if you're building on a 64-bit machine
  • jam
  • wget
  • flex

On Ubuntu 14.04: apt-get install gcc jam make flex bison gcc-multilib

On Fedora 21: yum install gcc jam make flex patch bison glibc-devel.i686 libgcc.i686

Meterpreter requires libpcap-1.1.1 and OpenSSL 0.9.8za sources, which it will download automatically during the build process. If for some reason, you cannot access the internet during build, you will need to:

Now you should be able to type make in the base directory, go make a sandwich, and come back to a working[1] meterpreter for Linux.

[1] For some value of "working." Meterpreter in POSIX environments is not considered stable. It does stuff, but expect occasional problems.

Testing

There is currently no automated testing for meterpreter, but we're working on it.

Once you've made changes and compiled a new .dll or .so, copy the contents of the output/ directory into your Metasploit Framework's data/meterpreter/ directory. In POSIX you can do this automatically if metasploit-framework and meterpreter live in the same place by running make install

If you made any changes to metsrv.dll or msflinker_linux_x86.bin, ensure that all extensions still load and function properly.

Creating Extensions

Creating extensions isn't complicated, but it's not simple either. In an attempt make the set up a little easier on the Meterpreter side, a new project called ext_server_bare has been created which is just the shell of a project which can be used as the starting point for your code. To use this as a template to create your own project, you can follow these steps.

Note: All paths listed here are relative to the root meterpreter folder where this document resides.

Pick a name for your extension, make sure it's something meaningful and short. For the sake of example, we'll create a new extension called splat. Once you have a cool an meaningful name, you can get your project going by doing the following:

  1. Create a new folder called workspace/ext_server_splat.
  2. Copy workspace/ext_server_bare/ext_server_bare.vcxproj to workspace/ext_server_bare/ext_server_splat.vcxproj
  3. Open workspace/ext_server_bare/ext_server_splat.vcxproj with a text editor and..
    • Replace all instances of BARE with SPLAT.
    • Replace all instances of bare with splat.
    • Search for the ProjectGuid property in the document. It looks like <ProjectGuid>{D3F39324-040D-4B1F-ADA9-762F16A120E6}</ProjectGuid>. When found, generate a new GUID for your project either using guidgen.exe or an online tool, and replace this GUID with your new GUID. Make sure you keep the curly braces.
  4. Create a new folder called source/extensions/splat.
  5. Copy source/extensions/bare/bare.c to source/extensions/splat/splat.c
  6. Copy source/extensions/bare/bare.h to source/extensions/splat/splat.h
  7. Open workspace/meterpreter.sln in Visual Studio 2013.
  8. Right-click on the solution item called Solution 'meterpreter' and select Add, then Existing Project....
  9. Browse to your new project's location at workspace/ext_server_splat and select ext_server_splat.vcxproj.
  10. The solution should automagically pick up your project configurations and wire them in where appropriate.
  11. Right-click, again, on the solution item and select Configuration Manager.
  12. In the resulting window, iterate through all combinations Active Solution Configuration and Active Solution Platform and make sure that:
    • Configuration matches with all the other extensions in each case.
    • Platform matches with all the other extensions in each case.
    • Build is checked in each case.
    • Deploy is NOT checked in each case.
  13. Modify the contents of splat.c and splat.h so that the file header commands are up to date, and that all references to bare have been removed.

At this point you're ready to start adding your extension's functionality.

Things to Remember

  • Your extension is set up to build both 32 and 64 bit versions. Make sure you're mindful of this when you are writing your code. All of the usual pitfalls apply when dealing with things like pointer sizes, value trunction, etc.
  • Make sure your extension builds correctly from the command line using make.
  • The outputs of your builds, when successful, are copied to output/x64 and output/x86.

Good luck!

More Repositories

1

metasploit-framework

Metasploit Framework
Ruby
31,198
star
2

metasploitable3

Metasploitable3 is a VM that is built from the ground up with a large amount of security vulnerabilities.
HTML
4,644
star
3

metasploit-payloads

Unified repository for different Metasploit Framework payloads
C
1,543
star
4

hackazon

A modern vulnerable web app
HTML
944
star
5

ssh-badkeys

A collection of static SSH keys (public and private) that have made their way into software and hardware products.
790
star
6

IoTSeeker

Created by Jin Qian via the GitHub Connector
Perl
749
star
7

recog

Pattern recognition for hosts, services, and content
Ruby
591
star
8

metasploit-vulnerability-emulator

Created by Jin Qian via the GitHub Connector
Perl
428
star
9

mettle

This is an implementation of a native-code Meterpreter, designed for portability, embeddability, and low resource utilization.
C
398
star
10

sonar

Project Sonar
234
star
11

metasploit-omnibus

Packaging metasploit-framework with omnibus
Ruby
222
star
12

warvox

Ruby
197
star
13

dap

Data Analysis Pipeline
Ruby
151
star
14

nexpose-client

DEPRECATED: Rapid7 Nexpose API client library written in Ruby
Ruby
145
star
15

embedded-tools

AGS Script
143
star
16

awsaml

Awsaml is an application for providing automatically rotated temporary AWS credentials.
JavaScript
133
star
17

myBFF

myBFF - a Brute Force Framework
Python
132
star
18

docker-logentries

Forward all your Docker logs to logentries, like a breeze
JavaScript
111
star
19

le_node

Node module for logentries.com
JavaScript
108
star
20

jsobfu

Obfuscate JavaScript (beyond repair) with Ruby
JavaScript
89
star
21

metasploit-javapayload

THIS REPO IS OBSOLETE. USE https://github.com/rapid7/metasploit-payloads INSTEAD
Java
87
star
22

ruby_smb

A native Ruby implementation of the SMB Protocol Family
Ruby
76
star
23

vm-console-client-python

the UNOFFICIAL (but useful) Python library for the Rapid7 InsightVM/Nexpose RESTful API
Python
76
star
24

vm-automation

Created to simplify interactions with virtual machines
Python
75
star
25

le_js

Client-side JavaScript logging library for Logentries
JavaScript
73
star
26

insightconnect-plugins

Plugin source code for the InsightConnect SOAR product, developer documentation at https://docs.rapid7.com/insightconnect/getting-started
Python
66
star
27

insightvm-sql-queries

InsightVM helpful SQL queries
56
star
28

conqueso

Centrally and dynamically change configuration values of your services!
JavaScript
55
star
29

smbj-rpc

Created by Paul Miseiko via the GitHub Connector
Java
53
star
30

go-get-proxied

Cross platform retrieval of system proxy configurations
Go
52
star
31

metasploit_data_models

MSF database code, gemified
Ruby
51
star
32

rex-powershell

Rex library for dealing with Powershell Scripts
Ruby
51
star
33

DLLHijackAuditKit

This toolkit detects applications vulnerable to DLL hijacking (released in 2010)
JavaScript
51
star
34

metasploit-aggregator

Created by Jeffrey Martin via the GitHub Connector
Ruby
49
star
35

rex

Rex provides a variety of classes useful for security testing and exploit development.
Ruby
48
star
36

le_ruby

Ruby logging support for logentries.com
Ruby
47
star
37

data

HTML
42
star
38

convection

A fully generic, modular DSL for AWS CloudFormation
Ruby
41
star
39

Rapid7-Labs

Rapid7 Labs operates as the division of Rapid7 focused on threat research. It is renowned for providing comprehensive threat intelligence, research and analytics.
YARA
35
star
40

github-connector

The GitHub Active Directory Connector allows managing GitHub organizations with Active Directory.
Ruby
34
star
41

krip

Dead simple encryption, using WebCrypto under the hood
JavaScript
33
star
42

le_dotnet

.NET support for Logentries
C#
30
star
43

le_java

Direct logging support for Java language
Java
30
star
44

metasploit-credential

Code for modeling and managing credentials in Metasploit, implemented as a Rails Engine
Ruby
29
star
45

nexpose-resources

Scripts, SQL queries, and other resources for Nexpose
Ruby
27
star
46

re2-java

re2 for Java
Java
27
star
47

vaccination

C
26
star
48

metasploit-baseline-builder

Created by Jeffrey Martin via the GitHub Connector
Python
26
star
49

pdf-renderer

Golang based app that will render an html page and create a pdf.
Go
26
star
50

nexpose-client-python

DEPRECATED : Rapid7 Nexpose API client library written in Python
Python
25
star
51

metabot

Use security tools from within IRC.
Ruby
24
star
52

lecli

Seamlessly view recent events, run queries and manage your account from the command line
Python
23
star
53

msfrpc-client

Rapid7 Metasploit API client library written in Ruby
Ruby
23
star
54

rex-exploitation

Rex library for various exploitation helpers
Ruby
22
star
55

propsd

Dynamic property management at scale
JavaScript
22
star
56

builderator

Tools to make CI Packer builds awesome
Ruby
22
star
57

sonar-client

Ruby
21
star
58

savery

JavaScript
21
star
59

tabtalk

Secure, encrypted cross-tab communication in the browser
JavaScript
21
star
60

le_chef

Ruby
20
star
61

Websploit-Tests

A place for scripts that describe web exploits to live so they can be used in testing
PHP
20
star
62

rex-text

Rex library for text generation and manipulation
Ruby
19
star
63

godap

The Data Analysis Pipeline
Go
18
star
64

memorandom

Ruby
18
star
65

dogwatch

A Ruby DSL to create DataDog monitors.
Ruby
17
star
66

FullAutoOSINT

Python
17
star
67

metakitty

Metakitty, The Metasploit Resource Portal
Ruby
16
star
68

akheron-proxy

UART proxy tool for inter-chip analysis.
Python
16
star
69

guardian

A lightweight authentication proxy for HTTP services
JavaScript
16
star
70

le_community_packs

Logentries Community Packs
VCL
16
star
71

le_lambda

Python
16
star
72

fastlib

FastLib provides a "jar-like" format for Ruby libraries, with specific features for the Metasploit Framework
Ruby
15
star
73

react-prefixer

JavaScript
15
star
74

nexpose_java_api

DEPRECATED : A library used to connect to the Nexpose API
Java
15
star
75

geppetto

Geppetto - Virtual machine and infrastructure orchestration
Python
14
star
76

raptor-io

The eventual successor to the networking/IO functionalities of Metasploit's REX library
Ruby
13
star
77

presales-engineering

Shell
13
star
78

marionette.carpenter

A thing that makes tables
JavaScript
13
star
79

tokend

A Node.js daemon that interfaces with Vault and Warden to provide a secure method to deliver secrets to servers in the cloud.
JavaScript
13
star
80

metasploit-vagrant-builders

Build tools to generate vagrant images used by metasploit-framework CI
Ruby
13
star
81

rex-socket

The Rex Socket Abstraction Library
Ruby
12
star
82

psych_shield

PsychShield provides a filtering mechanism for YAML.load when using the Psych parser
Ruby
12
star
83

docker-image-analyzer

docker image analyzer
Java
12
star
84

insightvm-api-examples

Created by Ivan Quintanilla via the GitHub Connector
Python
12
star
85

appspider-pentestkit

Created by Denis Podgurskiy via the GitHub Connector
JavaScript
12
star
86

rex-bin_tools

Created by David Maloney via the GitHub Connector
Ruby
11
star
87

attackerkb

Repo for creating-and-tracking issues related to AttackerKB
11
star
88

vm-console-client-ruby

The UNOFFICIAL (but useful) Ruby gem for the Rapid7 InsightVM/Nexpose RESTful API
Ruby
10
star
89

javascript-style-guide

10
star
90

resynth

A network packet synthesis language
Rust
10
star
91

network_interface

C
10
star
92

insightappsec-azure-devops-extension

Rapid7 InsightAppSec Extension for Azure DevOps
TypeScript
10
star
93

insightcloudsec-actions

10
star
94

metasploit-model

Common code, such as validators and mixins, that are shared between ActiveModels in metasploit-framework and ActiveRecords in metasploit_data_models
Ruby
10
star
95

jenkinsci-appspider-plugin

Jenkins plugin that calls the AppSpider API
Java
9
star
96

r7insight_js

Client-side JavaScript logging library for InsightOps
JavaScript
9
star
97

recog-java

Recog java
Java
9
star
98

insightappsec-api-examples

Project intended to provide guides for InsightAppSec API examples and use cases
Python
9
star
99

insightappsec-scan-github-actions

JavaScript
9
star
100

armor

This repository is no longer supported
Java
8
star