search
HomeCMS TutorialPHPCMSPHPCMS vulnerability frontend injection leads to arbitrary file reading

PHPCMS vulnerability frontend injection leads to arbitrary file reading

About the repair issue of arbitrary file reading vulnerability caused by phpcms front-end injection

简介:
phpcms的/phpcms/modules/content/down.php 文件中,对输入参数 $_GET['a_k'] 未进行严格过滤,导致SQL注入的发生,黑客
可利用该漏洞读取任意文件。
…
阿里云服务器提示漏洞问题。

Solution:

1. According to the vulnerability prompt in the introduction, find the corresponding location of the corresponding file down.php (near lines 18 and 89), and add or replace the corresponding code.

The patch code snippet is as follows:

$a_k = safe_replace($a_k);
parse_str($a_k);

The modified patch code snippet is as follows:

The first modification, near line 18:

PHPCMS vulnerability frontend injection leads to arbitrary file reading

The second modification, near line 89:

PHPCMS vulnerability frontend injection leads to arbitrary file reading

Note: The contents of the first and second patch codes are the same.

The third modification, near line 120:

The patch code snippet is as follows:

$fileurl = str_replace(array(&#39;<&#39;,&#39;>&#39;), &#39;&#39;,$fileurl); 
file_down($fileurl, $filename);

Note: After actual testing, as much as possible between the above two lines of code There should be no other code to avoid being detected by Alibaba Cloud and the repair result will be invalid.

The screenshot of the modified patch code snippet is as follows:

PHPCMS vulnerability frontend injection leads to arbitrary file reading

2. Then, upload the modified file to the corresponding file location on the server and overwrite it directly;

3. Finally, log in to the Alibaba Cloud backend and click Verify (screenshot below) to complete the vulnerability repair.

PHPCMS vulnerability frontend injection leads to arbitrary file reading

The above is all about the "phpcms front-end injection leading to arbitrary file reading vulnerability" vulnerability repair content.

PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!

The above is the detailed content of PHPCMS vulnerability frontend injection leads to arbitrary file reading. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),