hakawati 2015. 6. 30. 18:10

1. 개요

이전에 Thug 관련 포스팅을 한 적이 있다. 그때 당시 docker와 같은 개념도 없었기에 수동으로 에러를 잡아가며 설치해야 했었다. 하지만 이제 docker를 통해 편리하게 구축하고 이용할 수 있다.

Thug는 구글의 자바스크립트 엔진인 v8 과 함께 드라이브-바이 다운로드 공격을 탐지하기 위한 도구이다. 굳이 분류하자면 저 가용성(Low-Interaction) 허니클라이언트에 해당한다. 최신 버전은 0.6.3 버전을 제공하고 있으나 docker를 통해 설치하는 버전은 0.6.2 버전이며, 설치하는 환경은 Ubuntu 14.04 LTS amd64 이다.

2. 설치

우선 핵심 도구인 docker를 설치한다.

 sudo apt-get install docker.io

설치가 끝나면 허니넷에서 docker로 구축하여 운영중인 Thug를 다운로드 받는다.


sudo docker pull honeynet/thug

다운로드 완료되었으면 Thug를 실행한다.


sudo docker run -it honeynet/thug

Thug가 설치된 위치는 /opt/thug/디렉터리이다.

 


python /opt/thug/src/thug.py -h

Synopsis:
    Thug: Pure Python honeyclient implementation

    Usage:
        python thug.py [ options ] url

    Options:
        -h, --help          	Display this help information
        -V, --version       	Display Thug version
        -u, --useragent=    	Select a user agent (see below for values, default: winxpie60)
        -e, --events=       	Enable comma-separated specified DOM events handling
        -w, --delay=        	Set a maximum setTimeout/setInterval delay value (in milliseconds)
        -n, --logdir=       	Set the log output directory
        -o, --output=       	Log to a specified file
        -r, --referer=      	Specify a referer
        -p, --proxy=        	Specify a proxy (see below for format and supported schemes)
        -l, --local         	Analyze a locally saved page
        -x, --local-nofetch 	Analyze a locally saved page and prevent remote content fetching
        -v, --verbose       	Enable verbose mode
        -d, --debug         	Enable debug mode
        -q, --quiet         	Disable console logging
        -m, --no-cache      	Disable local web cache
        -a, --ast-debug     	Enable AST debug mode (requires debug mode)
        -g, --http-debug    	Enable HTTP debug mode 
        -t, --threshold     	Maximum pages to fetch
        -E, --extensive     	Extensive fetch of linked pages
        -T, --timeout=      	Set the analysis timeout (in seconds)
        -B, --broken-url    	Set the broken URL mode
        -y, --vtquery       	Query VirusTotal for samples analysis
        -s, --vtsubmit      	Submit samples to VirusTotal
        -z, --web-tracking  	Enable web client tracking inspection
        -N, --no-honeyagent 	Disable HoneyAgent support

        Plugins:
        -A, --adobepdf=     	Specify the Adobe Acrobat Reader version (default: 9.1.0)
        -P, --no-adobepdf   	Disable Adobe Acrobat Reader plugin
        -S, --shockwave=    	Specify the Shockwave Flash version (default: 10.0.64.0)
        -R, --no-shockwave  	Disable Shockwave Flash plugin
        -J, --javaplugin=   	Specify the JavaPlugin version (default: 1.6.0.32)
        -K, --no-javaplugin 	Disable Java plugin

        Classifiers:
        -Q, --urlclassifier 	Specify a list of additional (comma separated) URL classifier rule files
        -W, --jsclassifier  	Specify a list of additional (comma separated) JS classifier rule files
        -C, --sampleclassifier 	Specify a list of additional (comma separated) sample classifier rule files

        Logging:
        -F, --file-logging  	Enable file logging mode (default: disabled)
        -Z, --json-logging  	Enable JSON logging mode (default: disabled)
        -M, --maec11-logging	Enable MAEC11 logging mode (default: disabled)

    Proxy Format:
        scheme://[username:password@]host:port (supported schemes: http, socks4, socks5)

    Available User-Agents:
        winxpie60		        Internet Explorer 6.0	(Windows XP)
        winxpie61		        Internet Explorer 6.1	(Windows XP)
        winxpie70		        Internet Explorer 7.0	(Windows XP)
        winxpie80		        Internet Explorer 8.0	(Windows XP)
        winxpchrome20		    Chrome 20.0.1132.47	(Windows XP)
        winxpfirefox12		    Firefox 12.0		(Windows XP)
        winxpsafari5		    Safari 5.1.7		(Windows XP)
        win2kie60		        Internet Explorer 6.0	(Windows 2000)
        win2kie80		        Internet Explorer 8.0	(Windows 2000)
        win7ie80		        Internet Explorer 8.0	(Windows 7)
        win7ie90		        Internet Explorer 9.0	(Windows 7)
        win7chrome20		    Chrome 20.0.1132.47	(Windows 7)
        win7chrome40		    Chrome 40.0.2214.91	(Windows 7)
        win7firefox3		    Firefox 3.6.13		(Windows 7)
        win7safari5		        Safari 5.1.7		(Windows 7)
        osx10safari5		    Safari 5.1.1		(MacOS X 10.7.2)
        osx10chrome19		    Chrome 19.0.1084.54	(MacOS X 10.7.4)
        linuxchrome26		    Chrome 26.0.1410.19	(Linux)
        linuxchrome30		    Chrome 30.0.1599.15	(Linux)
        linuxfirefox19		    Firefox 19.0		(Linux)
        galaxy2chrome18		    Chrome 18.0.1025.166	(Samsung Galaxy S II, Android 4.0.3)
        galaxy2chrome25		    Chrome 25.0.1364.123	(Samsung Galaxy S II, Android 4.0.3)
        galaxy2chrome29		    Chrome 29.0.1547.59	(Samsung Galaxy S II, Android 4.1.2)
        nexuschrome18		    Chrome 18.0.1025.133	(Google Nexus, Android 4.0.4)
        ipadsafari7		        Safari 7.0		(iPad, iOS 7.0.4)
        ipadsafari8		        Safari 8.0		(iPad, iOS 8.0.2)
        ipadchrome33		    Chrome 33.0.1750.21	(iPad, iOS 7.1)
        ipadchrome35		    Chrome 35.0.1916.41	(iPad, iOS 7.1.1)
        ipadchrome37		    Chrome 37.0.2062.52	(iPad, iOS 7.1.2)
        ipadchrome38		    Chrome 38.0.2125.59	(iPad, iOS 8.0.2)
        ipadchrome39		    Chrome 39.0.2171.45	(iPad, iOS 8.1.1)

3. 운영

Thug 도구를 운영하는데 있어 도움이 될 만한 곳은 당연히 Thug 문서이다. 예전에 포스팅했던 자바스크립트 난독화 소스코드를 토대로 Thug의 V8 자바스크립트 엔진의 가능성을 테스트했다. 사용한 자바스크립트 난독화 코드는 jjencode이다.

그림 1. jjencode 난독화 해제

그림 1과 같이 jjencode의 난독화가 해제된 것을 볼 수 있다. jjencode는 정확한 위치의 난독화 해제 코드를 이용하는 방법이 아니면 난독화 해제하기 어렵다. 또한 가장 많이 사용하는 Malzilla와 같은 도구는 이 난독화를 해제 할 수 없지만, Thug는 가능했다. 

또한 난독화 해제 범위는 중요한 시사점을 가진다. 예를 들면, Thug는 웹 크롤러 엔진을 가지고 있기에 해제 가능한 난독화가 많을 수록 추적의 깊이가 깊어질 수 있다는 것이다.

4. 참조


반응형