网址:http://wargame.kr/challenge
already got
这个题打开直接就在响应头信息里
QR CODE PUZZLE
打开后发现有段不能看的图,查看源码发现图片被URL编码
<script type="text/javascript">
/*<![CDATA[*/
$(function(){
$('#join_img').attr('src',unescape('.%2f%69%6d%67%2f%71%72%2e%70%6e%67'));
$('#join_img').jqPuzzle({rows:6,cols:6,shuffle:true,numbers:false,control:false,style:{overlap:false}});
hide_pz();});
function hide_pz(){
var pz=$('#join_img div'); if(pz[pz.length-2]){$(pz[1]).remove();$(pz[pz.length-2]).remove();}else{setTimeout("hide_pz()",5);}
}
/*]]>*/
</script>
将%2f%69%6d%67%2f%71%72%2e%70%6e%67
解码后得到/img/qr.png
,访问得到二维码,随后得到网址,即得flag
flee button
打开后查看源码,得到一个链接,直接访问即得flag
login filtering
查看源码,得到关键代码
if(isset($_POST['id']) && isset($_POST['ps'])){
include("../lib.php"); # include for auth_code function.
mysql_connect("localhost","login_filtering","login_filtering_pz");
mysql_select_db ("login_filtering");
mysql_query("set names utf8");
$key = auth_code("login filtering");
$id = mysql_real_escape_string(trim($_POST['id']));
$ps = mysql_real_escape_string(trim($_POST['ps']));
$row=mysql_fetch_array(mysql_query("select * from user where id='$id' and ps=md5('$ps')"));
if(isset($row['id'])){
if($id=='guest' || $id=='blueh4g'){
echo "your account is blocked";
}else{
echo "login ok"."<br />";
echo "Password : ".$key;
}
}else{
echo "wrong..";
}
}
并给出了两个用户
you have blocked accounts.
guest / guest
blueh4g / blueh4g1234ps
由于mysql_real_escape_string的存在,会将特殊字符转义,再加上固定编码格式为UTF-8
,基本上防止绕过。如此,就只能在比较上下功夫,由于数据库没有进行大小写严格的过滤,所以利用大小写来绕过比较判断。所以提交id=Guest&ps=guest
即得flag
WTF_CODE
打开看一片空白,但有的是tab,有的是空格,猜测是whitespace语言,脚本破解
def t2i(str):
out = 0
for i in range(0,8):
out += int(str[i])*(2**(7-i))
return out
f = open("C:/Users/lanlan/Desktop/source_code.ws","rb")
x = f.readline()
x = f.readline()
ans=""
k = 0
while x:
out = ''
for c in x:
if c==' ':
out += '0'
else:
out += '1'
x = f.readline()
l = len(out)
if 8 <= l <= 11 and k%2 ==0:
print out
c = t2i('0'+out[l-8:l-1])
#print c
#print chr(c)
ans+= chr(c)
k+=1
f.close()
print ans
即得flag
DB is really GOOD
首先确定数据库类型,通过write.php
尝试各种字符,知道加/
促使报错,知道是sqlite数据库
通过查找规律可以知道sqlite数据库的db
文件位置在/db/wkrm_username.db
处,直接访问下载得到db
文件
直接notepad++查看,最后发现文件路径
访问即得flag
fly me to the moon
打开是一个游戏,貌似需要分数很高,通过提示需要作弊修改,查看源码没有发现情况,直接一步一步抓包
在high-scores.php
页面修改分数,修改很大,最后得到flag
md5_compare
查看,发现是md5弱类型比较
if (isset($_GET['v1']) && isset($_GET['v2'])) {
sleep(3); // anti brute force
$chk = true;
$v1 = $_GET['v1'];
$v2 = $_GET['v2'];
if (!ctype_alpha($v1)) {
$chk = false;}
if (!is_numeric($v2) ) {
$chk = false;}
if (md5($v1) != md5($v2)) {
$chk = false;}
if ($chk){
include("../lib.php");
echo "Congratulations! FLAG is : ".auth_code("md5_compare");
} else {
echo "Wrong...";
}
}
}
md5 password
是一个关于MD5加密后的sql注入,直接
链接
strcmp
<?php
require("../lib.php"); // for auth_code function
$password = sha1(md5(rand().file_get_contents("/var/lib/dummy_file")).rand());
if (isset($_GET['view-source'])) {
show_source(__FILE__);
exit();
}else if(isset($_POST['password'])){
sleep(1); // do not brute force!
if (strcmp($_POST['password'], $password) == 0) {
echo "Congratulations! Flag is <b>" . auth_code("strcmp") ."</b>";
exit();
} else {
echo "Wrong password..";
}
}
?>
同样是一个弱类型比较
type confusion
tmitter
打开看是一个伪造的注册登录界面,由于提示要求admin
进入,但不知道其密码,在注册的页面得到提示
是利用最大长度截断来强行注册admin达到修改密码的目的
由于有trim()
存在会过来首尾两段空格,所以在一堆空格后面附加1
来绕过,最后通过此函数来强行注册
SimpleBoard
首先可以知道http://wargame.kr:8080/SimpleBoard/read.php?idx=5
是一个注入点,查看源码
关键部分
public function read($idx){
$idx = mysql_real_escape_string($idx);
if ($this->read_chk($idx) == false){
$this->inc_hit($idx);
}
return $this->db->get_query("select * from {$this->table} where idx=$idx");
}
private