VYPR
Critical severityOSV Advisory· Published Aug 11, 2021· Updated Sep 16, 2024

Deserialization of Untrusted Data

CVE-2021-23420

Description

This affects the package codeception/codeception from 4.0.0 and before 4.1.22, before 3.1.3. The RunProcess class can be leveraged as a gadget to run arbitrary commands on a system that is deserializing user input without validation.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
codeception/codeceptionPackagist
< 3.1.33.1.3
codeception/codeceptionPackagist
>= 4.0.0, < 4.1.224.1.22

Affected products

1

Patches

2
802a108057d2

Security: Disable deserialization of RunProcess class (#6241)

https://github.com/Codeception/CodeceptionGintautas MiselisAug 6, 2021via ghsa
1 file changed · +22 0
  • ext/RunProcess.php+22 0 modified
    @@ -102,4 +102,26 @@ public function stopProcess()
             }
             $this->processes = [];
         }
    +
    +    /**
    +     * Disable the deserialization of the class to prevent attacker executing
    +     * code by leveraging the __destruct method.
    +     *
    +     * @see https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection
    +     */
    +    public function __sleep()
    +    {
    +        throw new \BadMethodCallException('Cannot serialize ' . __CLASS__);
    +    }
    +
    +    /**
    +     * Disable the deserialization of the class to prevent attacker executing
    +     * code by leveraging the __destruct method.
    +     *
    +     * @see https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection
    +     */
    +    public function __wakeup()
    +    {
    +        throw new \BadMethodCallException('Cannot unserialize ' . __CLASS__);
    +    }
     }
    
cbce9ea7f466

Security: Disable deserialization of RunProcess class (#6241)

https://github.com/Codeception/CodeceptionGintautas MiselisAug 6, 2021via ghsa
1 file changed · +22 0
  • ext/RunProcess.php+22 0 modified
    @@ -107,4 +107,26 @@ public function stopProcess()
             }
             $this->processes = [];
         }
    +
    +    /**
    +     * Disable the deserialization of the class to prevent attacker executing
    +     * code by leveraging the __destruct method.
    +     *
    +     * @see https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection
    +     */
    +    public function __sleep()
    +    {
    +        throw new \BadMethodCallException('Cannot serialize ' . __CLASS__);
    +    }
    +
    +    /**
    +     * Disable the deserialization of the class to prevent attacker executing
    +     * code by leveraging the __destruct method.
    +     *
    +     * @see https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection
    +     */
    +    public function __wakeup()
    +    {
    +        throw new \BadMethodCallException('Cannot unserialize ' . __CLASS__);
    +    }
     }
    

Vulnerability mechanics

Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

10

News mentions

0

No linked articles in our index yet.