Fastjson 1.2.68 and Earlier Remote Code Execution Vulnerability Threat Alert

Fastjson 1.2.68 and Earlier Remote Code Execution Vulnerability Threat Alert

June 8, 2020 | Adeline Zhang

Vulnerability Description

On May 28, Fastjson 1.2.68 and before were reported to contain a remote code execution vulnerability that bypasses the autoType switch to implement deserialization of classes that contain security risks. Attackers could exploit this vulnerability to execute arbitrary code on the target machine.

Fastjson is an open-source JSON library developed by Alibaba to parse JOSN strings. It can be used to serialize JavaBean into a JSON string and deserialize a JSON string to JavaBean. Fastjson works efficiently and therefore is widely used. Users should take preventive measures as soon as possible.

 Scope of Impact

Affected Versions

  • Fastjson <= 1.2.68
  • Vulnerability Detection
  • Version Check

Users can use the following command to check the current Fastjson version:

lsof | grep fastjson

Note: In Fastjson 1.2.68, safeMode is introduced to make the autoType function useless.

Mitigation

  • Workarounds

The vendor has not patched this vulnerability. Affected users can disable autoType and upgrade the JDK to the latest version for risk aversion.

As the autoType switch can be bypassed, affected users should upgrade Fastjson to 1.2.68 and activate safeMode to disable autoType. safeMode can be configured in one of the following ways:

  • Configure safeMode in the code:
ParserConfig.getGlobalInstance().setSafeMode(true);
  • Add the JVM startup parameter:
-Dfastjson.parser.safeMode=true

If there are multiple package name prefixes, separate them with commas (,).

  • Use the fastjson.properties file in the class path for configuration:
fastjson.parser.safeMode=true

Add risky classes to the blacklist for protection:

ParserConfig.getGlobalInstance().addDeny(“class name”);

Users of this software are advised to watch for Fastjson’s security advisory and load the update as soon as it is available to protect against this vulnerability. Download link: https://github.com/alibaba/fastjson/releases

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA).

A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.