SymbOS/Album Follows the Path of SymbOS/Yxes

by Axelle Apvrille
July 8, 2010 at 2:05 am

Lately, I have been analyzing a sample of SymbOS/Album.A!tr, another advanced malware targeting mobile phones running Symbian OS 9 and greater.

First of all, once more, like SymbOS/Yxes, this malware was “legitimately” signed by Symbian’s Express Signed program. The certificate is now revoked:

Serial Number: c8:8e:00:01:00:23:db:45:38:bc:e7:2a:d3:03
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=GB, O=Symbian Limited, CN=Symbian CA I
Validity
    Not Before: Nov 20 05:00:02 2009 GMT
    Not After : Nov 21 05:00:02 2019 GMT
Subject: C=CN, ST=guangdong, L=shenzhen,
O=Shenzhen ZhongXunTianCheng Technology Co.,Ltd.,
OU=PF_V100  1.0.0,
OU=Symbian Signed ContentID,
CN=Shenzhen ZhongXunTianCheng Technology Co.,Ltd.

Like SymbOS/Yxes, SymbOS/Album has the capability to silently send SMS messages. It does not do it the same way though: Yxes uses the RSendAs class, whereas Album uses a non-official Symbian API named EasyDgm API (Easy Datagram API). This API sends SMS messages via sockets. Check out the API’s source code for more details, but basically, this is how it works:

  1. open a socket (RSocket) and select the SMS protocol: iSocket.Open(iSocketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
  2. create a stream to write over that socket: RSmsSocketWriteStream writeStream(iSocket);
  3. dump the SMS message in the stream: writeStream << *smsMsg;
  4. flush all remaining data in the stream: writeStream.CommitL();

SMS messages sent that way are not reported in the phone’s Sent message box, so they are ‘invisible’ to the user (but not to his/her future bill !). To see what’s happening, one must read the phone’s internal log file, c:\101f401d\logdbu.dat:

"28/06/2010","15:26","Short message","Outgoing","Not sent",
   "1*1#","10665xxx"...
"28/06/2010","15:24","Short message","Outgoing","Not sent",
   "@id=200@V1.2.0@YOUR IMSI@3","13410252xxx"...

The log shows the malware tried to send 2 SMS messages, one to the phone number 10665xxx with text “1*1#” and the other one to 13410252xxx with a string containing the IMSI. Those SMS messages had no chance to make it to their recipient because they are only valid in China and I am not ;) (and, of course, I had checked manually in the disassembly what numbers the malware was likely to dial before trying !). Unfortunately, several Chinese users have been less lucky and have reported abnormal bill growth (see Figures 1 and 2).

13410252120-complaint-censored 10665-complaint-censored
Figure 1. Chinese user complaining his phone dialed 13410252xxx (text translated from Chinese) Figure 2. Chinese user complaining about unexpected SMS messages to 10665xxx (text translated from Chinese)

The number 10665xxx is special. It corresponds to a service provider number, i.e a special number allocated by the operator to so-called “service providers”. In that case, the number was allocated by China Mobile to “Interactive Technology Co., Ltd. Shenzhen Creation”.

As for the number 13410252xxx, it corresponds to a personal GSM located in Shenzhen, in the Guangdong Province, and it is operated by China Mobile.

13410252-location-censored

Figure 3. Locating number 13410252xxx (translated from Chinese)

Does that ring a bell? Look at the certificate at the top of this post:

C=CN, ST=guangdong, L=shenzhen

Yes, the certificate also belongs to an individual/company located in Shenzhen. No proof, but looks likely both belong to the same person.
Note that the names “Interactive Technology Co” or “ZhongXunTianCheng” may be fake, or impersonated and hence may not correspond to the malware authors.

Thanks to NetQin for sharing this sample.

– the Crypto Girl

Author bio: Axelle Apvrille's initial field of expertise is cryptology, security protocols and OS. She is a senior antivirus analyst and researcher for Fortinet, where she more specifically looks into mobile malware.

Reversing the Symbian Enoriv malware

by Axelle Apvrille
April 13, 2010 at 9:17 am

On Symbian phones, most malware are either implemented natively in C++ (over the Symbian API) or in Java (midlets). SymbOS/Enoriv.A!tr.dial uses another language called m.

Usually, m scripts (.m extension) are run within the m environment, (mShell) using the various features offered by m library modules (messaging, obex, video, zip…). This is comparable to Java midlets, which run over a Java environment and use various Java API packages. The m scripts can also be compiled to be included in a stand-alone Symbian application. In that case, the Symbian SIS package contains the compiled m script (.mex extension) and the m runtime environment (library and resources) for the mobile phone.

So, when we unpack Enoriv, most files are actually not malicious and only related to the legitimate m environment:

File: !:\system\apps\file\file.app,     Type: EInstFileTypeRun
File: !:\system\apps\file\file.mex,     Type: EInstFileTypeSimple
File: !:\system\apps\file\dialogs.rsc,  Type: EInstFileTypeSimple
File: !:\system\apps\file\menvironment.rsc,     Type: EInstFileTypeSimple
File: !:\system\apps\file\file.rsc,     Type: EInstFileTypeSimple
File: !:\system\apps\file\file.aif,     Type: EInstFileTypeSimple

Files such as dialogs.rsc, menvironment.rsc, file.rsc and file.aif are non-malicious resources (menu, icon files etc). A close look at the main application file, file.app, which is run at installation, reveals mEnvironment error codes and exceptions (ErrDied, ErrNoMemory, ExcInvalidNumber…), built-in m function names (isfunction, sleep…) and use of functions to display a GUI (CAknQueryDialog, CEikDialog…), load resources (CCoeEnv::AddResourceFile…), find .mex files, load a built-in top level class etc. So, file.app does not look alarming at all, it is the standalone m runtime environment. The only possible concern with the main application file is that it contains code to send SMS messages. We will explain that later.

The ‘interesting’ file is file.mex. A quick hexdump confirms itcontains the malicious payload:

00000000  4d 45 58 02 09 0e ff 03  ff ff ff 07 00 00 80 28  |MEX............(|
00000010  01 00 01 06 02 04 00 00  00 00 00 00 ff 5d 36 01  |.............]6.|
00000020  00 00 43 11 00 00 11 01  00 36 01 05 02 43 0f e8  |..C......6...C..|
00000030  03 36 00 1b 01 43 11 02  00 11 03 00 36 01 05 02  |.6...C......6...|
00000040  43 0f e8 03 36 00 1b 01  43 11 04 00 11 03 00 36  |C...6...C......6|
00000050  01 05 02 43 0f e8 03 36  00 1b 01 43 11 02 00 11  |...C...6...C....|
00000060  03 00 36 01 05 02 43 0f  e8 03 36 00 1b 01 43 11  |..6...C...6...C.|
00000070  05 00 11 03 00 36 01 05  02 43 3d 04 05 73 6c 65  |.....6...C=..sle|
00000080  65 70 1b 01 01 01 00 ff  1b 07 04 33 36 34 39 07  |ep.........3649.|
00000090  0a 6f 70 73 65 78 20 33  39 32 32 07 04 37 31 32  |.opsex 3922..712|
000000a0  32 07 0a 6d 75 6e 65 74  20 33 39 32 32 07 04 31  |2..munet 3922..1|
000000b0  31 37 31 07 04 38 33 35  35 00 01 03 73 6d 73 00  |171..8355...sms.|
000000c0  00 02 04 04 73 65 6e 64  05 02 03 01 00 ff 04 00  |....send........|
000000d0  00                                                |.|
000000d1
Notice the strings at the end “opsex 3922″, “7122″,  “munet 3922″, “sms”, “send”. Smells like a script sending SMS messages to premium phone numbers. But, what exactly is it sending ? an SMS to 3649 with the text “opsex 3922″ ? several SMS to numbers 3649, 3922, 7122, 1171, 8355 ? Let’s have a closer look.

As we said previously, .mex files are compiled m scripts. A developer writes an m script (extension .m), and may then compile it using the “Compile” menu of the mShell application installed on his development mobile phone.

01

Figure 1. Test m script file Figure 2. Compiling an m script

Unfortunately, the format of .mex is not (publicly) documented and .mex decompilers do not exist either (or not publicly). So, we have to work this out ourselves.

Obviously, .mex files begin with a “MEX” magic, followed by some formatting and finally strings. In the mShell documentation, we find there is a built-in sleep function which takes milliseconds as parameters, and a send function in the sms module, which takes a list of phone numbers as first argument and a text as second argument. We notice that, in the compiled script, function names are prefixed by 0×04 and the length of the function’s name:

  • 0×04 0×05 sleep
  • 0×04 0×04 send

Similarly, module names are prefixed by 0×01 and the length of the module’s name:

  • 0×01 0×03 sms

and constants used in the script are prefixed by 0×07 and the length of the string:

  • 0×07 0×04 3649
  • 0×07 0×0a opsex 3922
  • 0×07 0×04 7122
  • 0×07 0×0a munet 3922
  • 0×07 0×04 1171
  • 0×07 0×04 8355

At this point, we know the malicious script:

  1. uses the sms module
  2. calls the built-in sleep function
  3. calls the sms send function
  4. uses 6 constant strings

but we do not know to which function arguments the constants correspond. To understand this, we create a basic non-malicious m script that sends an SMS (see Figure 3) to our lab’s test phone.

2

Figure 3. Test SMS message received by our lab’s iPhone

Then we compile it and compare its hexdump with that of the malware:

00000000  4d 45 58 02 09 0e bf 01  00 ff ff ff 07 00 80 28  |MEX............(|
00000010  01 00 01 02 02 04 00 00  00 00 00 00 ff 19 36 01  |..............6.|
00000020  00 00 43 0f 05 00 36 00  1b 01 43 11 00 00 11 01  |..C...6...C.....|
00000030  00 36 01 05 02 43 3d 04  05 73 6c 65 65 70 1b 01  |.6...C=..sleep..|
00000040  01 01 00 ff 1b 07 0c 2b  30 30 31 31 32 32 33 33  |.......+00112233|
00000050  34 34 35 07 11 48 65 6c  6c 6f 20 43 72 79 70 74  |445..Hello Crypt|
00000060  6f 20 47 31 72 6c 00 01  03 73 6d 73 00 00 02 04  |o G1rl...sms....|
00000070  04 73 65 6e 64 05 02 03  01 00 ff 04 00 00        |.send.........|

We notice that the argument to the sleep function (5 milliseconds) does not appear as a text string, and that, for the sms.send() function, the phone number appears before the SMS text message.

This consequently means that the “3649″ string is not an amount of milliseconds but a premium phone number the malware sends SMS messages to.

To understand how the other strings are organized, we need to play a little more with our non-malicious test script and, for example, have it send several SMS messages (replace with your own phone numbers):use sms

sms.send("+00000000000", "Msg 1");
sms.send("+11111111111", "Msg 2");
sms.send(["+22222222222", "+33333333333"], "Msg 3");

In that case, the hexdump shows the first phone number (”+00000000000″), the first message (”Msg 1″), the second phone number (”+11111111111″), the second message (”Msg 2″), the third phone number (”+22222222222″), the fourth phone number (”+33333333333″), the last message (”Msg 3″) and finally the string “sms” (reference to the sms module) and the string “send” (reference to the send function).

So, the malware sends a first SMS to the phone number 3649 with the text “opsex 3922″ and a second SMS to the phone number 7122 with the text “munet 3922″. For the remaining strings, 1171 and 8355 look like two premium phone numbers, but the 8355 could also be the SMS text. To tell the difference, we modify our non-malicious test script once more:

use sms
sms.send("+00000000000", "");

The hexdump shows the phone number (”+00000000000″), followed by a null string (0×07 0×00). As this does not occur in the malware, this means it only sends a third SMS message to phone number 1171 with text 8355. There we are, we retrieved the phone numbers and messages of all three SMS messages.

– Crypto Girl

Author bio: Axelle Apvrille's initial field of expertise is cryptology, security protocols and OS. She is a senior antivirus analyst and researcher for Fortinet, where she more specifically looks into mobile malware.

SymbOS/Yxes goes version 2

by Axelle Apvrille
March 4, 2010 at 1:32 am

A few days ago we encountered a new variant of the Symbian worm, Yxes, that we named SymbOS/Yxes.H!worm. This worm contacts malicious remote servers, which host Java Server Pages, and propagates by sending ‘attractive’ SMS messages. For instance, this new variant sends an SMS with an URL promising private information concerning a Chinese actress. Globally, the logic (and much of the code) is the same as in previous variants. Yet, there are a few updates, one of the main ones being the use of new remote malicious Java Server Pages.

I guess every analyst has noticed this variant of the malware contacts the following URLs:

http://XXXX/Jump.jsp?Version=2.0&PhoneType=...&PhoneImei=...&PhoneImsi=...&Source=...
http://XXXX/Kernel.jsp?Version=2.0&PhoneType=...&PhoneImei=...&PhoneImsi=...&Source=...
http://XXXX/KernelPara.jsp?Version=2.0&PhoneType=...&PhoneImei=...&PhoneImsi=...&Source=...

The PhoneType argument contains the model of the infected phone (e.g nokia3250, nokian95…), while the PhoneImei and PhoneImsi arguments respectively contain the phone’s IMEI and IMSI. The Source argument is new to this variant, and its use has not been reversed yet. It could possibly contain the name of the malicious website used to infect the phone.

The first of those JSP pages, Jump.jsp, redirects the user to a Chinese mobile social networking site (3g.kaixin001.com then wap.kaixin001.com). Actually, we had already noticed this behaviour in at least 2 former JSP pages used by previous versions.

The second JSP page, Kernel.jsp, actually replies the following string (host name removed):

http://XXXX/download/root/plugucsrv.sisx

And, from this location, we get a new minor variant of Yxes.D. This is a consistent behavior in Yxes: the worm indeed often works in pairs (e.g variants A, B, D or E download variants C, D or F). In this case, variant H silently downloads and installs a remotely hosted new version of variant D.

Its certificate says:

Serial Number:
 2a:2f:00:01:00:23:37:98:0c:73:b2:c7:69:17
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=GB, O=Symbian Limited, CN=Symbian CA I
Validity
 Not Before: Jan 23 17:55:42 2010 GMT
 Not After : Jan 24 17:55:42 2020 GMT
Subject: C=CN, ST=Fujian, L=XiaMen, O=Xiamen Jindoucheng Tech Co. Ltd.,
OU=plugucsrv  2.1.0, OU=Symbian Signed ContentID,
CN=Xiamen Jindoucheng Tech Co. Ltd.

A notification has been sent to Symbian, who tells us the certificate should soon be revoked. Meanwhile, be cautious if you encounter a file named plugucsrv.sisx that installs as a ‘Setting Wizard’.

That variant D then actually does most of the malicious work: collect data on the phone, report it back to the malicious web servers and send SMS messages. The URLs it contacts are:

http://XXXX/bs.jsp?Version=2.1&PhoneType=...&PhoneImei=...&PhoneImsi=...
&PhoneNumber=...&Succeed=...&Fail=...&Source=... &Time=...&Component=...
http://XXXX/index.jsp?Version=2.1&PhoneType=...&PhoneImei=...&PhoneImsi=...
&PhoneNumber=...&Succeed=...&Fail=...&Source=... &Time=...&Component=...
http://XXXX/number.jsp?Version=2.1&PhoneType=...&PhoneImei=...&PhoneImsi=...
&PhoneNumber=...&Succeed=...&Fail=...&Source=... &Time=...

The PhoneNumber, Succeed, Fail and Time arguments are obviously used to report contacts listed on the phone. The Succeed and Fail arguments are followed by an integer, probably the number of times that phone number has successfully been called or not.

Quite interestingly, if we try to get http://XXXX/bs.jsp, using a credible user agent (the malicious websites are known to check user agents – in particular, if it detects Internet Explorer, it responds “404 Not Found”):

SUCCESS reponse: 200 OK
http://hew1ett-packard.com/bs.jsp?

Notice the letter L of Hewlett has been replaced the number 1 (one).

So, the first malicious web server redirects the requests to another malicious web server, whose name is obviously intentionally crafted to fool the end-user. The URL does not respond any longer. Note that the Yxes worm is already known to use such mispellings:

  • www.megac1jck.com
  • www.mozi11a.com
  • www.makt00b.com
  • www.mediafir8.com
  • www.megaup10ad.com

The third JSP, KernelPara.jsp, is still a mystery we have to work on. It returns a file named encrypt_Kernel_Para.txt. If its name is meaningful, it is likely to be an encrypted version of a file named Kernel_Para.txt (the worm already uses files with similar names: Local_Para.txt and Remote_Para.txt). In our case, its content is fixed and 32-byte long. It is not an XOR encrypted URL.

Finally, to evaluate the worm’s authors progress, it is interesting to follow the dates and versions of samples. The dates are taken from the first validity date in the X.509 certificate used to sign the sample, and the version numbers are included either in the main executable of the sample or in the certificate.

Yxes-versions

Apart from a sporadic ‘accident’ end of June 2009 where a version 1.0 goes in the wild (probably an error in versioning), we see the worm authors are continuously working on Yxes since the end of 2008. So my first prediction for 2010 was nearly bound to be true…

– The Crypto Girl

Author bio: Axelle Apvrille's initial field of expertise is cryptology, security protocols and OS. She is a senior antivirus analyst and researcher for Fortinet, where she more specifically looks into mobile malware.

Transmitter.C is not Yxes.E

by Axelle Apvrille
August 26, 2009 at 11:31 pm

There has been a lot of confusion lately concerning the SymbOS/Yxes worm. Among those, it has now dawned on me the so-called Transmitter.C reported in numerous articles on the net (for instance, here and here), is not sexySpace.sisx (detected as SymbOS/Yxes.E!worm): those are two different malware.

Why ? As a matter of fact, several issues startled me (ordered from weakest to strongest point):

1. Transmitter.C is reported to send a massive amount of SMS messages (they are talking about 500 SMS). If Transmitter.C is Yxes.E, it is surprising because I cannot see any loop in the code indicating numerous copies of SMS are sent out, but of course, that would depend on the amount of contacts and SMS stored in the infected phone. Strange though. In Yxes.E, I do see the piece of code that sends SMS messages (see picture below), but I haven’t spotted any function calling it yet. The malicious code might be bugged. And, as a matter of fact, on the Nokia N95 I tried it on, Yxes.E did not succeed to send any SMS at all.

SMS sending routing in SymbOS/Yxes
Figure 1. Assembly routine sending an SMS – disassembled with IDA Pro. The routine connects to the SendAs server. Then it creates a message object, sets the recipient (”to”) and finally the message body.

2. The screenshot of the SMS message mentions the string “A very sexy girl, Try it now!” with a link to a website hosting sexySpace.sisx. But, quite strangely, this string is nowhere to be found in the executable inside sexySpace.sisx (AcsServer.exe) nor in other resources. No, it is definetely not in Yxes.E. Of course, it could be dynamically decrypted from data in the executable, but then, why are similar strings in cleartext in Yxes.D (”A very interesting sexy game!try it soon!”) ?

3. Last but not least, Transmitter.C is said to spread as a trojaned version of a legitimate application named ‘Advanced Device Locks’, but sexySpace.sisx does not install as ‘Advanced Device Locks’ at all: it installs under the name ‘Sexy Space’ and does not include any part of the Advanced Device Locks application. That does not sound like the right sample at all.

To my opinion, Transmitter.C is not sexySpace.sisx, and thus not SymbOS/Yxes.E!worm. In that case, the SMS screenshot should probably be credited to Transmitter.C (and not SymbOS/Yxes.E!worm), which is interesting, because it includes a link to a website hosting sexySpace.sisx. This means Transmitter.C can be seen as a kind of dropper that tries to spread SymbOS/Yxes.E!worm.

– The Crypto Girl.

PS. By the way, if you encounter a sample of Transmitter.C please be forward it to submitvirus (at) fortinet.com.

Author bio: Axelle Apvrille's initial field of expertise is cryptology, security protocols and OS. She is a senior antivirus analyst and researcher for Fortinet, where she more specifically looks into mobile malware.

Super Tuesday Extra: Details on the OWC (late) 0day

by Haifei Li
August 11, 2009 at 9:49 am

You may have taken note that Microsoft patched the Office Web Components zero-day vulnerability today. Previously, attacking code exploiting this vulnerability had been found in the wild, which had led us to release FortiGuard Advisory FGA-2009-27, reflecting Microsoft’s Security Advisory 973472 on July 13.

In fact, we worked in a quite nice collaboration with the Microsoft Security Response Center during the responsible disclosure process. As early as in August last year, this vulnerability was discovered by us and reported to the MSRC (marked as FG-VD-2008-021) along with Proof of Concept code; Later, we also spotted public attacking code and notified the vendor on July 11 this year (mentioned in our latest Threat Landscape Report as well).

It is important to note that the PoC we initially provided Microsoft with is not exactly the same as the one found in the wild; as a matter of course, they point to the same flaw, but vectors that could trigger the problem in the ActiveX control are in fact multiple (Note: our IPS signature can detect all vectors of which we are aware).

Regarding the technical details, after thorough research, we found out that the vulnerability lays in an inconsistency between dynamic libraries owc10.dll (or owc11.dll) and jscript.dll in the way they handle the “object” datatype. Indeed, it turned out that owc10.dll uses an instance of this datatype after Javascript already called its destructor (thereby freeing its memory space). It results in a “Use After Free” problem. Following snapshots provide more details:

pic1

On figure 1 above, a trained eye may recognize the assembly instructions operating the call of a C++ class virtual member function. Indeed, when an object is an instance of a virtual class, its memory representation consists in a pointer called the “vpointer”, (usually) followed by the object  member variables. The vpointer holds the address of the class’ vtable, which is a simple list of indexed member function addresses (aka the class methods). Essentially, this is how the dynamic  dispatch of method calls is implemented in machine code, and this is what effectively enables C++ inheritance polymorphism.

Here, register esi holds the object vpointer address (0×39DB88), which, we recall, is also the start of the instanced object’s memory space on the Heap. Therefore, mov eax, dword ptr [esi] loads the vtable address in register eax, and call dword ptr [eax+98] calls the function at index 0×98 in the vtable. What does this function do? The IDA Pro screenshot below enlightens us:

pic2

Obviously, the function at index 0×98 is the class destructor. The object memory space at 0×0039DB88 on the heap is therefore freed. Now, the dodgy thing happening in owc10.dll afterward is shown on Figure 3 below:

pic3

Again, one may recognize the same sequence of instructions typical of a virtual function call: eax holds the object vpointer address, mov ecx, dword ptr [eax] loads the vtable address in ecx, and call dword ptr [ecx+8] calls function at index 0×08 in the vtable.

In other words, the dll calls a method of the object sitting at eax. However, here, eax is set to… 0×0039DB88, and therefore points to an object that was freed above by jscript.dll. Conclusion: we’re in “Use After Free” case, which is relatively serious, since it could likely be exploited by attackers to run any malicious code they want on the system of a user simply visiting a specifically crafted web page.

We pointed this out in our original vulnerability report. Which turned out to be judicious, since as of writing, a working exploit has been seen spreading in the wild for more than one month.

Our customers are of course protected by the relevant IPS patterns. We nonetheless recommend that all Microsoft Office users apply the official patch as soon as possible.

Guillaume Lovet and Kyle Yang contributed to this report.

Author bio: Haifei Li is a senior vulnerability researcher with Fortinet's FortiGuard Labs.