Skip to main content

ubuntu的机器被黑了~

今早到学校,打开ubuntu机器,发现桌面是空的.我记得很清楚前一天走的时候还在写程序,打开了很多窗口,怎么窗口自动关闭了呢? 马上打开用户管理,发现多了一个nobody5的帐户.在application里也多了一个zenmap的扫描器.一部小心我成了别人肉鸡和跳板,汗~
然后我决定把nobody5找出来:
1 断网线
2 查看未知帐号"grep :x :0: /etc/passwd",发现多了一个管理员用户nobody5.
root:x:0:0:root:/root:/bin/bash
nobody5:x:0:1002:SunOS 5.x Nobody:/tmp:/bin/bash
3  "last -a"查找所有登录过的用户,看到了这厮~worldserver.net的ip显示是德国~
nobody5  pts/5        Tue Oct 13 19:14 – 21:15  (02:00)     vz275.worldserver.net
nobody5  pts/4        Tue Oct 13 17:09 – 19:42  (02:33)     vz275.worldserver.net
nobody5  pts/3        Tue Oct 13 16:17 – 19:40  (03:23)     vz275.worldserver.net
4 在用户管理器里修改nobody5的密码,然后用nobody5的帐号登陆,看看他干过什么."histroy"查看,动作很利落,没有什么多余的命令,注释如下:
    1  df -h  //查看磁盘使用情况
    2  cat /proc/version //查看系统版本信息
    3  cd ~
    6  ls -la //查看我的目录
    7  ifconfig -a //查看ip信息
    8  find / -name .bashrc //查看有几个bashrc,应该是看用户情况
    9  find / -name .bash_history
   10  vi /home/ppa/.bash_history //查看我输入过什么命令
   11  env //系统环境便量
   12  cat /etc/shadow //用户信息
   14  pwd //当前路径
   16  wget http://mirrors.kernel.org/debian-cd/5.0.3/i386/iso-cd/debian-503-i386-CD-31.iso //下了个镜像
   18  rm debian-503-i386-CD-31.iso //把刚下的东西删了,估计nobody5觉得这个没用
   19  apt-get install nmap //装nmap
   23  nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //开始扫描和我同网段的机器
   28  wget http://nmap.org/svn/scripts/smb-check-vulns.nse //装上一个加强版的脚本
   29  nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //再扫一遍
   36  rm temp //完事屁屁
   58  nmap -PN -T4 -p445 -n -v args=unsafe=1 –script smb-check-vulns,smb-os-discovery 129.59.0.0/16>>temp //胡汉山又回来了
   59  apt-get remove nmap //二擦屁屁
   60  rm -rf /usr/share/nmap //三擦屁屁
   71  cd mail //看我的邮件
   78  wget http://nmap.org/dist/nmap-5.00.tar.bz2 //下载一个最新版的nmap
   79  bzip2 -cd nmap-5.00.tar.bz2 | tar xvf – //解压缩
   80  cd nmap-5.00
   81  ./configure
   82  make
   83  make install
   85  find / -name nmap
   86  /usr/local/bin/nmap //装上了namp
   89  /usr/local/bin/nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery *.*.0.0/16>>temp //扫描同网机器
   90  /usr/local/bin/nmap -PN -T4 -p445 -n -v –script smb-check-vulns,smb-os-discovery 160.129.0.0/16>>temp2 //5555~我成了跳板
   91  cd /var/tmp/nmap-5.00
   94  tail -f temp | grep vul //看看谁的机器还有漏洞
  110  cat temp | grep -B 12 VULN
 
  460  wget http://iroffer.dinoex.net/iroffer-dinoex-3.15.tar.gz //装iroffer
5 修补漏洞:
a 改一个强壮的本机密码
b “userdel -r newuser”删除帐户(用户管理里删除不了管理员帐户)
c 重启机器发现无法从图形界面里登录了,显示错误“/etc/gdm/Xsession: Beginning session setup… mkdtemp: private socket dir: Permission denied.”,估计是和删除管理员帐户有关.幸好还能通过ssh远程登录,修改"/tmp"的权限:“chmod a+w /tmp”,搞定~
4 卸载namp
5 关闭ftp服务。虽然我的ftp已经换了端口,保险起见,还是先关了~
将"etc/rc5.d/S20vsftpd"改名成"K20vsftpd"
6 限制访问本机的ip:
在/etc/hosts.allow中添加允许的ip或者网段 
ALL:192.168.1.2:allow 或者
ALL:192.168.1.0/24:allow 
在/etc/hosts.deny添加不允许ssh登陆的IP
ALL: ALL@ALL, PARANOID
7 关闭ipp
sudo /etc/init.d/cupsys stop
sudo update-rc.d -f cupsys remove
8 设置ping,icmp和其他
a in ubuntu ping can be disable by adding following line to /etc/init.d/networking (network init script)
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
b in 8.04.1 /etc/sysctl.conf add:
# Ignore ICMP broadcasts
net/ipv4/icmp_echo_ignore_broadcasts = 1
#
# Ignore bogus ICMP errors
net/ipv4/icmp_ignore_bogus_error_responses = 1
#
# Do not accept ICMP redirects (prevent MITM attacks)
net/ipv4/conf/all/accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
net/ipv4/conf/all/secure_redirects = 0
#
# Do not send ICMP redirects (we are not a router)
net/ipv4/conf/all/send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
net/ipv4/conf/all/accept_source_route = 0

also add to /etc/ufw/sysctl.conf:

#Ignorar Broadcast.
net/ipv4/icmp_echo_ignore_broadcasts=1

#Ignorar pings.
net/ipv4/icmp_echo_ignore_all=1

#No responder a paquetes icmp defectuosos.
net/ipv4/icmp_ignore_bogus_error_responses=1
ps:现在用"netstat -a -t"查看,只剩下ssh, vnc的端口还在使用,ping主机没反应,很完美~应该能清静一会了~
ps2:安装chkrootkit又查了一遍,确保没有留下后门,这次真的该清静了~

Comments

Popular posts from this blog

OWASP Top 10 Threats and Mitigations Exam - Single Select

Last updated 4 Aug 11 Course Title: OWASP Top 10 Threats and Mitigation Exam Questions - Single Select 1) Which of the following consequences is most likely to occur due to an injection attack? Spoofing Cross-site request forgery Denial of service   Correct Insecure direct object references 2) Your application is created using a language that does not support a clear distinction between code and data. Which vulnerability is most likely to occur in your application? Injection   Correct Insecure direct object references Failure to restrict URL access Insufficient transport layer protection 3) Which of the following scenarios is most likely to cause an injection attack? Unvalidated input is embedded in an instruction stream.   Correct Unvalidated input can be distinguished from valid instructions. A Web application does not validate a client’s access to a resource. A Web action performs an operation on behalf of the user without checking a shared sec

CKA Simulator Kubernetes 1.22

  https://killer.sh Pre Setup Once you've gained access to your terminal it might be wise to spend ~1 minute to setup your environment. You could set these: alias k = kubectl                         # will already be pre-configured export do = "--dry-run=client -o yaml"     # k get pod x $do export now = "--force --grace-period 0"   # k delete pod x $now Vim To make vim use 2 spaces for a tab edit ~/.vimrc to contain: set tabstop=2 set expandtab set shiftwidth=2 More setup suggestions are in the tips section .     Question 1 | Contexts Task weight: 1%   You have access to multiple clusters from your main terminal through kubectl contexts. Write all those context names into /opt/course/1/contexts . Next write a command to display the current context into /opt/course/1/context_default_kubectl.sh , the command should use kubectl . Finally write a second command doing the same thing into /opt/course/1/context_default_no_kubectl.sh , but without the use of k

标 题: 关于Daniel Guo 律师

发信人: q123452017 (水天一色), 信区: I140 标  题: 关于Daniel Guo 律师 关键字: Daniel Guo 发信站: BBS 未名空间站 (Thu Apr 26 02:11:35 2018, 美东) 这些是lz根据亲身经历在 Immigration版上发的帖以及一些关于Daniel Guo 律师的回 帖,希望大家不要被一些马甲帖广告帖所骗,慎重考虑选择律师。 WG 和Guo两家律师对比 1. fully refund的合约上的区别 wegreened家是case不过只要第二次没有file就可以fully refund。郭家是要两次case 没过才给refund,而且只要第二次pl draft好律师就可以不退任何律师费。 2. 回信速度 wegreened家一般24小时内回信。郭律师是在可以快速回复的时候才回复很快,对于需 要时间回复或者是不愿意给出确切答复的时候就回复的比较慢。 比如:lz问过郭律师他们律所在nsc区域最近eb1a的通过率,大家也知道nsc现在杀手如 云,但是郭律师过了两天只回复说让秘书update最近的case然后去网页上查,但是上面 并没有写明tsc还是nsc。 lz还问过郭律师关于准备ps (他要求的文件)的一些问题,模版上有的东西不是很清 楚,但是他一般就是把模版上的东西再copy一遍发过来。 3. 材料区别 (推荐信) 因为我只收到郭律师写的推荐信,所以可以比下两家推荐信 wegreened家推荐信写的比较长,而且每封推荐信会用不同的语气和风格,会包含lz写 的research summary里面的某个方面 郭家四封推荐信都是一个格式,一种语气,连地址,信的称呼都是一样的,怎么看四封 推荐信都是同一个人写出来的。套路基本都是第一段目的,第二段介绍推荐人,第三段 某篇或几篇文章的abstract,最后结论 4. 前期材料准备 wegreened家要按照他们的模版准备一个十几页的research summary。 郭律师在签约之前说的是只需要准备五页左右的summary,但是在lz签完约收到推荐信 ,郭律师又发来一个很长的ps要lz自己填,而且和pl的格式基本差不多。 总结下来,申请自己上心最重要。但是如果选律师,lz更倾向于wegreened,