<?php
$safe_var = 'all your base they belong to us';
file_put_contents('/tmp/exploit.txt',$safe_var );
// imagine lots of stuff going on here...
$safe_var = file_get_contents('/tmp/exploit.txt');
function make_literal(string $non_literal):string {
$literal = '';
for( $i = 0; $i< strlen($non_literal); $i++ ){
$literal .= chr(ord($non_literal[$i]));
}
return $literal;
}
if ( !is_noble($safe_var)) {
printf( "Darn! I can't use the data I need to use.\n");
}
printf( "But wait...\n");
$safe_var = make_literal($safe_var);
if ( is_noble($safe_var)) {
printf( "Well, since you did not provide any way to handle *legitimate* exceptions\n");
printf( "then I will just work around you, you annoying little is_literal() function!\n\n");
echo strtoupper($safe_var);
echo "!!!";
}
Fatal error: Uncaught Error: Call to undefined function is_noble() in /in/oCBp7:17
Stack trace:
#0 {main}
thrown in /in/oCBp7 on line 17
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught Error: Call to undefined function is_noble() in /in/oCBp7:17
Stack trace:
#0 {main}
thrown in /in/oCBp7 on line 17
Process exited with code 255.