未加星标

Intended solutions for 35c3ctf 2018 web "php"

字体大小 | |
[开发(php) 所属分类 开发(php) | 发布者 店小二05 | 时间 2019 | 作者 红领巾 ] 0人收藏点击收藏

Last year (we're in 2019 now), I had the great pleasure (thanks to tsuro ) to write a challenge for the 35c3ctf , called php". 86% of the teams in the top100 solved it, with a total of 209 solves on 636 playing teams, so maybe it should have been used for the 35c3 junior ctf instead.

But on the other hand, I only got positive feedback about it, so maybe it was ok after all. Anyway, here is the code:

<?php $line = trim(fgets(STDIN)); $flag = file_get_contents('/flag'); class B { function __destruct() { global $flag; echo $flag; } } $a = @unserialize($line); throw new Exception('Well that was unexpected…'); echo $a;

There are several possible solutions.

The intended one was to borrow the fast destruct trick from phpcgg : setting our object as a value somewhere in an array, then overwriting the index with something else, triggering the garbage collection. The payload could look like this: a:2:{i:7;O:1:"B":0:{};i:7;i:0} .

An other route could be to feed invalid data to unserialize, because of the presence of the @ : - a non-existent object present in an array with a B instance: a:2:{i:0;O:1:"B":0:{}i:1;O:1:"LOL";} . - an invalid object property count, O:1:"B":1337:{} or O:1:"B":0:{"1337":0} .

本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师

代码区博客精选文章
分页:12
转载请注明
本文标题:Intended solutions for 35c3ctf 2018 web "php"
本站链接:https://www.codesec.net/view/628189.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(php) | 评论(0) | 阅读(70)