当前位置:网站首页>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 .
边栏推荐
- To do list application vikunja
- Hands on practice - teach you how to make an intelligent fish tank with STM32
- Opengauss simple version installation error
- NFT数字藏品系统开发:华为发布首款珍藏版数字藏品
- NFT数字藏品开发:数字藏品与NFT的六大区别
- 数据平台调度升级改造 | 从Azkaban 平滑过度到 Apache DolphinScheduler 的操作实践
- NFT数字藏品系统开发:激活数字文化遗产
- NFT数字藏品系统开发:NFT数藏 的最佳数字营销策略有哪些
- WPS or office compression of ppt
- DaemonSet
猜你喜欢

Opengauss simple version installation error

Lite actor: lightweight optimization of ark actor concurrency model

No .egg-info directory found in xxx\pip-pip-egg-info-mq

【C语言】你真的了解printf吗?(printf典型易错,强烈建议收藏)

Hcip - MPLS Technology

Redis migrate tool migration error.

MySQL installation tutorial - hands on installation

Advanced Mathematics (Seventh Edition) Tongji University General exercises two person solution

What are the basics of getting started with spot silver

屏:框贴、0贴合、全贴合
随机推荐
此章节用于补充
Weekly tip 142: multi parameter constructors and explicit
Data platform scheduling upgrade and transformation | operation practice from Azkaban smooth transition to Apache dolphin scheduler
Opencv learning color detection
"Wei Lai Cup" 2022 Niuke summer multi school training camp 1 supplementary question record (acdgij)
成为 Apache 贡献者,So easy!
Opencv learn read images videos and webcams
Learn browser decoding from XSS payload
Yolov6 target detection practice: training your own data set (video tutorial)
倒计时2日!基于 Apache DolphinScheduler&TiDB 的交叉开发实践,从编写到调度让你大幅提升效率
Drools (2): drools quick start
unity3d-对象池的用法
Upgrade ecological proposition: what has Alibaba cloud brought to thousands of businesses?
【C语言】你真的了解printf吗?(printf典型易错,强烈建议收藏)
此章节用于补充2
Make a chase game with pyGame
Contents mismatch at: 08000000H (Flash=FFH Required=00H) ! Too many errors to display !
Drools (3): drools basic syntax (1)
4. Data integrity
6. Backup and recovery of MySQL database