Skip to main content

Jsunpack-n Tutorial (Analyzing Malicious Documents)


INSTALLATION:

Required Dependencies(all these dependencies are present in jsunpack-n package in a folder named depend):
1) Build and install pynids (nids) from ./depends/pynids-0.6.1.tar.gz
To compile pynids, you may need the following (ubuntu) packages:
libpcap-dev pkg-config python-dev libgtk2.0-dev libnet1-dev
        To install these package either use software center or command apt-get install PackageName

    $ cd depends
    $ tar xvfz pynids-0.6.1.tar.gz
$ cd pynids-0.6.1/ directory
$ python setup.py build
$ sudo python setup.py install

2) Build SpiderMonkey 'js' from ./depends/js-1.8.0-rc1-src.tar.gz

    This package has modifications to the spidermonkey source code; therefore, it is not recommended you use default smjs packages. (Details of the modifications are in INSTALL.spidermonkey.shellcode and INSTALL.spidermonkey, for historical purposes)

    $ cd depends/
    $ tar xvfz js-1.8.0-rc1-src.tar.gz
    $ cd js-1.8.0-rc1-src
    $ make BUILD_OPT=1 -f Makefile.ref
    Then, make the 'js' binary available within your path.
    $ echo "export $PATH="     //to find your env var value...which will be used in JS_DIST
    $sudo make BUILD_OPT=1 JS_DIST=/usr/local -f Makefile.ref export

3) Build and install YARA from ./depends/yara-1.6.tar.gz
    (For Ubuntu or other systems, these packages may be required: libpcre3 libpcre3-dev)

    $ cd depends
    $ .
    $ cd yara-1.6
    $ ./configure
    $ make
    $ sudo make install

For Ubuntu12.04 or other systems, you may need to add the following path after building:

$ sudo echo "/usr/local/lib" >> /etc/ld.so.conf
$ sudo ldconfig

4) Build and install YARA Python from ./depends/yara-python-1.6.tar.gz

    $ cd depends
    $ tar xvfz yara-python-1.6.tar.gz
    $ cd  yara-python-1.6
    $ python setup.py build
    $ sudo python setup.py install
   

5) Build and install BeautifulSoup from ./depends/BeautifulSoup-3.2.0.tar.gz
    (alternatively from the pypi http://pypi.python.org/pypi/BeautifulSoup/3.2.0)

    $ cd depends
    $ tar xvfz BeautifulSoup-3.2.0.tar.gz
    $ cd BeautifulSoup-3.2.0/
    $ python setup.py build
    $ sudo python setup.py install

6) Install pycrypto (for encrypted PDFs) from ./depends/pycrypto-2.4.1.tar.gz
    (alternatively from the pypi http://pypi.python.org/pypi/pycrypto/2.4.1)

    $ cd depends
    $ tar xvfz pycrypto-2.4.1.tar.gz
    $ cd pycrypto-2.4.1
    $ python setup.py build
    $ sudo python setup.py install

Optional:
a) To use the -g --graph option, you should install the "python-yapgvb" package.

b) Filetype identification: Magic (optional)
    If you use Ubuntu, you can install the python-magic package using apt-get install python-magic.
   To define your local magic data use file /etc/magic.

Using Jsunpack-n
Now unzip the samples.tgz,it contain many document on which you can test jsunpack
1:Run following command to find file type first as in sample folder file extension are renamed:
$file NameofFile 
$./jsunpackn.py -V /home/alt/Desktop/Analyze-Mal-doc/jsunpack-n/jsunpack-n/samples/pdf.file
Jsunpack-n

2:Read the decoded  file which is extracted in last step.
$cat ./temp/files/original_c34022681fa89171fc803baeb2b120400bc1775f 

Jsunpack decoded file

3:jsunpack-n also contain pdf.py  tools that can be used to decompress javascripts.
$ ./pdf.py -V /home/alt/Desktop/Analyze-Mal-doc/jsunpack-n/jsunpack-n/samples/pdf-thisCreator.file
Above command will otput javascript in a ".out" file
$cat samples/pdf-thisCreator.file.out

pdf.py tool in jsunpack-n

4:Produce a graph using -g option,give name of a picture file with proper extension like uname.png with -g option ex: -g nameofpicfile.png
$./jsunpackn.py -g unamed.png /home/alt/Desktop/Analyze-Mal-doc/jsunpack-n/jsunpack-n/samples/pdf.file
Jsunpack graph


Comments

  1. Casino City Hotel & Casino | MapyRO
    Find the best Casinos in Las Vegas, NV and other places to stay in 2021. 김포 출장마사지 Casino City 논산 출장샵 Hotel and Casino 밀양 출장마사지 Las 남양주 출장샵 Vegas (mapyro). 전라남도 출장마사지

    ReplyDelete

Post a Comment

Popular posts from this blog

Hacking Windows 10 UWP App: DLL Injection & common Vulnerabilities

I recently started working on  widows 10 Apps( Apps not Applications) security. Before diving deep in hacking terms lets try to understand what's new in Windows 10 UWP( Universal Platform) as compared to old Apps. Lets begin with how apps actually work on windows 10(desktop/tablet). Now windows 10 comes with a container only for running apps inside the isolated environment. By default, /APPCONTAINER(Linker Flag) is off. This option modifies an executable to indicate whether the app must be run in the appcontainer process-isolation environment. Specify /APPCONTAINER for an app that must run in the appcontainer environment—for example, a Windows Store app. (The option is set automatically in Visual Studio when you create a Windows Store app from a template.) For a desktop app, specify /APPCONTAINER:NO or just omit the option. The /APPCONTAINER option was introduced in Windows 8. Now there is no registry entry concept for these app in the System HIVE rather they install they own hiv

Installing vmware-11.0 on Ubuntu 15.04 Using kernel Patch

curl http://pastie.org/pastes/9934018/download -o /tmp/vmnet-3.19.patch cd /usr/lib/vmware/modules/source tar -xf vmnet.tar patch -p0 -i /tmp/vmnet-3.19.patch tar -cf vmnet.tar vmnet-only rm -r *-only vmware-modconfig --console --install-all References: http://askubuntu.com/questions/605530/vmware-player-7-1-0-on-ubuntu-15-04-kernel-3-19-0-10-generic-app-loading http://askubuntu.com/questions/617704/failed-to-build-vmnet-for-kernel-3-19

SSI Injection Attack

SSIs are directives present on Web applications used to feed an HTML page with dynamic contents. They are similar to CGIs, except that SSIs are used to execute some actions before the current page is loaded or while the page is being visualized. In order to do so, the web server analyzes SSI before supplying the page to the user. The Server-Side Includes attack allows the exploitation of a web application by injecting scripts in HTML pages or executing arbitrary codes remotely. It can be exploited through manipulation of SSI in use in the application or force its use through user input fields. It is possible to check if the application is properly validating input fields data by inserting characters that are used in SSI directives, like:  Code: < ! # = / . " - > and [a-zA-Z0-9] Another way to discover if the application is vulnerable is to verify the presence of pages with extension .stm, .shtm and .shtml. However, the lack of these type of pages does not mean that th