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 5ea172d commit 802a108
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ext/RunProcess.php
Expand Up @@ -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__);
}
}

0 comments on commit 802a108

Please sign in to comment.