search
HomeBackend DevelopmentPHP Tutorial求问关于php 混淆字符+eval的解密构思。希望xuzuning等高手来帮忙

最近遇到2个php文件加密比较恶心,好像用了混淆+eval。
这个混淆不同于0 | o的区别。好像编码比较乱看起来想ascii编码过的函数名字。
不知道高手能不能给个思路?
废话不多,直接上代码

<?php global $?????;$?????=array('?????'=>__FILE__);if(!defined('FEEAABFAA')){define("FEEAABFAA",1395120187);function ?????($?????,$?????=""){global $?????;$?????=base64_decode($?????);if(empty($?????)) return "";if($?????==""){return ~$?????;}else{$?????=$?????['?????']($?????);$?????=$?????['?????']($?????,$?????,$?????);return $?????^$?????;}}}$?????['?????']=?????('jIuNk5qR','');$?????['?????']=?????('mpKPi4Y=','');$?????['?????']=?????('nZ6MmsnLoJua?JCbmg==','');$?????['?????']=?????('jIuN?I+emw==','');$?????['?????']=?????('AgYIDg==','gpibl4mKhJ8=');$?????['?????']=?????('GStOLDVHHCA?OEgu','iY+Kj5yP');$?????['?????']=?????('0MvIzsfMm?rPmsmex8+encnJyczM?8rGmcrKnsfHnsjO?Jo=','');eval($?????['?????'](' 写不下了,这里省略…………'));return;?>4861704e7c6c38ed5439414665b9adb0

另外还有一个
<?php if(!defined('BCCEFFAFDBEC')){define("BCCEFFAFDBEC",1377408872);function ?????($?????,$?????=""){global $?????;$?????=base64_decode($?????);if(empty($?????)) return "";if($?????==""){return ~$?????;}else{$侗?????$?????['侗?????]($?????);$?????=$?????['船???豹']($?????,$侗?????$?????);return $?????^$?????;}}}global $?????;$?????=array('?酣????=>__FILE__);$?????['?????']=?????('nZ6Mm?nLoJuan?Cbmg==','');$?????['侗?????]=?????('jIuNk5qR','');$?????['?????']=?????('mpKPi4Y=','');$?????['船???豹']=?????('jIuNoI+emw?=','');$?????['辜脯千?羌']=?????('0J2cz5?amZn?nsaZx?nLzJv?y53H?5qcy8?JzMjOys?H0Jo=','');$?????['?『???']=?????('CDomNQ==','mLGYqYGhx6M=');$?????['噶????']=?????('GChXHzBKKh?YVEwj','hZ2xo8Odt5/FoQ==');$?????['?????']=?????('/K73993Zn?b0kA==','k4qfiY+Vw7M=');@$?????['噶????']($?????['辜脯千?羌'],$?????['?『???'].'('.$?????['?????'].'('.$?????['?????'].'(\'这里省略…………写不下了');return;?>616df3258c3d0520a46c2829342b76be 


两个代码我打包了
链接: http://pan.baidu.com/s/1tNVxs 密码: gtip


希望各位大大赐教一下


回复讨论(解决方案)

链接: http://pan.baidu.com/s/1tNVxs 密码: gtip

地址重新发布一下。

??文件在?行的?候都提示有?法??,??法?你

??文件在?行的?候都提示有?法??,??法?你
亲,单独运行的没错,但是不会报错。下载一下,百度网盘的;

如果你觉得看起来比较恶心,你自己换成字母好了,原理是一样的。

如果你觉得看起来比较恶心,你自己换成字母好了,原理是一样的。
我试过改动,可以随便改动一下就出问题。

你的 dadadi.php 被你改动过了吧?

你的 dadadi.php 被你改动过了吧?

链接: http://pan.baidu.com/s/1qWLLFDa 密码: 4372

这个应该没有问题。

另外我自己尝试破解了一下plugin.class.php,得出下面2个php
但是发现好像是循环的,应该是核心算法应该是
//function 在上面//定义了一个fun($var1,$var2='');大体意思是先先把$var1 base64还原 然后reutren ~取补数。再判断var2是否有值,下面那个好像没读懂 最后是 rerun aaa^bbb;(互斥)//下面加密了一串变量//放在一个数组中//数组的话,我后面的压缩包里面有个detempb可以弄出来,好像显示正确preg_match('正则表达式(我没有还原出来,还是还原错了感觉不对)',eval(gzuncompress(base64_decode(加密字符串穿))), ‘这里好像是一串数字’)


另外我自己弄了半天。生成这两个文件是plugin.class.php的解密文件,运行没错误,应该没有解密错。后面的不知道怎么弄了
当再打算再输出一遍   那个加密字符串时候,感觉不对。始终得不到正确结果。求指点
链接: http://pan.baidu.com/s/1u3Tgy 密码: j15w

手工解密的方法就是看eval里的变量的值,可能出来的还是带eval的,要如此反复。反正是个体力活就对了。

哦?想当然了吧
第一遍出来就没有 eval 了

手工解密的方法就是看eval里的变量的值,可能出来的还是带eval的,要如此反复。反正是个体力活就对了。

哦?想当然了吧
第一遍出来就没有 eval 了


手工解密的方法就是看eval里的变量的值,可能出来的还是带eval的,要如此反复。反正是个体力活就对了。
没想当然,我只是说可能,又没说这个代码第一遍解出来的一定有。说可能,只是因为我解过一个,要反复三四次才最后搞定。

哦?想当然了吧
第一遍出来就没有 eval 了


手工解密的方法就是看eval里的变量的值,可能出来的还是带eval的,要如此反复。反正是个体力活就对了。
这个我弄了一下,执行好像是经过二次@gzuncompress(base64_decode( code....... ))
第二遍eval 好像存在之前的数组中
但是到第二遍@gzuncompress(base64_decode( code....... ))执行后出现data error不知道您是怎么做的?能给个思路么? 

他的结构比较复杂
第一层

Array(    [?????] => plugin.class.php.php    [?????] => strlen    [?????] => empty    [?????] => base64_decode    [?????] => str_pad    [?????] => eval    [?????] => preg_replace    [?????] => /47183fe0e6a80ab66633459f55a88a71/e)

第二层
Array(    [?????] => plugin.class.php.php    [?????] => strlen    [?????] => empty    [?????] => base64_decode    [?????] => str_pad    [?????] => eval    [?????] => preg_replace    [?????] => /47183fe0e6a80ab66633459f55a88a71/e    [?????] => time    [?????] => basename    [?????] => die    [?????] => ?????    [?????] => explode    [?????] => in_array    [?????] => gethostbyname)
第三层又直接使用了 eval

由于是通过 preg_replace 驱动的(正则附加属性 e)拦截起来比较困难
需要把数组中的 eval 改成自定义函数

解出的代码需拆分,先执行前面的参数设置,然后处理后面的自解码代码

他的结构比较复杂
第一层

Array(    [?????] => plugin.class.php.php    [?????] => strlen    [?????] => empty    [?????] => base64_decode    [?????] => str_pad    [?????] => eval    [?????] => preg_replace    [?????] => /47183fe0e6a80ab66633459f55a88a71/e)

第二层
Array(    [?????] => plugin.class.php.php    [?????] => strlen    [?????] => empty    [?????] => base64_decode    [?????] => str_pad    [?????] => eval    [?????] => preg_replace    [?????] => /47183fe0e6a80ab66633459f55a88a71/e    [?????] => time    [?????] => basename    [?????] => die    [?????] => ?????    [?????] => explode    [?????] => in_array    [?????] => gethostbyname)
第三层又直接使用了 eval

由于是通过 preg_replace 驱动的(正则附加属性 e)拦截起来比较困难
需要把数组中的 eval 改成自定义函数

解出的代码需拆分,先执行前面的参数设置,然后处理后面的自解码代码


数组中的eval (原始加密)在原始位置已经替换成了echo,后面的怎么拆分?

他的结构比较复杂
第一层

Array(    [?????] => plugin.class.php.php    [?????] => strlen    [?????] => empty    [?????] => base64_decode    [?????] => str_pad    [?????] => eval    [?????] => preg_replace    [?????] => /47183fe0e6a80ab66633459f55a88a71/e)

第二层
Array(    [?????] => plugin.class.php.php    [?????] => strlen    [?????] => empty    [?????] => base64_decode    [?????] => str_pad    [?????] => eval    [?????] => preg_replace    [?????] => /47183fe0e6a80ab66633459f55a88a71/e    [?????] => time    [?????] => basename    [?????] => die    [?????] => ?????    [?????] => explode    [?????] => in_array    [?????] => gethostbyname)
第三层又直接使用了 eval

由于是通过 preg_replace 驱动的(正则附加属性 e)拦截起来比较困难
需要把数组中的 eval 改成自定义函数

解出的代码需拆分,先执行前面的参数设置,然后处理后面的自解码代码

能不能提供一下你解密获取array的代码,我研究一下

preg_replace('\b777fb918ffda23fb0979c4ca77ab814\e',eval(gzuncompress(base64_decode($code))),'??b777fb918ffda23fb0979c4ca77ab814???');

这个该如何重组,解码呢?

代码是这样的
应该是思路有点问题,做不下去了

$filename = __DIR__ . '/plugin.class.php';$gl = '';$old_vars = '';$c = explode('eval', file_get_contents($filename));file_put_contents($filename.'_0.php', $c[0]);$old_vars = get_defined_vars();include $filename.'_0.php';$new_vars = array_diff_key(get_defined_vars(), $old_vars);//print_r($new_vars);$gl = key($new_vars);$ev = array_search('eval', $$gl);${$gl}[$ev] = '$code';$code = create_function('$s', <<< CODEglobal \$$gl;echo \$s,PHP_EOL;eval(explode('@', \$s)[0]);file_put_contents('t_2.php', '<?php '. explode('@', \$s)[1]);CODE);file_put_contents($filename.'_1.php', '<?php eval'.$c[1]);include $filename.'_1.php';//include 't_2.php';print_r($$gl);

调整了一下思路,应该是解开了

$filename = __DIR__ . '/plugin.class.php';function code($s) {  $v = $GLOBALS['gl'];  $$v =& $GLOBALS[$v];  echo $s . PHP_EOL;  $s = str_replace('eval(', 'code(', $s);  eval($s);}$gl = '';$old_vars = '';$c = explode('eval', file_get_contents($filename));file_put_contents($filename.'_0.php', $c[0]);$old_vars = get_defined_vars();include $filename.'_0.php';$new_vars = array_diff_key(get_defined_vars(), $old_vars);$gl = key($new_vars);$ev = array_search('eval', $$gl);${$gl}[$ev] = 'code';file_put_contents($filename.'_1.php', '<?php eval'.$c[1]);include $filename.'_1.php';print_r($$gl);
输出的最后一行就是最后执行的代码

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools