Jump to content

[SOLVED] str_replace eval


newbtophp

Recommended Posts

I have the following code, everything works fine, but i can't get the str_replace to work, I think its because $file doesnt contain unset, but once executed (after the eval), it then prints unset.

 

So theirfore im unsure on where to place that line?

 

$file = file_get_contents('code.php');
$file = str_replace('<?php', '', $file);
$file = str_replace('<?', '', $file);
$file = str_replace('?>', '', $file);

$file = str_replace('unset', 'hello', $file);

eval($file);

Link to comment
https://forums.phpfreaks.com/topic/180467-solved-str_replace-eval/
Share on other sites

replace the base64_encoded version of unset with the base64_encoded version of hello.

 

$file = file_get_contents('code.php');
$file = str_replace('<?php', '', $file);
$file = str_replace('<?', '', $file);
$file = str_replace('?>', '', $file);

$file = str_replace(base64_encode('unset'), base64_encode('hello'), $file);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.