From b0a0202956b9215cd6b53f62c34431cca1f4aedc Mon Sep 17 00:00:00 2001 From: Tod Beardsley <tod_beardsley@rapid7.com> Date: Thu, 5 Jun 2014 14:50:52 -0500 Subject: [PATCH] Add new libs and docs for the same. --- c/meterpreter/README.md | 12 ++ .../source/openssl/lib/win/README.md | 108 ++++++++++++++++++ .../source/openssl/lib/win/x64/build.txt | 16 --- 3 files changed, 120 insertions(+), 16 deletions(-) create mode 100644 c/meterpreter/source/openssl/lib/win/README.md delete mode 100644 c/meterpreter/source/openssl/lib/win/x64/build.txt diff --git a/c/meterpreter/README.md b/c/meterpreter/README.md index ec740e4d..ce97d40d 100644 --- a/c/meterpreter/README.md +++ b/c/meterpreter/README.md @@ -41,6 +41,17 @@ $ git submodule init && git submodule update At this point the dependencies will be ready to use and Meterpreter should be ready to build. +* [OpenSSL][openssl] + +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](https://github.com/rapid7/meterpreter/pull/86). + Running the Build ----------------- @@ -190,3 +201,4 @@ Good luck! [framework]: https://github.com/rapid7/metasploit-framework [build_icon]: https://ci.metasploit.com/buildStatus/icon?job=MeterpreterWin [rdi]: https://github.com/rapid7/ReflectiveDLLInjection + [openssl]: https://github.com/rapid7/meterpreter/tree/master/source/openssl diff --git a/c/meterpreter/source/openssl/lib/win/README.md b/c/meterpreter/source/openssl/lib/win/README.md new file mode 100644 index 00000000..8dfcfa56 --- /dev/null +++ b/c/meterpreter/source/openssl/lib/win/README.md @@ -0,0 +1,108 @@ +# Build instructions for libeay32.lib and ssleay32.lib + +These are the instructions for building static DLLs for OpenSSL for +Windows. The procedure here assumes **0.9.8za**, released June 5, 2014. +If this is not the correct version, it should be straightforward enough +to replace all references **za** with whatever is current. + +## Preparing the build environment + +On a 64-bit build machine (Windows 7 64-bit will do nicely): + +- Download openssl from https://openssl.org +- Download ActiveState ActivePerl +- Install ActivePerl +- Download 7zip +- Install 7zip +- Download Visual Studio per Meterpreter instructions +- Install Visiual Studio Express. Takes many clicks. +- Extract source to C:\openssl-0.9.8za (whatever the correct version is) +- Create C:\openssl-0.9.8za-bin +- Create C:\openssl-0.9.8za-bin-64 + +- Open a Developer Command Prompt for VS2013 (from the Start menu) + +## Compiling 32-Bit Binaries + +- Get to the source directory: + +```` +cd C:\openssl-0.9.8za +```` + +- Start off with a clean slate: + +```` + rmdir /s /q out32 + nmake -f ms\nt.mak clean +```` + +- Configure for a Win32 build target and installation directory. + +```` + perl Configure VC-WIN32 no-asm --prefix=C:\openssl-0.9.8za-bin + ms\do_ms +```` + +- Don't treat warnings as errors (because there are warnings). Edit + `ms\nt.mak` `CFLAGS` with notepad, replacing `/W3 /WX` with `/W3 /WX-` +(Hopefully, this step will not be required in future versions of +OpenSSL). + +- Compile: + +```` + nmake -f ms\nt.mak +```` + +Test your results. + +```` + nmake -f ms\nt.mak test +```` + +- See the "passed all tests" statement. Yay. + +- Copy to the named install directory: + +- nmake -f ms\nt.mak install + +Now your libs are in openssl-0.9.8za-bin\lib . Hooray! + +## Compiling 64-Bit binaries + +The process is quite similar. + +```` +cd C:/openssl-0.9.8za +rmdir /s /q out32 +nmake -f ms\nt.mak clean +perl Configure VC-WIN64A no-asm --prefix=C:\openssl-0.9.8za-bin-64 +ms\do_win64a +nmake -f ms\nt.mak +nmake -f ms\nt.mak test +nmake -f ms\nt.mak install +```` + +## Updating Meterpeter source + +Copy the resulting binaries (easiest if your build environment is a +Windows VM and your git checkout is either the host OS or another VM on +the same host). They should end up in: + +https://github.com/rapid7/meterpreter/tree/master/source/openssl/lib/win + +and + +https://github.com/rapid7/meterpreter/tree/master/source/openssl/lib/win/x64 + +## Build Meterpreter + +Follow the instructions at: + +https://github.com/rapid7/meterpreter/blob/master/README.md + +## You're done! + + + diff --git a/c/meterpreter/source/openssl/lib/win/x64/build.txt b/c/meterpreter/source/openssl/lib/win/x64/build.txt deleted file mode 100644 index dc73b462..00000000 --- a/c/meterpreter/source/openssl/lib/win/x64/build.txt +++ /dev/null @@ -1,16 +0,0 @@ -1. Install Windows SDK in order to get the x64 build enviroment. -2. Install perl if not allready present. -3. Download the latest stable openssl source. -4. Remove the bufferoverflowu.lib references from the openssl make files as this lib is not shipped in new Win SDK. -5. Open a Windows SDK command prompt (installed into the start menu)... - -C:\Program Files\Microsoft SDKs\Windows\v6.1>SetEnv /Release /x64 -C:\Program Files\Microsoft SDKs\Windows\v6.1>cd c:\openssl-0.9.8k -C:\openssl-0.9.8k>perl Configure VC-WIN64A -C:\openssl-0.9.8k>ms\do_win64a -C:\openssl-0.9.8k>nmake -f ms\nt.mak -C:\openssl-0.9.8k>cd out32 -C:\openssl-0.9.8k\out32dll>copy /b ssleay32.lib c:\msf3\external\source\meterpreter\source\openssl\lib\win\x64\ -C:\openssl-0.9.8k\out32dll>copy /b libeay32.lib c:\msf3\external\source\meterpreter\source\openssl\lib\win\x64\ - -6. If the include file need to be updated copy them over. \ No newline at end of file