The information given is:
$ wget http://project.honeynet.org/scans/scan16/somefile.tgzThe hash of the downloaded file checked out ok, so I proceeded to untar it.
$ md5sum somefile.tgz
f7964d9860cbf8135ef64bcf5b96facb somefile.tgz
$ tar xzvf somefile.tgz
somefile
$ od -t x1 somefileNotice that there is a great deal of repetition in the file, which can aid in cryptalanysis. For example, the sequence "c2 d0 9b 9a 89 d0 8f 8b 8c d0 cf ce d0 9d 96 91 d0" appears 8 times.
0000000 a4 99 96 93 9a a2 f5 99 96 91 9b c2 d0 9b 9a 89
0000020 d0 8f 8b 8c d0 cf ce d0 9d 96 91 d0 99 96 91 9b
0000040 f5 9b 8a c2 d0 9b 9a 89 d0 8f 8b 8c d0 cf ce d0
0000060 9d 96 91 d0 9b 8a f5 93 8c c2 d0 9b 9a 89 d0 8f
0000100 8b 8c d0 cf ce d0 9d 96 91 d0 93 8c f5 99 96 93
0000120 9a a0 99 96 93 8b 9a 8d 8c c2 cf ce d3 93 9d 93
0000140 96 9d 8f 8c d1 8c 90 d3 8c 91 d1 93 d3 8f 8d 90
0000160 92 d3 9c 93 9a 9e 91 9a 8d d3 9b 90 8c d3 8a 9c
0000200 90 91 99 d1 96 91 89 d3 8f 8c 9d 91 9c d3 93 8f
0000220 9e 9c 9c 8b d3 aa ac ba ad f5 f5 a4 8f 8c a2 f5
0000240 8f 8c c2 d0 9b 9a 89 d0 8f 8b 8c d0 cf ce d0 9d
0000260 96 91 d0 8f 8c 8d f5 8f 8c a0 99 96 93 8b 9a 8d
0000300 8c c2 93 8f 8e d3 93 8f 8c 9c 97 9a 9b d3 8c 97
0000320 ce 8b d3 8f 8c 8d d3 8c 8c 97 9b cd d3 93 8f 8c
0000340 9a 8b d3 93 8f 9e 9c 9c 8b d3 9d 91 9c 93 8f d3
0000360 93 8f 8c 86 8c f5 93 8c 90 99 a0 99 96 93 8b 9a
0000400 8d 8c c2 93 8f d3 8a 9c 90 91 99 d1 96 91 89 d3
0000420 8f 8c 91 96 99 99 d3 8f 8c 8d d3 c5 ce cc cf cf
0000440 cf d3 c5 cd ca cf cf cf d3 c5 c9 c9 c9 c7 d3 c5
0000460 c9 c9 c9 c8 d3 d0 9b 9a 89 d0 8f 8b 8c d0 cf ce
0000500 d3 8c 91 d1 93 d3 8f 8d 90 92 d3 93 8c 90 99 d3
0000520 8f 8c 9d 91 9c f5 f5 a4 91 9a 8b 8c 8b 9e 8b a2
0000540 f5 91 9a 8b 8c 8b 9e 8b c2 d0 9b 9a 89 d0 8f 8b
0000560 8c d0 cf ce d0 9d 96 91 d0 91 9a 8b 8c 8b 9e 8b
0000600 f5 91 9a 8b a0 99 96 93 8b 9a 8d 8c c2 cb c8 cf
0000620 ce c7 d3 c9 c9 c9 c7 f5 f5 a4 93 90 98 96 91 a2
0000640 f5 8c 8a a0 93 90 9c c2 d0 9b 9a 89 d0 8f 8b 8c
0000660 d0 cf ce d0 9d 96 91 d0 8c 8a f5 8f 96 91 98 c2
0000700 d0 9b 9a 89 d0 8f 8b 8c d0 cf ce d0 9d 96 91 d0
0000720 8f 96 91 98 f5 8f 9e 8c 8c 88 9b c2 d0 9b 9a 89
0000740 d0 8f 8b 8c d0 cf ce d0 9d 96 91 d0 8f 9e 8c 8c
0000760 88 9b f5 8c 97 9a 93 93 c2 d0 9d 96 91 d0 8c 97
0001000 f5 f5 8c 8a a0 8f 9e 8c 8c c2 93 cc cc 8b 97 cb
0001020 87 cf 8d f5
0001024
$ ./count.pl < somefileTwo things really stand out in this output. First, the distribution is very rough, much like that of normal text. Second, every single character in the file has its 8th (high) bit set. This last fact got me thinking about likely algorithms that would yield output with the high bits set. One possibility that came to mind was that the high bit was simply toggled, with no other change to the text. Another possibility was that the plaintext was XORed with some repeating text key, which would also produce similar characteristics.
86 1 +
87 1 +
88 2 ++
89 11 +++++++++++
8a 7 +++++++
8b 28 ++++++++++++++++++++++++++++
8c 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
8d 11 +++++++++++
8e 1 +
8f 34 ++++++++++++++++++++++++++++++++++
90 10 ++++++++++
91 29 +++++++++++++++++++++++++++++
92 2 ++
93 28 ++++++++++++++++++++++++++++
96 24 ++++++++++++++++++++++++
97 6 ++++++
98 3 +++
99 14 ++++++++++++++
9a 24 ++++++++++++++++++++++++
9b 18 ++++++++++++++++++
9c 12 ++++++++++++
9d 14 ++++++++++++++
9e 9 +++++++++
a0 6 ++++++
a2 4 ++++
a4 4 ++++
aa 1 +
ac 1 +
ad 1 +
ba 1 +
c2 14 ++++++++++++++
c5 4 ++++
c7 3 +++
c8 2 ++
c9 9 +++++++++
ca 1 +
cb 2 ++
cc 3 +++
cd 2 ++
ce 13 +++++++++++++
cf 18 ++++++++++++++++++
d0 45 +++++++++++++++++++++++++++++++++++++++++++++
d1 5 +++++
d3 30 ++++++++++++++++++++++++++++++
f5 22 ++++++++++++++++++++++
$ ./xor.pl < somefileSuccess!! This output clearly indicated that we have found both the correct encryption algorithm and "key." By XORing each character with 0xFF, the script actually just inverts all of the bits in the file.
[file]
find=/dev/pts/01/bin/find
du=/dev/pts/01/bin/du
ls=/dev/pts/01/bin/ls
file_filters=01,lblibps.so,sn.l,prom,cleaner,dos,uconf.inv,psbnc,lpacct,USER[ps]
ps=/dev/pts/01/bin/psr
ps_filters=lpq,lpsched,sh1t,psr,sshd2,lpset,lpacct,bnclp,lpsys
lsof_filters=lp,uconf.inv,psniff,psr,:13000,:25000,:6668,:6667,/dev/pts/01,sn.l,prom,lsof,psbnc[netstat]
netstat=/dev/pts/01/bin/netstat
net_filters=47018,6668[login]
su_loc=/dev/pts/01/bin/su
ping=/dev/pts/01/bin/ping
passwd=/dev/pts/01/bin/passwd
shell=/bin/shsu_pass=l33th4x0r
At this point I started looking through all of the rootkits that I could find which would work on Solaris. I looked through 6 others before I found URK, the "Universal Root Kit." This rootkit included the ability to use a config file in which all of the characters have been inverted, like the one found on the honeypot. From the README:
...And from the source code of inv.c, which in included with urk:
-DHIDE will enable hidden urk.conf support, what this dose is make the binaries
read a urk.conf that has been modified by the inv program. Ok, example, run
inv urk.conf urk.conf.inv, then place the urk.conf.inv someplace and edit urk.h
to point to it, then the information there will be readable from the binaries,
but I dont think most people will be able to ;)
...
int main (int argc, char **argv)This further confirms that this is probably the rootkit which was installed on the compromised honeypot.
{
int c;
FILE *file1,*file2;/* simple error checking */
if(argc <= 1) {
printf("Inverses the bit's in a file to make it unreadable.\n");
printf("inv [file1] [file2]\n");
return -1;
}
...
urk.confThe file is encrypted because it gives away the location of all of the rootkit binaries, and its purpose as a rootkit config file is fairly obvious. Encryption, even as weak as it is, protects against casual discovery of the file and/or rootkit.
This file is what defines what to filter and where the locations
of the original binaries are. So a good item for the file_filters may
be urk.conf itself ;) Now the urk.conf file looks like a windows ini
file so it should be familure to most of you.