Record one CMS code audit, and record one activity contest composition with more than 500 words

4 minutes
two hundred and ninety-three
zero

Original title: Record a CMS code audit

Author: ddwGeGe

This article is adapted from the Prophet Community: //xz.aliyun.com/t/11774

preface

Inadvertently browse the official website of a niche OA and download it to the source code. After a random audit, get the shell successfully. Don't spray it

directory structure

Environment construction

WIN11 PhpStudy(Mysql) Redis IDEA(Tomcat 8.0)

Import the sql file into phpstudy (MySQL), start the Redis service at the same time, and configure the database environment

Use white and black for audit. From the function point, images can be uploaded in the personal data

Starting to capture packages for file upload, the suffix and file content were not verified, and the upload path and file name were returned. It was thought that it could get the shell directly, but it could not be parsed, and the file did not land

Code audit

Directly search the route according to the path of the data packet (/func/upload/uploadImages), and successfully find the upload function

First, judge the value of db, and determine the saving method of uploaded files according to the value of db

When uploading initially, db=1, while if's GlobalConstant FILE_UPLOADER_SAVE_FILE=0, so directly enter else if

New file name=upload time 10 random numbers suffix of original uploaded file

String extend = FileUtils.getExtend(fileName);// Get File Extension
String noextfilename = DateUtils.getDataString(DateUtils.SDF_YYYYMMDDHHMMSS) StringUtil.random(10);// Custom File Name
String myfilename= noextfilename "." extend;// Custom File Name

The file is stored in the database, the file name is saved through the map, and finally returned to the data package

DB is controllable. When uploading, change db=1 to db=0 and enter if

A new upload directory will be created. The new directory=the upload time of the web root directory (MM/DD/YYYY). If it does not exist, it will be created

String realPath = request.getSession.getServletContext.getRealPath("/") "/upload/" strYYYYMMDD "/";// The real path of the file's hard disk
String path = "upload/" strYYYYMMDD "/";
File file = new File(realPath);
if (!file.exists) {
file.mkdirs;// Create root directory
}

The naming method of the new file name is basically the same as else if. When obtaining the suffix of the file, the file was not checked and filtered, but directly spliced, resulting in a file upload vulnerability

Finally, directly copy the uploaded file content to the newly created file

FileCopyUtils.copy(mf.getBytes, savefile);

Finally, the file is stored through the map, and the file upload path and file name are stored in filePath and saveName respectively

Map

This article is written by: Shallow singing Published on Software Development of Little Turkey , please indicate the source for reprinting: //hongchengtech.cn/blog/2639.html
Shallow singing
author

Related recommendations

1 year ago (2024-02-20)

What technologies have been applied and developed in the field of new media, and the application of new technologies in media

In the field of new media, many technologies have been applied and developed. These include: cloud computing: cloud computing technology enables new media companies to develop and deploy applications more quickly, and can dynamically adjust resources according to needs. Big data: New media companies can use big data technology to analyze massive user data, understand user preferences, behavior habits and other information
nine hundred and seventy-one
one
1 year ago (2024-02-20)

WMS warehouse management system, promoting the transformation of warehousing from extensive to fine management, WMS warehouse management

Warehousing is extremely important for the manufacturing industry and is an important guarantee for the survival and development of manufacturing enterprises. However, with the expansion of manufacturing enterprises' business, the traditional warehouse management has been unable to respond to business changes quickly. The extensive management mode not only makes the warehouse operation not smooth, but also increases the storage cost. Therefore, it is necessary for manufacturing enterprises to deploy a WMS warehouse management system
eight hundred and forty-eight
one
1 year ago (2024-02-20)

How to select MES system? Main contents of MES production management

Original title: How to select MES system? The main content of MES production management Production and manufacturing activities are the core activities of manufacturing enterprises. As the entity unit of manufacturing activities, planning objectives and the realization of enterprise value, workshop management is the focus of enterprise management. With the rapid development of manufacturing industry, MES is the focus and current hot spot of manufacturing enterprise information automation system
nine hundred and sixty-four
zero
1 year ago (2024-02-20)

The WeChat management system can manage the information content of WeChat more effectively. Let's manage the data of WeChat here

Original title: WeChat management system manages the information content of WeChat more effectively. Many enterprises will assign work to WeChat, because no one wants their personal WeChat to mix work and other related knowledge, but someone will always use the company's loopholes to do something harmful to the company's interests. Don't think such things are rare. I learned about a media financing company in Shenzhen. They have 3
seven hundred and seventy-seven
zero
1 year ago (2024-02-19)

Student electronic file management system, three-dimensional communication space of "home", "school" and "community", and school electronic files

In the era of big data, in the process of recording the growth of students, the school reexamines the management of student files, moves with the times, and promotes the reform of student growth files with new thinking. "Electronic files of primary and secondary school students' growth records" have been gradually introduced into educational management, and show vigorous vitality. Student file management system is an indispensable part of the school, its content for the school
five hundred and seventy-one
zero
1 year ago (2024-02-19)

Ruizhe Information: Select Sitecore? Or... just six steps to choose a content management system, Ruizhe Information Technology Service Co., Ltd

The content management system (CMS) is an important part of the success of website construction. At present, the content management system on the network is relatively complex. It is not easy to find a good content management system that is very suitable for the current digital marketing environment. Before we compare the functionality, operation, scalability, security and other specific performance of the major CMS systems, we need to achieve
three hundred and forty-three
zero

comment

0 people have participated in the review

Scan code to add WeChat

contact us

WeChat: Kuzhuti
Online consultation: