Skip to content

Commit 08a0bf7

Browse files
committed
Validate gpgconf binary on object destructor
Fixes potential of using the Crypt_GPG_Engine class to execute remote code by injecting an incomplete object with $_gpgconf property into a session.
1 parent 11acf64 commit 08a0bf7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Crypt/GPG/Engine.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,8 @@ private function _closePipe($pipeNumber)
18311831
*/
18321832
private function _closeIdleAgents()
18331833
{
1834-
if ($this->_gpgconf) {
1834+
// Note: We check that this binary is executable again for security reasons
1835+
if ($this->_gpgconf && is_executable($this->_gpgconf)) {
18351836
// before 2.1.13 --homedir wasn't supported, use env variable
18361837
$env = ['GNUPGHOME' => $this->_homedir];
18371838
$cmd = $this->_gpgconf . ' --kill gpg-agent';

0 commit comments

Comments
 (0)