- MITM PE INJECTOR -

- instructions - about - description - features - peinjector - servers - download - related projects - contact -

----- instructions ----- ^^

Foot-Shooting Prevention Agreement

For security professionals and researchers only. Usage against targets without explicit permission is illegal. It is the end user's responsibility to obey all applicable laws. The developers assume no liability and are not responsible for any misuse.

X: _______________

----- about ----- ^^

         ,x-"F   ]    Ax^" q    hp"  `u jM""u    a^ ^, j"  "*g_   p  ^mg_   N    "-x,              
           jLs*^6   `_  _&*"  q  _,NF   "wp"    "*g"   _NL_  p  "-d_   F   ]"*u_F                  
            ]   J_,x-E   3_  jN^" `u _w^*_  _R"""R_  _J^w_ j"  "pL_  f   7^-L_F   #__              
         w*^0   4   9__sAF" `L  _Dr"  m__m""q_,,_a^"m__*  "qA_  j" ""Au__f   J   0^                
            #_,J@^""p  `_ _jp-""q  _Dw^" ^cj*"  "*,j^  "p#_  y""^wE_ _F   F"^qN,_j                 
            L  ]   k,w@#"""_  "_a*^E   ba-" ^qjqj-""^pe"  J^-u_f  _f "q@w,j   f  jL _              
         -,Jp*^#""9   L  5_a*N"""q__INr" "q_e^"^"*,p^""qME_ y"""p6u,f  j'  f "N^--LL               
         _ t  J  __,Jb--N""",  *_s0M`""q_a@NW_@@_JP^u_p"""p4a,p" _F""V--wL,_F_ F  #                
          r#^^0""E" 6  q  q__hg-@4""*,_Z*q_"^pwpwr""p*C__@""0N-qdL_p" p  J" 3""5^^0r-              
           F Jp 9__b__M,Juw*w*^#^9#""EED*dP_@EZEZ@^E@*#EjP"5M"gM@p*Ww&,jL_J__f  F j                
         rNrr4r*pr4r@grNr@q@Ng@q@N0@N#@NNMpmgg@@ggmqgNN@NN@#@4p*@M@p4qp@w@m@Mq@r#rq@r              
          j  L 6 9""Q"#^q@NDNNNMpg----                  ----gggNNW#W4p^p@jF"P"]"j  F               
         a0,3_j_j_9FN@N@0NMp--                                  --ggNZNrNM"P_f_f_E,0a              
         "0^#-LJ_9"NNNMp--                                           -gN#@#"R_#g@q^9"              
         _F`@q4WBN@Np-                                                  -gNN@ZL#p"Fj_              
         JLE5@WRNp                                                          g@NNNF3_L              
         4JF@NNp- ---------------------------------------------------------- -g0WNNL@              
         40NNh-    ____  _____ _____    _____ _____ _____ ____  _____ _____    -gN#B0              
         NN#p     |    \|     |   __|  |  |  |   __|  _  |    \|   __| __  |     j0NN              
         ##       |  |  |  |  |__   |  |     |   __|     |  |  |   __|    -|       d#              
        J#        |____/|_____|_____|  |__|__|_____|__|__|____/|_____|__|__|        #L             
       J#                                                                            #L            
      J# ---------------------------------------------------------------------------- #L           
     J#               _____ _____    _____ _____ _____ ____  _____ _____               #L          
    J#               |  _  |   __|  |  |  |   __|  _  |    \|   __| __  |               #L         
   J#                |   __|   __|  |     |   __|     |  |  |   __|    -|                #L        
  J#                 |__|  |_____|  |__|_ _,.-----.,_ |____/|_____|__|__|                 #L       
 J#                                    ,-~           ~-.                                   #L      
'# --------------------------------- ,^___           ___^. -------------------------------- #'     
t#  _____ _____ _____ _____ _____   /~"   ~"   .   "~   "~\  _____ _____ ____  _____ _____  #j     
t# |     |  _  |_   _|     |     | Y  ,--._    I    _.--.  Y    __|  _  |    \|   __| __  | #j     
t# |  |  |   __| | | |-   -|  |  | | Y     ~-. | ,-~     Y |    __|     |  |  |   __|    -| #j     
t# |_____|__|    |_| |_____|_____| | |        }:{        | | _____|__|__|____/|_____|__|__| #j     
.#                                 j l       / | \       ! l                                #'     
 Y#---------------------------- .-~  (__,.--" .^. "--.,__)  ~-. -------------------------- #Y      
  Y#      _____ _____ _____ ___(           / / | \ \           ) _ _____ __    _____      #Y       
   Y#    |   __|   __|     |_   \.____,   ~  \/"\/  ~   .____,/   | __  |  |  |   __|    #Y        
    Y#   |__   |   __|   --| | | ^.____                 ____.^    | __ -|  |__|   __|   #Y         
     Y#  |_____|_____|_____| |_| |_ | |T ~\  !   !  /~ T| | |__|__|_____|_____|_____|  #Y          
      Y#                            | |l   _ _ _ _ _   !| |                           #Y           
       Y#, ------------------------ | l \/V V V V V V\/ j | ----------------------- ,#Y            
        Y#            _____ _____ _ l  \ \|_|_|_|_|_|/ /  ! ___    ___              #Y             
        t#           |   __|   __|   \  \[T T T T T TI/  /   | |  |   |             #j             
        t#           |__   |   __|   -\  `^-^-^-^-^-^'  /  | | |  | | |             #j             
        t#           |_____|_____|____ \               / |_|___|  |___|             #j             
        t#                              \.           ,/                             #j             
        t# ------------------------------ "^-.___,-^" ----------------------------- #j             
        t#            _____ _____ _____ _____ _____ _____ _____    ___              #j             
        t#           |   __|   __|     |_   _|     |     |   | |  |_  |             #j             
        t#           |__   |   __|   --| | | |-   -|  |  | | | |   _| |_            #j             
        t#           |_____|_____|_____| |_| |_____|_____|_|___|  |_____|           #j             
        '#_                                                                         #'             
         ##_ --------------------------------------------------------------------- d#              
         NN#p         _____ _____ _____ _____ _____ _____ _____    _____         j0NN              
         40NNh_      |   __|   __|     |_   _|     |     |   | |  |   | |      _gN#B0              
         4JF@NNp_    |__   |   __|   --| | | |-   -|  |  | | | |  | | | |    _g0WNNL@              
         JLE5@WRNp_  |_____|_____|_____| |_| |_____|_____|_|___|  |_|___|  _g@NNNF3_L              
         _F`@q4WBN@Np_                                                  _gNN@ZL#p"Fj_              
         "0^#-LJ_9"NNNMp__ ----------------------------------------- _gN#@#"R_#g@q^9"              
         a0,3_j_j_9FN@N@0NMp__                                  __ggNZNrNM"P_f_f_E,0a              
          j  L 6 9""Q"#^q@NDNNNMpg____                  ____gggNNW#W4p^p@jF"P"]"j  F               
         rNrr4r*pr4r@grNr@q@Ng@q@N0@N#@NNMpmgg@@ggmqgNN@NN@#@4p*@M@p4qp@w@m@Mq@r#rq@r              
           F Jp 9__b__M,Juw*w*^#^9#""EED*dP_@EZEZ@^E@*#EjP"5M"gM@p*Ww&,jL_J__f  F j                
         -r#^^0""E" 6  q  q__hg-@4""*,_Z*q_"^pwpwr""p*C__@""0N-qdL_p" p  J" 3""5^^0r-              
           t  J  __,Jb--N""",  *_s0M`""q_a@NW_@@_JP^u_p"""p4a,p" _F""V--wL,_F_ F  #                
         _,Jp*^#""9   L  5_a*N"""q__INr" "q_e^"^"*,p^""qME_ y"""p6u,f  j'  f "N^--LL_              
            L  ]   k,w@#"""_  "_a*^E   ba-" ^qjqj-""^pe"  J^-u_f  _f "q@w,j   f  jL                
            #_,J@^""p  `_ _jp-""q  _Dw^" ^cj*"  "*,j^  "p#_  y""^wE_ _F   F"^qN,_j                 
         w*^0   4   9__sAF" `L  _Dr"  m__m""q_,,_a^"m__*  "qA_  j" ""Au__f   J   0^--              
            ]   J_,x-E   3_  jN^" `u _w^*_  _R"""R_  _J^w_ j"  "pL_  f   7^-L_F   #                
           jLs*^6   `_  _&*"  q  _,NF   "wp"    "*g"   _NL_  p  "-d_   F   ]"*u_F                  
         ,x-"F   ]    Ax^" q    hp"  `u jM""u    a^ ^, j"  "*g_   p  ^mg_   N    "-x,              

----- description ----- ^^

The executable file format on the Windows platform is PE COFF. The peinjector provides different ways to infect these files with custom payloads without changing the original functionality. It creates patches, which are then applied seamlessly during file transfer. It is very performant, lightweight, modular and can be operated on embedded hardware.

----- features ----- ^^

-
Full x86 and x64 PE file support.
-
Open Source (MIT License).
-
Fully working on Windows and Linux, including automated installation scripts.
-
On Linux, all servers will be automatically integrated as service, no manual configuration required.
-
Plain C, no external libraries required (peinjector).
-
MITM integration is available in C, Python and Java. A sample Python MITM implementation is included.
-
Foolproof, mobile-ready web interface. Anyone who can configure a home router can configure the injector server.
-
Easy to use integrated shellcode factory, including reverse shells, meterpreter, ... or own shellcode. Everything is available in 32 and 64 bit with optional automated encryption to drop AV detection rates. Custom shellcode can be injected directly or as a new thread.
-
An awesome about page and much more, check it out.

----- peinjector ----- ^^

                              + configuration                  
                              | payload                        
                              | ...                            
                  +-----------v------------+                   
  +-------+       |                        |                   
  | PATCH <-------+      libpeinfect       <--+                
  +-------+       |                        |  |                
                  +-----------+------------+  |                
                              |               |                
                  +-----------v------------+  |                
                  |                        |  |                
  +--------------->       libpetool        |  |                
  | change values |                        |  |                
  | add sections  +-----------^------------+  |                
  | resize sect.              |               |                
  + ...                  +----v----+          |                
                         | PEFILE  +----------+                
                         +----^----+                           
                              |                                
                  +-----------v------------+                   
  PE File data    |                        |    PE File data   
  +--------------->       libpefile        +--------------->   
                  |                        |                   
                +------------------------+                 
- libpefile -
Provides PE file parsing, modification and reassembling capabilities, based on PE COFF specification. Also works with many non-compliant and deliberately malformed files which the Windows Loader accepts.

- libpetool -
Provides more complex modifications (adding/resizing sections). Keeps header values PE COFF compliant.

- libpeinfect -
Provides different infection methods, removes integrity checks, certificates, etc. It can fully infect a file (statically, e.g. from disk) or generate a patch (for MITM infection. Connectors which work with these patches are available in C, Python and Java). The infected file keeps its original functionality.

----- servers ----- ^^

                                  +-----------------+-+
                                  |   web browser   |X|
        +-------------+           +-----------------+-+
        | peinjector- |           |       _____       |
------->+ interceptor +---------> |      /     \      |
-orig.->+   (MITM)    +-patched-> |     | () () |     |
-data-->+             +-data----> |      \  ^  /      |
------->+ +---------+ +---------> |       |||||       |
        | |connector| |           |                   |
        +-+-+-----^-+-+           +-----+------^------+
     raw    |     |              send   |      | get   
     header |     | patch        config |      | status
            |     |                     |      |       
        +-+-v-----+-+-+           +-+---v------+---+-+ 
        | |data port| |           | |http(s) server| | 
        | +---------+ |           | +--------------+ | 
        | peinjector  |           |                  | 
        | (core   +---+ crtl      +---+ peinjector-  | 
        | engine) |c p| protocol  |c p| control      | 
        |         |r o+----------->r r| (user        | 
        |         |t r<-----------+t o| interface)   | 
        |         |l t|           |l .|              | 
        +---------+---+           +---+--------------+ 
- peinjector -
Provides PE file patching as a service. Just send the raw header of your PE file and you'll receive a custom-made patch for it. Can be remotely controlled via a command protocol.

- peinjector-control -
Web interface to configure and control a peinjector server. A small shellcode factory with some basic shellcodes, automatic encryptoin/obfuscation and thread generation is provided - alternatively, custom shellcode can be injected.

- peinjector-interceptor -
Sample MITM integration. Based on Python and libmproxy, supports SSL interception, can act as transparent Proxy, HTTP Proxy, ... . Provides seamless PE patching capabilities.

----- download ----- ^^

----- related projects ----- ^^

mitmproxy - An interactive console program that allows traffic flows to be intercepted, inspected, modified and replayed. Written in Python 2.7. peinjector-interceptor is based on mitmproxy's libmproxy library.

BDFProxy - The idea for peinjector comes from this project. It can also do MITM executable modification, but doesn't provide seamless patching and isn't as performant as peinjector. It provides ELF and MACH-O infection, PE code cave jumping, IAT patching and more "static" patching methods.

----- contact ----- ^^

anon.zMisc@gmail.com