Blog PostZenCrypt -- PHP Encoder

Last night, I was searching the internet for PHP Encoders, I always knew that ZendGuard and IONCUBE are the best. However, I thought of giving others a chance. While searching I came across ZenCrypt. One of the good things about it that it doesn't need a loader on the server-side. Thus, the scripts are self-decodable. But this makes it easy to decrypt. On thier website, they have two scripts. One is the source, and the other is the encoded script.

My Attempt to understand its way of encoding to see if it worth the USD45.

Source PHP Code:

<?php /\* ------------------------------------------------- www.ZenCrypt.com ZenCrypt simple demo User Manual: http://www.zencrypt.com/INFO/ZenCrypt\_PHP\_Encoder.pdf ------------------------------------------------- \*/ //{{{PHP\_INSERT\_a1}}} // Encoded chunk of code will be inserted here by ZenCrypt // Encoded version - test\_encoded.php was generated by running ZenCrypt with this command: // php -f zencrypt.php infile=test\_plain.php outfile=test\_encoded.php enccycles=10 stripcomments=yes //{{{/PHP\_INSERT\_a1}}} // This code client will see $encrypted\_number = 52728; $resulted\_number = ZEN\_encrypt ($encrypted\_number); echo "\\nEncrypted number=$resulted\_number"; $resulted\_number = ZEN\_decrypt ($resulted\_number); echo "\\nDecrypted number=$resulted\_number"; //{{{PHP\_ENCODE\_a1}}} // This part will be encoded and moved above (in between PHP\_INSERT tags). // We do not want to expose these "super secret" encryption functions to the clients. function ZEN\_encrypt ($input) { return ($input+5432); } function ZEN\_decrypt ($input) { return ($input-5432); } //{{{/PHP\_ENCODE\_a1}}} ?>

Encoded Code:

<?php /\* ------------------------------------------------- www.ZenCrypt.com ZenCrypt simple demo User Manual: http://www.zencrypt.com/INFO/ZenCrypt\_PHP\_Encoder.pdf ------------------------------------------------- \*/ $juTSvfNAGsrLGell='=ch/5z/T/fd3E73dPj+i+/rRNYcW/rz/sr6zjSNreaXN+nf/W876jLfWtd9fYXR5F3mtYCRhWNW7dOXGPsM19c920z3acnzSfxYMLFxg/Lz0nIz1FfpnLVdf/xksrTZqs55rpk///93fz27zHki6/oWYz1+9boz693v+vwQE52qDxffRSPNxjIf7xOfHb07GgxXHS/CawCIAXw9xuOY/EVs2Ku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eval($lUETluMevSaLCDV); // This code client will see $encrypted\_number = 52728; $resulted\_number = ZEN\_encrypt ($encrypted\_number); echo "\\nEncrypted number=$resulted\_number"; $resulted\_number = ZEN\_decrypt ($resulted\_number); echo "\\nDecrypted number=$resulted\_number"; ?>

My Attempt to Decode the Code:

<?php /\* ------------------------------------------------- www.ZenCrypt.com ZenCrypt simple demo User Manual: http://www.zencrypt.com/INFO/ZenCrypt\_PHP\_Encoder.pdf ------------------------------------------------- \*/ $juTSvfNAGsrLGell='=ch/5z/T/fd3E73dPj+i+/rRNYcW/rz/sr6zjSNreaXN+nf/W876jLfWtd9fYXR5F3mtYCRhWNW7dOXGPsM19c920z3acnzSfxYMLFxg/Lz0nIz1FfpnLVdf/xksrTZqs55rpk///93fz27zHki6/oWYz1+9boz693v+vwQE52qDxffRSPNxjIf7xOfHb07GgxXHS/CawCIAXw9xuOY/EVs2KuqrxeJFCMTjEENA0ny6gTRUnndy30KTE/uyY77Pa0TWPVyHmqmYQ98Vf+dgq80ne2FgRkZzz1I103xrDgFjbVdXrcq4coJhOlJwGfXOMVavufyVOwpoIna3qQ5ldM+cVFUwoIHxuEbp3t6HEKKHnhi8rDY6aBfCxM9HkjSCeDP5gWj8GO2zaLsMsrsmLaLw605dRJDxFQZcyTe/X5RDaN9pJ0JTlyEzs0b6ds4cIeRg0uf7/INtfOgFECfah6aJz5Z8WbW5XorpGJZQAk/0H4sxB6GZiXZT44QtxETrhcqSgW5rtxHBxfDN6o8R8m7tbItO7uy3VBIRCi7f1Z+g6qkDoFRh3oiPBehlfbWHOCxdljFFxBjWwZhwOG/tAPA/EtX8LOkw3h04N+Ju7F25yDu6L7itrTU2jJ4dhqbPfBXzXg73fIzmZCyYxdmischnH+1voRzSntcnhxhyLfEriTCyEOhlOlzadH8WzfTUst9O3HBBP0U2JxDBRaLNQUeZjSpFWaDrQGUz3zWFYzBrYHUEtIjENWe0YsQpaFChodc7xDgaegxTTZNNb/il0sihsr6TdlVaq6HCfBywAK92VzCMe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c19kmOMpKd0N1d62IdjeeufMxGxM42QFe+NS+rZeD5jY9KOe6c4adcJMToZDt7F8mEN4isP9okCSxpN1Wvr8cpj+Rwn6xFslssE60hp54EwDmogCfgu1xz9dLGUCP4hk8BQAEPxCJ3+8KALk/4ry59SEHgAsPZW3QeuBJ1xQWsQQHnvphTU/hFcFApGOYgiqw+P2bHPAtahgbhG4g5twGhSmwIIAggBccUccjnrn9Z2wn+ZbQAB1eN9CTMBQMBEE98OApvjbJ2EAYeui/+/PE0n78g542p9K1FhlIIT7xFwOvff919+OIkX675p2SBB7YNRuCWYXBZyvDISuj3SVb';$QynVyKBtA\_laXYfjkJ=';))))yyrTYefTNAsiFGhw$(ireegf(rqbprq\_46rfno(rgnysavmt(ynir';$LoMOYHmyNmPlxD=strrev($QynVyKBtA\_laXYfjkJ);$lUETluMevSaLCDV=str\_rot13($LoMOYHmyNmPlxD);eval($lUETluMevSaLCDV); //print  gzinflate(base64\_decode(strrev($juTSvfNAGsrLGell))); $str=str\_replace("eval","\\$str=", gzinflate(base64\_decode(strrev($juTSvfNAGsrLGell)))); eval($str); print $str."\\n--\\n"; //print "--\\n"; for($icount=0; $icount<17; $icount++) { $str=str\_replace("eval","\\$str=", $str); print $str."\\n$icount--\\n"; eval($str); print $str."\\n$icount--\\n"; } // This code client will see $encrypted\_number = 52728; $resulted\_number = ZEN\_encrypt ($encrypted\_number); echo "\\nEncrypted number=$resulted\_number"; $resulted\_number = ZEN\_decrypt ($resulted\_number); echo "\\nDecrypted number=$resulted\_number"; ?>

Conclusion:

What I see that it doesn't worth the the USD45. Maybe if it was encoded with ZendGuard or ionCube and produces a file that requires a PHP Loader. Just like PHPCipher. However, from this attempt. I thought that I will write my own encoder. It will be using the same method, however, the output will be encoded in both ZendGuard and ionCube. Stay tuned!

Comments

Discuss with me and others You need to sign in to post comments