<div dir="ltr"><a href="https://nakedsecurity.sophos.com/2016/03/02/php-ransomware-attacks-blogs-websites-content-managers-and-more/">https://nakedsecurity.sophos.com/2016/03/02/php-ransomware-attacks-blogs-websites-content-managers-and-more/</a><span style="font-family:arial,helvetica,sans-serif"><span style="font-size:8pt"></span></span><br><span style="font-family:arial,helvetica,sans-serif"><span style="font-size:8pt"></span></span><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><p>Most file-scrambling <a href="https://nakedsecurity.sophos.com/?s=ransomware">ransomware</a> is written for <a href="https://nakedsecurity.sophos.com/2016/02/17/locky-ransomware-what-you-need-to-know/">Windows computers</a>, although it can encrypt files anywhere they’re writable, including Macs, file servers and cloud storage sites.</p>
<p>We’ve seen a few attempts at both <a href="https://nakedsecurity.sophos.com/2014/07/25/android-fbi-lock-malware-how-to-avoid-paying-the-ransom/">Android</a> and <a href="https://nakedsecurity.sophos.com/2015/11/11/ransomware-meets-linux-on-the-command-line/">Linux</a> ransomware.</p>
<p>And, if you cast your mind back, you may remember that the very first ransomware, more than 25 years ago, was the <a href="https://nakedsecurity.sophos.com/2012/09/25/ransomware-would-you-pay-up/">AIDS Information Trojan</a>, that ran on good old MS-DOS.</p>
<p>
</p>
<p>Now, sadly, we’ve got a whole new sort of ransomware, written in PHP.</p>
<h2>What is PHP?</h2>
<p>PHP is a programming language intended to help you produce 
dynamically-generated content on your web server, typically by embedding
 PHP commands inside your HTML pages.</p>
<p>Before the page is sent out by the server, the PHP script parts are 
executed, and replaced in the final page with the output from the 
script.</p>
<p>In the input file below, for example, the part between <tt><?php</tt> and <tt>?></tt> is run by the PHP processor…</p>
<p><img src="https://sophosnews.files.wordpress.com/2016/03/php-before-6401.png?w=640&h=102" class="" width="640" height="102"></p>
<p>…and converted into output that looks something like this:</p>
<p><img src="https://sophosnews.files.wordpress.com/2016/03/php-after-6401.png?w=640&h=102" class="" width="640" height="102"></p>
<p>Many, if not most, web servers make use of PHP, automatically processing files with a <tt>.php</tt> extension before they are served up.</p>
<p style="background-color:rgb(232,232,232);font-size:80%;padding:1em 2em;margin:2em 0px">PHP
 is sort-of like JavaScript, except that the script processing is done 
on the server before the page goes out. JavaScript, in contrast, is sent
 to your browser and the script processing is done inside the browser 
after the page is received but before it is displayed.</p>
<h2>PHP malware</h2>
<p>Notably, most content and management systems, such as WordPress, Joomla and Drupal use PHP.</p>
<p>In other words, if a crook has your blog password and can upload 
files to your server, or if you have an unpatched server plugin that 
allows him to modify files that are supposed to be write-protected, and 
he can alter one or more of your PHP files…</p>
<p>…then he can install a payload on your website that will trigger whenever anyone happens to visit the booby-trapped page.</p>
<p>Indeed, he can activate the payload himself at will by accessing the 
page himself in what appears to be an entirely innocent web request.</p>
<p>That’s how the malware known as <strong>Troj/PHPRansm-B</strong> works.</p>
<p>It infects your server by means of a file called index.php that contains:</p>
<ul><li> File encrypting and decrypting code using PHP.
</li><li> Style-sheet information using CSS, plus inline images.
</li><li> A “pay page” using HTML and JavaScript.
</li></ul>
<p>The file encryption doesn’t happen every time the page is viewed, 
only when the crook himself submits a specially-formatted upload request
 in which he specifies two passwords, a “test” password and a “full” 
password.</p>
<p>Once the encryption is kicked off, two randomly-chosen files are 
encrypted with the test pasword, and the rest with the full password. 
(The encryption uses the AES cipher in CBC mode.)</p>
<p>Anyone else visiting the page – embarrassingly, this may very well 
include your prospects and customers – will see a warning page like 
this:</p>
<p><img src="https://sophosnews.files.wordpress.com/2016/03/paypage-640.png?w=640&h=644" class="" width="640" height="644">
</p><p style="text-align:center;font-size:85%;margin-top:0px;padding-top:0px;color:rgb(128,128,128)"><em>Troj/PHPRansm-B “pay page” from 2016</em></p>
<p>Simply put, you need to fork over BTC 0.4 (0.4 bitcoins, currently about $170) to get the full password back from the crooks.</p>
<p>You may recognise the name “CTB-Locker” from the pay page: that name was also used by the crooks behind a <a href="https://blogs.sophos.com/2015/12/31/the-current-state-of-ransomware-ctb-locker/">widespread Windows ransomware campaign</a> back in 2014.</p>
<p>(You can read about the Windows version of CTB-Locker and other ransomware variants in the SophosLabs paper <a href="https://www.sophos.com/en-us/medialibrary/PDFs/technical%20papers/sophos-current-state-of-ransomware.pdf?la=en"><em>The Current State of Ransomware</em></a>, published in December 2015.)</p>
<p>If you need convincing that paying up is likely to work, you can click on the <tt>[Free decrypt]</tt> button to upload the “test” files that were encrypted with the test paswords.</p>
<p>Even if you use a web debugger to intercept the free decryption 
function, and successfully extract the test password from memory, it 
won’t help you to unscramble any of your other files.</p>
<p>And there’ even a <tt>[Chat]</tt> window where you can communicate with the crooks:</p>
<pre>Chat room

If you have any questions or suggestions, please leave a 
english message below. To prove that you are an administrator, 
you must specify the name of the secret file that is in same 
directory with index.php. We will reply to you within 24 hours.
</pre>
<h2>What to do?</h2>
<ul><li> <strong>Pick a proper password for your web server, content management system or blog.</strong> We shouldn’t have to say this, but don’t choose the same password that you have used anywhere else.
</li><li> <strong>Consider using two-factor authentication.</strong> 
This usually works by sending you an SMS, or requiring you to run a 
special code-generating app on your phone, with a one-time code to 
complete your login. This means your password alone is not enough.
</li><li> <strong>Review all your server access permissions.</strong> Make sure that guest users, for example, can’t modify files they aren’t supposed to.
</li><li> <strong>Make sure your server is patched against security holes.</strong>
 This means updating the operating system, your blogging or web server 
software, the PHP application, your site’s themes and plugins, and much 
more.
</li><li> <strong>Run a real-time anti-virus on your server.</strong> Yes, even if it’s Linux. Especially if it’s Linux. By the way, <a href="https://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-linux.aspx">Sophos Anti-Virus for Linux</a> is 100% free for desktops and servers, at work and at home.
</li></ul>
<hr style="margin:2em 0px"><br><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">





</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>