Jump to content

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);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.