当前位置:网站首页>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 .
边栏推荐
- C51 and MDK coexist keil5 installation tutorial
- NFT数字藏品系统开发:企业如何开发属于自己的数藏平台
- anaconda安装教程-手把手教你安装
- 达人专栏 | 还不会用 Apache Dolphinscheduler?大佬用时一个月写出的最全入门教程【三】
- unity3d-对象池的用法
- Unity3d-异步加载场景、进度条加载
- Embedded development: tools -- intelligent watchdog design
- Opencv learning drawing shapes and text
- Airiot IOT platform enables the container industry to build a welding station information monitoring system
- 如何对C盘进行扩容重新分区?
猜你喜欢
unity3d-对象池的用法

IDEA——使用@Slf4j打印日志

金融任务实例实时、离线跑批Apache DolphinScheduler在新网银行的三大场景与五大优化

Learn browser decoding from XSS payload

A guide for you to fully use TS

PR字幕制作

Embedded development: tools -- intelligent watchdog design

Drools (2): drools quick start

Airiot IOT platform enables the container industry to build a welding station information monitoring system

Drools (4): drools basic syntax (2)
随机推荐
NPM command
Drools(2):Drools快速入门
Opencv learn resize and crop
Why can't extern compile variables decorated with const?
20220725 compensator in automatic control principle
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-5 personal solutions
Common programming shortcut keys of idea (take off after learning the operation)
NFT数字藏品系统开发:NFT数藏 的最佳数字营销策略有哪些
LTS(Light-Task-Scheduler)
如何对C盘进行扩容重新分区?
6、组合数据类型
Deep learning visualization
This section is intended to supplement
Leetcode 1184: distance between bus stops
Airiot IOT platform enables the container industry to build a welding station information monitoring system
NFT数字藏品系统开发:企业如何开发属于自己的数藏平台
Introduction to C language -- summary table of operator priority sorting
Compose text and icon splicing to realize drawableleft or drawableright
Now the metauniverse is no longer an existence that is only applied to the social field
[QT] how to obtain the number of rows and columns of qtableview and qtablewidget