skout-blog

Cybersecurity Threat Advisory 0037-22: FastJson before Version 1.2.83 are vulnerable to Deserialization of Untrusted Data

ADVISORY OVERVIEW

A new version of FastJson has been released and has patched a vulnerability which allows malicious actors to utilize “AutoTypeCheck” mechanism and achieve remote code execution in FastJson. All Java applications that pass user-controlled data to either the JSON.parse or JSON.parseObject APIs without specifying a specific class to deserialize, are affected.

Technical Detail & Additional Information

WHAT IS THE THREAT?

The new version of FastJson addresses the vulnerability CVE-2022-25845, which allows remote code execution under specific conditions. If the deserialized JSON is user-controlled, parsing it with AutoType enabled can lead to malicious actors instantiating any class that’s available on the Classpath, and feed its constructor with arbitrary arguments. However, FastJson will deserialize arbitrary classes if the target class extends the throwable class.

WHY IS IT NOTEWORTHY?

A public proof of concept exploit exists, and the potential impact is very high due to passing untrusted input to specific vulnerable APIs. Totality of the Java gadget classes that can utilize this vulnerability have not been explored. With that being said, the malicious actors need to research finding a suitable gadget (loaded in the Classpath), that extends throwable and would contain relevant information that a malicious actor can utilize.

WHAT IS THE EXPOSURE OR RISK?

Due to the vast number of gadgets in Java libraries and the extensive research that must be done, security researchers have concluded that this is unlikely due to the very specific gadget class that must be utilized. With that being said, the NIST gave this a score of 9.8 Critical since there still is a potential for undiscovered gadget classes that malicious actors can utilize to gain privileges, run arbitrary code, or download sensitive information. 

WHAT ARE THE RECOMMENDATIONS?

Barracuda MSP recommends the following actions to remediate and mitigate FastJson vulnerability:

  • Remediate by updating to the latest version 1.2.83
  • Mitigate by enabling “Safe Mode”.
    Code – ParserConfig.getGlobalInstance().setSafeMode(true);
    JVM startup parameters – -Dfastjson.parser.safeMode=true
    Fastjson’s properties file – fastjson.parser.safeMode=true

REFERENCES

For more in-depth information about the recommendations, please visit the following links:

If you have any questions, please contact our Security Operations Center.

Threat Advisory Sign Up