The Customizer Export/Import WordPress plugin is a widely utilized utility that allows website administrators to effortlessly export and import settings of WordPress Customizer to transfer configurations between different websites. However, versions of the plugin prior to .9.5 contain an unrestricted unserialization vulnerability that, if exploited, may lead to PHP object injection and potentially arbitrary code execution. This blog post aims to provide a detailed insight into CVE-2022-3380, the vulnerability affecting the Customizer Export/Import plugin, including its exploit code, original references, and steps for mitigation.

Vulnerability Description

The vulnerability in question, CVE-2022-3380, arises due to the unsafe handling of unserialized data within the Customizer Export/Import plugin. Specifically, when an administrator imports a file containing customizer settings for their WordPress site, the plugin does not sufficiently validate the content of the file. As a result, this opens up possibilities for an attacker to inject malicious PHP objects within the imported file. If an adequate gadget chain is present on the target blog, attackers can leverage this vulnerability to use the injected PHP objects for malicious purposes, including arbitrary code execution.

Exploit Details

To better understand the exploit and how it takes advantage of the unserialize() function, let's examine the vulnerable code found in the cei_import.php file within the Customizer Export/Import plugin.

function import( $file ) {
   $data = unserialize( file_get_contents( $file ) );

   if ( is_array( $data ) && isset( $data['mods'] ) ) {
      CEI_Import_Settings::import_options( $data );

In this snippet, the import function reads the entire content of the imported file and then directly unserializes it. As there is no proper validation or sanitization of the file contents before unserialization, it may lead to PHP object injection.

The following sample code illustrates a possible exploit scenario

class MaliciousClass {
   public function __toString() {
      return system('id');

$payload = new MaliciousClass();
$serialized_payload = serialize($payload);
file_put_contents('malicious_file.dat', $serialized_payload);

With this malicious file created, an attacker could then trick a website administrator into importing it by uploading it to the target WordPress site. Upon importing, the plugin would unserialize the file, consequently executing the malicious PHP object.

Original References

The CVE-2022-3380 vulnerability was initially reported by Giovanni de Blasio. Further references and details can be found in his GitHub post:


To protect your WordPress site against the CVE-2022-3380 vulnerability, it is strongly recommended to update the Customizer Export/Import plugin to version .9.5 or later. As the vulnerability affects older versions of the plugin, updating to the latest release is essential for ensuring that your website remains secure.


The CVE-2022-3380 vulnerability highlights the importance of proper validation and sanitization of imported files in web applications. When working with serialized data, always follow best practices to avoid potential security risks. Regularly updating your WordPress themes, plugins, and core installations alongside practicing strong web security hygiene will help in safeguarding your site against known vulnerabilities and exploits.


Published on: 10/31/2022 16:15:00 UTC
Last modified on: 11/01/2022 15:23:00 UTC