Struts2-045 vulnerability handling pitfalls (upgrade Struts2.5 requires special attention to the configuration ),

Source: Internet
Author: User

Struts2-045 vulnerability handling pitfalls (upgrade Struts2.5 requires special attention to the configuration ),

Recently, a problem occurred in the company's ssh construction of old projects. People caught the vulnerability and obtained the permission. Fortunately, the white guest did not perform much damage, the reason was that the Struts2 framework had a vulnerability and shared the pitfalls it encountered when solving it.

Methods for detecting Struts2 vulnerabilities:

Can download K8 great god Struts vulnerability detection tool http://qqhack8.blog.163.com/blog/static/1141479852014631102759126/

Hazards of the 045 vulnerability:

Almost unconditionally, all URLs are exploited by this vulnerability, even if you do not use the upload function

Cause Analysis of 045 vulnerabilities:

Read more

Versions involved in the 045 vulnerability:

2.3-2.5, that is to say, 2.5.10 and above are all secure versions. We use 2.3.28.1 in our project, so we are caught with the vulnerability.

Solution:

The point is: Upgrade the jar package to Struts2 to a secure version. Here I use the latest version 2.5.14.1 on the official website.

Attachment official download link http://struts.apache.org/download.cgi#struts2514.1

Pitfalls:

This is mainly about the configuration required when Struts 2.3 is upgraded to 2.5. There are several configurations in 2.5 that need special attention.

1. Required jar packages for Struts 2.5

2. Modify the core filter of web. xml

Core interceptor

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

Changed to (A. ng path is missing)

org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
3. Modify the header DTD constraint of struts. xml

The constraint is changed to 2.5. Otherwise, the <global-allowed-methods> label cannot be used.

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC    "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"    "http://struts.apache.org/dtds/struts-2.5.dtd">
4,Add the range of dynamic methods in struts. xml

Add Tag

<global-allowed-methods>regex:.*</global-allowed-methods>

Note that the label is in the <package> label order.Write in strict order

Generally, it is on the <global-exception-mappings> label.

 

Note: if there is any infringement, please reply and delete it immediately

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.