diff options
Diffstat (limited to 'src/tests/deny_writable_execution_simulation.phpt')
| -rw-r--r-- | src/tests/deny_writable_execution_simulation.phpt | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/tests/deny_writable_execution_simulation.phpt b/src/tests/deny_writable_execution_simulation.phpt deleted file mode 100644 index 7f3546a..0000000 --- a/src/tests/deny_writable_execution_simulation.phpt +++ /dev/null | |||
| @@ -1,50 +0,0 @@ | |||
| 1 | --TEST-- | ||
| 2 | Readonly execution attempt (simulation mode) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php | ||
| 5 | if (!extension_loaded("snuffleupagus")) print "skip"; | ||
| 6 | |||
| 7 | // root has write privileges on any file | ||
| 8 | if (TRUE == function_exists("posix_getuid")) { | ||
| 9 | if (0 == posix_getuid()) { | ||
| 10 | print "skip"; | ||
| 11 | } | ||
| 12 | } elseif (TRUE == function_exists("shell_exec")) { | ||
| 13 | if ("root" == trim(shell_exec("whoami"))) { | ||
| 14 | print "skip"; | ||
| 15 | } | ||
| 16 | } | ||
| 17 | ?> | ||
| 18 | --INI-- | ||
| 19 | sp.configuration_file={PWD}/config/config_disable_writable_simulation.ini | ||
| 20 | --FILE-- | ||
| 21 | <?php | ||
| 22 | $dir = __DIR__; | ||
| 23 | |||
| 24 | // just in case | ||
| 25 | @unlink("$dir/non_writable_file.txt"); | ||
| 26 | @unlink("$dir/writable_file.txt"); | ||
| 27 | |||
| 28 | file_put_contents("$dir/writable_file.txt", '<?php echo "Code execution within a writable file.\n";'); | ||
| 29 | file_put_contents("$dir/non_writable_file.txt", '<?php echo "Code execution within a non-writable file.\n";'); | ||
| 30 | chmod("$dir/writable_file.txt", 0777); | ||
| 31 | chmod("$dir/non_writable_file.txt", 0400); | ||
| 32 | include "$dir/writable_file.txt"; | ||
| 33 | include "$dir/non_writable_file.txt"; | ||
| 34 | ?> | ||
| 35 | --CLEAN-- | ||
| 36 | <?php | ||
| 37 | $dir = __DIR__; | ||
| 38 | chmod("$dir/non_writable_file.txt", 0777); | ||
| 39 | chmod("$dir/writable_file.txt", 0777); | ||
| 40 | unlink("$dir/non_writable_file.txt"); | ||
| 41 | unlink("$dir/writable_file.txt"); | ||
| 42 | ?> | ||
| 43 | --EXPECTF-- | ||
| 44 | Warning: [snuffleupagus][readonly_exec] Attempted execution of a writable file (%a/src/tests/deny_writable_execution_simulation.php). in %a/src/tests/deny_writable_execution_simulation.php on line 2 | ||
| 45 | |||
| 46 | Warning: [snuffleupagus][readonly_exec] Attempted execution of a writable file (%a/src/tests/writable_file.txt). in %a/src/tests/deny_writable_execution_simulation.php on line 12 | ||
| 47 | |||
| 48 | Warning: [snuffleupagus][readonly_exec] Attempted execution of a writable file (%a/src/tests/writable_file.txt). in %a/src/tests/writable_file.txt on line 1 | ||
| 49 | Code execution within a writable file. | ||
| 50 | Code execution within a non-writable file. | ||
