当前位置:网站首页>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 .
边栏推荐
- Leetcode:1898. maximum number of removable characters [if you want to delete some IDX from a pile of things, don't use pop]
- College degree sales career, from the third tier 4K to the first tier 20k+, I am very satisfied with myself
- Qt:模态非模态、文本框、按钮、单行输入框
- Do you want to restart the database to replace the license?
- Hcip - MPLS Technology
- 6、组合数据类型
- NFT数字藏品系统开发:文学+数字藏品的碰撞
- IR tool in JIT and download, compile and use of jitwatch
- NFT数字藏品系统开发:华为发布首款珍藏版数字藏品
- NFT数字藏品开发:数字藏品与NFT的六大区别
猜你喜欢

HCIP --- MPLS技术

MySQL安装教程-手把手教你安装

Question: can't download sh shellcheck Please install it manually and some commands of shell script

NFT数字藏品系统开发:NFT数藏 的最佳数字营销策略有哪些

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

WPS or office compression of ppt

Compose canvas custom circular progress bar

QT: list box, table, tree control

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

Compose text and icon splicing to realize drawableleft or drawableright
随机推荐
RGB-T追踪——【数据集基准】GTOT / RGBT210 / RGBT234 / VOT-2019-2020 / LasHeR / VTUAV
Opencv learning color detection
[yiku] wonderful! This library organization NPM script is simply explosive!
Differences in the use of function call pointer parameters *p, * & P
Analysis of strong tennis cup 2021 PWN competition -- baby_ diary
Image annotation software reference
Advanced Mathematics (Seventh Edition) Tongji University exercises 2-5 personal solutions
NFT数字藏品系统开发:数字藏品赋予品牌新活力
"Wei Lai Cup" 2022 Niuke summer multi school training camp 1 supplementary question record (acdgij)
Drools (2): drools quick start
shape 和 size() 区别
Screen: frame paste, 0 fit, full fit
此章节用于补充2
unity3d-对象池的用法
C51 and MDK coexist keil5 installation tutorial
anaconda安装教程-手把手教你安装
Hands on practice - teach you how to make an intelligent fish tank with STM32
Unity3d-异步加载场景、进度条加载
C51与MDK共存 Keil5安装教程
倒计时2日!基于 Apache DolphinScheduler&TiDB 的交叉开发实践,从编写到调度让你大幅提升效率