Skip to main content

Droidbox, Study of Android Dynamic Analysis (✖╭╮✖) (day 4)


My teacher always encourage me about reading paper of research in order to up to date with the current method whether it is android malware or android pentest topic. I have read a lot of awesome research that truly open my eyes in the field of research and development in mobile security. So when i try to do my daily search of interesting topic, i came across with this really cool tool called "DROIDBOX".

Credit goes to the author, this post is inspire from the following link: https://www.honeynet.org/node/1317

Before we going to talk more about "DROIDBOX". Let me explain some simple concept.

In the field of security there are two analysis that is typically known. One is static analysis and the other one is dynamic analysis.

Static analysis is where you try to find some interest(e.g: malicious class, vulnerable component) in the application without executing it in the safe environment. So long story short most of the time you will do reverse engineering and string analysis.  The point of static analysis is to give you better overview of the application so that you can get enough information that will lay foundation of the next step of your analysis which is dynamic analysis.

Dynamic analysis is analyzing the application with executing the application in the safe environment whether in docker or virtual machine. The point of dynamic analysis is to have better insight on the behavior of the application. Dynamic analysis could be achieve by network analysis, debugging, memory analysis or sending an event to the application to trigger an interesting behavior.

Droidbox is the dynamic analysis platform sandbox built based on taintdroid. It will record and generate information based on the dynamic behavior that happened from the application.

The following information is described in the results, generated when analysis is complete:
  • Hashes for the analyzed package
  • Incoming/outgoing network data
  • File read and write operations
  • Started services and loaded classes through DexClassLoader
  • Information leaks via the network, file and SMS
  • Circumvented permissions
  • Cryptographic operations performed using Android API
  • Listing broadcast receivers
  • Sent SMS and phone calls
(i copy paste it from the github page :p)

you could check the official repository of the droidbox in the following github page: https://github.com/pjlantz/droidbox 

what so cool about droidbox development is that it's already provide with docker container that could be use right away for analyzing application.

link: https://hub.docker.com/r/honeynet/droidbox/

it is really simple first you just have to pull the image and you are ready to go(mind your internet connection because the image is pretty big):

~# docker pull honeynet/droidbox


first you need to create a directory that will have the analyzed application for this post i will try to analyze the triada malware apk that i got. The name is not really that important you can name it anything you want.


all of the result of the analysis will go into this directory. Fire up the docker by putting these command.


Notice that if you use this command after you deploy the docker it will automatically delete itself from the process. I set Droidbox to analyze the application time limit to be 10 seconds(longer the better)


When the droidbox is running it will take your CPU power massively(and your computer fan maybe will go crazy) but don't worry it doesn't take your memory much.


Don't worry if the format is not really that good to read, you can check the result in more readable format in directory called "out" that will contain all the result of the analysis.


lets open the analysis.json file (i use lolcat)



first thing that make me confuse is the "proc/PID/cmdline" it shows that the apk access and read the following file. Why android malware application want to access cmdline file ?

i try to read the manual about the file but it still make me confuse, it explain like this:

/proc/[pid]/cmdline
    This holds the complete command line for the process, unless the process is a zombie.  In the  latter
    case, there is nothing in this file: that is, a read on this file will return 0 characters.  The com‐
    mand-line arguments appear in this file as a set of strings separated by null bytes  ('\0'),  with  a
    further null byte after the last string.

all i can get from this explanation is that when you try to do command line execution the process will be store in the /proc/[pid]/cmdline file based of the reserved PID. But it still don't show any motive about why malware wants to access this file.

after several minute of research i think i found the answer, it is from the research paper called "Mobile Root Exploit Detection based on System Events Extracted from Android Platform", it explain like this:

"When  rooting  process  begins,  firstly BinBreak searches  and  finds  out  PID  of  Volume  Daemon.  It  can  be  accomplished  by  looking  for  each  file  named  /proc/<PID>/cmdline, where PID means currently running processes’ PID. Currently running process  can  be known  from  /proc/net/netlink  file.  Once  identifying Volume Daemon’s PID, malware retrieves device-related information from  /etc/vold.fstable  that  is  a  file  system  table  of  Volume  Daemon. With use of Volume Daemon’s PID, socket connection is established. Finally,  it  sends  specific  message  through  the  connection  and  gains root privilege. "

link:https://pdfs.semanticscholar.org/5a9d/f5f40da8363e99300b37ac01cd6f31f0c00f.pdf

what i could i summarize from the following explanation is that in order the malware to gain root privilege first it will check the Volume daemon PID by checking the "/proc/<PID>/cmdline". Volume daemon or so called volume management daemon(vold) is the who responsible for mounting and unmounting SD card. These particular daemon always listening connection from NETLINK socket and the bad things about the service is that never check where the source is of the packet originally come from. So any application could create a NETLINK socket connection and send a specifically crafted message to the vold that will lead to memory corruption, execution of arbitary code and gain root privilege.

these mechanism of exploitation is known as gingerbread(CVE-2011-1823)

link to more detail explanation:https://books.google.co.id/books?id=AKbNBgAAQBAJ&pg=PA18&lpg=PA18&dq=volume+daemon+android,+root&source=bl&ots=Mbm7whKFiL&sig=VnTitgGAYP1XfiI0CROY94az__E&hl=en&sa=X&ved=2ahUKEwjs_sfpxeXeAhUJ2o8KHaOSCVw4ChDoATAAegQIChAB

another interesting information that i could obtain is the "com.hd.android.tubede" package from dexclass.

i'm just being honest i have no idea what this package for. All i can find is that the following apk have connection to trojan application:


link: https://blog.zimperium.com/wp-content/uploads/2016/08/HummerTrojan-IOCs.pdf

(i will try to research application next time and update this post)

That's all that i could mustard up for this post. I'm sorry if my power of analyzing android malware really not that good

Comments

  1. Hi, can you please contact me on duniaalqahtani@gmail.com. I have several questions that I want to ask you about. Thank you :)

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. how to get your mail id>>> i have certain doubts

    ReplyDelete

Post a Comment

Popular posts from this blog

Having fun analyzing nginx log to find malicious attacker in the net (ง'̀-'́)ง (day 37)

  What makes you sleepless at night? is it because of a ghost or scary stories? is it because you have an important meeting tomorrow? or is it because you have an exam? For me, what keeps me up all night is that I keep thinking about what happens to a website that I just created, is it safe from an attacker (certainly not) or did I missing some security adjustments that lead to vulnerability? well I'm not the best secure programmer in the world, I'm still learning and there is a big possibility that I can make a mistake but for me, a mistake can be a valuable investment to myself or yourself to be better so from this idea, I want to know more about what attackers casually do when attacking a website. Here in this post, I'm going to show you how I analyzed attack to the website that I have permission to design and also some interesting findings that I could get from the analysis Background: All of this analysis comes from the traffic that is targeted to th

Utilize Pwntools for crafting ROP chain :') (day 69)

who doesn't like pwntools? it is a very versatile tool and can be customized according to our need using the python script but did you need to know that pwntools itself can help us to automatically craft a rop chain for us? so in this post, I will show you how to make rop chain less painful and make pwntools do all the heavy lifting. To demonstrate this I will use the binary challenge callme 64 bit from ropemporium link: https://ropemporium.com/challenge/callme.html Crashing the app: Like any other exploitation process, we need to crash the program by generating a long string pattern to determine the offset. based on the information from the above figure we can see that we required to provide 40 bytes of offset Fun stuff: now this where the fun stuff began write the following python script: as in the guideline of the challenged said we need to chain the function call by first to call the callme_one function, callme_two function and then callme_three funct

WriteUp PWN tarzan ROP UNICTF ಠ_ಠ (day 61)

So in this post, I'm going to talk about how to solve the Tarzan pwn challenge from UNICTF 2019. Back in the day when the competition is still going I couldn't finish it and don't have any clue to solve this but this time I was able to finish it :) Also in this post, we will be going to be heavily focused on how to utilize pwntools to construct a ROP chain. If you kinda confused about my explanation in this post you can refer to this following youtube video, link: https://www.youtube.com/watch?v=gWU2yOu0COk I build the python script based on this video Ok, let's get started! In this challenge, you will get two binary first go with tarzan and libc-2.29.so by providing .so file it tell us what version library that the target machine is using this could help us to do ROP chain. first, we run the Tarzan binary to get the basic idea of the program work and as you can see it just show you some text, newline and when you try to input something it doesn't gi