当前位置:网站首页>Singles cup web WP
Singles cup web WP
2022-07-26 07:19:00 【GSflyy】
web Sign in problem

php Code audit
post Pass in a parameter file,file The inverted string of and file When the same, the executable file contains
payload :
?file=data://text/plain,<?php echo system("cat /f*")?>>?)"*f/ tac"(metsys ohce php?<,nialp/txet//:atad
Use ?> You can truncate the code
easyPHP

php Code audit
POST Mode in cmd and param Two parameters , Use escapeshellcmd() and escapeshellarg() The two functions are processed and merged into one cmd The order is handed over to shell_exec() Function execution
The parameter cmd Limited to three digits , Parameters param Unlimited length
escapeshellcmd() and escapeshellarg() I'm not familiar with functions , Check first :
escapeshellcmd()

escapeshellarg()

Simply speaking ,
escapeshellcmd It's right &#;|*?~<>^()[]{}$\, \x0A and `\xFF Add an escape character before these characters '\'.
escapeshellarg The role of is use The space replaces the percent sign 、 Exclamatory mark ( Delay variable replacement ) And double quotes , And put double quotation marks around the string . Besides , Each continuous backslash (\) Will be escaped by an additional backslash .
reference k The master wp Study
← sed Basic course sed Environmental installation →
SED brief introduction
sed, English full name stream editor , It's a non interactive stream editor , Modify the text that flows through it through a variety of transformations .
sed You can add, delete, modify, replace and check the text ( Filter 、 Take row ), Can handle multiple files and multiple lines at the same time .
sed And awk And called Linux/Unix The world's two ace word processors .
sed And awk equally , All are Line word processor .
awk The point is Split and recombine . and sed The focus is Replace .
Step one
Let's focus on what we need ,k Master uses sed The order replaced shell_exec Function is system function , And will $cmd=escapeshellcmd(substr($cmd,0,3))." ".escapeshellarg($param)." ".__FILE__; This line has been deleted
The parameter passed in is
cmd=sed¶m=/esca/d;s/shell_exec/system;w 1.php
sed It's a three word command , Naturally no more than sustr String length limit , Next, the command parameters are described :
/esca/d: The slash symbol is in sed Used to isolate different parameters ( Or command ), /d The role of is delete, Delete immediately ,/esca yes /d The string you need to match , It contains esca The line of this string will be deleted .
; :sed The semicolon is the separation between different commands .
s/shell_exec/system:s yes sed String replacement command in
Here you can learn the specific usage and effect :sed String replacement command s - sed Basic course - Simple tutorial , Simple programming
s/shell_exec/system That is, will shell_exec Replace with system The order of .
w 1.php :w namely write write in , Together, the modified file is written 1.php in
So it's time to payload The actual effect is sed '/esca/d;s/shell_exec/system;ww 1.php'
Step two
So now we know sed How to replace strings and write to files , We know that eventually there will be one 1.php Will be generated under the website directory , So add 1.php Get into

We can learn about our revised results , Next use post cmd Pass in the command line instructions used :
cmd = ls / : Understand the files in the current directory

cmd=cat /f* You can get flag

AWK brief introduction
Reference link :AWK brief introduction - Awk Basic course - Simple tutorial , Simple programming
AWK Is a command line tool , It and others Unix/Linux Command line tools , such as curl and wget equally , No interface .
AWK It's a language , Right , A language , And it is an interpretive programming language . Use Awk Can complete countless tasks , Let's simply list a few
Text processing
Generate formatted text reports
Run some simple arithmetic operations
Perform some common string operations
AWK There are two ways to run a program :
One is directly at the terminal ( shell ) Use in .
AWK Another way of using , It can be with Shell Script , Write it in a text file , Then run the text file . But this way is rare
AWK The most common way to use it is to input directly in the terminal AWK Script .
awk [options] file ...
Use directly on the command line , We need to talk about AWK Code using Single quotation marks ( '' ) Lead up .
such as
[www.twle.cn]$ awk '{print}' employee.txtexp

because awk Can directly execute instructions .
边栏推荐
- NFT数字藏品开发:数字艺术藏品赋能公益平台
- Curl post request on the server, using postman tool for parameter conversion
- NFT数字藏品系统开发:企业如何开发属于自己的数藏平台
- 成为 Apache 贡献者,So easy!
- Compose Canvas line chart
- Contents mismatch at: 08000000H (Flash=FFH Required=00H) ! Too many errors to display !
- Data platform scheduling upgrade and transformation | operation practice from Azkaban smooth transition to Apache dolphin scheduler
- C51与MDK共存 Keil5安装教程
- Opencv learn resize and crop
- Opencv learning drawing shapes and text
猜你喜欢

Apache dolphin scheduler version 3.0.0-beta-1 was released, and flinksql and Zeppelin task types were added

WPS or office compression of ppt

成为 Apache 贡献者,So easy!

NFT数字藏品系统开发:文学+数字藏品的碰撞

LTS(Light-Task-Scheduler)

Compose text and icon splicing to realize drawableleft or drawableright

Idea -- use @slf4j to print logs

HCIP---BGP综合实验

Become an Apache contributor, so easy!

C51与MDK共存 Keil5安装教程
随机推荐
Apache Dolphinscheduler3.0.0-beta-1 版本发布,新增FlinkSQL、Zeppelin任务类型
Airiot IOT platform enables the container industry to build a welding station information monitoring system
5、多表查询
Compose canvas custom circular progress bar
【C语言】你真的了解printf吗?(printf典型易错,强烈建议收藏)
Opengauss simple version installation error
Curl post request on the server, using postman tool for parameter conversion
Anaconda installation tutorial - hands on installation
Leetcode 1184: distance between bus stops
Weekly tip 142: multi parameter constructors and explicit
NFT数字藏品系统开发:激活数字文化遗产
Drools (4): drools basic syntax (2)
Deep learning learning notes -- solve the problem of slow download of CONDA and pip
This section is intended to supplement
With Huawei cloud welink, you can connect to the world even in the countryside
RGB-T追踪——【数据集基准】GTOT / RGBT210 / RGBT234 / VOT-2019-2020 / LasHeR / VTUAV
PR字幕制作
[yiku] wonderful! This library organization NPM script is simply explosive!
404 page best practices to improve user experience
Agile and tidy way