Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 01-14-2005, 10:00 PM   #1 (permalink)
Crazy
 
Location: Bit Bucket
Probably Hacked... sigh

So today my dedicated server (running RH9) was shut down by my host. They pulled the plug after seeing an insane amount of UDP traffic slamming this one IP. Now, I unfortunately don't have much experience with this at all. I've tried to do my best to keep the box secure and tied down as best as possible.

What I'd like to try and get from the community here is tips on what to look for on my server when my host brings the server back up for me during business hours. Ways to detect things that would be abnormal and how to track down where on the server it is coming from (what script is generating the traffic?). Things like that. Any help would be GREATLY appreciated.

Thank you now for any time and effort you put forth.
devnull is offline  
Old 01-15-2005, 06:25 AM   #2 (permalink)
Psycho
 
jonjon42's Avatar
 
Location: inside my own mind
change your passwords....root user everything
then use chkrootkit to scan if you got rooted (just in case)
make sure you have a solid set of firewall rules
update packages that have had security vulnerabilities
and browse your logs a bit to see if you can figure out what happened from their.
if you want extra security run a scanner like snort
__________________
A damn dirty hippie without the dirty part....
jonjon42 is offline  
Old 01-15-2005, 09:53 AM   #3 (permalink)
Professional Loafer
 
bendsley's Avatar
 
Location: texas
* Log in as root.
* Run /usr/sbin/visudo. Add your account. We recommend you use this sudoers template:

# Sample Linux sudoers file
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
# http://www.sudo.ws/
############################
# User alias specification #
############################
# put users into groups here
User_Alias ROOTNOPASSWD =
User_Alias ROOTPASSWD =
User_Alias ROOTRESTRICTED =
############################
# Cmnd alias specification #
############################
# define command aliases here
Cmnd_Alias SHELLS = /bin/sh, /bin/bash, /bin/bash2, /bin/ash, /bin/bsh, /bin/tcsh, /bin/csh, /bin/ksh
Cmnd_Alias SU = /bin/su
Cmnd_Alias PASSWD = /bin/passwd
Cmnd_Alias VISUDO = /usr/sbin/visudo

######################
# User specification #
######################
# root can run anything as any user
root ALL = (ALL) ALL

# ROOTNOPASSWD users can run anything without a password
ROOTNOPASSWD ALL = (ALL) NOPASSWD: ALL
# ROOTPASSWD USERS may run anything but need a password
ROOTPASSWD ALL = (ALL) ALL
# ROOTRESTRICTED users may run anything besides a shell, su, passwd, or visudo
ROOTRESTRICTED ALL = ALL, !SHELLS, !SU, !PASSWD, !VISUDO

* Log out from the root account
* Log in as yourself
* Run sudo /usr/sbin/setup.
* Enter "System Services" and disable everything you don't need. This may include:
o apmd
o gpm
o isdn
o kudzu
o lpd
o nfslock
o pppoe
o pcmcia
o portmap
o rawdevices
o rhnsd
* Note that you will need pcmia if you have a laptop and wish to use PC Card devices, and you will need portmap if you need to connect to and/or serve NFS shares
* As root, edit /etc/ntp.conf to set up NTP servers. Use the 'setup' utility to ensure that ntpd is starting at boot. Here is a sample configuration file that will operate with Penn's NTP daemons:

driftfile /var/ntp/ntp.drift
server timeserver1.upenn.edu version 3
server timeserver2.upenn.edu version 3
server timeserver3.upenn.edu version 3

* Make sure the /etc/services has the following entries for POP and IMAP service:
o time 37/tcp
time 37/udp
* Be sure to modify /etc/ipfw.conf rules to allow the new services:

add allow tcp from any to any ntp out keep-state
add allow udp from any to any ntp out keep-state

* Edit /etc/issue and /etc/issue.net to say: UNAUTHORIZED ACCESS PROHIBITED
* Edit /etc/motd to look like this:

This system is for the use of authorized users only. Individuals using this computer system without authority, or in excess of their authority, are subject to having all of their activities on this system monitored and recorded by properly authorized system personnel. In the course of monitoring individuals improperly using this system, or in the course of system maintenance, the activities of authorized users may also be monitored by properly authorized personnel. Anyone using this system expressly consents to such monitoring and is advised that if such monitoring reveals possible evidence of criminal activity, system personnel may provide the evidence of such monitoring to law enforcement officials.

* Install rhupdate:
o lynx http://www.jjminer.org/rhupdate/
o Download the latest rhupdate
o Expand the file: tar -xzlf rhupdate-whatever.tar.gz
o Install: cd rhupdate-whatever/; ./configure; sudo make install
o Delete what's left: cd ..; rm -rf rhupdate-whatever*
* Download and install updates:
o Create a download directory: mkdir /tmp/updates
o Download the updates: /usr/local/bin/rhupdate --download /tmp/updates --server mirror.services.wisc.edu --dir /mirrors/linux/distributions/redhat/updates/ --hash
o Install the updates: sudo rpm -Uvh /tmp/updates/*.rpm
o Delete the updates: rm -f /tmp/updates/*
* Prevent some DoS-denial attacks. Add the following lines to the end of /etc/rc.d/rc.local:

##### Begin DoS Prevention #####
# shut some DoS stuff down
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

# increase the local port range
echo 1024 65535 > /proc/sys/net/ipv4/ip_local_port_range

# increase the SYN backlog queue
echo 2048 > /proc/sys/net/ipv4/tcp_max_syn_backlog

echo 0 > /proc/sys/net/ipv4/tcp_sack
echo 0 > /proc/sys/net/ipv4/tcp_timestamps

echo 64000 > /proc/sys/fs/file-max

ulimit -n 64000

# stop source routing
for i in /proc/sys/net/ipv4/conf/*/accept_source_route
do
echo 0 > $i
done

# enable reverse-path filtering
for i in /proc/sys/net/ipv4/conf/*/rp_filter
do
echo 1 > $i
done

##### End DoS Prevention #####

* Edit /etc/logrotate.conf for the proper settings (compress, etc).
* Edit /etc/sysctl.conf and change kernel.sysrq to equal 1
* Edit /etc/hosts.{allow,deny}
o You will need to configure the hosts files to meet the needs of each individual server. As a rule, only allow what you need from where you need it. The best thing to do is start off denying everything and allow only sshd and then add services as you go. For more information see "man 5 hosts_access"
* Edit /etc/ssh/sshd_config:
o Change "PermitRootLogin yes" to "PermitRootLogin no"
o Change "Protocol 1,2" to "Protocol 2"
* Reboot the machine: sudo /sbin/shutdown -r now

-----------------------------------------------------------
You might also look at Nessus and as mentioned above, chkrootkit.
Please note that these are suggestions as I am not proficient with Redhat at all, although Debian is another story.

Also, please make sure your root passwords are at least 8 characters, contain numbers, UPPER and lowercase letters, and any special characters (!@#$%^&*().

Example of a good password: x7z3GnaX>l2X#%_|t]Fx\D<_-H2q~

Hope this helps.
__________________
"You hear the one about the fella who died, went to the pearly gates? St. Peter let him in. Sees a guy in a suit making a closing argument. Says, "Who's that?" St. Peter says, "Oh, that's God. Thinks he's Denny Crane."

Last edited by bendsley; 01-15-2005 at 10:03 AM..
bendsley is offline  
 

Tags
hacked, sigh


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:03 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360