Skip to content

Commit

Permalink
Security: Disable deserialization of RunProcess class (#6241)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naktibalda committed Aug 6, 2021
1 parent d69ab79 commit cbce9ea
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ext/RunProcess.php
Expand Up @@ -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__);
}
}

0 comments on commit cbce9ea

Please sign in to comment.